Skip to content
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

Automatically pick the Android SDK path using environment variables #84285

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

m4gr3d
Copy link
Contributor

@m4gr3d m4gr3d commented Nov 1, 2023

@m4gr3d
Copy link
Contributor Author

m4gr3d commented Nov 1, 2023

@akien-mga @YuriSizov It's not a bug so I'm putting in for 4.3, but it's small enough it could be included for 4.2.

Up to you to decide!

void register_android_exporter_types() {
GDREGISTER_VIRTUAL_CLASS(EditorExportPlatformAndroid);
}

void register_android_exporter() {
#ifndef ANDROID_ENABLED
EDITOR_DEF("export/android/android_sdk_path", "");
EDITOR_DEF("export/android/android_sdk_path", getenv("ANDROID_SDK_ROOT"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EDITOR_DEF("export/android/android_sdk_path", getenv("ANDROID_SDK_ROOT"));
EDITOR_DEF("export/android/android_sdk_path", OS::get_singleton()->get_environment("ANDROID_SDK_ROOT"));

Also, won't be useful on macOS (without #81266), since editor can't access shell environment (not a big deal, but should be mentioned if it's documented to auto pick it).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on a mac laptop and it seems to work as expected and picked up the env variable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work only when running the editor from terminal but not when running as a bundled app.

@m4gr3d m4gr3d force-pushed the auto_set_android_sdk_default branch from 93a9516 to f86e611 Compare November 1, 2023 14:36
@akien-mga akien-mga modified the milestones: 4.3, 4.2 Nov 1, 2023
@akien-mga akien-mga merged commit 2277eea into godotengine:master Nov 1, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@m4gr3d m4gr3d deleted the auto_set_android_sdk_default branch November 1, 2023 22:32
@YuriSizov YuriSizov changed the title Automatically pick the Android sdk path using environment variables Automatically pick the Android SDK path using environment variables Nov 6, 2023
@goatchurchprime
Copy link

This has proved useful for the automation of the setup under NixOS (see attachment).

If we also had environment variable settings for debug_keystore, export_templates_folder and blender3_path then I could make Godot work at startup (ie connect to all the right directories) without having to patch the source code.

flake.zip](https://github.com/godotengine/godot/files/13319882/flake.zip)

@m4gr3d
Copy link
Contributor Author

m4gr3d commented Nov 10, 2023

This has proved useful for the automation of the setup under NixOS (see attachment).

If we also had environment variable settings for debug_keystore, export_templates_folder and blender3_path then I could make Godot work at startup (ie connect to all the right directories) without having to patch the source code.

flake.zip](https://github.com/godotengine/godot/files/13319882/flake.zip)

@goatchurchprime Sounds like a good idea! Can you create a proposal for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants