Search Unity

Issues with pre-export methods using Cloud Build Manifest

Discussion in 'Unity Build Automation' started by sam_ettinger_sm, Dec 7, 2016.

  1. sam_ettinger_sm

    sam_ettinger_sm

    Joined:
    Dec 1, 2016
    Posts:
    19
    Hey all, I want to gather some data from the Unity Cloud Build Manifest from within a pre-export method. Specifically, I'd like to collect the scmCommitId and buildNumber values so I can tie which Git commits become which builds. Unfortunately, all my attempted builds are failing and I can't determine why.

    The pre-export method I am using is *exactly* the method from the Unity Cloud Build Manifest guide linked above. I have that class saved to Assets/Scripts/CloudBuildHelper.cs, and in UCB Advanced Settings I have set the pre-export method name to CloudBuildHelper.PreExport. During the build, I get the following warning several times:

    787: [Unity] Assets/Scripts/CloudBuildHelper.cs(9,74): warning CS0618: `UnityEngine.CloudBuild.BuildManifestObject.GetValue(string, string)' is obsolete: `Use GetValue<type>(string, object) instead.'

    Then, eventually, I get this unhelpful error:
    1602: [Unity] ERROR: preExportMethod 'CloudBuildHelper.PreExport' failed, aborting.

    Has anyone run into similar problems? How did you solve them? Can someone kindly direct me to more recent/thorough/helpful examples of using the build manifest in pre-export methods?
     
  2. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    Responded about this in another thread, but just for others who come across this - scripts used for pre/post export need to be placed in an Editor/ folder in your project.
     
  3. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    Still getting in my cloud build:
    warning CS0618: 'BuildManifestObject.GetValue(string)' is obsolete: 'Use GetValue<type>(string) instead

    my original line being:
    public static void PrepareCloud(UnityEngine.CloudBuild.BuildManifestObject manifest) {
    string a = manifest.GetValue("buildNumber");
    }


    I'm not sure how I should write that to avoid the warning. I didn't found much examples on the internet. Is it something like :

    GetValue<string>("buildNumber", manifest) ?


    Thanks
     
    Last edited: Aug 17, 2021
  4. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    Still getting the warning. (and my script is in editor folder)
    how should I write the line when i read this ?:
    `Use GetValue<type>(string, object) instead.'

    Should I write something like that ?

    GetValue<string>("buildNumber", manifest)
    ??
     
    Last edited: Aug 17, 2021
  5. agasser

    agasser

    Joined:
    Nov 25, 2018
    Posts:
    7
    Immu likes this.