From 6c34fa85ad87444cacc85c2d141aa2825a7b52ff Mon Sep 17 00:00:00 2001 From: cpagravel Date: Fri, 30 Sep 2022 10:36:20 -0700 Subject: [PATCH] [1.0 Cherrypick] - genio file naming, telink example, increase -Xmx on Android builds (#22977) * Increase -Xmx for android builds from 2G to 4G (#22910) * Fix telink examples on vscode image (#22911) * Fix telink builds on vscode: force more env variables set * Fix unit tests * Fix file naming for genio (#22918) Co-authored-by: Andrei Litvin --- examples/tv-app/android/App/gradle.properties | 2 +- .../android/App/gradle.properties | 2 +- scripts/build/builders/genio.py | 4 +-- scripts/build/builders/telink.py | 21 +++++++++------ .../build/testdata/build_all_except_host.txt | 27 ++++++++++++------- src/android/CHIPTest/gradle.properties | 2 +- src/android/CHIPTool/gradle.properties | 4 +-- 7 files changed, 38 insertions(+), 24 deletions(-) diff --git a/examples/tv-app/android/App/gradle.properties b/examples/tv-app/android/App/gradle.properties index e94cae88f85eaa..7357abbe5e28e8 100644 --- a/examples/tv-app/android/App/gradle.properties +++ b/examples/tv-app/android/App/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/examples/tv-casting-app/android/App/gradle.properties b/examples/tv-casting-app/android/App/gradle.properties index d47c2f04446cf6..9bf7e81826e3d7 100644 --- a/examples/tv-casting-app/android/App/gradle.properties +++ b/examples/tv-casting-app/android/App/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/scripts/build/builders/genio.py b/scripts/build/builders/genio.py index 2262cfad26f19c..ce099a2504919e 100755 --- a/scripts/build/builders/genio.py +++ b/scripts/build/builders/genio.py @@ -19,9 +19,9 @@ def ExampleName(self): def AppNamePrefix(self): if self == GenioApp.LIGHT: - return 'chip-genio-lighting-app-example' + return 'chip-mt793x-lighting-app-example' elif self == GenioApp.SHELL: - return 'chip-genio-shell-example' + return 'chip-mt793x-shell-example' else: raise Exception('Unknown app type: %r' % self) diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py index 728d0dfb8338a9..8ec841285175f1 100644 --- a/scripts/build/builders/telink.py +++ b/scripts/build/builders/telink.py @@ -67,22 +67,26 @@ def __init__(self, self.app = app self.board = board - def generate(self): - if os.path.exists(self.output_dir): - return - + def get_cmd_prefixes(self): if not self._runner.dry_run: # Zephyr base if 'TELINK_ZEPHYR_BASE' not in os.environ: raise Exception("Telink builds require TELINK_ZEPHYR_BASE") - cmd = 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"\n' + cmd = 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr\n' + cmd += 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"\n' if 'TELINK_ZEPHYR_SDK_DIR' in os.environ: cmd += 'export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"\n' + return cmd + + def generate(self): + if os.path.exists(self.output_dir): + return + + cmd = self.get_cmd_prefixes() cmd += ''' -export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {outdir} -b {board} {sourcedir} '''.format( @@ -97,8 +101,9 @@ def generate(self): def _build(self): logging.info('Compiling Telink at %s', self.output_dir) - self._Execute(['ninja', '-C', self.output_dir], - title='Building ' + self.identifier) + cmd = self.get_cmd_prefixes() + ("ninja -C %s" % self.output_dir) + + self._Execute(['bash', '-c', cmd], title='Building ' + self.identifier) def build_outputs(self): return { diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index fdcc58923d1dad..194d14ecf4fb69 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -1163,23 +1163,23 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/shell/qpg '--args=qpg_target_ic="qpg6105"' {out}/qpg-shell # Generating telink-tlsr9518adk80d-light -bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" -export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {out}/telink-tlsr9518adk80d-light -b tlsr9518adk80d {root}/examples/lighting-app/telink' # Generating telink-tlsr9518adk80d-light-switch -bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" -export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {out}/telink-tlsr9518adk80d-light-switch -b tlsr9518adk80d {root}/examples/light-switch-app/telink' # Generating telink-tlsr9518adk80d-ota-requestor -bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" -export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {out}/telink-tlsr9518adk80d-ota-requestor -b tlsr9518adk80d {root}/examples/ota-requestor-app/telink' @@ -2402,13 +2402,22 @@ ninja -C {out}/qpg-persistent-storage ninja -C {out}/qpg-shell # Building telink-tlsr9518adk80d-light -ninja -C {out}/telink-tlsr9518adk80d-light +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" +ninja -C {out}/telink-tlsr9518adk80d-light' # Building telink-tlsr9518adk80d-light-switch -ninja -C {out}/telink-tlsr9518adk80d-light-switch +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" +ninja -C {out}/telink-tlsr9518adk80d-light-switch' # Building telink-tlsr9518adk80d-ota-requestor -ninja -C {out}/telink-tlsr9518adk80d-ota-requestor +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" +ninja -C {out}/telink-tlsr9518adk80d-ota-requestor' # Building tizen-arm-all-clusters ninja -C {out}/tizen-arm-all-clusters diff --git a/src/android/CHIPTest/gradle.properties b/src/android/CHIPTest/gradle.properties index 3026069c70e98f..a85d072fd2e1ed 100644 --- a/src/android/CHIPTest/gradle.properties +++ b/src/android/CHIPTest/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/src/android/CHIPTool/gradle.properties b/src/android/CHIPTool/gradle.properties index 164a67d7e5fcd2..71f72db8c81ef2 100644 --- a/src/android/CHIPTool/gradle.properties +++ b/src/android/CHIPTool/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects @@ -28,4 +28,4 @@ matterBuildSrcDir=../../../../out/android_arm64 # Semicolon-separated ABI filter list for building from source (aka IDE build). # Has no effect if matterSdkSourceBuild is false or matterBuildSrcDir is empty. # See https://developer.android.com/ndk/guides/abis#sa for a list of ABIs. -matterSourceBuildAbiFilters=arm64-v8a \ No newline at end of file +matterSourceBuildAbiFilters=arm64-v8a