Skip to content

Commit ee49249

Browse files
[One .NET] set env var automatically for $(UseInterpreter) (#6027)
Fixes: #6016 Context: https://github.com/dotnet/maui/blob/main/src/Templates/src/templates/maui-mobile/MauiApp1/Android/AndroidEnvironment.txt Currently, the the .NET MAUI project template includes a `@(AndroidEnvironment)` file for "Hot Reload" scenarios. Let's setup this value by default so it will not be needed.
1 parent 941dc3a commit ee49249

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3929,17 +3929,21 @@ public void AbiNameInIntermediateOutputPath ()
39293929
public void PackageNamingPolicy ([Values ("LowercaseMD5", "LowercaseCrc64")] string packageNamingPolicy)
39303930
{
39313931
var proj = new XamarinAndroidApplicationProject ();
3932+
proj.SetProperty ("UseInterpreter", "true");
39323933
proj.SetProperty ("AndroidPackageNamingPolicy", packageNamingPolicy);
39333934
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86");
39343935
using (var b = CreateApkBuilder ()) {
39353936
Assert.IsTrue (b.Build (proj), "build should have succeeded.");
39363937
var environment = b.Output.GetIntermediaryPath (Path.Combine ("__environment__.txt"));
39373938
FileAssert.Exists (environment);
3939+
var values = new List<string> {
3940+
$"__XA_PACKAGE_NAMING_POLICY__={packageNamingPolicy}"
3941+
};
39383942
if (Builder.UseDotNet) {
3939-
Assert.AreEqual ($"__XA_PACKAGE_NAMING_POLICY__={packageNamingPolicy}{Environment.NewLine}mono.enable_assembly_preload=0", File.ReadAllText (environment).Trim ());
3940-
} else {
3941-
Assert.AreEqual ($"__XA_PACKAGE_NAMING_POLICY__={packageNamingPolicy}", File.ReadAllText (environment).Trim ());
3943+
values.Add ("mono.enable_assembly_preload=0");
3944+
values.Add ("DOTNET_MODIFIABLE_ASSEMBLIES=Debug");
39423945
}
3946+
Assert.AreEqual (string.Join (Environment.NewLine, values), File.ReadAllText (environment).Trim ());
39433947
}
39443948
}
39453949

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,7 @@ because xbuild doesn't support framework reference assemblies.
15131513
<ItemGroup>
15141514
<_GeneratedAndroidEnvironment Include="__XA_PACKAGE_NAMING_POLICY__=$(AndroidPackageNamingPolicy)" />
15151515
<_GeneratedAndroidEnvironment Include="mono.enable_assembly_preload=0" Condition=" '$(AndroidEnablePreloadAssemblies)' != 'True' " />
1516+
<_GeneratedAndroidEnvironment Include="DOTNET_MODIFIABLE_ASSEMBLIES=Debug" Condition=" '$(UsingAndroidNETSdk)' == 'true' and '$(AndroidIncludeDebugSymbols)' == 'true' and '$(AndroidUseInterpreter)' == 'true' " />
15161517
</ItemGroup>
15171518
<WriteLinesToFile
15181519
File="$(IntermediateOutputPath)__environment__.txt"

0 commit comments

Comments
 (0)