Skip to content

Commit

Permalink
Move android examples from src/android to examples/android (#22946)
Browse files Browse the repository at this point in the history
* Move android examples from src/android to examples/android

* Update docs

Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
yufengwangca and andy31415 authored Sep 29, 2022
1 parent 852c879 commit a334714
Show file tree
Hide file tree
Showing 185 changed files with 75 additions and 81 deletions.
3 changes: 0 additions & 3 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ labelPRBasedOnFilePath:
ble:
- src/ble/*

android:
- src/android/*

app:
- src/app/*

Expand Down
4 changes: 0 additions & 4 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ ble:
- src/ble/*
- src/ble/**/*

android:
- src/android/*
- src/android/**/*

app:
- src/app/*
- src/app/**/*
Expand Down
2 changes: 1 addition & 1 deletion .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ exclude:
- "third_party/bluez/repo/**/*"
- "third_party/cirque/repo/**/*"
- "third_party/nanopb/repo/**/*"
- "src/android/CHIPTool/gradlew" # gradle wrapper generated file
- "examples/android/CHIPTool/gradlew" # gradle wrapper generated file
- "third_party/android_deps/gradlew" # gradle wrapper generated file
- "src/controller/python/chip/clusters/Objects.py" # generated file, no point to restyle
- "src/controller/python/chip/clusters/CHIPClusters.py" # generated file, no point to restyle
Expand Down
15 changes: 8 additions & 7 deletions docs/guides/android_building.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ There are following Apps on Android

## Source files

You can find source files of the Android applications in the `src/android/`
You can find source files of the Android applications in the `examples/android/`
directory.

<hr>
Expand Down Expand Up @@ -169,7 +169,7 @@ which allows us to directly edit core Matter code in-IDE.
2. Modify the `matterSdkSourceBuild` variable to true, `matterBuildSrcDir` point
to the appropriate output directory (e.g. `../../../../out/android_arm64`),
and `matterSourceBuildAbiFilters` to the desired ABIs in
[src/android/CHIPTool/gradle.properties](https://github.com/project-chip/connectedhomeip/blob/master/src/android/CHIPTool/gradle.properties)
[examples/android/CHIPTool/gradle.properties](https://github.com/project-chip/connectedhomeip/blob/master/examples/android/CHIPTool/gradle.properties)

3) Open the project in Android Studio and run **File -> Sync Project with Gradle
Files**.
Expand All @@ -180,21 +180,22 @@ which allows us to directly edit core Matter code in-IDE.
- Run the following command in the command line:

```shell
cd src/android/CHIPTool
cd examples/android/CHIPTool
./gradlew build
```

The debug Android package `app-debug.apk` will be generated at
`src/android/CHIPTool/app/build/outputs/apk/debug/`, and can be installed with
`examples/android/CHIPTool/app/build/outputs/apk/debug/`, and can be installed
with

```shell
adb install src/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk
adb install examples/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk
```

or

```shell
(cd src/android/CHIPTool && ./gradlew installDebug)
(cd examples/android/CHIPTool && ./gradlew installDebug)
```

<a name="building-chiptest-scripts"></a>
Expand All @@ -209,5 +210,5 @@ Currently, the CHIPTest can only be built from scripts. The steps are similar to
```

You can modify the `matterUTestLib` variable to the test lib in
[src/android/CHIPTest/gradle.properties](https://github.com/project-chip/connectedhomeip/blob/master/src/android/CHIPTest/gradle.properties)
[examples/android/CHIPTest/gradle.properties](https://github.com/project-chip/connectedhomeip/blob/master/examples/android/CHIPTest/gradle.properties)
to change target to test.
2 changes: 1 addition & 1 deletion docs/guides/esp32/build_app_and_commission.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Below apps can be used for commissioning the application running on ESP32:
- [Python Based Device Controller](https://github.com/project-chip/connectedhomeip/tree/master/src/controller/python)
- [Standalone chip-tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool)
- [iOS chip-tool App](https://github.com/project-chip/connectedhomeip/tree/master/src/darwin/CHIPTool)
- [Android chip-tool App](https://github.com/project-chip/connectedhomeip/tree/master/src/android/CHIPTool)
- [Android chip-tool App](https://github.com/project-chip/connectedhomeip/tree/master/examples/android/CHIPTool)
### Building Standalone chip-tool
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/mbedos_commissioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ brightness between 0-255.
If **Lighting LED** is available then brightness change can be observed.

> For more details about Android CHIPTool please visit
> [CHIPTool](../../src/android/CHIPTool/README.md)
> [CHIPTool](../../examples/android/CHIPTool/README.md)
# POSIX CLI CHIPTool

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/nrfconnect_android_commissioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ After building, install the application by completing the following steps:
replaced with the path to the Matter source directory:

```
adb install -r chip-dir/src/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk
adb install -r chip-dir/examples/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk
```

6. Navigate to settings on your smartphone and grant **Camera** and
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/nxp_k32w_android_commissioning.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Commissioning NXP K32W using Android CHIPTool

This article describes how to use
[CHIPTool](../../src/android/CHIPTool/README.md) for Android smartphones to
[CHIPTool](../../examples/android/CHIPTool/README.md) for Android smartphones to
commission an NXP K32W061 DK6 running
[NXP K32W Lock/Light Example Application](../../examples/lock-light-app/k32w/README.md)
onto a CHIP-enabled Thread network.
Expand Down Expand Up @@ -372,7 +372,7 @@ to learn how to build and program the light example onto an K32W061 DK6.
## Building and installing Android CHIPTool
To build the CHIPTool application for your smartphone, read
[Android CHIPTool README](../../src/android/CHIPTool/README.md).
[Android CHIPTool README](../../examples/android/CHIPTool/README.md).
After building, install the application by completing the following steps:
Expand All @@ -393,7 +393,7 @@ After building, install the application by completing the following steps:
replaced with the path to the CHIP source directory:
```
adb install -r chip-dir/src/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk
adb install -r chip-dir/examples/android/CHIPTool/app/build/outputs/apk/debug/app-debug.apk
```
6. Navigate to settings on your smartphone and grant _Camera_ and _Location_
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,6 @@ learn how to use command-line interface of the application.

Read the
[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md)
to see how to use [CHIPTool](../../../src/android/CHIPTool/README.md) for
to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for
Android smartphones to commission and control the application within a
Matter-enabled Thread network.
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,6 @@ learn how to use command-line interface of the application.

Read the
[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md)
to see how to use [CHIPTool](../../../src/android/CHIPTool/README.md) for
to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for
Android smartphones to commission and control the application within a
Matter-enabled Thread network.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/lighting-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ learn how to use command-line interface of the application.

Read the
[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md)
to see how to use [CHIPTool](../../../src/android/CHIPTool/README.md) for
to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for
Android smartphones to commission and control the application within a
Matter-enabled Thread network.

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ learn how to use command-line interface of the application.

Read the
[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md)
to see how to use [CHIPTool](../../../src/android/CHIPTool/README.md) for
to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for
Android smartphones to commission and control the application within a
Matter-enabled Thread network.

Expand Down
2 changes: 1 addition & 1 deletion examples/pump-app/cc13x2x7_26x2x7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Router][ot_border_router_setup].
The first step to bring the Matter device onto the network is to provision it.
Our example accomplishes this with Bluetooth Low Energy (BLE) and the
[CHIPTool](../../../src/android/CHIPTool/README.md) mobile app.
[CHIPTool](../../../examples/android/CHIPTool/README.md) mobile app.
#### Bluetooth LE Advertising
Expand Down
2 changes: 1 addition & 1 deletion examples/pump-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,6 @@ learn how to use command-line interface of the application.

Read the
[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md)
to see how to use [CHIPTool](../../../src/android/CHIPTool/README.md) for
to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for
Android smartphones to commission and control the application within a
Matter-enabled Thread network.
2 changes: 1 addition & 1 deletion examples/pump-controller-app/cc13x2x7_26x2x7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Router][ot_border_router_setup].
The first step to bring the Matter device onto the network is to provision it.
Our example accomplishes this with Bluetooth Low Energy (BLE) and the
[CHIPTool](../../../src/android/CHIPTool/README.md) mobile app.
[CHIPTool](../../../examples/android/CHIPTool/README.md) mobile app.
#### Bluetooth LE Advertising
Expand Down
2 changes: 1 addition & 1 deletion examples/pump-controller-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,6 @@ learn how to use command-line interface of the application.

Read the
[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md)
to see how to use [CHIPTool](../../../src/android/CHIPTool/README.md) for
to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for
Android smartphones to commission and control the application within a
CHIP-enabled Thread network.
2 changes: 1 addition & 1 deletion examples/window-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ learn how to use command-line interface of the application.

Read the
[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md)
to see how to use [CHIPTool](../../../src/android/CHIPTool/README.md) for
to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for
Android smartphones to commission and control the application within a
Matter-enabled Thread network.

Expand Down
14 changes: 7 additions & 7 deletions scripts/build/builders/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ def copyToSrcAndroid(self):
# when using dry run.
jnilibs_dir = os.path.join(
self.root,
"src/android/",
"examples/android/",
self.app.AppName(),
"app/libs/jniLibs",
self.board.AbiName(),
)
libs_dir = os.path.join(
self.root, "src/android/", self.app.AppName(), "app/libs"
self.root, "examples/android/", self.app.AppName(), "app/libs"
)
self._Execute(
["mkdir", "-p", jnilibs_dir], title="Prepare Native libs " + self.identifier
Expand Down Expand Up @@ -272,9 +272,9 @@ def gradlewBuildSrcAndroid(self):
# App compilation
self._Execute(
[
"%s/src/android/%s/gradlew" % (self.root, self.app.AppName()),
"%s/examples/android/%s/gradlew" % (self.root, self.app.AppName()),
"-p",
"%s/src/android/%s" % (self.root, self.app.AppName()),
"%s/examples/android/%s" % (self.root, self.app.AppName()),
"-PmatterBuildSrcDir=%s" % self.output_dir,
"-PmatterSdkSourceBuild=false",
"-PbuildDir=%s" % self.output_dir,
Expand Down Expand Up @@ -393,9 +393,9 @@ def _build(self):
# TODO: Android Gradle with module and -PbuildDir= will caused issue, remove -PbuildDir=
self._Execute(
[
"%s/src/android/%s/gradlew" % (self.root, self.app.AppName()),
"%s/examples/android/%s/gradlew" % (self.root, self.app.AppName()),
"-p",
"%s/src/android/%s" % (self.root, self.app.AppName()),
"%s/examples/android/%s" % (self.root, self.app.AppName()),
"-PmatterBuildSrcDir=%s" % self.output_dir,
"-PmatterSdkSourceBuild=true",
"-PmatterSourceBuildAbiFilters=%s" % self.board.AbiName(),
Expand Down Expand Up @@ -423,7 +423,7 @@ def build_outputs(self):
self.app.AppName()
+ "-debug.apk": os.path.join(
self.root,
"src/android",
"examples/android",
self.app.AppName(),
"app/build/outputs/apk/debug/app-debug.apk",
)
Expand Down
Loading

0 comments on commit a334714

Please sign in to comment.