コード例 #1
0
        static async Task TestBuildOperationApi(Configuration config, string orgId, string projectId, List <InlineResponse2003> buildTargets)
        {
            // Get Build Detail
            var buildApi = new UnityCloudBuildApi.IO.Swagger.Api.BuildsApi(config);
            var build    = await buildApi.GetBuildsAsync(orgId, projectId, buildTargets.FirstOrDefault().Buildtargetid);

            var piyo = build.Select(x => x.ToJson());

            // Start Build
            var option = new Options4
            {
                Clean = false,
                Delay = 0,
            };
            var startBuild = await buildApi.StartBuildsAsync(orgId, projectId, buildTargets.FirstOrDefault().Buildtargetid, option);

            var poyo = startBuild.Select(x => x.ToJson());

            // Cancel All queued Build
            foreach (var item in build.Where(x => x.BuildStatus == "queued"))
            {
                var cancelBuilds = await buildApi.CancelAllBuildsAsync(orgId, projectId, item.Buildtargetid);

                var koko = cancelBuilds.Select(x => x.ToString());
            }

            // Cancel Specific Builds
            var cancelBuild = await buildApi.CancelBuildAsync(orgId, projectId, buildTargets.FirstOrDefault().Buildtargetid, startBuild.FirstOrDefault().Build.ToString());

            #endregion
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: nyakagawan/UCBFront
        public static async Task <string[]> StartBuild(StartaBuildParam param)
        {
            Debug.WriteLine("StartBuild with: " + param);

            var buildTargetsApi = new UnityCloudBuildApi.IO.Swagger.Api.BuildtargetsApi(config);

            Debug.WriteLine("StartBuild 1");
            // Get BuildTargets for list BuildTargetId
            var buildTargets = await buildTargetsApi.GetBuildTargetsAsync(OrgId, ProjectId, "settings");

            Debug.WriteLine("StartBuild 2");

            var targets = from x in buildTargets
                          where x.Platform == param.Platform
                          where x.Settings != null && x.Settings.Advanced != null && x.Settings.Advanced.Unity != null
                          let symbolsStr = x.Settings.Advanced.Unity.ScriptingDefineSymbols
                                           let symbolList = symbolsStr.Split(';')
                                                            let release = symbolList.Contains("RELEASE")
                                                                          let realStore = symbolList.Contains("REAL_STORE")
                                                                                          where release == param.ReleaseBuild
                                                                                          where realStore == param.RealStore
                                                                                          let relVer0 = symbolList.Contains("RELEASEVER_0")
                                                                                                        let relVer1 = symbolList.Contains("RELEASEVER_1")
                                                                                                                      let relVer2 = symbolList.Contains("RELEASEVER_2")
                                                                                                                                    let relVer3 = symbolList.Contains("RELEASEVER_3")
                                                                                                                                                  where
                                                                                                                                                  (param.ReleaseVer == 3 && (relVer0 && relVer1 && relVer2 && relVer3)) ||
                                                                                                                                                  (param.ReleaseVer == 2 && (relVer0 && relVer1 && relVer2) && (!relVer3)) ||
                                                                                                                                                  (param.ReleaseVer == 1 && (relVer0 && relVer1) && (!relVer2 && !relVer3)) ||
                                                                                                                                                  (param.ReleaseVer == 0 && (relVer0) && (!relVer1 && !relVer2 && !relVer3))
                                                                                                                                                  select x;

            Debug.WriteLine("StartBuild 3: " + targets.Count());

            var buildApi = new UnityCloudBuildApi.IO.Swagger.Api.BuildsApi(config);

            foreach (var target in targets)
            {
                var opt4 = new Options4
                {
                    Clean = param.CleanBuild,
                    Delay = 0,
                };
                Debug.WriteLine("Build: " + target.Buildtargetid);
                await buildApi.StartBuildsAsync(OrgId, ProjectId, target.Buildtargetid, opt4);
            }

            Debug.WriteLine("StartBuild 4: ");

            return(targets.Select(x => x.Name).ToArray());
        }