| | |
| | | set { LocalSave.SetInt("HalfAssetPrior", value); }
|
| | | }
|
| | |
|
| | | static string ANDROID_PLUGIN_PATH = Application.dataPath + "/Plugins/Android";
|
| | | static string THE_2TH_WORLD_SDK_PATH = Application.dataPath + "/Plugins/Android/bin";
|
| | | // static string MANIFEST_PATH = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";
|
| | | static string iOS_PLUGIN_PATH = Application.dataPath + "/Plugins/iOS";
|
| | |
|
| | | /// <summary>
|
| | | /// 打包
|
| | | /// </summary>
|
| | | /// <param name="_sdkPath">整合sdk路径</param>
|
| | | /// <param name="_assetBundlePath">_assetBundle的资源路径,默认在项目目录下的 AssetBundles/android</param>
|
| | | /// <param name="_output">打包完成后的输出路径</param>
|
| | | /// <param name="_publisherString">渠道id,可打多个包,用|分割</param>
|
| | | /// <param name="_buildIndex">打包序序号,用于标识名称</param>
|
| | | /// <param name="_development">是否为开发版</param>
|
| | | /// <param name="_replace">ios打包导出xcode工程模式,Append和Replace</param>
|
| | | public static void BuildPublishers(string _sdkPath, string _assetBundlePath, string _output, string _publisherString, int _buildIndex, bool _development, bool _replace)
|
| | | {
|
| | | var publisherIds = new List<string>();
|
| | |
| | | || file.FullName.Contains("HelpInfo.txt")
|
| | | || file.FullName.Contains("PriorBundle.txt")
|
| | | || file.FullName.Contains("PriorLanguage.txt")
|
| | | || file.FullName.Contains("ApkUpdateUrl.txt"))
|
| | | || file.FullName.Contains("ApkUpdateUrl.txt")
|
| | | || file.FullName.Contains("InitialFunction.txt"))
|
| | | {
|
| | | builtInFiles.Add(file);
|
| | | continue;
|
| | | }
|
| | |
|
| | | File.Delete(file.FullName);
|
| | | // File.Delete(file.FullName);
|
| | | }
|
| | |
|
| | | var totalCount = builtInFiles.Count;
|
| | |
| | | {
|
| | | var relativePath = FileExtersion.GetFileRelativePath(_assetBundlePath, item.FullName);
|
| | | var to = StringUtility.Contact(ResourcesPath.Instance.StreamingAssetPath, relativePath);
|
| | | if (relativePath.StartsWith("patch"))//不包含meta文件和补丁
|
| | | continue;
|
| | |
|
| | | var directory = Path.GetDirectoryName(to);
|
| | | if (!Directory.Exists(directory))
|
| | | {
|
| | | Directory.CreateDirectory(directory);
|
| | | }
|
| | |
|
| | | var extension = Path.GetExtension(item.FullName);
|
| | | if (extension == ".meta")
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | File.Copy(item.FullName, to, true);
|
| | | completeCount++;
|
| | |
| | | {
|
| | | var relativePath = FileExtersion.GetFileRelativePath(_assetBundlePath, item.FullName);
|
| | | var to = StringUtility.Contact(ResourcesPath.Instance.StreamingAssetPath, relativePath);
|
| | | if (relativePath.StartsWith("patch"))//不包含meta文件和补丁
|
| | | continue;
|
| | |
|
| | | var directory = Path.GetDirectoryName(to);
|
| | | if (!Directory.Exists(directory))
|
| | | {
|
| | | Directory.CreateDirectory(directory);
|
| | | }
|
| | |
|
| | | var extension = Path.GetExtension(item.FullName);
|
| | | if (extension == ".meta")
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | File.Copy(item.FullName, to, true);
|
| | | completeCount++;
|
| | |
| | |
|
| | | public static void BuildApk(string _sdkPath, string _output, string _publisher, int _buildIndex, bool _development)
|
| | | {
|
| | | return;
|
| | | PreBuild(_publisher, _buildIndex);
|
| | |
|
| | | var auditTimeFile = StringUtility.Contact(Application.dataPath, Path.DirectorySeparatorChar, "Resources/Config/AuditTime.txt");
|
| | | if (File.Exists(auditTimeFile))
|
| | | {
|
| | |
| | | // 针对某一些打包的特殊性, 这里特指依赖的第三方库含有资源的问题
|
| | | // 这里对有这种特型的渠道的sdk在打包的时候差异化gradle文件
|
| | | // 更名原有文件
|
| | | string _gradleTemplateUrl = EditorApplication.applicationContentsPath + "/PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/";
|
| | | string _gradleFileUrl = _gradleTemplateUrl + "mainTemplate.gradle";
|
| | | string _diffGradleFileUrl = StringUtility.Contact(_sdkPath, "/GradleDiff/", versionConfig.appId, "/mainTemplate.gradle");
|
| | | FileInfo _fileInfo = new FileInfo(_diffGradleFileUrl);
|
| | | // string _gradleTemplateUrl = EditorApplication.applicationContentsPath + "/PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/";
|
| | | // string _gradleFileUrl = _gradleTemplateUrl + "mainTemplate.gradle";
|
| | | // string _diffGradleFileUrl = StringUtility.Contact(_sdkPath, "/GradleDiff/", versionConfig.appId, "/mainTemplate.gradle");
|
| | | // FileInfo _fileInfo = new FileInfo(_diffGradleFileUrl);
|
| | |
|
| | | if (!_fileInfo.Exists)
|
| | | {
|
| | | EditorUtility.DisplayDialog("警告", "Gradle模式需要配置差异文件,但是没有找到该文件: " + _diffGradleFileUrl, "@Hale");
|
| | | return;
|
| | | }
|
| | | // if (!_fileInfo.Exists)
|
| | | // {
|
| | | // EditorUtility.DisplayDialog("警告", "Gradle模式需要配置差异文件,但是没有找到该文件: " + _diffGradleFileUrl, "@Hale");
|
| | | // return;
|
| | | // }
|
| | |
|
| | | _fileInfo.CopyTo(_gradleFileUrl, true);
|
| | | // _fileInfo.CopyTo(_gradleFileUrl, true);
|
| | |
|
| | | // 移动配置文件至打包工作目录中
|
| | |
|
| | | PlayerSettings.Android.keystoreName = Application.dataPath + "/Editor/Keystore/" + versionConfig.keystoreFileName + ".keystore";
|
| | | var keystorePath = Application.dataPath + "/Editor/Keystore/" + versionConfig.keystoreFileName + ".keystore";
|
| | | if (!File.Exists(keystorePath))
|
| | | {
|
| | | Debug.LogError("签名文件不存在");
|
| | | return;
|
| | | }
|
| | | PlayerSettings.Android.keystoreName = keystorePath;
|
| | | PlayerSettings.Android.keystorePass = versionConfig.keystorePassword;
|
| | | PlayerSettings.Android.keyaliasName = versionConfig.keystoreAlias;
|
| | | PlayerSettings.Android.keyaliasPass = versionConfig.keystoreAliasPassword;
|
| | | PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel22;
|
| | | // PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel22;
|
| | | PlayerSettings.Android.bundleVersionCode = VersionConfig.GetVersionNumber(versionConfig.version);
|
| | |
|
| | | PlayerSettings.enableInternalProfiler = _development;
|
| | |
|
| | | if (Directory.Exists(ANDROID_PLUGIN_PATH))
|
| | | {
|
| | | Directory.Delete(ANDROID_PLUGIN_PATH, true);
|
| | | }
|
| | | //删除原sdk文件
|
| | | if (Directory.Exists(THE_2TH_WORLD_SDK_PATH))
|
| | | Directory.Delete(THE_2TH_WORLD_SDK_PATH, true);
|
| | | //删除原清单文件
|
| | | // if (File.Exists(MANIFEST_PATH))
|
| | | // File.Delete(MANIFEST_PATH);
|
| | |
|
| | | Debug.LogFormat("执行Android SDK 文件拷贝,from:{0};to:{1}", StringUtility.Contact(_sdkPath, "/Android/release"), ANDROID_PLUGIN_PATH);
|
| | | FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/Android/release"), ANDROID_PLUGIN_PATH);
|
| | | FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/ChannelDiff/Android/", versionConfig.appId), ANDROID_PLUGIN_PATH);
|
| | | var variant = _development ? "debug" : "release";
|
| | |
|
| | | // var manifestpath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/AndroidManifest.xml");
|
| | | var channelSdkPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/", variant);
|
| | |
|
| | | // if (File.Exists(manifestpath))
|
| | | // {
|
| | | // File.Copy(manifestpath, MANIFEST_PATH);
|
| | | // DebugEx.LogFormat("执行Android 清单文件拷贝,from:{0};to:{1}", manifestpath, MANIFEST_PATH);
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // DebugEx.LogFormat("Android 清单文件不存在,{0}", manifestpath);
|
| | | // // return;
|
| | | // }
|
| | |
|
| | | if (Directory.Exists(channelSdkPath))
|
| | | {
|
| | | FileExtersion.DirectoryCopy(channelSdkPath, THE_2TH_WORLD_SDK_PATH);
|
| | | DebugEx.LogFormat("执行Android 渠道SDK 文件拷贝,from:{0};to:{1}", channelSdkPath, THE_2TH_WORLD_SDK_PATH);
|
| | | }
|
| | | else
|
| | | {
|
| | | DebugEx.LogFormat("Android 渠道SDK文件不存在,{0}", channelSdkPath);
|
| | | return;
|
| | | }
|
| | |
|
| | | var option = AssetDatabase.LoadAssetAtPath<Options>("Assets/Editor/Beebyte/Obfuscator/ObfuscatorOptions.asset");
|
| | | if (option != null)
|
| | |
| | |
|
| | | AssetDatabase.SaveAssets();
|
| | | AssetDatabase.Refresh();
|
| | |
|
| | | IFix.Editor.IFixEditor.InjectAllAssemblys();//对injectAssemblys里的程序集进行注入,然后备份
|
| | |
|
| | | if (_development)
|
| | | {
|
| | |
| | | PlayerSettings.iOS.buildNumber = VersionConfig.Get().buildIndex.ToString();
|
| | | PlayerSettings.iOS.appleDeveloperTeamID = VersionConfig.Get().appleDeveloperTeamID;
|
| | |
|
| | | IFix.Editor.IFixEditor.InjectAllAssemblys();//对injectAssemblys里的程序集进行注入,然后备份
|
| | |
|
| | | if (_replace)
|
| | | {
|
| | | XCodeProjectMod.BuildIOSProject_Replace();
|
| | |
| | | EditorUtility.SetDirty(newVersionConfig);
|
| | |
|
| | | SetIconAndSplashImage(versionName);
|
| | | SetCreateRoleAnimation();
|
| | | //SetCreateRoleAnimation();
|
| | |
|
| | | PlayerSettings.companyName = "TheSecondWorld";
|
| | | PlayerSettings.productName = newVersionConfig.productName;
|