Skip to content

Commit

Permalink
fix --copy-artifacts-to issue in build_example.py (#10437)
Browse files Browse the repository at this point in the history
* fix --copy-artifacts-to issue in build_example.py

* remove todo for this issue
  • Loading branch information
xylophone21 authored Oct 21, 2021
1 parent caeb26b commit 30f7de7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
7 changes: 1 addition & 6 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ def AndroidTargets():
yield target.Extend('x64-chip-tool', board=AndroidBoard.X64, app=AndroidApp.CHIP_TOOL)
yield target.Extend('x86-chip-tool', board=AndroidBoard.X86, app=AndroidApp.CHIP_TOOL)
yield target.Extend('arm64-chip-test', board=AndroidBoard.ARM64, app=AndroidApp.CHIP_TEST)
# TODO: android studio build is broken:
# - When compile succeeds, build artifact copy fails with "No such file or
# directory: '<out_prefix>/android-androidstudio-chip-tool/outputs/apk/debug/app-debug.apk'
# - Compiling locally in the vscode image fails with
# "2 files found with path 'lib/armeabi-v7a/libCHIPController.so'"
# yield target.Extend('androidstudio-chip-tool', board=AndroidBoard.AndroidStudio, app=AndroidApp.CHIP_TOOL)
yield target.Extend('androidstudio-chip-tool', board=AndroidBoard.AndroidStudio, app=AndroidApp.CHIP_TOOL)


ALL = []
Expand Down
16 changes: 10 additions & 6 deletions scripts/build/builders/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,11 @@ def _build(self):
title='Building APP ' + self.identifier)

def build_outputs(self):
outputs = {
self.app.AppName() + '-debug.apk':
if not self.board.IsIde():
outputs = {
self.app.AppName() + 'app-debug.apk':
os.path.join(self.output_dir, 'outputs', 'apk', 'debug',
'app-debug.apk'),
}
if not self.board.IsIde():
outputs.update({
'CHIPController.jar':
os.path.join(self.output_dir, 'lib',
'src/controller/java/CHIPController.jar'),
Expand All @@ -243,6 +241,12 @@ def build_outputs(self):
'jni/%s/libc++_shared.so' % self.board.AbiName():
os.path.join(self.output_dir, 'lib', 'jni',
self.board.AbiName(), 'libc++_shared.so'),
})
}
else:
outputs = {
self.app.AppName() + '-debug.apk':
os.path.join(self.root, "src/android", self.app.AppName(),
'app/build/outputs/apk/debug/app-debug.apk')
}

return outputs
1 change: 1 addition & 0 deletions scripts/build/testdata/all_targets_except_host.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ameba-amebad-all-clusters
android-androidstudio-chip-tool
android-arm-chip-tool
android-arm64-chip-test
android-arm64-chip-tool
Expand Down
15 changes: 15 additions & 0 deletions scripts/build/testdata/build_all_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ python3 build/chip/java/tests/generate_jars_for_test.py
# Setting up Android deps through Gradle
python3 third_party/android_deps/set_up_android_deps.py

# Generating android-androidstudio-chip-tool
gn gen --check --fail-on-unused-args {out}/android-androidstudio-chip-tool '--args=target_os="android" target_cpu="arm64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_use_clusters_for_ip_commissioning="true"' --ide=json --json-ide-script=//scripts/examples/gn_to_cmakelists.py

# Accepting NDK licenses
bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'

# Generating JARs for Java build rules test
python3 build/chip/java/tests/generate_jars_for_test.py

# Setting up Android deps through Gradle
python3 third_party/android_deps/set_up_android_deps.py

# Generating android-arm-chip-tool
gn gen --check --fail-on-unused-args {out}/android-arm-chip-tool '--args=target_os="android" target_cpu="arm" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_use_clusters_for_ip_commissioning="true"'

Expand Down Expand Up @@ -248,6 +260,9 @@ gn gen --check --fail-on-unused-args --root={root}/examples/lighting-app/linux '
# Building ameba-amebad-all-clusters
ninja -C {out}/ameba-amebad-all-clusters

# Building APP android-androidstudio-chip-tool
{root}/src/android/CHIPTool/gradlew -p {root}/src/android/CHIPTool -PmatterBuildSrcDir={out}/android-androidstudio-chip-tool -PmatterSdkSourceBuild=true assembleDebug

# Building JNI android-arm-chip-tool
ninja -C {out}/android-arm-chip-tool

Expand Down

0 comments on commit 30f7de7

Please sign in to comment.