public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { // Set spatializer plugin AudioSettings.SetSpatializerPluginName(SpatializerPlugin); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { // Verify that butler executable exists. if (!File.Exists(pathToButlerExe)) { UnityEngine.Debug.LogError("Couldn't find butler.exe file at path \"" + pathToButlerExe + "\", please check provided path"); return; } buildPath = Path.GetFullPath(buildPath); // Generate build args for the form: butler push {optional args} {build path} {itch username}/{itch game}:{channel} StringBuilder scriptArguments = new StringBuilder("push "); switch (architecture.target) { case BuildTarget.StandaloneOSX: #if !UNITY_2019_2_OR_NEWER case BuildTarget.StandaloneLinux: case BuildTarget.StandaloneLinuxUniversal: #endif case BuildTarget.StandaloneLinux64: // Fix exe permissions for Linux/OSX. scriptArguments.Append("--fix-permissions "); break; } if (useGeneratedBuildVersion) { // Append generated versions string. scriptArguments.Append(string.Format("--userversion \"{0}\" ", BuildSettings.productParameters.lastGeneratedVersion)); } scriptArguments.Append("\"" + buildPath + "\"" + " " + nameOfItchUser + "/" + nameOfItchGame + ":"); if (!string.IsNullOrEmpty(itchChannelOverride)) { scriptArguments.Append(itchChannelOverride); } else { string itchChannel = GetChannelName(channelName, architecture.target, releaseType); if (string.IsNullOrEmpty(itchChannel)) { UnityEngine.Debug.LogWarning("UploadItch: The current BuildTarget doesn't appear to be a standard Itch.IO build target."); } scriptArguments.Append(itchChannel); } // UnityEngine.Debug.Log("Would have run itch uploader with following command line: \"" + pathToButlerExe + " " + scriptArguments + "\""); RunScript(pathToButlerExe, scriptArguments.ToString()); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { if (platform.targetGroup == BuildTargetGroup.iOS) { PlayerSettings.iOS.buildNumber = (int.Parse(PlayerSettings.iOS.buildNumber) + 1).ToString(); } }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { string resolvedInputPath = FileUtility.ResolvePerBuildPath(inputPath, releaseType, platform, architecture, distribution, buildTime, buildPath); string resolvedOutputPath = FileUtility.ResolvePerBuildPath(outputPath, releaseType, platform, architecture, distribution, buildTime, buildPath); switch (operation) { case Operation.Copy: Copy(resolvedInputPath, resolvedOutputPath); break; case Operation.Move: Move(resolvedInputPath, resolvedOutputPath); break; case Operation.Delete: Delete(resolvedInputPath); break; } AssetDatabase.Refresh(); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { StringBuilder defines = new StringBuilder(BuildProject.GenerateDefaultDefines(releaseType, platform, architecture, distribution)); if (!string.IsNullOrEmpty(removeDefines)) { string resolvedRemove = BuildProject.ResolvePath(removeDefines, releaseType, platform, architecture, distribution, buildTime); string[] splitRemove = resolvedRemove.Split(';'); for (int i = 0; i < splitRemove.Length; i++) { defines.Replace(splitRemove[i] + ";", ""); defines.Replace(splitRemove[i], ""); } } if (!string.IsNullOrEmpty(addDefines)) { string resolvedAdd = BuildProject.ResolvePath(addDefines, releaseType, platform, architecture, distribution, buildTime); if (defines.Length > 0) { defines.Append(";" + resolvedAdd); } else { defines.Append(resolvedAdd); } } PlayerSettings.SetScriptingDefineSymbolsForGroup(platform.targetGroup, defines.ToString()); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { PackagesToRemove.ForEach(id => HandleRequest(Client.Remove(id), id)); PackagesToAdd.ForEach(id => HandleRequest(Client.Add(id), id)); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { string resolvedScriptPath = BuildProject.ResolvePath(scriptPath, releaseType, platform, architecture, distribution, buildTime); string resolvedScriptArgs = BuildProject.ResolvePath(scriptArguments, releaseType, platform, architecture, distribution, buildTime); RunScript(resolvedScriptPath, resolvedScriptArgs); }
public bool Evaluate(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, string configKeychain) { if (clauses == null || clauses.Length == 0) { return(true); } // Set default state for success based on condition type. bool success = true; if (condition == FilterCondition.Any || condition == FilterCondition.ExactlyOne) { success = false; } for (int i = 0; i < clauses.Length; i++) { if (condition == FilterCondition.Any) { // Succeed as soon as any test evaluates true. success |= clauses[i].Evaluate(releaseType, platform, architecture, distribution, configKeychain); if (success) { break; } } else if (condition == FilterCondition.All) { // Succeed only if all tests evaluate true. success &= clauses[i].Evaluate(releaseType, platform, architecture, distribution, configKeychain); if (!success) { break; } } else if (condition == FilterCondition.None) { // Succeed only if all tests fail. success &= !(clauses[i].Evaluate(releaseType, platform, architecture, distribution, configKeychain)); if (!success) { break; } } else if (condition == FilterCondition.ExactlyOne) { // Succeed only if exactly one test evaluates true. if (clauses[i].Evaluate(releaseType, platform, architecture, distribution, configKeychain)) { if (success) { // Another test already succeeded, so this is a failure. success = false; break; } else { success = true; } } } } return(success); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { XRGeneralSettings generalSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(platform.targetGroup); XRManagerSettings settingsManager = generalSettings.Manager; generalSettings.InitManagerOnStart = InitializeXROnStartup; #if UNITY_XR_MANAGEMENT_400_OR_NEWER settingsManager.TrySetLoaders(XRPlugins); #else settingsManager.loaders = XRPlugins; #endif }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { // Set preloaded assets Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets(); List <Object> preloadedAssetsList = PreservePreloadedAssets ? preloadedAssets.ToList() : new List <Object>(); preloadedAssetsList.AddRange(PreloadedAssets); PlayerSettings.SetPreloadedAssets(preloadedAssetsList.ToArray()); }
public bool Evaluate(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, string configKeychain) { bool success = false; test = test.Trim().ToUpper(); switch (type) { case FilterType.ReleaseType: success = PerformTest(releaseType.typeName); break; case FilterType.Platform: success = PerformTest(platform.platformName); break; case FilterType.Architecture: success = PerformTest(architecture.name); break; case FilterType.Distribution: success = PerformTest(distribution.distributionName); break; case FilterType.FullConfigurationKey: success = PerformTest(configKeychain); break; } return(success); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { // Verify that butler executable exists. if (!File.Exists(pathTGJPushExe)) { UnityEngine.Debug.LogError("Couldn't find gjpush.exe file at path \"" + pathTGJPushExe + "\", please check provided path"); return; } string resolvedOutputPath = Path.Combine(outputPath.Replace("$BUILDPATH", buildPath), outputFileName); resolvedOutputPath = BuildProject.ResolvePath(resolvedOutputPath, releaseType, platform, architecture, distribution, buildTime); if (!resolvedOutputPath.EndsWith(".zip")) { resolvedOutputPath += ".zip"; } buildPath = Path.GetFullPath(buildPath); string zip = Path.GetFullPath(resolvedOutputPath); PerformZip(Path.GetFullPath(buildPath), Path.GetFullPath(resolvedOutputPath)); // Generate build args for the form: butler push {optional args} {build path} {itch username}/{itch game}:{channel} StringBuilder scriptArguments = new StringBuilder(""); scriptArguments.Append(string.Format("-r {0} ", BuildSettings.productParameters.lastGeneratedVersion)); scriptArguments.Append("-g " + gameID + " -p " + packageID + " "); if (BrowserBuild) { scriptArguments.Append("-b "); } scriptArguments.Append("\"" + zip + "\""); // UnityEngine.Debug.Log("Would have run itch uploader with following command line: \"" + pathToButlerExe + " " + scriptArguments + "\""); UnityEngine.Debug.Log(scriptArguments.ToString()); RunScript(pathTGJPushExe, scriptArguments.ToString()); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath) { // Get valid SDKs for platform string[] validSDKs = PlayerSettings.GetAvailableVirtualRealitySDKs(platform.targetGroup); // Build list of valid SDKs to set List <string> sdks = new List <string>(); foreach (SDK sdk in Sdks) { string sdkName = sdkNames[sdk]; if (Array.IndexOf(validSDKs, sdkName) != -1) { sdks.Add(sdkName); } } // Update player settings PlayerSettings.SetVirtualRealitySupported(platform.targetGroup, VRSupported); PlayerSettings.SetVirtualRealitySDKs(platform.targetGroup, sdks.ToArray()); PlayerSettings.stereoRenderingPath = StereoRenderingMode; #if SUPPORTS_OCULUS_V2_SIGNING PlayerSettings.VROculus.v2Signing = OculusV2Signing; #endif if (platform.targetGroup == BuildTargetGroup.Android) { PlayerSettings.Android.ARCoreEnabled = ARCoreSupported; } }
public static void Generate( DateTime buildTime, string currentVersion = "", BuildReleaseType currentReleaseType = null, BuildPlatform currentBuildPlatform = null, BuildArchitecture currentBuildArchitecture = null, BuildDistribution currentBuildDistribution = null) { // Find the BuildConstants file. string filePath = FindFile(); if (string.IsNullOrEmpty(filePath)) { return; } // Cache any current values if needed. string versionString = string.IsNullOrEmpty(currentVersion) ? BuildConstants.version.ToString() : currentVersion; string releaseTypeString = currentReleaseType == null?BuildConstants.releaseType.ToString() : SanitizeString(currentReleaseType.typeName); string platformString = currentBuildPlatform == null?BuildConstants.platform.ToString() : SanitizeString(currentBuildPlatform.platformName); string archString = currentBuildArchitecture == null?BuildConstants.architecture.ToString() : SanitizeString(currentBuildArchitecture.name); string distributionString = string.Empty; if (currentBuildDistribution == null) { if (currentReleaseType == null) { // No new parameter specified, so use the old value. distributionString = BuildConstants.architecture.ToString(); } else { // There are new parameters but no distribution. Should be intentional, so distribution is NONE. distributionString = NONE; } } else { distributionString = SanitizeString(currentBuildDistribution.distributionName); } // Delete any existing version. if (File.Exists(filePath)) { File.Delete(filePath); } // Create a buffer that we'll use to check for any duplicated names. List <string> enumBuffer = new List <string>(); using (StreamWriter writer = new StreamWriter(filePath)) { // Start of file and class. writer.WriteLine("// This file is auto-generated. Do not modify or move this file."); writer.WriteLine(); writer.WriteLine("public static class BuildConstants"); writer.WriteLine("{"); // Write ReleaseType enum. writer.WriteLine(" public enum ReleaseType"); writer.WriteLine(" {"); writer.WriteLine(" {0},", NONE); enumBuffer.Add(NONE); foreach (BuildReleaseType releaseType in BuildSettings.releaseTypeList.releaseTypes) { string addedString = SanitizeString(releaseType.typeName); if (!enumBuffer.Contains(addedString)) { enumBuffer.Add(addedString); writer.WriteLine(" {0},", addedString); } } writer.WriteLine(" }"); writer.WriteLine(); // Validate ReleaseType string. if (!enumBuffer.Contains(releaseTypeString)) { releaseTypeString = NONE; } // Write Platform enum. enumBuffer.Clear(); writer.WriteLine(" public enum Platform"); writer.WriteLine(" {"); writer.WriteLine(" {0},", NONE); enumBuffer.Add(NONE); foreach (BuildPlatform platform in BuildSettings.platformList.platforms) { string addedString = SanitizeString(platform.platformName); if (platform.enabled && !enumBuffer.Contains(addedString)) { enumBuffer.Add(addedString); writer.WriteLine(" {0},", addedString); } } writer.WriteLine(" }"); writer.WriteLine(); // Validate Platform string. if (!enumBuffer.Contains(platformString)) { platformString = NONE; } // Write Architecture enum. enumBuffer.Clear(); writer.WriteLine(" public enum Architecture"); writer.WriteLine(" {"); writer.WriteLine(" {0},", NONE); enumBuffer.Add(NONE); foreach (BuildPlatform platform in BuildSettings.platformList.platforms) { if (platform.enabled) { foreach (BuildArchitecture arch in platform.architectures) { string addedString = SanitizeString(arch.name); if (arch.enabled && !enumBuffer.Contains(addedString)) { enumBuffer.Add(addedString); writer.WriteLine(" {0},", addedString); } } } } writer.WriteLine(" }"); writer.WriteLine(); // Validate Architecture string. if (!enumBuffer.Contains(archString)) { archString = NONE; } // Write Distribution enum. enumBuffer.Clear(); writer.WriteLine(" public enum Distribution"); writer.WriteLine(" {"); writer.WriteLine(" {0},", NONE); enumBuffer.Add(NONE); foreach (BuildPlatform platform in BuildSettings.platformList.platforms) { if (platform.enabled) { foreach (BuildDistribution dist in platform.distributionList.distributions) { string addedString = SanitizeString(dist.distributionName); if (dist.enabled && !enumBuffer.Contains(addedString)) { enumBuffer.Add(addedString); writer.WriteLine(" {0},", addedString); } } } } writer.WriteLine(" }"); writer.WriteLine(); // Validate Distribution string. if (!enumBuffer.Contains(distributionString)) { distributionString = NONE; } // Write current values. writer.WriteLine(" public static readonly System.DateTime buildDate = new System.DateTime({0});", buildTime.Ticks); writer.WriteLine(" public const string version = \"{0}\";", versionString); writer.WriteLine(" public const ReleaseType releaseType = ReleaseType.{0};", releaseTypeString); writer.WriteLine(" public const Platform platform = Platform.{0};", platformString); writer.WriteLine(" public const Architecture architecture = Architecture.{0};", archString); writer.WriteLine(" public const Distribution distribution = Distribution.{0};", distributionString); // End of class. writer.WriteLine("}"); writer.WriteLine(); } // Refresh AssetDatabse so that changes take effect. AssetDatabase.Refresh(); }
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref UnityEditor.BuildOptions options, string configKey, string buildPath) { string resolvedOutputPath = Path.Combine(outputPath.Replace("$BUILDPATH", buildPath), outputFileName); resolvedOutputPath = BuildProject.ResolvePath(resolvedOutputPath, releaseType, platform, architecture, distribution, buildTime); string resolvedInputPath = inputPath.Replace("$BUILDPATH", buildPath); resolvedInputPath = BuildProject.ResolvePath(resolvedInputPath, releaseType, platform, architecture, distribution, buildTime); if (!resolvedOutputPath.EndsWith(".zip")) { resolvedOutputPath += ".zip"; } PerformZip(Path.GetFullPath(resolvedInputPath), Path.GetFullPath(resolvedOutputPath)); }
public static string ResolvePerBuildPath(string prototype, BuildReleaseType releaseType, BuildPlatform buildPlatform, BuildArchitecture arch, BuildDistribution dist, DateTime buildTime, string buildPath) { return(BuildProject.ResolvePath( prototype .Replace("$BUILDPATH", buildPath) .Replace("$BASEPATH", BuildSettings.basicSettings.baseBuildFolder), releaseType, buildPlatform, arch, dist, buildTime)); }