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

Fix Android build in gn_build.sh #10157

Merged
merged 1 commit into from
Oct 4, 2021

Conversation

austinh0
Copy link
Contributor

@austinh0 austinh0 commented Oct 1, 2021

Problem

After #9876 and #9996, set_up_android_deps.py and generate_jars_for_test.py are a prerequisite for Android builds. They were added to the Android build scripts, but I missed gn_build.sh because it uses target_os=all.

Change overview

  • Invoke JAR generation scripts in gn_build.sh

Testing

gn_build.sh passes

@austinh0 austinh0 changed the title Gn build fix Fix Android build in gn_build.sh Oct 1, 2021
@andy31415 andy31415 merged commit 50b044f into project-chip:master Oct 4, 2021
@mspang
Copy link
Contributor

mspang commented Oct 13, 2021

These steps should be part of the bootstrap.

@austinh0
Copy link
Contributor Author

These steps should be part of the bootstrap.

I don't think set_up_android_deps.py should be in the bootstrap - it downloads different JARs with any changes to third_party/android_deps/android_deps.gradle.

generate_jars_for_test.py would make more sense in the bootstrap, but since it writes the JARs to /tmp I was afraid of them being cleared. Would we prefer generating those JARs somewhere in-tree, and then just gitignore that folder?

@jonsmirl
Copy link
Contributor

jonsmirl commented Apr 1, 2022

This script does not work on Linux which prevents the Android build from working.

jonsmirl@ares:/aosp/chip$ python3 build/chip/java/tests/generate_jars_for_test.py
/home/jonsmirl/aosp/chip/build/chip/java/tests/IncludedInJar.java:4: error: cannot find symbol
IncludedInChildJar includedInChildJar;
^
symbol: class IncludedInChildJar
location: class IncludedInJar
1 error
Traceback (most recent call last):
File "/home/jonsmirl/aosp/chip/build/chip/java/javac_runner.py", line 146, in
sys.exit(main())
File "/home/jonsmirl/aosp/chip/build/chip/java/javac_runner.py", line 130, in main
retcode = subprocess.check_call(java_args + args.rest)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/javac', '-d', '/tmp/chip_java_build_test/classes', '/home/jonsmirl/aosp/chip/build/chip/java/tests/IncludedInJar.java']' returned non-zero exit status 1.
Traceback (most recent call last):
File "build/chip/java/tests/generate_jars_for_test.py", line 50, in
sys.exit(main())
File "build/chip/java/tests/generate_jars_for_test.py", line 45, in main
generateJar(test_dir + '/IncludedInJar.java', 'prebuilt_jar.jar')
File "build/chip/java/tests/generate_jars_for_test.py", line 30, in generateJar
subprocess.check_call(javac_runner_command)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['python3', '/home/jonsmirl/aosp/chip/build/chip/java/javac_runner.py', '--classdir', '/tmp/chip_java_build_test/classes', '--outfile', '/tmp/chip_java_build_test/prebuilt_jar.classlist', '--build-config', '/home/jonsmirl/aosp/chip/build/chip/java/tests/empty_build_config.json', '--', '-d', '/tmp/chip_java_build_test/classes', '/home/jonsmirl/aosp/chip/build/chip/java/tests/IncludedInJar.java']' returned non-zero exit status 1.
jonsmirl@ares:~/aosp/chip$

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.

8 participants