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

Some additional environment variables #84

Closed
dominicmarmionswrve opened this issue Feb 19, 2021 · 5 comments · Fixed by #90
Closed

Some additional environment variables #84

dominicmarmionswrve opened this issue Feb 19, 2021 · 5 comments · Fixed by #90

Comments

@dominicmarmionswrve
Copy link

Context
We are migrating from gableroux docker images on circleci.

Suggested solution
Could you please add the following environment variables on images similar to unityci/editor:ubuntu-2019.4.14f1-android-0.9.0?

  1. export JAVA_HOME=/opt/unity/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK
  2. export ANDROID_HOME=/opt/unity/Editor/Data/PlaybackEngines/AndroidPlayer/SDK
  3. export ANDROID_NDK_HOME=/opt/unity/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
  4. export PATH=$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH

Also, could you run the following to accept latest android tool updates: yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses || true

Considered alternatives
Also worth considering, could you either change UNITY_PATH environment variable
from: /opt/unity
to: /opt/unity/Editor/Unity
Or alternatively create a new environment variable for this.

Additional details
We can set these ourselves in our own yml builds but it might useful for others.

Thanks!

@webbertakken
Copy link
Member

Could you please elaborate on the rationale behind these changes?

Please assume I don't know anything about the inner workings of Unity editor.
We're willing to add each line if there's a sound rationale behind it.

Also note that some of these paths may not really exist on images other than those with android as a target platform.

@dominicmarmionswrve
Copy link
Author

No problem. Yeah, the java ones are for android target platforms.

We build a unity sdk that leverages native code on android which is coded in java. To build the unity android app we need to compile (and run tests) on the native android layer, which then gets packaged into unity, and then we build/package the whole lot together.

@chrishultin
Copy link
Contributor

This might also increase general reliability for Android builds.

Quick details of each var:
JAVA_HOME - Canonical way to specify system path to Java JRE/JDK
ANDROID_HOME - Canonical way to specify system path to Android SDK
ANDROID_NDK_HOME - Canonical way to specify Android NDK path

The PATH env var should also be updated to add all the Android command-line utilities to the default search path, to facilitate usage of those tools in pre- or post-Unity build steps.

@chrishultin
Copy link
Contributor

@dominicmarmionswrve Check out #88 - just merged, should set those environment variables for you. You might still need to accept the license agreement on your own, though.

@webbertakken
Copy link
Member

webbertakken commented Mar 1, 2021

We might still wanna accept the license for the sdk manager, as we're making images for CI, and the license has been accepted on peoples computers already.

I recently excluded 2018.2 builds and below from using this fix because sdkmanager was not recognized. Perhaps we should undo the change using your suggestion:

yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses

We could then apply it to both 2018.2- and 2019+ images.

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

Successfully merging a pull request may close this issue.

3 participants