Skip to content

Commit

Permalink
[1.0 Cherrypick] - genio file naming, telink example, increase -Xmx o…
Browse files Browse the repository at this point in the history
…n 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 <[email protected]>
  • Loading branch information
cpagravel and andy31415 authored Sep 30, 2022
1 parent 4f4d148 commit 6c34fa8
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 24 deletions.
2 changes: 1 addition & 1 deletion examples/tv-app/android/App/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-casting-app/android/App/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scripts/build/builders/genio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
21 changes: 13 additions & 8 deletions scripts/build/builders/telink.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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 {
Expand Down
27 changes: 18 additions & 9 deletions scripts/build/testdata/build_all_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/android/CHIPTest/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/android/CHIPTool/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
matterSourceBuildAbiFilters=arm64-v8a

0 comments on commit 6c34fa8

Please sign in to comment.