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

Fix CI #1

Merged
merged 16 commits into from
May 4, 2024
Merged
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: CI

on:
push:
branches: "*"
pull_request:
branches: [ "master" ]

Expand Down
146 changes: 66 additions & 80 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
exports_files(["LICENSE"])
load("@rules_jvm_external//:defs.bzl", "artifact")

exports_files([
"LICENSE",
".blazeproject",
"WORKSPACE",
])

MANIFEST = "src/main/AndroidManifest.xml"

MANIFEST_DEBUG = "src/main/AndroidManifestDebug.xml"

PACKAGE = "com.afwsamples.testdpc"

aar_import(
name = "setupdesign",
aar = "lib/setupdesign.aar",
deps = [
":setupdesign_strings",
":setupcompat",
"@maven//:com_google_android_material_material",
],
)

aar_import(
name = "setupcompat",
aar = "lib/setupcompat.aar",
)

aar_import(
name = "setupdesign_strings",
aar = "lib/strings.aar",
)

android_library(
name = "setupdesign_deps",
exports = [
":setupdesign",
":setupcompat"
],
)

android_library(
name = "androidx_deps",
exports = [
"@maven//:androidx_annotation_annotation",
"@maven//:androidx_appcompat_appcompat",
"@maven//:androidx_collection_collection",
"@maven//:androidx_core_core",
"@maven//:androidx_enterprise_enterprise_feedback",
"@maven//:androidx_legacy_legacy_support_v13",
Expand All @@ -48,7 +27,6 @@ android_library(
"@maven//:androidx_localbroadcastmanager_localbroadcastmanager",
"@maven//:androidx_preference_preference",
"@maven//:androidx_recyclerview_recyclerview",
"@maven//:androidx_collection_collection"
],
)

Expand Down Expand Up @@ -118,7 +96,8 @@ android_library(
":androidx_deps",
":bouncycastle_deps",
":guava_deps",
":setupdesign_deps",
"@setupdesign//:setupdesign",
"@setupcompat//:setupcompat",
],
)

Expand All @@ -136,59 +115,66 @@ java_library(
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/Utils.java"],
)


android_local_test(
name = "PermissionsHelperTest",
srcs = ["src/test/java/com/afwsamples/testdpc/common/PermissionsHelperTest.java"],
manifest = MANIFEST,
deps = [
":testdpc_lib",
":test_deps"
],
custom_package = "com.afwsamples.testdpc.common"
name = "PermissionsHelperTest",
srcs = ["src/test/java/com/afwsamples/testdpc/common/PermissionsHelperTest.java"],
manifest = MANIFEST,
deps = [
":test_deps",
":testdpc_lib",
"@robolectric//bazel:android-all",
],
custom_package = "com.afwsamples.testdpc.common"
)

android_local_test(
name = "AppStatesServiceTest",
srcs = ["src/test/java/com/afwsamples/testdpc/feedback/AppStatesServiceTest.java"],
manifest = MANIFEST,
deps = [
":testdpc_lib",
":androidx_deps",
":test_deps"
],
custom_package = "com.afwsamples.testdpc.feedback"
name = "AppStatesServiceTest",
srcs = ["src/test/java/com/afwsamples/testdpc/feedback/AppStatesServiceTest.java"],
manifest = MANIFEST,
deps = [
":androidx_deps",
":test_deps",
":testdpc_lib",
"@robolectric//bazel:android-all",
],
custom_package = "com.afwsamples.testdpc.feedback"
)

android_local_test(
name = "WifiConfigUtilTest",
srcs = ["src/test/java/com/afwsamples/testdpc/policy/wifimanagement/WifiConfigUtilTest.java"],
manifest = MANIFEST,
deps = [
":testdpc_lib",
":test_deps"
],
custom_package = "com.afwsamples.testdpc.policy.wifimanagement"
name = "WifiConfigUtilTest",
srcs = ["src/test/java/com/afwsamples/testdpc/policy/wifimanagement/WifiConfigUtilTest.java"],
manifest = MANIFEST,
deps = [
":test_deps",
":testdpc_lib",
"@robolectric//bazel:android-all",
],
custom_package = "com.afwsamples.testdpc.policy.wifimanagement"
)

android_local_test(
name = "GetProvisioningModeActivityTest",
srcs = ["src/test/java/com/afwsamples/testdpc/provision/GetProvisioningModeActivityTest.java"],
manifest = MANIFEST,
deps = [
":testdpc_lib",
":test_deps"
],
custom_package = "com.afwsamples.testdpc.provision"
name = "GetProvisioningModeActivityTest",
srcs = ["src/test/java/com/afwsamples/testdpc/provision/GetProvisioningModeActivityTest.java"],
manifest = MANIFEST,
test_class = "com.afwsamples.testdpc.provision.GetProvisioningModeActivityTest",
deps = [
":test_deps",
":testdpc_lib",
"@maven//:org_robolectric_robolectric",
"@robolectric//bazel:android-all",
],
custom_package = "com.afwsamples.testdpc.provision"
)

java_test(
name = "BooleanParserTest",
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/BooleanParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -197,9 +183,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/ByteParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -208,9 +194,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/CharParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -219,9 +205,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/DoubleParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -230,9 +216,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/FloatParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -241,9 +227,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/IntParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -252,9 +238,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/LongParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -263,9 +249,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/ShortParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -274,9 +260,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/StringParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -285,9 +271,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/CustomParserTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -296,9 +282,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/CallbackTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -307,9 +293,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/HelpTextGenerationTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -318,9 +304,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/InvalidCallsTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -329,9 +315,9 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/ParamTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)

Expand All @@ -340,8 +326,8 @@ java_test(
size = "small",
srcs = ["src/test/java/com/afwsamples/testdpc/util/flags/RegistrationTest.java"],
deps = [
":test_deps",
":test_utils",
":testdpc_lib",
":test_deps"
],
)
)
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Provisioning

You can find various kinds of provisioning methods [here](https://developers.google.com/android/work/prov-devices#Key_provisioning_differences_across_android_releases). Let's take a few of them as an example.

#### QR code provisioing (Device Owner N+ only) ####
#### QR code provisioning (Device Owner N+ only) ####
1. Factory reset your device and tap the welcome screen in setup wizard 6 times.
2. The setup wizard prompts the user to connect to the Internet so the setup wizard can download a QR code reader.
3. Modify (if needed) and scan [this QR code] (http://down-box.appspot.com/qr/nQB0tw7b).
Expand Down Expand Up @@ -68,7 +68,7 @@ Android Studio import
---------------------

To import this repository in Android Studio, you need to use the
[Bazel for IntelliJ](https://plugins.jetbrains.com/plugin/8609-bazel-for-intellij)
[Bazel for Android Studio](https://plugins.jetbrains.com/plugin/9185-bazel-for-android-studio)
Plugin.

When importing the project you have to select the folder containing the Bazel's
Expand All @@ -78,11 +78,20 @@ this repository.

Once Bazel has complete the import operation and the first sync of the
project, you can create a "Run Configuration".
Select "Bazel Command" as Configuration type and add `//:testdpc` as
Select "Bazel Command" as Configuration type and add `//:testdpc` as
"target expression".

You can now run the project from inside Android Studio.


Building with Bazel
-------------------

The repository includes a `build.sh` script to build the application. The required
[setupdesign library](https://android.googlesource.com/platform/external/setupdesign/+/refs/heads/main)
is now imported and patched dynamically using the command line utility `ed`. This needs to be
available on the path to successfully build the project.

Support
-------

Expand Down
Loading
Loading