1840 Jenkins打包build编号没有增加
| | |
| | | static string ANDROID_PLUGIN_PATH = Application.dataPath + "/Plugins/Android";
|
| | | static string iOS_PLUGIN_PATH = Application.dataPath + "/Plugins/iOS/The2thWorldSDK/The2thWorldRES.bundle";
|
| | |
|
| | | static int packageIndex
|
| | | {
|
| | | get { return LocalSave.GetInt("ClientPackageIndex", 1); }
|
| | | set { LocalSave.SetInt("ClientPackageIndex", value); }
|
| | | }
|
| | |
|
| | | public static void BuildPublishers(string _sdkPath, string _assetBundlePath, string _output, string _publisherString, bool _development, bool _replace)
|
| | | public static void BuildPublishers(string _sdkPath, string _assetBundlePath, string _output, string _publisherString, int _buildIndex, bool _development, bool _replace)
|
| | | {
|
| | | var publisherIds = new List<string>();
|
| | | var tempStrings = _publisherString.Split(StringUtility.splitSeparator, StringSplitOptions.RemoveEmptyEntries);
|
| | |
| | | for (int i = 0; i < smallPackages.Count; i++)
|
| | | {
|
| | | #if UNITY_ANDROID
|
| | | BuildApk(_sdkPath, _output, smallPackages[i], _development);
|
| | | BuildApk(_sdkPath, _output, smallPackages[i], _buildIndex, _development);
|
| | | #elif UNITY_IOS
|
| | | BuildIpa(_sdkPath, smallPackages[i], _replace);
|
| | | BuildIpa(_sdkPath, smallPackages[i], _buildIndex, _replace);
|
| | | #endif
|
| | | }
|
| | | }
|
| | |
| | | for (int i = 0; i < halfPackages.Count; i++)
|
| | | {
|
| | | #if UNITY_ANDROID
|
| | | BuildApk(_sdkPath, _output, halfPackages[i], _development);
|
| | | BuildApk(_sdkPath, _output, halfPackages[i], _buildIndex, _development);
|
| | | #elif UNITY_IOS
|
| | | BuildIpa(_sdkPath, halfPackages[i], _replace);
|
| | | BuildIpa(_sdkPath, halfPackages[i], _buildIndex, _replace);
|
| | | #endif
|
| | | }
|
| | | }
|
| | |
| | | for (int i = 0; i < bigPackages.Count; i++)
|
| | | {
|
| | | #if UNITY_ANDROID
|
| | | BuildApk(_sdkPath, _output, bigPackages[i], _development);
|
| | | BuildApk(_sdkPath, _output, bigPackages[i], _buildIndex, _development);
|
| | | #elif UNITY_IOS
|
| | | BuildIpa(_sdkPath, bigPackages[i], _replace);
|
| | | BuildIpa(_sdkPath, bigPackages[i], _buildIndex, _replace);
|
| | | #endif
|
| | | }
|
| | | }
|
| | |
|
| | | packageIndex++;
|
| | | }
|
| | |
|
| | | public static void BuildApk(string _sdkPath, string _output, string _publisher, bool _development)
|
| | | public static void BuildApk(string _sdkPath, string _output, string _publisher, int _buildIndex, bool _development)
|
| | | {
|
| | | PreBuild(_publisher);
|
| | | PreBuild(_publisher, _buildIndex);
|
| | |
|
| | | var versionName = string.Empty;
|
| | | var versionConfig = GetVersionConfig(_publisher, out versionName);
|
| | |
| | | AssetDatabase.SaveAssets();
|
| | | AssetDatabase.Refresh();
|
| | |
|
| | | var index = packageIndex;
|
| | | if (_development)
|
| | | {
|
| | | var apkName = StringUtility.Contact(_output, "/", versionName, "_", versionConfig.clientPackageFlag, "_v", versionConfig.m_Version, "_", index, "_development.apk");
|
| | | var apkName = StringUtility.Contact(_output, "/", versionName, "_", versionConfig.clientPackageFlag, "_v", versionConfig.m_Version, "_", _buildIndex, "_development.apk");
|
| | | BuildPipeline.BuildPlayer(baseLevels, apkName, BuildTarget.Android, BuildOptions.Development | BuildOptions.ConnectWithProfiler | BuildOptions.AllowDebugging);
|
| | | }
|
| | | else
|
| | | {
|
| | | var apkName = StringUtility.Contact(_output, "/", versionName, "_", versionConfig.clientPackageFlag, "_v", versionConfig.m_Version, "_", index, ".apk");
|
| | | var apkName = StringUtility.Contact(_output, "/", versionName, "_", versionConfig.clientPackageFlag, "_v", versionConfig.m_Version, "_", _buildIndex, ".apk");
|
| | | BuildPipeline.BuildPlayer(baseLevels, apkName, BuildTarget.Android, BuildOptions.None);
|
| | | }
|
| | | }
|
| | |
|
| | | public static void BuildIpa(string _sdkPath, string _publisher, bool _replace)
|
| | | public static void BuildIpa(string _sdkPath, string _publisher, int _buildIndex, bool _replace)
|
| | | {
|
| | | PreBuild(_publisher);
|
| | | PreBuild(_publisher, _buildIndex);
|
| | |
|
| | | var versionName = string.Empty;
|
| | | var versionConfig = GetVersionConfig(_publisher, out versionName);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private static void PreBuild(string _publisher)
|
| | | private static void PreBuild(string _publisher, int _buildIndex)
|
| | | {
|
| | | try
|
| | | {
|
| | |
| | |
|
| | | VersionConfig.Copy(fromVersionConfig, newVersionConfig);
|
| | | newVersionConfig.buildTime = DateTime.Now.ToString("yy/MM/dd--HH:mm");
|
| | | newVersionConfig.buildIndex = packageIndex;
|
| | | newVersionConfig.buildIndex = _buildIndex;
|
| | |
|
| | | AssetDatabase.CreateAsset(newVersionConfig, newVersionConfigPath);
|
| | | EditorUtility.SetDirty(newVersionConfig);
|
| | |
| | | try |
| | | { |
| | | Debug.LogFormat("从命令行中解析出来的SDKPATH 是:{0}", parameters.sdkPath); |
| | | ClientPackage.BuildPublishers(parameters.sdkPath, parameters.assetbundlePath, parameters.outputPath, parameters.publishers, false, false); |
| | | ClientPackage.BuildPublishers(parameters.sdkPath, parameters.assetbundlePath, parameters.outputPath, parameters.publishers, parameters.buildIndex, false, false); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | public string assetbundlePath; |
| | | public string outputPath; |
| | | public string publishers; |
| | | public int buildIndex; |
| | | public string sdkPath; |
| | | |
| | | public BuildParameters() |
| | |
| | | { |
| | | publishers = args[i + 1]; |
| | | } |
| | | else if (arg.ToLower() == "-buildindex") |
| | | { |
| | | int.TryParse(args[i + 1], out buildIndex); |
| | | } |
| | | else if (arg.ToLower() == "-sdkpath") |
| | | { |
| | | sdkPath = args[i + 1]; |