当前位置:   article > 正文

HybridCLR Example_exception: generatestripedaotdlls failed

exception: generatestripedaotdlls failed

https://gitee.com/weifen/hybrid-clrexample

模拟器测试:

hybridclr 热更真机测试

功能:

  • 一键构建PC,Android整包
  • 一键构建AssetBundle和dll热更
  • 一键本地热更测试
  • 热更构建时检查link和aot
  • sceneTest 测试场景加载
  • AssemblyCSharpHotUpdate 测试Assembly-CSharp作为热更dll加载

热更文件结构:

热更构建的时候会把生成的文件复制到StreamingAssets目录下
如果是构建热更会根据编译目标存放到 FileServer/{buildtarget}下
在这里插入图片描述

link.cs:

	// 整个程序集都不要裁剪
    private static readonly HashSet<string> assemblyAlls = new HashSet<string>
    {
        "mscorlib",
    };
    // 构建不同平台时会导致link增删,这里提供额外的补充
	private static readonly Dictionary<string, List<string>> fixedList = new Dictionary<string, List<string>>()
    {

    };

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

ScriptUpdate.cs:

根据提交记录和上次构建整包对比文件变化,aot出现改动时阻断

热更dll构建:

    private static void HotUpdateDll(BuildTarget buildTarget, bool developmentBuild = false, bool isGenerateAot = false)
    {
        if (!SettingsUtil.Enable)
        {
            Debug.Log("HybridCLR unenable");
            return;
        }

        InstallerController installer = new InstallerController();
        if (!installer.HasInstalledHybridCLR())
            installer.InstallDefaultHybridCLR();

        Il2CppDefGeneratorCommand.GenerateIl2CppDef();
        CompileDllCommand.CompileDll(buildTarget, developmentBuild);
        // 工程导出后已经裁剪的类不能通过AOT增加?
        // 暂时热更的时候去除AOT生成
        if(isGenerateAot)
        {
            StripAOTDllCommand.GenerateStripedAOTDlls(buildTarget);
            AOTReferenceGeneratorCommand.GenerateAOTGenericReference(buildTarget);
        }
        // 热更可能不能生成桥接函数,暂时先放着
        MethodBridgeGeneratorCommand.GenerateMethodBridge(buildTarget);
    }

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

构建步骤:

  1. 构建时先填充unity平台参数
  2. 根据编译参数填充宏
  3. 构建HybridCLR内容
  4. 构建AssetBundle,【可选】这里是为了用户第一次打开的时候不用再去下载,优化体验用
  5. 构建link
  6. 开始构建

预留了读取buildInfo.json文件方便使用命令行模式启动时读取编译参数,以下为编译参数

    private struct BuildInfo
    {
        public BuildTarget buildTarget;
        public BuildTargetGroup buildTargetGroup;
        public string localPathName;
        public UIOrientation orientation;
        public bool isRoationPortrait;
        public bool isRoationLeft;
        public bool isRoationRight;
        public bool isRoationDown;
        public bool isEnableHybridCLR;
        public string identifier;
        public bool isMono;
        public BuildType buildType;
        public bool buildWithDeepProfilingSupport;
        public bool ExportProject;
        public string bundleVersion;
        public int bundleVersionCode;
        public bool isAssetBundleIncrement;
    }

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/686980
推荐阅读
相关标签
  

闽ICP备14008679号