private static PluginBuilderBase GetBuilder(BuildPlatform buildPlatform) { if (builders == null) { builders = new Dictionary <BuildPlatform, PluginBuilderBase>(); } if (!builders.ContainsKey(buildPlatform)) { builders[buildPlatform] = PluginBuilderBase.GetBuilderForTarget(buildPlatform); } return(builders[buildPlatform]); }
public void Build() { bool nothingToBuild = true; foreach (NativeBuildOptions options in buildOptions) { if (!options.isEnabled) { continue; } nothingToBuild = false; PluginBuilderBase builder = PluginBuilderBase.GetBuilderForTarget(options.BuildPlatform); builder.PreBuild(this, options); BackgroundProcess buildProcess = builder.Build(this, options); buildProcess.Exited += (exitCode, outputData, errorData) => { if (!string.IsNullOrEmpty(outputData)) { string log = string.Format("{0}:\n{1}", buildProcess.Name, outputData); File.WriteAllText(PluginBuilderBase.CombineFullPath(options.OutputDirectory, "Build_StdOut.log"), log); Debug.Log(log); } if (!string.IsNullOrEmpty(errorData)) { string log = string.Format("{0}:\n{1}", buildProcess.Name, errorData); File.WriteAllText(PluginBuilderBase.CombineFullPath(options.OutputDirectory, "Build_StdErr.log"), log); if (exitCode == 0) { Debug.LogWarning(log); } else { Debug.LogError(log); } } }; BackgroundProcess installProcess = builder.Install(this, options); installProcess.StartAfter(buildProcess); installProcess.Exited += (exitCode, outputData, errorData) => { if (!string.IsNullOrEmpty(outputData)) { string log = string.Format("{0}:\n{1}", installProcess.Name, outputData); File.WriteAllText(PluginBuilderBase.CombineFullPath(options.OutputDirectory, "Install_StdOut.log"), log); Debug.Log(log); } if (!string.IsNullOrEmpty(errorData)) { string log = string.Format("{0}:\n{1}", installProcess.Name, errorData); File.WriteAllText(PluginBuilderBase.CombineFullPath(options.OutputDirectory, "Install_StdErr.log"), log); if (exitCode == 0) { Debug.LogWarning(log); } else { Debug.LogError(log); } } if (exitCode == 0) { builder.PostBuild(this, options); } }; buildProcess.Start(); } if (nothingToBuild) { Debug.Log(string.Format("{0}: Nothing to build.", Name)); } }