Skip to content

Commit

Permalink
[Ameba]Update scripts/build (#12740)
Browse files Browse the repository at this point in the history
  • Loading branch information
pankore authored and pull[bot] committed Mar 31, 2022
1 parent f63b938 commit d8960e1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
15 changes: 9 additions & 6 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

class Target:
"""Represents a build target:
Has a name identifier plus parameters on how to build it (what
builder class to use and what arguments are required to produce
the specified build)
Expand All @@ -56,7 +55,6 @@ def Clone(self):

def Extend(self, suffix, **kargs):
"""Creates a clone of the current object extending its build parameters.
Arguments:
suffix: appended with a "-" as separator to the clone name
**kargs: arguments needed to produce the new build variant
Expand Down Expand Up @@ -320,6 +318,13 @@ def InfineonTargets():
yield target.Extend('p6-light', board=InfineonBoard.P6BOARD, app=InfineonApp.LIGHT)


def AmebaTargets():
ameba_target = Target('ameba', AmebaBuilder)

yield ameba_target.Extend('amebad-all-clusters', board=AmebaBoard.AMEBAD, app=AmebaApp.ALL_CLUSTERS)
yield ameba_target.Extend('amebad-light', board=AmebaBoard.AMEBAD, app=AmebaApp.LIGHT)


ALL = []

target_generators = [
Expand All @@ -329,8 +334,8 @@ def InfineonTargets():
NrfTargets(),
AndroidTargets(),
MbedTargets(),
InfineonTargets()

InfineonTargets(),
AmebaTargets()
]

for generator in target_generators:
Expand All @@ -343,8 +348,6 @@ def InfineonTargets():
board=TelinkBoard.TLSR9518ADK80D, app=TelinkApp.LIGHT))
ALL.append(Target('tizen-arm-light', TizenBuilder,
board=TizenBoard.ARM, app=TizenApp.LIGHT))
ALL.append(Target('ameba-amebad-all-clusters', AmebaBuilder,
board=AmebaBoard.AMEBAD, app=AmebaApp.ALL_CLUSTERS))

# have a consistent order overall
ALL.sort(key=lambda t: t.name)
11 changes: 8 additions & 3 deletions scripts/build/builders/ameba.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,23 @@ class AmebaBoard(Enum):

class AmebaApp(Enum):
ALL_CLUSTERS = auto()
LIGHT = auto()

@property
def ExampleName(self):
if self == AmebaApp.ALL_CLUSTERS:
return 'all-clusters-app'
elif self == AmebaApp.LIGHT:
return 'lighting-app'
else:
raise Exception('Unknown app type: %r' % self)

@property
def AppNamePrefix(self):
if self == AmebaApp.ALL_CLUSTERS:
return 'chip-all-clusters-app'
return 'chip-ameba-all-clusters-app'
elif self == AmebaApp.LIGHT:
return 'chip-ameba-lighting-app'
else:
raise Exception('Unknown app type: %r' % self)

Expand All @@ -53,8 +58,8 @@ def __init__(self,
self.app = app

def generate(self):
cmd = '$AMEBA_PATH/project/realtek_amebaD_va0_example/GCC-RELEASE/build.sh %s ninja %s' % (
self.root, self.output_dir)
cmd = '$AMEBA_PATH/project/realtek_amebaD_va0_example/GCC-RELEASE/build.sh %s ninja %s %s' % (
self.root, self.output_dir, self.app.ExampleName)
self._Execute(['bash', '-c', cmd],
title='Generating ' + self.identifier)

Expand Down
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
ameba-amebad-light
android-androidstudio-arm-chip-tool
android-androidstudio-arm64-chip-tool
android-androidstudio-x64-chip-tool
Expand Down
8 changes: 7 additions & 1 deletion scripts/build/testdata/build_all_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
cd "{root}"

# Generating ameba-amebad-all-clusters
bash -c '$AMEBA_PATH/project/realtek_amebaD_va0_example/GCC-RELEASE/build.sh {root} ninja {out}/ameba-amebad-all-clusters'
bash -c '$AMEBA_PATH/project/realtek_amebaD_va0_example/GCC-RELEASE/build.sh {root} ninja {out}/ameba-amebad-all-clusters all-clusters-app'

# Generating ameba-amebad-light
bash -c '$AMEBA_PATH/project/realtek_amebaD_va0_example/GCC-RELEASE/build.sh {root} ninja {out}/ameba-amebad-light lighting-app'

# Generating JARs for Java build rules test
python3 build/chip/java/tests/generate_jars_for_test.py
Expand Down Expand Up @@ -582,6 +585,9 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa
# Building ameba-amebad-all-clusters
ninja -C {out}/ameba-amebad-all-clusters

# Building ameba-amebad-light
ninja -C {out}/ameba-amebad-light

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

Expand Down
1 change: 1 addition & 0 deletions scripts/build/testdata/glob_star_targets_except_host.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ameba-amebad-all-clusters
ameba-amebad-light
android-androidstudio-arm-chip-tool
android-androidstudio-arm64-chip-tool
android-androidstudio-x64-chip-tool
Expand Down

0 comments on commit d8960e1

Please sign in to comment.