public T GetValueByEnum <T>(string key) where T : struct { string value = this[key]; T enumValue; if (BuilderUtils.TryParse <T>(value, out enumValue)) { return(enumValue); } throw new ArgumentException(string.Format("invalid '{0}' command value:'{1}'", key, value)); }
public void Build(Arguments args) { BuilderUtils.AssertRequiredArguments <BuilderArguments>(args, true); args.AssertKeys(BuilderArguments.BuildTarget, BuilderArguments.BuildVersion, BuilderArguments.Out, BuilderArguments.BuildNumber); if (args.IsVerbose) { _logger.Log(Help); _logger.Log("command line arguments: " + Environment.NewLine + args.ToString("\t{0}={1};" + Environment.NewLine)); } BuildTarget buildTarget; Assert.IsTrue(BuilderUtils.TryParse(args[BuilderArguments.BuildTarget], out buildTarget), BuilderUtils.GetMessageNotValidArgs(BuilderArguments.BuildTarget, args)); Version version; Assert.IsTrue(BuilderUtils.TryParse(args[BuilderArguments.BuildVersion], out version), BuilderUtils.GetMessageNotValidArgs(BuilderArguments.BuildVersion, args)); int buildNumber; Assert.IsTrue(int.TryParse(args[BuilderArguments.BuildNumber], NumberStyles.Any, NumberFormatInfo.InvariantInfo, out buildNumber), BuilderUtils.GetMessageNotValidArgs(BuilderArguments.BuildNumber, args)); version = new Version(version.Major, version.Minor, buildNumber); if (args.IsVerbose) { _logger.Log("Version: " + version); } PlayerSettings.bundleVersion = version.ToString(); BuildOptions buildOptions = BuildOptions.None; BuildTargetGroup targetGroup = UnityEditor.BuildPipeline.GetBuildTargetGroup(buildTarget); ScriptingDefines defines = new ScriptingDefines(targetGroup, args.IsVerbose); ScriptingImplementation scriptingImplementation; if (BuilderUtils.TryGetScriptingBackend(args, targetGroup, out scriptingImplementation)) { PlayerSettings.SetScriptingBackend(targetGroup, scriptingImplementation); } if (args.Contains(BuilderArguments.Debug)) { buildOptions |= BuildOptions.Development; defines.Add(Defines.DEBUG); } else { defines.Remove(Defines.DEBUG); defines.Add(Defines.RELEASE); } var options = new BuildPlayerOptions { options = buildOptions, target = buildTarget, targetGroup = targetGroup, scenes = _scenes, locationPathName = args[BuilderArguments.Out] }; var config = new BuildConfiguration(args, defines, buildNumber, version.ToString(), options); var report = Build(config); if (args.IsVerbose) { _logger.Log("command line build result: " + report.summary.result); } }
public void Build(string[] args) { Build(BuilderUtils.GetCommandLineArguments(args)); }
public void Build() { var args = BuilderUtils.GetCommandLineArguments(); Build(args); }