Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Allow the automatic local publication workflows to work on Windows.
Browse files Browse the repository at this point in the history
The end result is that Android Studio can be used in Windows to build Fenix
when using the "local publish" workflow managed by settings.gradle -
android-components publishes automatically, although it's necessary to
manually public application-services because it doesn't build on native
Windows, only via WSL. So instead of trying to build it, it just
prints a message indicating the manual build is necessary.
  • Loading branch information
mhammond authored and ekager committed Jun 12, 2020
1 parent e71ed31 commit b5e46e6
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,37 @@ if (localProperties != null) {
if (appServicesLocalPath != null) {
log("Enabling automatic publication of application-services from: $appServicesLocalPath")
def publishAppServicesCmd = ["./automation/publish_to_maven_local_if_modified.py"]
runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.", false)
// Application-services doesn't build on native Windows. However, it still makes sense to
// enable these workflows on Windows, even if it isn't quote as automatic as elsewhere -
// specifically, you must run the build command on WSL, but after that you can happily build
// and debug directly from within Android Studio on native Windows - but only after following
// https://github.com/mozilla/application-services/blob/master/docs/howtos/setup-android-build-environment.md#using-windows
// So rather than fail we make noise...
if (System.properties['os.name'].toLowerCase().contains('windows')) {
log('NOTE: The autoPublish workflows do not work on native windows.');
log('You must manually ensure that the following command has completed successfully in WSL:');
log("> $publishAppServicesCmd");
log("(from the '$appServicesLocalPath' directory)");
log('Then restart the build');
} else {
runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.", false)
}
} else {
log("Disabled auto-publication of application-services. Enable it by settings '$settingAppServicesPath' in local.properties")
}

String androidComponentsLocalPath = localProperties.getProperty(settingAndroidComponentsPath)

if (androidComponentsLocalPath != null) {
// android-components does build on native windows, so it doesn't get the special Windows treatment above.
// But it doesn't like executing .py files directly. We assume a "manually installed" python,
// which comes with a "py" launcher and respects the shebang line to specify the version.
log("Enabling automatic publication of android-components from: $androidComponentsLocalPath")
def publishAcCmd = ["./automation/publish_to_maven_local_if_modified.py"]
def publishAcCmd = [];
if (System.properties['os.name'].toLowerCase().contains('windows')) {
publishAcCmd << "py";
}
publishAcCmd << "./automation/publish_to_maven_local_if_modified.py";
runCmd(publishAcCmd, androidComponentsLocalPath, "Published android-components for local development.", false)
} else {
log("Disabled auto-publication of android-components. Enable it by settings '$settingAndroidComponentsPath' in local.properties")
Expand Down

0 comments on commit b5e46e6

Please sign in to comment.