-
Notifications
You must be signed in to change notification settings - Fork 554
Remove IsRunningOnDesktop for the Android designer #10234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
IsRunningOnDesktop
for the Android designer
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs
Outdated
Show resolved
Hide resolved
…est list initialization, and remove remaining is_running_on_desktop usage from C++ code Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see more instances of is_running_on_desktop
that can be removed:
static constexpr bool is_running_on_desktop = false; |
Then there are several usages in src\native\mono\monodroid\monodroid-glue.cc
.
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Fixed in 6f46321. Removed the unused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grendello should review the changes to native code.
@@ -1299,9 +1299,7 @@ public void PackageNamingPolicy ([Values ("LowercaseMD5", "LowercaseCrc64")] str | |||
Assert.IsTrue (b.Build (proj), "build should have succeeded."); | |||
var environment = b.Output.GetIntermediaryPath (Path.Combine ("__environment__.txt")); | |||
FileAssert.Exists (environment); | |||
var values = new List<string> { | |||
$"__XA_PACKAGE_NAMING_POLICY__={packageNamingPolicy}" | |||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this is relevant to the removal of desktop support
@@ -1758,7 +1758,6 @@ because xbuild doesn't support framework reference assemblies. | |||
|
|||
<Target Name="_GenerateEnvironmentFiles"> | |||
<ItemGroup> | |||
<_GeneratedAndroidEnvironment Include="__XA_PACKAGE_NAMING_POLICY__=$(AndroidPackageNamingPolicy)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this is relevant to the removal of desktop support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This spot seemed to be the only place that actually reads the env var:
android/src/Mono.Android/Android.Runtime/JNIEnvInit.cs
Lines 142 to 147 in 5c5854f
if (IsRunningOnDesktop) { | |
var packageNamingPolicy = Environment.GetEnvironmentVariable ("__XA_PACKAGE_NAMING_POLICY__"); | |
if (Enum.TryParse (packageNamingPolicy, out PackageNamingPolicy pnp)) { | |
JavaNativeTypeManager.PackageNamingPolicy = pnp; | |
} | |
} |
$(AndroidPackageNamingPolicy)
is still left in, which embeds a value in libxamarin-app.so
.
The C++ changes look fine |
The Android designer has been removed from Visual Studio, but we still had code in the product supporting it. This PR removes all the desktop-specific functionality as it's no longer needed.
Changes Made
C++ Changes
isRunningOnDesktop
field fromJnienvInitializeArgs
struct inmanaged-interface.hh
monodroid-glue.cc
andhost.cc
C# Changes
IsRunningOnDesktop
static field fromJNIEnvInit
class__XA_PACKAGE_NAMING_POLICY__
environment variable handlingTypeManager.cs
assuming desktop is always falseAndroidRuntime.cs
removing desktop-specific type lookupsSyncContext.cs
Build Changes
__XA_PACKAGE_NAMING_POLICY__
environment variable generation from MSBuild targetsKey Points
if (IsRunningOnDesktop)
statements have been inlined/deleted assuming the condition is alwaysfalse
$(AndroidPackageNamingPolicy)
MSBuild property remains as-is since it's still used within the codebase__XA_PACKAGE_NAMING_POLICY__
environment variable has been removed as it was only used within desktop blocksVerification
IsRunningOnDesktop
remain in C# source filesisRunningOnDesktop
remain in C++ source files__XA_PACKAGE_NAMING_POLICY__
remain in source filesis_running_on_desktop
constant inmonodroid-glue-internal.hh
is also removedFixes #10233.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.