模块化编译.Net 7源码

起因

在编译.Net源码的时候,第一次的时候是全部编译,后面可以指定那个模块编译,事实上.Net源码build.cmd/build.sh脚本是提供模块编译额.比如编译System.Private.Corelib.dll(这个其他BCL库不一样,这个是核心库,加载coreclr.dll→System.Private.Corelib.dll(基础类型,bool/int等类型)→corejit.dll).

若是使用VS调试的话,就不用使用模块编译,当.Net源码更新后,VS发现源码变化后,调试的时候会进行重新编译的.

编译System.Private.Corelib.dll

.\build.cmd -subset clr.corelib -c Debug -rc Debug

使用dotnet编译编译,模块编译System.Private.Corelib.dl

编译jit

.\build.cmd -subset clr.alljits

使用dotnet编译编译jit模块,可以通过环境变量指定使用那个jit动态库

编译host(corerun.exe)

.\build.cmd -subset clr.hosts

使用dotnet编译编译host模块,包括corerun.exe

秋风 2022-03-21