少年修仙传客户端基础资源
hch
2023-12-10 cdb165fb0db4c0228f8d0e642950fcf6a241b029
0312 安卓清单gradle从sdk拷贝
1个文件已修改
94 ■■■■ 已修改文件
Assets/Editor/Tool/ClientPackage.cs 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/ClientPackage.cs
@@ -45,6 +45,13 @@
    static string MANIFEST_PATH = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";
    static string iOS_PLUGIN_PATH = Application.dataPath + "/Plugins/iOS/Channel";
    static string File_baseProjectTemplate = Application.dataPath + "/Plugins/Android/baseProjectTemplate.gradle";
    static string File_google_services = Application.dataPath + "/Plugins/Android/google-services.json";
    static string File_gradleTemplate = Application.dataPath + "/Plugins/Android/gradleTemplate.properties";
    static string File_LauncherManifest = Application.dataPath + "/Plugins/Android/LauncherManifest.xml";
    static string File_launcherTemplate = Application.dataPath + "/Plugins/Android/launcherTemplate.gradle";
    static string File_mainTemplate = Application.dataPath + "/Plugins/Android/mainTemplate.gradle";
    /// <summary>
    /// 打包
@@ -433,32 +440,73 @@
        //删除原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);
        if (File.Exists(MANIFEST_PATH))
            File.Delete(MANIFEST_PATH);
        if (File.Exists(File_baseProjectTemplate))
            File.Delete(File_baseProjectTemplate);
        if (File.Exists(File_google_services))
            File.Delete(File_google_services);
        if (File.Exists(File_gradleTemplate))
            File.Delete(File_gradleTemplate);
        if (File.Exists(File_LauncherManifest))
            File.Delete(File_LauncherManifest);
        if (File.Exists(File_launcherTemplate))
            File.Delete(File_launcherTemplate);
        if (File.Exists(File_mainTemplate))
            File.Delete(File_mainTemplate);
        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);
        var manifeastPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/AndroidManifest.xml");
        string channelSdkPath;
        string copySdkFile;
        if (versionConfig.sdkFileName.Trim().Length != 0)
        if (versionConfig.sdkFileName.Trim() == "mlgtgame_quick")
        {
            channelSdkPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/", variant);
            manifeastPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/AndroidManifest.xml");
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/AndroidManifest.xml");
            File.Copy(copySdkFile, MANIFEST_PATH);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/mainTemplate.gradle");
            File.Copy(copySdkFile, File_mainTemplate);
            DebugEx.LogFormat("Android 清单等文件拷贝成功");
        }
        else if (versionConfig.sdkFileName.Trim() == "mlgtgame_1wjo")
        {
            channelSdkPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/", variant);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/AndroidManifest.xml");
            File.Copy(copySdkFile, MANIFEST_PATH);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/baseProjectTemplate.gradle");
            File.Copy(copySdkFile, File_baseProjectTemplate);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/google-services.json");
            File.Copy(copySdkFile, File_google_services);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/gradleTemplate.properties");
            File.Copy(copySdkFile, File_gradleTemplate);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/LauncherManifest.xml");
            File.Copy(copySdkFile, File_LauncherManifest);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/launcherTemplate.gradle");
            File.Copy(copySdkFile, File_launcherTemplate);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/mainTemplate.gradle");
            File.Copy(copySdkFile, File_mainTemplate);
            DebugEx.LogFormat("Android 清单等文件拷贝成功");
        }
        else
        {
            channelSdkPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/", variant);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/AndroidManifest.xml");
            File.Copy(copySdkFile, MANIFEST_PATH);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/baseProjectTemplate.gradle");
            File.Copy(copySdkFile, File_baseProjectTemplate);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/google-services.json");
            File.Copy(copySdkFile, File_google_services);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/gradleTemplate.properties");
            File.Copy(copySdkFile, File_gradleTemplate);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/LauncherManifest.xml");
            File.Copy(copySdkFile, File_LauncherManifest);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/launcherTemplate.gradle");
            File.Copy(copySdkFile, File_launcherTemplate);
            copySdkFile = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/mainTemplate.gradle");
            File.Copy(copySdkFile, File_mainTemplate);
            DebugEx.LogFormat("Android 清单等文件拷贝成功");
        }
        // 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))
        {
@@ -469,14 +517,6 @@
        {
            DebugEx.LogFormat("Android 渠道SDK文件不存在,{0}", channelSdkPath);
            return;
        }
        if (File.Exists(manifeastPath))
        {
            if (File.Exists(MANIFEST_PATH))
                File.Delete(MANIFEST_PATH);
            File.Copy(manifeastPath, MANIFEST_PATH);
            DebugEx.LogFormat("Android 清单文件拷贝成功,{0}", manifeastPath);
        }
        var option = AssetDatabase.LoadAssetAtPath<Options>("Assets/Editor/Beebyte/Obfuscator/ObfuscatorOptions.asset");