Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<!-- User-facing configuration-specific defaults -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<AndroidLinkMode Condition=" '$(AndroidLinkMode)' == '' ">None</AndroidLinkMode>
<UseInterpreter Condition=" '$(UseInterpreter)' == '' and '$(AndroidUseInterpreter)' == '' ">true</UseInterpreter>
<UseInterpreter Condition=" '$(UseInterpreter)' == '' and '$(AndroidUseInterpreter)' == '' and '$(_AndroidRuntime)' == 'MonoVM' ">true</UseInterpreter>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' ">true</EmbedAssembliesIntoApk>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1687,17 +1687,16 @@ static IEnumerable<object[]> Get_EnvironmentVariablesData ()
var ret = new List<object[]> ();

foreach (AndroidRuntime runtime in new[] { AndroidRuntime.CoreCLR, AndroidRuntime.NativeAOT }) {
AddTestData (true, "LowercaseMD5", "", runtime, runtime == AndroidRuntime.CoreCLR);
AddTestData (true, "LowercaseCrc64", "", runtime, false);
AddTestData (false, "", "127.0.0.1:9000,suspend,connect", runtime, false);
AddTestData ("LowercaseMD5", "", runtime, runtime == AndroidRuntime.CoreCLR);
AddTestData ("LowercaseCrc64", "", runtime, false);
AddTestData ("", "127.0.0.1:9000,suspend,connect", runtime, false);
}

return ret;

void AddTestData (bool useInterpreter, string packageNamingPolicy, string diagnosticConfiguration, AndroidRuntime runtime, bool enableCrashReport)
void AddTestData (string packageNamingPolicy, string diagnosticConfiguration, AndroidRuntime runtime, bool enableCrashReport)
{
ret.Add (new object[] {
useInterpreter,
packageNamingPolicy,
diagnosticConfiguration,
runtime,
Expand All @@ -1708,34 +1707,23 @@ void AddTestData (bool useInterpreter, string packageNamingPolicy, string diagno

[Test]
[TestCaseSource (nameof (Get_EnvironmentVariablesData))]
public void EnvironmentVariables (bool useInterpreter, string packageNamingPolicy, string diagnosticConfiguration, AndroidRuntime runtime, bool enableCrashReport)
public void EnvironmentVariables (string packageNamingPolicy, string diagnosticConfiguration, AndroidRuntime runtime, bool enableCrashReport)
{
// NativeAOT supports neither the interpreter nor debug builds, but what we test here is
// environment file creation and contents, and that's relevant to NativeAOT too
// NativeAOT does not support debug builds, but environment file creation and contents are relevant to NativeAOT too.
bool isRelease = runtime == AndroidRuntime.NativeAOT;
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}

if (runtime == AndroidRuntime.NativeAOT) {
if (packageNamingPolicy == "LowercaseMD5") {
Assert.Ignore ("NativeAOT does not support the 'LowercaseMD5' package naming policy.");
return;
}

// TODO: investigate and fix this. For some reason, `DOTNET_MODIFIABLE_ASSEMBLIES=Debug` is not
// in the environment variables file
if (useInterpreter && packageNamingPolicy == "LowercaseCrc64" && diagnosticConfiguration == "") {
Assert.Ignore ("NativeAOT doesn't put the DOTNET_MODIFIABLE_ASSEMBLIES=Debug variable in the environment file.");
return;
}
if (runtime == AndroidRuntime.NativeAOT && packageNamingPolicy == "LowercaseMD5") {
Assert.Ignore ("NativeAOT does not support the 'LowercaseMD5' package naming policy.");
return;
}

var proj = new XamarinAndroidApplicationProject {
IsRelease = isRelease,
};
proj.SetRuntime (runtime);
proj.SetProperty ("UseInterpreter", useInterpreter.ToString ());
proj.SetProperty ("EnableCrashReport", enableCrashReport.ToString ());
if (!string.IsNullOrEmpty (packageNamingPolicy))
proj.SetProperty ("AndroidPackageNamingPolicy", packageNamingPolicy);
Expand All @@ -1748,7 +1736,7 @@ public void EnvironmentVariables (bool useInterpreter, string packageNamingPolic
var values = new List<string> {
"mono.enable_assembly_preload=0",
};
if (useInterpreter)
if (!isRelease)
values.Add ("DOTNET_MODIFIABLE_ASSEMBLIES=Debug");
if (!string.IsNullOrEmpty (diagnosticConfiguration))
values.Add ($"DOTNET_DiagnosticPorts={diagnosticConfiguration}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ because xbuild doesn't support framework reference assemblies.
<Target Name="_GenerateEnvironmentFiles" DependsOnTargets="_AndroidConfigureHotReloadEnvironment">
<ItemGroup>
<_GeneratedAndroidEnvironment Include="mono.enable_assembly_preload=0" Condition=" '$(AndroidEnablePreloadAssemblies)' != 'True' " />
<_GeneratedAndroidEnvironment Include="DOTNET_MODIFIABLE_ASSEMBLIES=Debug" Condition=" '$(AndroidIncludeDebugSymbols)' == 'true' and '$(AndroidUseInterpreter)' == 'true' " />
<_GeneratedAndroidEnvironment Include="DOTNET_MODIFIABLE_ASSEMBLIES=Debug" Condition=" '$(AndroidIncludeDebugSymbols)' == 'true' " />
<_GeneratedAndroidEnvironment Include="DOTNET_DiagnosticPorts=$(DiagnosticConfiguration)" Condition=" '$(DiagnosticConfiguration)' != '' " />
<_GeneratedAndroidEnvironment Include="DOTNET_EnableCrashReport=1" Condition=" '$(EnableCrashReport)' == 'true' and '$(UseMonoRuntime)' != 'true' " />
<!-- RuntimeEnvironmentVariable items come from 'dotnet run -e NAME=VALUE' -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2212,7 +2212,7 @@ public void FastDeployEnvironmentFiles ([Values] bool isRelease, [Values] bool e
logcatOutput,
"The Environment variable \"DOTNET_DiagnosticPorts\" was not set to expected value \"127.0.0.1:9000,connect,nosuspend\"."
);
// NOTE: set when $(UseInterpreter) is true, default for Debug mode
// NOTE: set when $(AndroidIncludeDebugSymbols) is true
if (!isRelease) {
StringAssert.Contains (
"DOTNET_MODIFIABLE_ASSEMBLIES=Debug",
Expand Down
Loading