Skip to content

Commit

Permalink
Merge pull request #731 from unoplatform/dev/jela/exports-fix
Browse files Browse the repository at this point in the history
fix: Adjust aot profile generation
  • Loading branch information
jeromelaban authored May 24, 2023
2 parents 7de8917 + ee18f51 commit 793ddd1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}

public static initialize(context: DotnetPublicAPI, unoConfig: Uno.WebAssembly.Bootstrap.UnoConfig): AotProfilerSupport {
if (context.Module.ENVIRONMENT_IS_WEB && unoConfig.generate_aot_profile) {
if (Bootstrapper.ENVIRONMENT_IS_WEB && unoConfig.generate_aot_profile) {
return new AotProfilerSupport(context, unoConfig);
}
return null;
Expand Down
11 changes: 4 additions & 7 deletions src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ namespace Uno.WebAssembly.Bootstrap {
// Module may not be initialized yet (.NET 8 and later)
(<any>this._context).Module = this._context.Module || {};

this._context.Module.ENVIRONMENT_IS_WEB = Bootstrapper.ENVIRONMENT_IS_WEB;
this._context.Module.ENVIRONMENT_IS_NODE = Bootstrapper.ENVIRONMENT_IS_NODE;

this.setupRequire();
this.setupEmscriptenPreRun();

Expand All @@ -174,7 +171,7 @@ namespace Uno.WebAssembly.Bootstrap {
}

private async setupHotReload() {
if (this._context.Module.ENVIRONMENT_IS_WEB && this.hasDebuggingEnabled()) {
if (Bootstrapper.ENVIRONMENT_IS_WEB && this.hasDebuggingEnabled()) {
await HotReloadSupport.tryInitializeExports(this._getAssemblyExports);

this._hotReloadSupport = new HotReloadSupport(this._context, this._unoConfig);
Expand Down Expand Up @@ -527,7 +524,7 @@ namespace Uno.WebAssembly.Bootstrap {

asset = asset.replace("/managed/", `/${this._unoConfig.uno_remote_managedpath}/`);

if (this._context.Module.ENVIRONMENT_IS_NODE) {
if (Bootstrapper.ENVIRONMENT_IS_NODE) {
var fs = require('fs');

console.log('Loading... ' + asset);
Expand Down Expand Up @@ -572,7 +569,7 @@ namespace Uno.WebAssembly.Bootstrap {

// Uno.Wasm.Bootstrap is using "requirejs" by default, which is an AMD implementation
// But when run with NodeJS or Electron, it's using CommonJS instead of AMD
this._isUsingCommonJS = this._unoConfig.uno_shell_mode !== "BrowserEmbedded" && (this._context.Module.ENVIRONMENT_IS_NODE || this.isElectron());
this._isUsingCommonJS = this._unoConfig.uno_shell_mode !== "BrowserEmbedded" && (Bootstrapper.ENVIRONMENT_IS_NODE || this.isElectron());

if (this._unoConfig.enable_debugging) console.log("Done loading the BCL");

Expand Down Expand Up @@ -646,7 +643,7 @@ namespace Uno.WebAssembly.Bootstrap {
}

private attachDebuggerHotkey() {
if (this._context.Module.ENVIRONMENT_IS_WEB) {
if (Bootstrapper.ENVIRONMENT_IS_WEB) {

let loadAssemblyUrls = this._monoConfig.assets.map(a => a.name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

private attachHotKey() {

if (this._context.Module.ENVIRONMENT_IS_WEB) {
if (Bootstrapper.ENVIRONMENT_IS_WEB) {

if (LogProfilerSupport._logProfilerEnabled) {
// Use the combination shift+alt+D because it isn't used by the major browsers
Expand Down
2 changes: 0 additions & 2 deletions src/Uno.Wasm.Bootstrap/ts/types/dotnet/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ declare interface EmscriptenModule {
/**
* BEGIN UNO SPECIFIC
*/
ENVIRONMENT_IS_NODE: boolean;
ENVIRONMENT_IS_WEB: boolean;
aotProfileData: any;
/**
* END UNO SPECIFIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<None Include="$(MSBuildThisFileDirectory)side_module\side.wasm" />
<None Include="$(MSBuildThisFileDirectory)test.cpp" />
</ItemGroup>
<ItemGroup Condition="'$(UseAOT)'=='true' or '$(WasmShellGenerateAOTProfile)'=='true'">
<ItemGroup Condition="'$(UseAOT)'=='true' or '$(WasmShellGenerateAOTProfile)'=='true' or '$(WasmShellEnableLogProfiler)'=='true'">
<Content Include="$(MSBuildThisFileDirectory)native/**/*.bc" />
<WasmShellNativeCompile Include="$(MSBuildThisFileDirectory)test.cpp" />
</ItemGroup>
Expand Down

0 comments on commit 793ddd1

Please sign in to comment.