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

Revert "Compile android in build_examples.py and move android compilation outside of Github CI" #8928

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,51 @@ jobs:
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build android examples
- name: Build arm libs
timeout-minutes: 2
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --platform android build"
./scripts/examples/android_app.sh
env:
BUILD_TYPE: android_arm
TARGET_CPU: arm
- name: Build arm App
timeout-minutes: 5
run: |
yes | "$ANDROID_HOME"/tools/bin/sdkmanager --licenses
cd src/android/CHIPTool
./gradlew build
env:
BUILD_TYPE: android_arm
TARGET_CPU: arm
- name: Build arm64 libs
timeout-minutes: 2
run: |
./scripts/examples/android_app.sh
env:
BUILD_TYPE: android_arm64
TARGET_CPU: arm64
- name: Build arm64 App
timeout-minutes: 5
run: |
yes | "$ANDROID_HOME"/tools/bin/sdkmanager --licenses
cd src/android/CHIPTool
./gradlew build
env:
BUILD_TYPE: android_arm64
TARGET_CPU: arm64
- name: Build x64 libs
timeout-minutes: 2
run: |
./scripts/examples/android_app.sh
env:
BUILD_TYPE: android_x64
TARGET_CPU: x64
- name: Build x64 App
timeout-minutes: 5
run: |
yes | "$ANDROID_HOME"/tools/bin/sdkmanager --licenses
cd src/android/CHIPTool
./gradlew build
env:
BUILD_TYPE: android_x64
TARGET_CPU: x64
25 changes: 7 additions & 18 deletions scripts/build/build/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
from typing import Set

from builders.builder import Builder

from builders.android import AndroidBoard, AndroidBuilder
from builders.efr32 import Efr32Builder, Efr32App, Efr32Board
from builders.esp32 import Esp32Builder, Esp32Board, Esp32App
from builders.host import HostBuilder, HostApp
from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder
from builders.qpg import QpgBuilder
from builders.esp32 import Esp32Builder, Esp32Board, Esp32App
from builders.efr32 import Efr32Builder, Efr32App, Efr32Board
from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder

from .targets import Application, Board, Platform

Expand Down Expand Up @@ -86,16 +84,13 @@ def Create(self, runner, __board_key: Board, __app_key: Application,
Platform.QPG: Matcher(QpgBuilder),
Platform.EFR32: Matcher(Efr32Builder),
Platform.NRF: Matcher(NrfConnectBuilder),
Platform.ANDROID: Matcher(AndroidBuilder),
}

# Matrix of what can be compiled and what build options are required
# by such compilation
_MATCHERS[Platform.HOST].AcceptBoard(Board.NATIVE)
_MATCHERS[Platform.HOST].AcceptApplication(
Application.ALL_CLUSTERS, app=HostApp.ALL_CLUSTERS)
_MATCHERS[Platform.HOST].AcceptApplication(
Application.CHIP_TOOL, app=HostApp.CHIP_TOOL)
_MATCHERS[Platform.HOST].AcceptApplication(Application.ALL_CLUSTERS, app=HostApp.ALL_CLUSTERS)
_MATCHERS[Platform.HOST].AcceptApplication(Application.CHIP_TOOL, app=HostApp.CHIP_TOOL)

_MATCHERS[Platform.ESP32].AcceptBoard(Board.DEVKITC, board=Esp32Board.DevKitC)
_MATCHERS[Platform.ESP32].AcceptBoard(Board.M5STACK, board=Esp32Board.M5Stack)
Expand All @@ -119,18 +114,13 @@ def Create(self, runner, __board_key: Board, __app_key: Application,
_MATCHERS[Platform.EFR32].AcceptApplication(
Application.WINDOW_COVERING, app=Efr32App.WINDOW_COVERING)


_MATCHERS[Platform.NRF].AcceptBoard(Board.NRF5340, board=NrfBoard.NRF5340)
_MATCHERS[Platform.NRF].AcceptBoard(Board.NRF52840, board=NrfBoard.NRF52840)
_MATCHERS[Platform.NRF].AcceptApplication(Application.LOCK, app=NrfApp.LOCK)
_MATCHERS[Platform.NRF].AcceptApplication(Application.LIGHT, app=NrfApp.LIGHT)
_MATCHERS[Platform.NRF].AcceptApplication(Application.SHELL, app=NrfApp.SHELL)

_MATCHERS[Platform.ANDROID].AcceptBoard(Board.ARM, board=AndroidBoard.ARM)
_MATCHERS[Platform.ANDROID].AcceptBoard(Board.ARM64, board=AndroidBoard.ARM64)
_MATCHERS[Platform.ANDROID].AcceptBoard(Board.X64, board=AndroidBoard.X64)
_MATCHERS[Platform.ANDROID].AcceptApplication(Application.CHIP_TOOL)


class BuilderFactory:
"""Creates application builders."""

Expand All @@ -150,8 +140,7 @@ def Create(self, platform: Platform, board: Board, app: Application, enable_flas
output_prefix=self.output_prefix)

if builder:
builder.SetIdentifier(platform.name.lower(), board.name.lower(),
app.name.lower())
builder.SetIdentifier(platform.name.lower(), board.name.lower(), app.name.lower())
builder.enable_flashbundle(enable_flashbundle)

return builder
Expand Down
6 changes: 0 additions & 6 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class Platform(IntEnum):
ESP32 = auto()
EFR32 = auto()
NRF = auto()
ANDROID = auto()

@property
def ArgName(self):
Expand Down Expand Up @@ -60,11 +59,6 @@ class Board(IntEnum):
NRF52840 = auto()
NRF5340 = auto()

# Android platform
ARM = auto()
ARM64 = auto()
X64 = auto()

@property
def ArgName(self):
return self.name.lower()
Expand Down
163 changes: 0 additions & 163 deletions scripts/build/builders/android.py

This file was deleted.

59 changes: 1 addition & 58 deletions scripts/build/expected_all_platform_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
gn gen --check --fail-on-unused-args --root={root}/examples/all-clusters-app/linux {out}/{real_platform}-native-all_clusters

# Generating {real_platform}-native-chip_tool
gn gen --check --fail-on-unused-args --root={root}/examples/chip-tool {out}/{real_platform}-native-chip_tool
gn gen --check --fail-on-unused-args --root=/TEST/BUILD/ROOT/examples/chip-tool {out}/{real_platform}-native-chip_tool

# Generating qpg-qpg6100-lock
gn gen --check --fail-on-unused-args --root={root}/examples/lock-app/qpg {out}/qpg-qpg6100-lock
Expand Down Expand Up @@ -76,24 +76,6 @@ bash -c 'source "$ZEPHYR_BASE/zephyr-env.sh";
export GNUARMEMB_TOOLCHAIN_PATH="$PW_PIGWEED_CIPD_INSTALL_DIR";
west build --cmake-only -d {out}/nrf-nrf5340-shell -b nrf5340dk_nrf5340_cpuapp {root}/examples/shell/nrfconnect'

# 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"'

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

# Generating android-arm64-chip_tool
gn gen --check --fail-on-unused-args {out}/android-arm64-chip_tool '--args=target_os="android" target_cpu="arm64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME"'

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

# Generating android-x64-chip_tool
gn gen --check --fail-on-unused-args {out}/android-x64-chip_tool '--args=target_os="android" target_cpu="x64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME"'

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

# Building {real_platform}-native-all_clusters
ninja -C {out}/{real_platform}-native-all_clusters

Expand Down Expand Up @@ -148,43 +130,4 @@ ninja -C {out}/nrf-nrf5340-lock
# Building nrf-nrf5340-shell
ninja -C {out}/nrf-nrf5340-shell

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

# Prepare Native libs android-arm-chip_tool
mkdir -p {root}/src/android/CHIPTool/app/src/main/jniLibs/armeabi-v7a

cp {out}/android-arm-chip_tool/lib/jni/armeabi-v7a/libSetupPayloadParser.so {root}/src/android/CHIPTool/app/src/main/jniLibs/armeabi-v7a/libSetupPayloadParser.so

cp {out}/android-arm-chip_tool/lib/jni/armeabi-v7a/libCHIPController.so {root}/src/android/CHIPTool/app/src/main/jniLibs/armeabi-v7a/libCHIPController.so

# Building APP android-arm-chip_tool
{root}/src/android/CHIPTool/gradlew -p {root}/src/android/CHIPTool -PchipSdkJarDir={out}/android-arm-chip_tool/lib -PbuildDir={out}/android-arm-chip_tool build

# Building JNI android-arm64-chip_tool
ninja -C {out}/android-arm64-chip_tool

# Prepare Native libs android-arm64-chip_tool
mkdir -p {root}/src/android/CHIPTool/app/src/main/jniLibs/arm64-v8a

cp {out}/android-arm64-chip_tool/lib/jni/arm64-v8a/libSetupPayloadParser.so {root}/src/android/CHIPTool/app/src/main/jniLibs/arm64-v8a/libSetupPayloadParser.so

cp {out}/android-arm64-chip_tool/lib/jni/arm64-v8a/libCHIPController.so {root}/src/android/CHIPTool/app/src/main/jniLibs/arm64-v8a/libCHIPController.so

# Building APP android-arm64-chip_tool
{root}/src/android/CHIPTool/gradlew -p {root}/src/android/CHIPTool -PchipSdkJarDir={out}/android-arm64-chip_tool/lib -PbuildDir={out}/android-arm64-chip_tool build

# Building JNI android-x64-chip_tool
ninja -C {out}/android-x64-chip_tool

# Prepare Native libs android-x64-chip_tool
mkdir -p {root}/src/android/CHIPTool/app/src/main/jniLibs/x86_64

cp {out}/android-x64-chip_tool/lib/jni/x86_64/libSetupPayloadParser.so {root}/src/android/CHIPTool/app/src/main/jniLibs/x86_64/libSetupPayloadParser.so

cp {out}/android-x64-chip_tool/lib/jni/x86_64/libCHIPController.so {root}/src/android/CHIPTool/app/src/main/jniLibs/x86_64/libCHIPController.so

# Building APP android-x64-chip_tool
{root}/src/android/CHIPTool/gradlew -p {root}/src/android/CHIPTool -PchipSdkJarDir={out}/android-x64-chip_tool/lib -PbuildDir={out}/android-x64-chip_tool build


Loading