Example #1
0
        private void DeployWebProject(BuildConfig config, string rootFolder)
        {
            FileInfo webProjectFile = new FileInfo(config.BuildFolder + "\\Source\\" + config.WebProjectPath);
            DirectoryInfo dir = webProjectFile.Directory;

            XDocument doc = XDocument.Load(webProjectFile.FullName);

            List<WebProjectFile> files = GetContentList(doc.Descendants()).ToList();

            foreach (var file in files)
            {
                var sourcePath = dir.FullName + "\\" + file.FilePath;
                var targetPath = rootFolder + "\\" + file.WebPath;
                string targetDir = System.IO.Path.GetDirectoryName(targetPath);
                if (!Directory.Exists(targetDir)) {
                    Directory.CreateDirectory(targetDir);
                }
                if (File.Exists(sourcePath))
                {
                    File.Copy(sourcePath, targetPath, true);
                }
            }

            dir = new DirectoryInfo(dir.FullName + "\\bin");

            DirectoryInfo tdir = new DirectoryInfo(rootFolder + "\\bin");
            if (!tdir.Exists) {
                tdir.Create();
            }

            CopyDirectory(dir, tdir);
        }
        public Task<List<ISourceItem>> FetchAllFiles(BuildConfig config)
        {

            string gitFolder = config.BuildFolder + "\\git";

            //// temporary hack...
            //// git-pull does not work
            //if (Directory.Exists(gitFolder)) {
            //    Directory.Delete(gitFolder, true);
            //}

            if (!Directory.Exists(gitFolder))
            {
                Directory.CreateDirectory(gitFolder);


                Console.WriteLine("Cloning repository " + config.SourceUrl);

                CloneOptions clone = new CloneOptions();
                clone.CredentialsProvider = CredentialsHandler;
                var rep = Repository.Clone(config.SourceUrl, gitFolder, clone);

                Console.WriteLine("Repository clone successful");
            }
            else {
                Console.WriteLine("Fetching remote Repository");
                var rep = new Repository(gitFolder);
                FetchOptions options = new FetchOptions();
                options.CredentialsProvider = CredentialsHandler;
                Remote remote = rep.Network.Remotes["origin"];

                //Commands.Fetch(rep,remote.Name,)

                //rep.Fetch(remote.Name, options);
                var master = rep.Branches["master"];
                Commands.Pull(rep, new Signature("IISCI", "*****@*****.**", DateTime.Now),  new PullOptions()
                {
                    FetchOptions = options,
                    MergeOptions = new MergeOptions() { 
                        MergeFileFavor = MergeFileFavor.Theirs,
                        CommitOnSuccess = true                        
                    }
                });
                Console.WriteLine("Fetch successful");
            }

            List<ISourceItem> files = new List<ISourceItem>();

            EnumerateFiles( new DirectoryInfo(gitFolder), files, "" );


            Parallel.ForEach(files, file =>
            {
                var md5 = System.Security.Cryptography.MD5.Create();
                ((GitSourceItem)file).Version = Convert.ToBase64String(md5.ComputeHash(File.ReadAllBytes(file.Url)));
            });


            return Task.FromResult(files);
        }
Example #3
0
        public string Process(BuildConfig config)
        {
            string buildFolder = config.BuildFolder;

            string buildXDT = buildFolder + "\\build.xdt";

            File.WriteAllText(buildXDT, CreateXDT(config));

            string webConfigPath = Path.GetDirectoryName( config.BuildFolder + "\\Source\\" + config.WebProjectPath )  + "\\web.config";

            string webConfig = null;

            if (File.Exists(webConfigPath))
            {
                webConfig = File.ReadAllText(webConfigPath);

                webConfig = Transform(webConfig, buildXDT);

                if (!string.IsNullOrWhiteSpace(config.CustomXDT))
                {
                    string customXDT = buildFolder + "\\custom.xdt";
                    File.WriteAllText(customXDT, config.CustomXDT);
                    webConfig = Transform(webConfig, customXDT);
                }

            }

            return webConfig;
        }
Example #4
0
        private string CreateXDT(BuildConfig config)
        {
            XNamespace xdt = "http://schemas.microsoft.com/XML-Document-Transform";

            var doc = XDocument.Parse("<?xml version=\"1.0\"?><configuration xmlns:xdt=\"http://schemas.microsoft.com/XML-Document-Transform\"></configuration>");

            var connectionStrings = new XElement(XName.Get("connectionStrings"));
            doc.Root.Add(connectionStrings);
            foreach (var item in config.ConnectionStrings)
            {
                XElement cnstr = new XElement(XName.Get("add"));
                connectionStrings.Add(cnstr);
                cnstr.SetAttributeValue(XName.Get("name"), item.Name);
                cnstr.SetAttributeValue(XName.Get("connectionString"), item.ConnectionString);
                cnstr.SetAttributeValue(xdt + "Transform", "SetAttributes");
                cnstr.SetAttributeValue(xdt + "Locator", "Match(name)");
                if(item.ProviderName!=null){
                    cnstr.SetAttributeValue(XName.Get("providerName"), item.ProviderName);
                }
            }
            var appSettings = new XElement(XName.Get("appSettings"));
            doc.Root.Add(appSettings);
            foreach (var item in config.AppSettings)
            {
                XElement cnstr = new XElement(XName.Get("add"));
                appSettings.Add(cnstr);
                cnstr.SetAttributeValue(XName.Get("key"), item.Key);
                cnstr.SetAttributeValue(XName.Get("value"), item.Value);
                cnstr.SetAttributeValue(xdt + "Transform", "SetAttributes");
                cnstr.SetAttributeValue(xdt + "Locator", "Match(key)");
            }

            return doc.ToString(SaveOptions.OmitDuplicateNamespaces);
        }
Example #5
0
        static void Main(string[] args)
        {
            try
            {
                CommandLineParser cli = new CommandLineParser(args);

                if (cli.Exists("?"))
                {
                    ShowHelp();
                    Environment.Exit(0);
                }

                BuildConfig buildConfig = new BuildConfig();

                buildConfig.Directory = cli.GetOpt("source");
                buildConfig.PackageName = cli.GetOpt("package");
                buildConfig.Version = cli.GetOpt("version");

                if (cli.Exists("author"))
                {
                    buildConfig.Manufacturer = cli.GetOpt("author");
                }
                else
                {
                    buildConfig.Manufacturer = Environment.UserName;
                }

                if (cli.Exists("path"))
                {
                    buildConfig.Path = true;
                }

                if (cli.Exists("shortcut"))
                {
                    buildConfig.Shortcut = cli.GetOpt("shortcut");
                }

                BuildManager builder = new BuildManager(buildConfig);

                if (cli.Exists("verbose"))
                {
                    BuildSession.Session.Verbose = true;
                }

                builder.build();

                if (cli.Exists("tc-build-num"))
                {
                    Console.WriteLine("##teamcity[buildNumber '{0}']", buildConfig.Version);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                ShowHelp();
                Environment.Exit(1);
            }
        }
Example #6
0
 public void Log()
 {
     SystemTrace.Instance.Debug($"Admin User: {AdminUserName}");
     SystemTrace.Instance.Debug($"Admin Domain: {AdminDomain}");
     SystemTrace.Instance.Debug($"Admin Email: {AdminEmail}");
     SystemTrace.Instance.Debug($"Organization: {OrganizationName}");
     SystemTrace.Instance.Debug($"Data Files Path: {DatabaseFilesPath}");
     SystemTrace.Instance.Debug($"File Share: {FileSharePath}");
     SystemTrace.Instance.Debug($"Server Hostname: {ServerHostname}");
     SystemTrace.Instance.Debug($"Current Version: {CurrentVersion}");
     SystemTrace.Instance.Debug($"Build Target: {BuildConfig.ToString()}");
 }
Example #7
0
        public static BuildConfig GetConfigFile(string fileName)
        {
            BuildConfig cfg = AssetDatabase.LoadAssetAtPath <BuildConfig>(string.Format(BUILD_CONFIG_PATH, fileName));

            if (cfg == null)
            {
                Debug.LogErrorFormat("{0} not found!", fileName);
                return(null);
            }
            cfg.Name = fileName;
            return(cfg);
        }
Example #8
0
        internal static BuildConfig AddWorker(this BuildConfig buildConfig, string workerType, BuildTargetConfig[] localConfigs, BuildTargetConfig[] cloudConfigs)
        {
            var workerConfig = new WorkerBuildConfiguration
            {
                WorkerType       = workerType,
                LocalBuildConfig = new BuildEnvironmentConfig(WorkerBuildData.LocalBuildTargets, localConfigs),
                CloudBuildConfig = new BuildEnvironmentConfig(WorkerBuildData.AllBuildTargets, cloudConfigs)
            };

            buildConfig.WorkerBuildConfigurations.Add(workerConfig);
            return(buildConfig);
        }
Example #9
0
        /// <summary>
        /// 解析shel参数
        /// </summary>
        public static void ReceiveCommondLine()
        {
            Debug.Log("开始解析 shell 参数  ············");
            config = AssetDatabase.LoadAssetAtPath <BuildConfig>(GameConst.BuildConfigPath);
            foreach (string arg in System.Environment.GetCommandLineArgs())
            {
                Debug.Log(arg);

                if (arg.Contains(apk))
                {
                    config.isGenerateAPK = GetBool(arg);
                }

                if (arg.Contains(ipa))
                {
                    config.isGenerateIPA = GetBool(arg);
                }

                if (arg.Contains(xcode))
                {
                    config.isGenerateXcode = GetBool(arg);
                }

                if (arg.Contains(assetbundle))
                {
                    config.isGenerateAssetbundle = GetBool(arg);
                }

                if (arg.Contains(publish))
                {
                    config.isPublish = GetBool(arg);
                }

                if (arg.Contains(obb))
                {
                    config.isObb = GetBool(arg);
                }

                if (arg.Contains(log))
                {
                    config.isLog = GetBool(arg);
                }


                if (arg.Contains(versionTag))
                {
                    config.version = GetString(arg);
                }
            }

            config.Log();
        }
Example #10
0
        private static bool BuildWorkerForEnvironment(
            string workerType,
            BuildEnvironment buildEnvironment,
            IEnumerable <BuildTarget> buildTargetFilter,
            ScriptingImplementation?scriptingBackend = null)
        {
            var spatialOSBuildConfiguration = BuildConfig.GetInstance();
            var environmentConfig           = spatialOSBuildConfiguration.GetEnvironmentConfigForWorker(workerType, buildEnvironment);

            var targetConfigs = buildTargetFilter == null
                ? environmentConfig?.BuildTargets.Where(t => t.Enabled)
                : environmentConfig?.BuildTargets.Where(t => t.Enabled && buildTargetFilter.Contains(t.Target));

            if (targetConfigs == null || !targetConfigs.Any())
            {
                Debug.LogWarning($"Skipping build for {workerType}.");
                return(false);
            }

            if (!Directory.Exists(PlayerBuildDirectory))
            {
                Directory.CreateDirectory(PlayerBuildDirectory);
            }

            var hasBuildSucceeded = true;

            foreach (var config in targetConfigs)
            {
                var buildTargetGroup       = BuildPipeline.GetBuildTargetGroup(config.Target);
                var activeScriptingBackend = PlayerSettings.GetScriptingBackend(buildTargetGroup);
                try
                {
                    if (scriptingBackend != null && config.Target != BuildTarget.iOS)
                    {
                        Debug.Log($"Setting scripting backend to {scriptingBackend.Value}");
                        PlayerSettings.SetScriptingBackend(buildTargetGroup, scriptingBackend.Value);
                    }

                    hasBuildSucceeded &= BuildWorkerForTarget(workerType, buildEnvironment, config.Target, config.Options);
                }
                catch (Exception e)
                {
                    throw new BuildFailedException(e);
                }
                finally
                {
                    PlayerSettings.SetScriptingBackend(buildTargetGroup, activeScriptingBackend);
                }
            }

            return(hasBuildSucceeded);
        }
Example #11
0
 public void Click_Build(int colorId, int level, BuildConfig buildConfig)
 {
     if (sOnSelect != null)
     {
         sOnSelect(colorId, level, buildConfig, onSelect_parameter);
         sOnSelect          = null;
         onSelect_parameter = null;
     }
     else
     {
         Create_Build(colorId, level, buildConfig, new Vector3(-22, 0, 17), null);
     }
 }
Example #12
0
        public async Task <JobBuildEntity> Add(BuildConfig config, string token)
        {
            var entity = new JobBuildEntity
            {
                Config    = config,
                CreatedAt = new DateTime(),
                Token     = token
            };

            await buildCollection.InsertOneAsync(entity);

            return(entity);
        }
Example #13
0
        private void InitializeWebApi(BuildConfig config)
        {
            VssCredentials c = null;

            c = new VssCredentials(new VssBasicCredential(string.IsNullOrWhiteSpace(config.Username) ? String.Empty : config.Username, config.Password));


            c.PromptType = CredentialPromptType.DoNotPrompt;

            this.Conn = new VssConnection(new Uri(config.SourceUrl + "/" + config.Collection), c);

            //this.Client = conn.GetClient<TfvcHttpClient>();
        }
Example #14
0
        public void NameTest()
        {
            string      projectFile = @"C:\Users\Test\file.wcodeproj";
            string      projectName = "Project";
            IProject    project     = new Project(projectFile, projectName);
            string      name        = "Debug Config";
            BuildConfig target      = new BuildConfig(project, name);

            string expected = name;
            string actual   = target.Name;

            Assert.AreEqual(expected, actual);
        }
Example #15
0
        static async Task Main(string[] args)
        {
            //test args
            //args = new string[] { @"Organic-Wizard|C:\Git\Organic-Wizard\src\Organic-Wizard| C:\Git\Organic-Wizard\src\| C:\Git\Organic-Wizard\src\Organic-Wizard\| Release"};
            BuildData.Init(args);
            if (!BuildConfig.ShouldExecuteBuildEvent())
            {
                return;
            }


            CopyReleaseFolderToPostBuildFolder(BuildData.TargetDir, BuildData.SolutionDir);
            var version = BuildConfig.GetAppVersionString();

            NugetHelper.PackageInfo info = new NugetHelper.PackageInfo()
            {
                Id          = BuildData.ProjectName,
                Version     = version,
                Author      = "Claude",
                Description = BuildData.ProjectName,
                Title       = BuildData.ProjectName,
                FilesFolder = BuildData.TargetDir
            };
            string packageName           = NugetHelper.CreatePackage(info, BuildData.SolutionDir);
            string squirrelReleaseFolder = Path.Combine(BuildData.SolutionDir, "Releases");
            string squirrelPackageName   = GetSquirrelPackageName(packageName);

            DeleteSetupFiles(squirrelReleaseFolder, squirrelPackageName);
            RemoveOlderVerisons(squirrelReleaseFolder);
            CopyReleaseDirToTempAndCopyBack(squirrelReleaseFolder);
            bool succes = await Releasify(squirrelReleaseFolder, packageName, squirrelPackageName, 5000);

            if (succes)
            {
                File.Delete(Path.Combine(BuildData.SolutionDir, packageName));
                CopyReleaseFilesToGitFolder(squirrelReleaseFolder);
                GitHelper.AddCommitPush();
                await GitHelper.CreateRelease();

                ChangeTxtFileVersion();
                BuildConfig.SetTxtFileVersion(BuildData.SettingsVersion);
                File.Copy(BuildConfig.GetTxtVersionFilePath(),
                          Path.Combine(BuildConfig.GetGitRepoLocalPath(), BuildConfig.GetVerionTxtFileName()), true);
                GitHelper.AddCommitPush();
                Console.WriteLine($"Version {version} released successfully!");
            }
            else
            {
                Console.WriteLine($"Failed to release package {packageName}");
            }
        }
Example #16
0
    void OnGUI()
    {
        //平台
        GUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Build Target:", EditorStyles.boldLabel, GUILayout.MaxWidth(100));
        EditorGUILayout.EnumPopup(EditorUserBuildSettings.activeBuildTarget);
        GUILayout.EndHorizontal();

        this.onSettingGUI();

        this.onConfigListGUI();

        if (GUILayout.Button("Build", GUILayout.Height(30)))
        {
            BuildConfig[] configArr = BuildConfigManager.Instance.BuildConfigs;

            IStrategy        bcStrategy      = null;
            BuildConfig      lastBuildConfig = null;
            HashSet <string> bcLog           = new HashSet <string>();
            // 分配AssetBundle关联
            foreach (BuildConfig buildConfig in configArr)
            {
                if (bcLog.Contains(buildConfig.BundleName))
                {
                    continue;
                }

                lastBuildConfig = onPrebuild(buildConfig);

                bcStrategy = GetStrategy(lastBuildConfig.BuildStrategy);
                bcStrategy.BeginProcess(lastBuildConfig);
                bcLog.Add(lastBuildConfig.BundleName);
            }

            this.buildAllBundle();

            //打包完成后的处理,比如文件移动等
            foreach (BuildConfig buildConfig in configArr)
            {
                bcStrategy = GetStrategy(buildConfig.BuildStrategy);
                bcStrategy.EndProcess(buildConfig);
            }

            //保存
            BuildConfigManager.Instance.SaveConfig();

            //提示
            EditorUtility.DisplayDialog("提示", "已打包完成!", "OK");
        }
        GUILayout.Space(5);
    }
Example #17
0
        /// <summary>
        /// Saves the configs using to the Blizzard standard location
        /// </summary>
        /// <param name="directory"></param>
        public void Save(string directory)
        {
            // save the localised configs
            BuildConfig.Write(directory);
            CDNConfig.Write(directory);

            // update the hashes
            VersionsFile.SetValue("buildconfig", BuildConfig.Checksum.ToString());
            VersionsFile.SetValue("cdnconfig", CDNConfig.Checksum.ToString());

            // save the primary configs
            CDNsFile.Write(directory, Product);
            VersionsFile.Write(directory, Product);
        }
Example #18
0
        public void BuildConfig_GetHashCodeTest()
        {
            string      projectFile = @"C:\Users\Test\file.wcodeproj";
            string      projectName = "Project";
            IProject    project     = new Project(projectFile, projectName);
            string      name        = "Debug Config";
            BuildConfig target      = new BuildConfig(project, name);
            BuildConfig target2     = new BuildConfig(project, name);

            int expected = target.GetHashCode();
            int actual   = target2.GetHashCode();

            Assert.AreEqual(expected, actual);
        }
        public BuildViewController(BuildingSystem buildingSystem, InventorySystem inventorySystem, BuildConfig buildConfig)
        {
            _buildingSystem  = buildingSystem;
            _inventorySystem = inventorySystem;
            _buildConfig     = buildConfig;
            _uiSpawnData     = inventorySystem.GetSpawnData();

            viewFactory.CreateAsync <BuildView>("GUI/BuildView", (v) =>
            {
                view = v;
                SetVisible(_isVisible);
                OnCreationComplete();
            });
        }
Example #20
0
        public void EqualsTest()
        {
            string      projectFile = @"C:\Users\Test\file.wcodeproj";
            string      projectName = "Project";
            IProject    project     = new Project(projectFile, projectName);
            string      name        = "Debug Config";
            BuildConfig target      = new BuildConfig(project, name);
            BuildConfig target2     = new BuildConfig(project, name);

            bool expected = true;
            bool actual   = target.Equals(target2);

            Assert.AreEqual(expected, actual);
        }
Example #21
0
    public void StartTurn()
    {
        BuildingManager.DayPassed(1);
        BuildConfig buildConfig = BuildingManager.GetCompletedBuild();

        while (buildConfig)
        {
            buildConfig = BuildingManager.GetCompletedBuild();
        }
        foreach (HexCell cityCell in PathFindingUtilities.GetCellsInRange(Location, influenceRange).FindAll(c => c.City))
        {
            cityCell.City.GetCityState().AdjustInfluence(Player, influence);
        }
    }
Example #22
0
        public async Task DeleteAllSnapshotDependencies(BuildConfig buildConfig, HashSet <string> buildConfigIdsToSkip = null)
        {
            Log.DebugFormat("API BuildConfig.DeleteAllSnapshotDependencies for: {0}", buildConfig.Id);

            foreach (DependencyDefinition dependencyDefinition in buildConfig.SnapshotDependencies)
            {
                if (buildConfigIdsToSkip != null && buildConfigIdsToSkip.Contains(dependencyDefinition.SourceBuildConfig.Id))
                {
                    continue;
                }

                await DeleteSnapshotDependency(buildConfig.Id, dependencyDefinition.SourceBuildConfig.Id);
            }
        }
Example #23
0
    public BuildConfig AddBuildConfig(string configName)
    {
        if (configDic.ContainsKey(configName))
        {
            return(configDic[configName]);
        }

        BuildConfig bc = new BuildConfig();

        bc.BundleName = configName;

        configDic[configName] = bc;
        return(bc);
    }
Example #24
0
 public virtual void HandleHoleList()
 {
     if (batteryHoleList != null && batteryHoleList.Count > 0)
     {
         for (int i = 0; i < batteryHoleList.Count; i++)
         {
             BuildConfig bc = batteryHoleList[i].GetComponent <BuildConfig>();
             if (!holeDic.ContainsKey(bc.index))
             {
                 holeDic[bc.index] = batteryHoleList[i];
             }
         }
     }
 }
Example #25
0
        private static void BuildPlayer(bool development)
        {
            var config = new BuildConfig();

            // Platform
            switch (EditorUserBuildSettings.activeBuildTarget)
            {
            case BuildTarget.StandaloneWindows64:
                SetWindows(ref config);
                break;

            case BuildTarget.StandaloneOSXIntel:
            case BuildTarget.StandaloneOSXIntel64:
            case BuildTarget.StandaloneOSXUniversal:
                SetOSX(ref config);
                break;

            case BuildTarget.iOS:
                SetiOS(ref config);
                break;

            case BuildTarget.Android:
                SetAndroid(ref config);
                break;

            default:
                break;
            }

            if (development)
            {
                SetDevelopment(ref config);
            }
            else
            {
                SetRelease(ref config);
            }

            // Check
            if (!System.IO.Directory.Exists(config.path))
            {
                System.IO.Directory.CreateDirectory(config.path);
            }

            // Build
            var levels = GetBuildLevels();

            BuildPipeline.BuildPlayer(levels, config.path, config.target, config.options);
        }
Example #26
0
        public void InitConfigKeys()
        {
            buildInfo = new BuildInfo(BasePath + "/.build.info");

            var buildConfigKey = buildInfo["Build Key"];

            if (buildConfigKey != null)
            {
                if (buildConfigKey.Length / 2 > 16)
                {
                    throw new InvalidOperationException("Build config key too long");
                }
                else if (buildConfigKey.Length / 2 < 16)
                {
                    throw new InvalidOperationException("Build config key too short");
                }

                buildConfig = new BuildConfig(BasePath, buildConfigKey);

                if (buildConfig == null)
                {
                    throw new InvalidOperationException("Can't create build config.");
                }
            }

            var cdnConfigKey = buildInfo["CDN Key"];

            if (cdnConfigKey != null)
            {
                if (cdnConfigKey.Length / 2 > 16)
                {
                    throw new InvalidOperationException("CDN config key too long");
                }
                else if (cdnConfigKey.Length / 2 < 16)
                {
                    throw new InvalidOperationException("CDN config key too short");
                }

                cdnConfig = new CDNConfig(BasePath, cdnConfigKey);

                cdnConfig.Path = buildInfo["CDN Path"];
                cdnConfig.Host = buildInfo["CDN Hosts"].Split(new[] { ' ' })[0];

                if (cdnConfig == null)
                {
                    throw new InvalidOperationException("Can't create cdn config.");
                }
            }
        }
Example #27
0
        public int Main(string[] args)
        {
            Thread.CurrentThread.Name = "Main";
            DebugThreadInterrupter.theInstance.RegisterThread(Thread.CurrentThread);
            MainAppForm mainAppForm = null;

            try
            {
                ParseArgs(args);
                try
                {
                    BuildConfig.Initialize();
                    if (BuildConfig.theConfig.buildConfiguration == "Broken")
                    {
                        throw new ConfigurationException(
                                  "MapCruncher configuration is broken. Please reinstall MapCruncher.");
                    }

                    if (_remoteFoxitServer != null)
                    {
                        int result = _remoteFoxitServer.Run();
                        return(result);
                    }

                    Application.EnableVisualStyles();
                    mainAppForm = new MainAppForm(_startDocumentPath, _renderOnLaunch);
                    mainAppForm.StartUpApplication();
                }
                catch (ConfigurationException ex)
                {
                    D.Say(0, ex.ToString());
                    HTMLMessageBox.Show(ex.Message, "MapCruncher Configuration Problem");
                    int result = 2;
                    return(result);
                }

                Application.Run(mainAppForm);
            }
            finally
            {
                DebugThreadInterrupter.theInstance.Quit();
                if (mainAppForm != null)
                {
                    mainAppForm.UndoConstruction();
                }
            }

            return(_applicationResultCode);
        }
Example #28
0
        private static void CopyReleaseFilesToGitFolder(string squirrelReleaseFolder)
        {
            var files = Directory.GetFiles(squirrelReleaseFolder);

            foreach (var squirrelFile in files)
            {
                FileInfo info         = new FileInfo(squirrelFile);
                string   localGitFile = Path.Combine(BuildConfig.GetGitRepoLocalPath(), info.Name);
                if (File.Exists(localGitFile))
                {
                    File.Delete(localGitFile);
                }
                File.Copy(squirrelFile, localGitFile, true);
            }
        }
Example #29
0
        public void CloneTest()
        {
            string      projectFile = @"C:\Users\Test\file.wcodeproj";
            string      projectName = "Project";
            IProject    project     = new Project(projectFile, projectName);
            string      name        = "Debug Config";
            BuildConfig target      = new BuildConfig(project, name);

            target.Steps.Add(new InternalBuildStep(project, 1, StepType.All, null, null));
            target.Steps.Add(new InternalBuildStep(project, 0, StepType.Listing, null, null));

            IBuildConfig actual = (IBuildConfig)target.Clone();

            Assert.AreEqual(target, actual);
        }
Example #30
0
        public void ForceBuild(string projectName, Branch branch)
        {
            projectName = NegotiateProjectName(projectName, null);

            var         client = Open();
            BuildConfig config = client.BuildConfigByConfigurationName(projectName);

            HttpWebRequest wr = WebRequest.Create(string.Concat(Url, string.Format("/httpAuth/action.html?add2Queue={0}&branch_project3={1}", config.Id, (branch == null || branch.IsMaster) ? "<default>" : branch.FullName))) as HttpWebRequest;

            wr.Method      = "post";
            wr.ContentType = "application/x-www-form-urlencoded";
            wr.Credentials = new NetworkCredential(this.Username, this.Password);

            wr.GetResponse();
        }
        public async Task UpdateBuildConfigCiExternalId_ReturnsBuildConfigUpdatedWithNewNameAndCiExternalId()
        {
            _fixture.Customize <BuildConfig>(c => c.Without(f => f.Project));
            IQueryable <BuildConfig> builds = _fixture
                                              .CreateMany <BuildConfig>()
                                              .AsQueryable();
            BuildConfig build = builds.First();

            DbSet <BuildConfig> buildsSet = A.Fake <DbSet <BuildConfig> >(builder => builder
                                                                          .Implements(typeof(IQueryable <BuildConfig>))
                                                                          .Implements(typeof(IDbAsyncEnumerable <BuildConfig>)));

            A.CallTo(() => ((IDbAsyncEnumerable <BuildConfig>)buildsSet).GetAsyncEnumerator())
            .Returns(new TestDbAsyncEnumerator <BuildConfig>(builds.GetEnumerator()));
            A.CallTo(() => ((IQueryable <BuildConfig>)buildsSet).Provider)
            .Returns(new TestDbAsyncQueryProvider <BuildConfig>(builds.Provider));
            A.CallTo(() => ((IQueryable <BuildConfig>)buildsSet).Expression).Returns(builds.Expression);
            A.CallTo(() => ((IQueryable <BuildConfig>)buildsSet).ElementType).Returns(builds.ElementType);
            A.CallTo(() => ((IQueryable <BuildConfig>)buildsSet).GetEnumerator()).Returns(builds.GetEnumerator());

            ICiDashboardContext context = A.Fake <ICiDashboardContext>();

            A.CallTo(() => context.BuildConfigs).Returns(buildsSet);

            ICiDashboardContextFactory factory = A.Fake <ICiDashboardContextFactory>();

            A.CallTo(() => factory.Create()).Returns(context);

            _fixture.Inject(factory);
            _fixture.Inject(context);

            CiDashboardService service = _fixture.Create <CiDashboardService>();

            string newName         = _fixture.Create <string>();
            string newCiExternalId = _fixture.Create <string>();
            bool   result          = await service.UpdateBuildConfigExternalId(build.Id, newName, newCiExternalId);

            A.CallTo(() => context.SaveChanges())
            .MustHaveHappened();

            result.Should()
            .BeTrue();

            build.Name.Should()
            .Be(newName);
            build.CiExternalId.Should()
            .Be(newCiExternalId);
        }
Example #32
0
        static void Main(string[] args)
        {
            var dictionary = args
                             .Select(x => x.Split(new char[] { '=' }, 2).Select(s => s.Trim()))
                             .Where(x => x.Count() == 2)
                             .ToDictionary(x => x.FirstOrDefault(), x => x.LastOrDefault());



            string id          = dictionary["id"];
            string configPath  = dictionary["config"].Trim('"');
            string buildFolder = dictionary["build"].Trim('"');

            bool   redeploy = false;
            string v;

            if (dictionary.TryGetValue("redeploy", out v))
            {
                redeploy = v?.Equals("yes", StringComparison.OrdinalIgnoreCase) ?? false;
            }



            string configXDT = null;

            if (args.Length > 2)
            {
                configXDT = args[2];
            }

            BuildConfig config = JsonStorage.ReadFile <BuildConfig>(configPath);

            config.BuildFolder = buildFolder;

            var lastBuild = Execute(config, redeploy);

            JsonStorage.WriteFile(lastBuild, config.BuildResult);

            if (lastBuild.Success)
            {
                Console.WriteLine(lastBuild.Log);
            }
            else
            {
                Console.Error.WriteLine(lastBuild.Error ?? "Something went wrong...");
                Environment.ExitCode = lastBuild.ExitCode;
            }
        }
Example #33
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            BuildConfig info = target as BuildConfig;

            if (GUILayout.Button("Android 打包"))
            {
                JenkinsBuild.BuildForAndroid();
            }

            if (GUILayout.Button("IOS 打包"))
            {
                JenkinsBuild.BuildForIOS();
            }
        }
Example #34
0
        private void RegisterCompiler(BuildConfig buildConfig)
        {
            var compilerExecutable = File.Exists(buildConfig.CustomCompiler.Executable) ? buildConfig.CustomCompiler.Executable : GetExecutableFromPath(buildConfig.CustomCompiler.Executable);

            if (string.IsNullOrWhiteSpace(buildConfig.CustomCompiler.Arguments))
            {
                throw new ArgumentException(nameof(buildConfig.CustomCompiler.Arguments));
            }

            if (buildConfig.CustomCompiler.FileTypes.Length == 0)
            {
                throw new ArgumentException(nameof(buildConfig.CustomCompiler.FileTypes));
            }

            compilerManager.AddCompiler(new CustomCompiler(compilerExecutable, buildConfig.CustomCompiler.Arguments, buildConfig.CustomCompiler.FileTypes));
        }
Example #35
0
        public void StartBuild(ICoreConfigSection coreConfigSection, bool thread)
        {
            var config  = BuildConfig.FullBuildConfig(_configController, _codeParser(), _sdBuildStrings, _allExporters);
            var context = new BuildContext(BuildMessenger, _sdBuildStrings, config);

            if (thread)
            {
                Stop();
                _buildThread = new Thread(context.StartBuild);
                _buildThread.Start();
            }
            else
            {
                context.StartBuild();
            }
        }
Example #36
0
        private static void BuildPlayer(bool development)
        {
            var config = new BuildConfig();

            // Platform
            switch (EditorUserBuildSettings.activeBuildTarget)
            {
                case BuildTarget.StandaloneWindows64:
                    SetWindows(ref config);
                    break;
                case BuildTarget.StandaloneOSXIntel:
                case BuildTarget.StandaloneOSXIntel64:
                case BuildTarget.StandaloneOSXUniversal:
                    SetOSX(ref config);
                    break;
                case BuildTarget.iOS:
                    SetiOS(ref config);
                    break;
                case BuildTarget.Android:
                    SetAndroid(ref config);
                    break;
                default:
                    break;
            }

            if (development)
            {
                SetDevelopment(ref config);
            }
            else
            {
                SetRelease(ref config);
            }

            // Check
            if (!System.IO.Directory.Exists (config.path)) {
                System.IO.Directory.CreateDirectory (config.path);
            }

            // Build
            var levels = GetBuildLevels();
            BuildPipeline.BuildPlayer(levels, config.path, config.target, config.options);
        }
Example #37
0
        internal void DeployFiles(BuildConfig config, string webConfig)
        {
            using (ServerManager mgr = new ServerManager()) {
                Site site = null;
                if (!string.IsNullOrWhiteSpace(config.SiteId))
                {
                    site = mgr.Sites.FirstOrDefault(x => x.Name == config.SiteId);
                }
                else
                {
                    site = mgr.Sites.FirstOrDefault(x => x.Bindings.Any(a => a.Host == config.SiteHost));
                }
                if (site == null) {
                    throw new KeyNotFoundException("No site with binding " + config.SiteHost + " found in IIS");
                }

                var app = site.Applications.FirstOrDefault();
                site.Stop();

                // copy all files...
                var dir = app.VirtualDirectories.FirstOrDefault();
                var rootFolder = dir.PhysicalPath;

                if (config.UseMSBuild) {
                    DeployWebProject(config, rootFolder);
                }

                FileInfo configFile = new FileInfo(rootFolder + "\\Web.Config");
                if (configFile.Exists)
                {
                    configFile.Delete();
                }

                File.WriteAllText(configFile.FullName, webConfig , UnicodeEncoding.Unicode);

                site.Start();
            }
        }
Example #38
0
        static async Task<int> DownloadFilesAsync(BuildConfig config, string buildFolder)
        {
            using (ISourceController ctrl = GetController(config))
            {
                using (LocalRepository rep = new LocalRepository(buildFolder))
                {
                    ctrl.Initialize(config);

                    List<ISourceItem> remoteItems = await ctrl.FetchAllFiles(config);
                    var changes = rep.GetChanges(remoteItems).ToList();

                    var changeTypes = changes
                        .Where(x=>!x.RepositoryFile.IsDirectory)
                        .GroupBy(x => x.Type);
                    foreach (var item in changeTypes)
                    {
                        Console.WriteLine("Changes {0}: {1}",item.Key, item.Count());
                    }

                    var updatedFiles = changes.Where(x => x.Type == ChangeType.Added || x.Type == ChangeType.Modified)
                        .Select(x => x.RepositoryFile).Where(x => !x.IsDirectory).ToList();

                    foreach (var item in changes.Where(x => x.Type == ChangeType.Removed))
                    {
                        string filePath = item.RepositoryFile.FilePath;
                        if (File.Exists(filePath))
                        {
                            File.Delete(filePath);
                        }
                    }

                    foreach (var slice in updatedFiles.Slice(25))
                    {
                        var downloadList = slice.Select(x =>
                        {
                            string filePath = rep.LocalFolder + x.Folder + "/" + x.Name;
                            System.IO.FileInfo finfo = new System.IO.FileInfo(filePath);
                            if (finfo.Exists)
                            {
                                finfo.Delete();
                            }
                            else
                            {
                                if (!finfo.Directory.Exists)
                                {
                                    finfo.Directory.Create();
                                }
                            }
                            x.FilePath = filePath;
                            return ctrl.DownloadAsync(config, x, filePath);
                        });

                        await Task.WhenAll(downloadList);
                        rep.UpdateFiles(slice);
                    }

                    return updatedFiles.Count();
                }
            }
        }
		private bool IsEditorRunning(BuildConfig Config)
		{
			string EditorFileName = Path.GetFullPath(GetEditorExePath(GetEditorBuildConfig()));
			try
			{
				foreach(Process ProcessInstance in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(EditorFileName)))
				{
					try
					{
						string ProcessFileName = Path.GetFullPath(Path.GetFullPath(ProcessInstance.MainModule.FileName));
						if(String.Compare(EditorFileName, ProcessFileName, StringComparison.InvariantCultureIgnoreCase) == 0)
						{
							return true;
						}
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
			return false;
		}
Example #40
0
 public BuildManager(BuildConfig buildConfig)
 {
     this.buildConfig = buildConfig;
 }
Example #41
0
 public void Initialize(BuildConfig config)
 {
     this.config = config;
 }
Example #42
0
 public async Task DownloadAsync(BuildConfig config, ISourceItem item, string filePath)
 {
     using (var source = File.OpenRead(item.Url))
     {
         using (var destination = File.OpenWrite(filePath))
         {
             await source.CopyToAsync(destination);
         }
     }
 }
Example #43
0
 // Platform
 private static void SetWindows(ref BuildConfig config)
 {
     config.path = buildRoot + "Windows/" + PlayerSettings.productName + ".exe";
     config.target = BuildTarget.StandaloneWindows64;
     config.options = BuildOptions.None;
 }
		void UpdateBuildConfig(BuildConfig NewConfig)
		{
			Settings.CompiledEditorBuildConfig = NewConfig;
			Settings.Save();
			UpdateCheckedBuildConfig();
		}
Example #45
0
 private static void SetiOS(ref BuildConfig config)
 {
     config.path = buildRoot + "iOS/";
     config.target = BuildTarget.iOS;
     config.options = BuildOptions.Il2CPP;
 }
Example #46
0
        private static LastBuild Execute(BuildConfig config)
        {
            try
            {

                string buildFolder = config.BuildFolder;

                var result = DownloadFilesAsync(config, buildFolder).Result;

                if (result == 0)
                {
                    var lb = JsonStorage.ReadFileOrDefault<LastBuild>(buildFolder + "\\last-build.json");
                    if (lb == null || string.IsNullOrWhiteSpace(lb.Error))
                    {
                        if (lb == null)
                        {
                            lb = new LastBuild { Time = DateTime.UtcNow };
                        }
                        lb.Log = "+++++++++++++++++++++ No changes to deploy +++++++++++++++++++++";
                        lb.ExitCode = 0;
                        lb.Error = "";
                        return lb;
                    }
                }

                if (config.UseMSBuild)
                {
                    var buildCommand = new MSBuildCommand()
                    {
                        Solution = config.SolutionPath,
                        BuildFolder = buildFolder,
                        Parameters = config.MSBuildParameters,
                        BuildConfig = config.MSBuildConfig
                    };

                    var lastBuild = buildCommand.Build();
                    if (!lastBuild.Success)
                    {
                        return lastBuild;
                    }

                    string webConfig = XDTService.Instance.Process(config);

                    IISManager.Instance.DeployFiles(config, webConfig);

                    lastBuild.Log += "\r\n+++++++++++++++++++++ Deployment Successful !!! +++++++++++++++++++++";

                    return lastBuild;
                }
                else {
                    throw new NotImplementedException();
                }

            }
            catch (Exception ex) {
                return new LastBuild { 
                    Error = ex.ToString(),
                    ExitCode = -1,
                    Time = DateTime.UtcNow
                };
            }

        }
Example #47
0
        private static ISourceController GetController(BuildConfig config)
        {
            string sourceType = config.SourceType.ToLower();

            switch (sourceType)
            {
                case "tfs2012":
                    return new TFS2012Client();
                case "tfs2015":
                    return new TFS2015Client();
                case "zipurl":
                    return new ZipSourceController();
                case "git":
                    return new Git.GitSourceController();
                default:
                    break;
            }

            throw new NotImplementedException("SourceControl does not exist for " + config.SourceType);
        }
Example #48
0
 public BuildActionResult(BuildConfig config, string cmdLine)
 {
     parameters = cmdLine;
     this.config = config;
 }
		private List<string> GetEditorReceiptPaths(BuildConfig Config)
		{
			string ConfigSuffix = (Config == BuildConfig.Development)? "" : String.Format("-Win64-{0}", Config.ToString());

			List<string> PossiblePaths = new List<string>();
			if(EditorTargetName == null)
			{
				PossiblePaths.Add(Path.Combine(BranchDirectoryName, "Engine", "Binaries", "Win64", String.Format("UE4Editor{0}.target", ConfigSuffix)));
				PossiblePaths.Add(Path.Combine(BranchDirectoryName, "Engine", "Build", "Receipts", String.Format("UE4Editor-Win64-{0}.target.xml", Config.ToString())));
			}
			else
			{
				PossiblePaths.Add(Path.Combine(Path.GetDirectoryName(SelectedFileName), "Binaries", "Win64", String.Format("{0}{1}.target", EditorTargetName, ConfigSuffix)));
				PossiblePaths.Add(Path.Combine(Path.GetDirectoryName(SelectedFileName), "Build", "Receipts", String.Format("{0}-Win64-{1}.target.xml", EditorTargetName, Config.ToString())));
			}
			return PossiblePaths;
		}
		public UserSettings(string InFileName)
		{
			FileName = InFileName;
			if(File.Exists(FileName))
			{
				ConfigFile.Load(FileName);
			}

			// General settings
			bBuildAfterSync = (ConfigFile.GetValue("General.BuildAfterSync", "1") != "0");
			bRunAfterSync = (ConfigFile.GetValue("General.RunAfterSync", "1") != "0");
			bSyncPrecompiledEditor = (ConfigFile.GetValue("General.SyncPrecompiledEditor", "0") != "0");
			bOpenSolutionAfterSync = (ConfigFile.GetValue("General.OpenSolutionAfterSync", "0") != "0");
			bShowLogWindow = (ConfigFile.GetValue("General.ShowLogWindow", false));
			bAutoResolveConflicts = (ConfigFile.GetValue("General.AutoResolveConflicts", "1") != "0");
			bUseIncrementalBuilds = ConfigFile.GetValue("General.IncrementalBuilds", true);
			bShowLocalTimes = ConfigFile.GetValue("General.ShowLocalTimes", false);
			bKeepInTray = ConfigFile.GetValue("General.KeepInTray", true);
			LastProjectFileName = ConfigFile.GetValue("General.LastProjectFileName", null);
			OtherProjectFileNames = ConfigFile.GetValues("General.OtherProjectFileNames", new string[0]);
			SyncFilter = ConfigFile.GetValues("General.SyncFilter", new string[0]);
			if(!Enum.TryParse(ConfigFile.GetValue("General.SyncType", ""), out SyncType))
			{
				SyncType = LatestChangeType.Good;
			}

			// Build configuration
			string CompiledEditorBuildConfigName = ConfigFile.GetValue("General.BuildConfig", "");
			if(!Enum.TryParse(CompiledEditorBuildConfigName, true, out CompiledEditorBuildConfig))
			{
				CompiledEditorBuildConfig = BuildConfig.DebugGame;
			}

			// Editor arguments
			string[] Arguments = ConfigFile.GetValues("General.EditorArguments", new string[]{ "0:-log", "0:-fastload" });
			foreach(string Argument in Arguments)
			{
				if(Argument.StartsWith("0:"))
				{
					EditorArguments.Add(new Tuple<string,bool>(Argument.Substring(2), false));
				}
				else if(Argument.StartsWith("1:"))
				{
					EditorArguments.Add(new Tuple<string,bool>(Argument.Substring(2), true));
				}
				else
				{
					EditorArguments.Add(new Tuple<string,bool>(Argument, true));
				}
			}

			// Window settings
			ConfigSection WindowSection = ConfigFile.FindSection("Window");
			if(WindowSection != null)
			{
				bHasWindowSettings = true;

				int X = WindowSection.GetValue("X", -1);
				int Y = WindowSection.GetValue("Y", -1);
				int Width = WindowSection.GetValue("Width", -1);
				int Height = WindowSection.GetValue("Height", -1);
				WindowRectangle = new Rectangle(X, Y, Width, Height);

				ConfigObject ColumnWidthObject = new ConfigObject(WindowSection.GetValue("ColumnWidths", ""));
				foreach(KeyValuePair<string, string> ColumnWidthPair in ColumnWidthObject.Pairs)
				{
					int Value;
					if(int.TryParse(ColumnWidthPair.Value, out Value))
					{
						ColumnWidths[ColumnWidthPair.Key] = Value;
					}
				}

				bWindowVisible = WindowSection.GetValue("Visible", true);
			}

			// Schedule settings
			bScheduleEnabled = ConfigFile.GetValue("Schedule.Enabled", false);
			if(!TimeSpan.TryParse(ConfigFile.GetValue("Schedule.Time", ""), out ScheduleTime))
			{
				ScheduleTime = new TimeSpan(6, 0, 0);
			}
			if(!Enum.TryParse(ConfigFile.GetValue("Schedule.Change", ""), out ScheduleChange))
			{
				ScheduleChange = LatestChangeType.Good;
			}
		}
Example #51
0
 private static void SetOSX(ref BuildConfig config)
 {
     config.path = buildRoot + "OSX/" + PlayerSettings.productName + ".app";
     config.target = BuildTarget.StandaloneOSXUniversal;
     config.options = BuildOptions.None;
 }
Example #52
0
 private static void SetDevelopment(ref BuildConfig config)
 {
     config.options |= BuildOptions.Development | BuildOptions.AllowDebugging;
 }
Example #53
0
 private static void SetAndroid(ref BuildConfig config)
 {
     config.path = buildRoot + "Android/" + PlayerSettings.productName + ".apk";
     config.target = BuildTarget.Android;
     config.options = BuildOptions.None;
 }
		private string GetEditorExePath(BuildConfig Config)
		{
			string ExeFileName = "UE4Editor.exe";
			if(Config != BuildConfig.DebugGame && Config != BuildConfig.Development)
			{
				ExeFileName	= String.Format("UE4Editor-Win64-{0}.exe", Config.ToString());
			}
			return Path.Combine(BranchDirectoryName, "Engine", "Binaries", "Win64", ExeFileName);
		}
Example #55
0
 // Environment
 private static void SetRelease(ref BuildConfig config)
 {
     // nothing
 }