Skip to content

Commit

Permalink
clean up dagger and android
Browse files Browse the repository at this point in the history
fix buidl files
add specific ndk version
  • Loading branch information
restingbull committed Aug 2, 2024
1 parent 875e686 commit 32a52c0
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 59 deletions.
5 changes: 2 additions & 3 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ matrix:
- ubuntu1804
- macos
# - windows re-enable when rules_bazel_integration_test can support custom test runner on windows.
# C:\b\ufjgchrk\execroot\_main\bazel-out\x64_windows-fastbuild\bin\examples\android_test_bazel_6_4_0: line 68: /c/b/ufjgchrk/execroot/_main/bazel-out/x64_windows-fastbuild/bin/examples/android_test_bazel_6_4_0.exe.runfiles/_main/src/main/kotlin/io/bazel/kotlin/test/BazelIntegrationTestRunner: No such file or directory
test_flags:
- ["--enable_bzlmod=true"]
- ["--enable_bzlmod=false"]
Expand All @@ -21,15 +20,15 @@ buildifier:
warnings: "-confusing-name,-constant-glob,-duplicated-name,-function-docstring,-function-docstring-args,-function-docstring-header,-module-docstring,-name-conventions,-no-effect,-constant-glob,-provider-params,-print,-rule-impl-return,-bzl-visibility,-unnamed-macro,-uninitialized,-unreachable"
tasks:
unittests:
name: "Unittests ${{ test_flags }}"
name: "Unit Tests"
platform: ${{ unittest_platform }}
build_flags: ${{ test_flags }}
test_flags: ${{ test_flags }}
test_targets:
- "//:all_tests"
build_targets:
- "//:rules_kotlin_release"
bazel_integration_tests:
integration_tests:
name: "Integration Tests"
platform: ${{ integration_platform }}
test_flags:
Expand Down
42 changes: 0 additions & 42 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,42 +0,0 @@
examples/jetpack_compose/app
examples/jetpack_compose/compose-ui
examples/jetpack_compose/stub
examples/ksp/third_party
examples/dagger/third_party
examples/dagger/src
examples/plugin/src
examples/trivial/app
examples/android/libKtAndroid
examples/android/app
examples/android/exclude
examples/android/bzl
examples/android/components
examples/android/third_party
examples/android/libJava
examples/android/libAndroid
examples/deps/libKtAndroid1
examples/deps/libKt2
examples/deps/libKt3
examples/deps/libKt4
examples/deps/libAndroid2
examples/deps/libJava1
examples/deps/libAndroid3
examples/deps/libAndroid4
examples/deps/bzl
examples/deps/libKt1
examples/deps/libKtAndroid2
examples/deps/libKtAndroid4
examples/deps/libKtAndroid3
examples/deps/libJava2
examples/deps/libAndroid1
examples/deps/libJava3
examples/deps/libJava4
examples/multiplex
examples/multiplex/exclude
examples/multiplex/src
examples/anvil/app
examples/anvil/library
examples/anvil/third_party
examples/anvil/repro
examples/anvil/scopes
examples/associates/projects
2 changes: 1 addition & 1 deletion examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ genrule(
tags = [],
test_runner = "//src/main/kotlin/io/bazel/kotlin/test:BazelIntegrationTestRunner",
workspace_files = glob(
["%s/**/*" % example],
["%s/**/**" % example],
# exclude any bazel directories if existing
exclude = ["%s/bazel-*/**" % example],
),
Expand Down
9 changes: 9 additions & 0 deletions examples/android/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,13 @@ load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")

robolectric_repositories()

http_archive(
name = "rules_android_ndk",
sha256 = "65aedff0cd728bee394f6fb8e65ba39c4c5efb11b29b766356922d4a74c623f5",
strip_prefix = "rules_android_ndk-0.1.2",
url = "https://github.com/bazelbuild/rules_android_ndk/releases/download/v0.1.2/rules_android_ndk-v0.1.2.tar.gz",
)

load("@rules_android_ndk//:rules.bzl", "android_ndk_repository")

android_ndk_repository(name = "androidndk")
15 changes: 12 additions & 3 deletions examples/anvil/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ http_archive(
url = "https://github.com/bazelbuild/rules_kotlin/releases/download/v1.9.5/rules_kotlin-v1.9.5.tar.gz",
)

load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions")

kotlin_repositories()

load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")

kt_register_toolchains()

load("@rules_kotlin//src/main/starlark/core/repositories:versions.bzl", "versions")

http_archive(
name = "rules_android",
sha256 = versions.ANDROID.SHA,
Expand All @@ -27,8 +25,19 @@ load("@rules_android//android:rules.bzl", "android_sdk_repository")

android_sdk_repository(name = "androidsdk")

http_archive(
name = "rules_android_ndk",
sha256 = "65aedff0cd728bee394f6fb8e65ba39c4c5efb11b29b766356922d4a74c623f5",
strip_prefix = "rules_android_ndk-0.1.2",
url = "https://github.com/bazelbuild/rules_android_ndk/releases/download/v0.1.2/rules_android_ndk-v0.1.2.tar.gz",
)

load("@rules_android_ndk//:rules.bzl", "android_ndk_repository")

android_ndk_repository(name = "androidndk")

register_toolchains("@androidndk//:all")

# Skylib, for build_test, so don't bother initializing the unit test infrastructure.
http_archive(
name = "bazel_skylib",
Expand Down
1 change: 0 additions & 1 deletion examples/dagger/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_java//java:defs.bzl", "java_binary")
load("@rules_kotlin//kotlin:core.bzl", "define_kt_toolchain")
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

Expand Down
22 changes: 16 additions & 6 deletions examples/dagger/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,26 @@ http_archive(
url = "https://github.com/bazelbuild/rules_kotlin/releases/download/v1.9.5/rules_kotlin-v1.9.5.tar.gz",
)

load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions")

versions.use_repository(
name = "rules_java",
rule = http_archive,
version = versions.RULES_JAVA,
)

load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")

rules_java_dependencies()

rules_java_toolchains()

kotlin_repositories()

load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")

kt_register_toolchains()

load("@rules_kotlin//src/main/starlark/core/repositories:versions.bzl", "versions")

http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
Expand All @@ -30,9 +40,9 @@ load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
artifacts = [
"com.google.dagger:dagger:2.45",
"com.google.dagger:dagger-compiler:2.45",
"com.google.dagger:dagger-producers:2.45",
"com.google.dagger:dagger:2.51.1",
"com.google.dagger:dagger-compiler:2.51.1",
"com.google.dagger:dagger-producers:2.51.1",
"javax.inject:javax.inject:1",
"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2",
],
Expand Down
2 changes: 0 additions & 2 deletions examples/dagger/third_party/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
load("@rules_java//java:defs.bzl", "java_library", "java_plugin")

java_plugin(
name = "dagger_component_plugin",
generates_api = True,
Expand Down
9 changes: 8 additions & 1 deletion scripts/install_android_sdk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ if which brew; then
brew install --cask android-commandlinetools
sudo mkdir /usr/local/android-sdk
sudo chown "$USER" /usr/local/android-sdk
sdkmanager --sdk_root=/usr/local/android-sdk "platform-tools" "platforms;android-33" "platforms;android-31" "build-tools;33.0.0" "emulator" "build-tools;30.0.3" "ndk-bundle"
sdkmanager --sdk_root=/usr/local/android-sdk \
"platform-tools" \
"platforms;android-33" \
"platforms;android-31" \
"build-tools;33.0.0" \
"emulator" \
"build-tools;30.0.3" \
"ndk;27.0.12077973"
else
echo "home brew not installed, unsupported. Here is a chance to improve the script!"
fi

0 comments on commit 32a52c0

Please sign in to comment.