Ejemplo n.º 1
0
        public static void ApplyDefineSymbol(BuildConfig config)
        {
            if (config == null)
            {
                return;
            }

            // Start to define symbols
            string defineStr = config.GetDefineStr();

            PlayerSettings.SetScriptingDefineSymbolsForGroup(WinBuildSchema.BuildTargetGroup,
                                                             defineStr);

            PlayerSettings.SetScriptingDefineSymbolsForGroup(AndroidBuildSchema.BuildTargetGroup,
                                                             defineStr);

            PlayerSettings.SetScriptingDefineSymbolsForGroup(IOSBuildSchema.BuildTargetGroup,
                                                             defineStr);

            //Debug.Log(string.Format("Current define symbol: {0}", defineStr));
        }
Ejemplo n.º 2
0
        public static void CreateConfig(string desPath, BuildConfig source = null)
        {
            // Prepare directory
            EditorHelper.PreparePathDirectory(desPath);

            // Replace with new
            if (File.Exists(desPath))
            {
                AssetDatabase.DeleteAsset(desPath);
            }

            // Create instance
            var asset = ScriptableObject.CreateInstance <BuildConfig>();

            if (source != null)
            {
                EditorUtility.CopySerialized(source, asset);
            }

            // Create asset
            AssetDatabase.CreateAsset(asset, desPath);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Ejemplo n.º 3
0
 public static void BuildIOS(BuildConfig config, string buildComment = null)
 {
     Build(IOSBuildSchema, config, buildComment);
 }
Ejemplo n.º 4
0
        private static void Build(BuildPlatformSchema schema, BuildConfig config, string buildComment)
        {
            // Validate folder path
            if (!EditorHelper.ValidateFolder(OutputFolder))
            {
                ChangeOutputFolderPath();
                return;
            }

            string packageName;

            // Set package name
            if (!string.IsNullOrEmpty(buildComment))
            {
                packageName = string.Format("{0}_{1}_{2}", config.ProductName,
                                            DateTimeUtils.StandardTimeStr, buildComment);
            }
            else
            {
                packageName = string.Format("{0}_{1}", config.ProductName, DateTimeUtils.StandardTimeStr);
            }

            // Update runtime config
            config.PackageName = packageName;
            CreateConfig(BuildConfig.RuntimeAssetConfigPath, config);

            // Set define symbols
            PlayerSettings.SetScriptingDefineSymbolsForGroup(schema.BuildTargetGroup, config.GetDefineStr());

            // Set basic product info
            PlayerSettings.companyName              = CompanyName;
            PlayerSettings.applicationIdentifier    = config.BundleIdentifier;
            PlayerSettings.productName              = config.ProductName;
            PlayerSettings.bundleVersion            = config.BundleVersion;
            PlayerSettings.iOS.appleDeveloperTeamID = "WBHCY56HJ5";

            if (schema.OnPreBuild != null)
            {
                schema.OnPreBuild(config);
            }

            // Prepare output path
            var packagePath = string.Format("{0}/{1}/{2}", OutputFolder, schema.BuildTarget,
                                            schema.ProcessPackagePath(packageName));

            EditorHelper.PreparePathDirectory(packagePath);

            // Save as last configuration before building
            LastBuildName = packageName;
            LastBuildPath = packagePath;
            GetShellParam();
            // Building...
            var result = BuildPipeline.BuildPlayer(GetBuildScenes(), packagePath, schema.BuildTarget, GetBuildOptions());

            if (string.IsNullOrEmpty(result))
            {
                //Debug.Log("Build complete!");

                // RevealInFinder after build complete
                EditorUtility.RevealInFinder(packagePath);
            }
            else
            {
                //Debug.Log("Build error occur!");

                //Debug.LogError(result);
            }
        }
Ejemplo n.º 5
0
 public static void BuildWin(BuildConfig config, string buildComment = null)
 {
     Build(WinBuildSchema, config, buildComment);
 }
Ejemplo n.º 6
0
 public static void BuildAndroid(BuildConfig config, string buildComment = null)
 {
     Build(AndroidBuildSchema, config, buildComment);
 }
Ejemplo n.º 7
0
 public static BuildOptions GetBuildOption(this BuildConfig buildConfig)
 {
     return((BuildOptions)buildConfig.BuildOptionInt);
 }
Ejemplo n.º 8
0
 public static void AddBuildOption(this BuildConfig buildConfig, BuildOptions buildOption)
 {
     buildConfig.SetBuildOption(buildConfig.GetBuildOption() | buildOption);
 }
Ejemplo n.º 9
0
 public static void DeleteBuildOption(this BuildConfig buildConfig, BuildOptions buildOption)
 {
     buildConfig.SetBuildOption(buildConfig.GetBuildOption() & ~buildOption);
 }
Ejemplo n.º 10
0
 public static bool HasBuildOption(this BuildConfig buildConfig, BuildOptions buildOption)
 {
     return((buildConfig.GetBuildOption() & buildOption) != 0);
 }
Ejemplo n.º 11
0
 public static void SetBuildOption(this BuildConfig buildConfig, BuildOptions newValue)
 {
     buildConfig.BuildOptionInt = (int)newValue;
 }