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

Improve Tool verification logging and feedback #1382

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

rmartin16
Copy link
Member

@rmartin16 rmartin16 commented Jul 24, 2023

Changes

  • Put breadcrumbs in debug log during tool verification to better understand what happened
  • Inform users they can set JAVA_HOME and ANDROID_HOME when Briefcase installs them
  • Provide feedback in errors on how JAVA_HOME and ANDROID_HOME should be specified
  • This also better aligns the tools with how I implemented logging Windows SDK verification

Install messages:

briefcase build android

[java] A Java 17 JDK was not found; downloading and installing...
To use an existing JDK 17 instance, specify its root directory path in the JAVA_HOME environment variable.

Downloading OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz...
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 00:03
Installing OpenJDK... done

[android_sdk] The Android SDK was not found; downloading and installing...
To use an existing Android SDK instance, specify its root directory path in the ANDROID_HOME environment variable.

Downloading commandlinetools-linux-8092744_latest.zip...
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 00:03
Installing Android SDK Command-Line Tools... done

Valid environment variables:

briefcase build android -v

>>> [Java JDK] Evaluating JAVA_HOME...
>>> JAVA_HOME=/home/russell/tmp/jdk-17.0.8+7/

>>> Running Command:
>>>     /home/russell/tmp/jdk-17.0.8+7/bin/javac -version
>>> Working Directory:
>>>     /home/russell/tmp/beeware/helloworld
>>> Command Output:
>>>     javac 17.0.8
>>> Return code: 0
>>> Using JDK at /home/russell/tmp/jdk-17.0.8+7

>>> [Android SDK] Evaluating ANDROID_HOME...
>>> ANDROID_HOME=/home/russell/.cache/briefcase/tools/android_sdk
>>> Using Android SDK at /home/russell/.cache/briefcase/tools/android_sdk

Bad JAVA_HOME value:

briefcase build android -v

>>> [Java JDK] Evaluating JAVA_HOME...
>>> JAVA_HOME=/home/russell/tmp/jdk-17.0.8+7/bin

>>> Running Command:
>>>     /home/russell/tmp/jdk-17.0.8+7/bin/bin/javac -version
>>> Working Directory:
>>>     /home/russell/tmp/beeware/helloworld

*************************************************************************
** WARNING: JAVA_HOME does not point to a JDK                          **
*************************************************************************

    The location pointed to by the JAVA_HOME environment variable:

    /home/russell/tmp/jdk-17.0.8+7/bin

    does not appear to be a JDK. It may be a Java Runtime Environment.

    If JAVA_HOME is a JDK, ensure it is the root directory of the JDK
    instance such that $JAVA_HOME/bin/javac is a valid filepath.

    Briefcase will proceed using its own JDK instance.

*************************************************************************
>>> Using JDK at /home/russell/.cache/briefcase/tools/java17

>>> [Android SDK] Evaluating ANDROID_HOME...
>>> ANDROID_HOME=/home/russell/.cache/briefcase/tools/android_sdk
>>> Using Android SDK at /home/russell/.cache/briefcase/tools/android_sdk

Bad ANDROID_HOME value:

briefcase build android -v

>>> [Java JDK] Evaluating JAVA_HOME...
>>> JAVA_HOME=/home/russell/tmp/jdk-17.0.8+7/

>>> Running Command:
>>>     /home/russell/tmp/jdk-17.0.8+7/bin/javac -version
>>> Working Directory:
>>>     /home/russell/tmp/beeware/helloworld
>>> Command Output:
>>>     javac 17.0.8
>>> Return code: 0
>>> Using JDK at /home/russell/tmp/jdk-17.0.8+7

>>> [Android SDK] Evaluating ANDROID_HOME...
>>> ANDROID_HOME=/home/russell/.cache/briefcase/tools/android_sdk/bin

*************************************************************************
** WARNING: ANDROID_HOME does not point to an Android SDK              **
*************************************************************************

    The location pointed to by the ANDROID_HOME environment
    variable:

    /home/russell/.cache/briefcase/tools/android_sdk/bin

    doesn't appear to contain an Android SDK.

    If ANDROID_HOME is an Android SDK, ensure it is the root directory
    of the Android SDK instance such that

    $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager

    is a valid filepath.

    Briefcase will proceed using its own SDK instance.

*************************************************************************
>>> Using Android SDK at /home/russell/.cache/briefcase/tools/android_sdk

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@rmartin16 rmartin16 marked this pull request as ready for review July 24, 2023 18:29
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Looks like some solid changes that should be very helpful in diagnostics 👍

@freakboy3742 freakboy3742 merged commit 5483fd9 into beeware:main Jul 26, 2023
32 of 35 checks passed
@rmartin16 rmartin16 deleted the tool-verify-debug branch July 31, 2023 01:04
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 this pull request may close these issues.

2 participants