public bool Build(BuildPathEnvironmentVariable buildEnvVar = null) { Log("Starting build process for {0}.", Name); try { var relativePath = GenerateRelativeBuildPath(); if (buildEnvVar == null) { buildEnvVar = BuildManagerWindow.LocalBuildRootEnvVar; } var buildRootFolder = buildEnvVar.Value; LocalBuild(relativePath, buildRootFolder); //CopyFolders(relativePath, buildRootFolder); CopyLocalFolders(relativePath, buildRootFolder); CopyLocalFiles(relativePath, buildRootFolder); Deploy(relativePath); } catch (Exception ex) { Debug.LogErrorFormat("Error during build, state unknown. Exception: {0}", ex); return(false); } Log("Ending build process for {0}.", Name); return(true); }
public static void PerformAutoBuild() { var buildName = CommandLineArgs.GetArgumentValue("buildName"); Debug.Log("PerformAutoBuild running for build name \"" + buildName + "\""); BuildManagerWindow bmw = ScriptableObject.CreateInstance("BuildManagerWindow") as BuildManagerWindow; Debug.Log("Loading manifest at " + bmw.ManifestPath); bmw.LoadManifest(); BuildEntry buildEntry = bmw.Manifest.Builds.Find(e => e.Name == buildName); if (buildEntry == null) { Debug.Log("Failure: Haxxis build entry not found."); EditorApplication.Exit(1); return; } //buildEntry.DoCopyFolders = true; buildEntry.DoCopyLocalFolders = true; buildEntry.DoCopyLocalFiles = true; buildEntry.DoDeploy = false; Debug.Log("Starting the build"); BuildPathEnvironmentVariable candidateBuildRootEnvVar = new BuildPathEnvironmentVariable( @"CGC_CANDIDATE_BUILD_ROOT", "Value should be the path where candidate builds should be placed (only used by Build Server)."); var success = buildEntry.Build(candidateBuildRootEnvVar); if (!success) { Debug.Log("PerformAutoBuild failed"); EditorApplication.Exit(1); return; } Debug.Log("Finished running PerformAutoBuild"); }
public void Deploy(string relativePath, BuildPathEnvironmentVariable buildEnvVar = null) { if (!DoDeploy) { Log("Skipping Deploy."); return; } Log("Starting deploy."); var sourceRootFolder = BuildManagerWindow.LocalBuildRoot; if (buildEnvVar != null) { sourceRootFolder = buildEnvVar.Value; } var sourcePath = Path.Combine(sourceRootFolder, relativePath).Replace("\\", "/"); var destinationParent = Path.Combine(BuildManagerWindow.RemoteBuildRoot, Name).Replace("\\", "/"); Directory.CreateDirectory(destinationParent); var destinationPath = Path.Combine(BuildManagerWindow.RemoteBuildRoot, relativePath).Replace("\\", "/"); FileUtil.CopyFileOrDirectory(sourcePath, destinationPath); // Copy the 'LastBuildMade' text file: var src1 = Path.Combine(sourceRootFolder, Name); var sourcePathLbm = Path.Combine(src1, LastBuildMadeFilename).Replace("\\", "/"); var dest1 = Path.Combine(BuildManagerWindow.RemoteBuildRoot, Name); var destPathLbm = Path.Combine(dest1, LastBuildMadeFilename).Replace("\\", "/"); FileUtil.ReplaceFile(sourcePathLbm, destPathLbm); Log("Ending deploy."); }
public static void PerformAutoDeploy() { // This is a call designed to be made externally, to do just the 'deploy' step on an already-built local build. var buildName = CommandLineArgs.GetArgumentValue("buildName"); Debug.Log("PerformAutoDeploy running for build name \"" + buildName + "\""); BuildManagerWindow bmw = ScriptableObject.CreateInstance("BuildManagerWindow") as BuildManagerWindow; Debug.Log("Loading manifest at " + bmw.ManifestPath); bmw.LoadManifest(); BuildEntry buildEntry = bmw.Manifest.Builds.Find(e => e.Name == buildName); if (buildEntry == null) { Debug.Log("Failure: Haxxis build entry not found."); EditorApplication.Exit(1); return; } buildEntry.DoDeploy = true; BuildPathEnvironmentVariable candidateBuildRootEnvVar = new BuildPathEnvironmentVariable( @"CGC_CANDIDATE_BUILD_ROOT", "Value should be the path where candidate builds should be placed (only used by Build Server)."); var path = Path.Combine(candidateBuildRootEnvVar.Value, buildEntry.Name); var filename = Path.Combine(path, BuildEntry.LastBuildMadeFilename); string lastBuildDirName = File.ReadAllText(filename); Debug.Log("Starting the deploy"); var relativePath = Path.Combine(buildEntry.Name, lastBuildDirName); buildEntry.Deploy(relativePath, candidateBuildRootEnvVar); Debug.Log("Finished running PerformAutoDeploy"); }