-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[Runtime] load debug env vars from Android system properties #78251
base: main
Are you sure you want to change the base?
[Runtime] load debug env vars from Android system properties #78251
Conversation
Note to reviewers: this change is primarily useful for |
@compnerd please see my response to your comment and let me know if you have any other suggestions. If you're good with what I have here, please request CI. Thanks! |
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 think that we should sink the debug.
to the end of the name so that all the Swift properties are co-located (in case we add any additional ones in the future).
@compnerd would you mind triggering test runs on this one? |
@swift-ci please test |
Purpose
Enable setting
SWIFT_DEBUG_
vars in Swift Android apps by readingdebug.swift.runtime.SWIFT_DEBUG_
system properties during runtime init on Android.Overview
platformInitialize()
function to the env var setup in the Swift runtime and implement it only for AndroidplatformInitialize
function from each of theswift::runtime::environment::initialize
implementationsBackground
Because all Android app processes all fork from the same process, they don't pick-up environment changes on launch. Android system properties give us an alternative, standard mechanism to do something similar. Only system properties prefixed with
debug.
can be set without root permissions.Validation
Set system properties on an Android device:
Kill and re-launch a simple Android app that initializes the Swift runtime from
Application.onCreate
.Using the debugger, confirm these variables are set to
true
: