Skip to content

Commit

Permalink
Fix up android related examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
restingbull committed Jun 23, 2024
1 parent 75e058d commit 128ab8b
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 7 deletions.
1 change: 1 addition & 0 deletions bit-ignore.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
common --deleted_packages=examples/jetpack_compose,examples/jetpack_compose/app,examples/jetpack_compose/compose-ui,examples/jetpack_compose/stub,examples/jetpack_compose/stub/sun,examples/jetpack_compose/stub/sun/misc,examples/ksp,examples/ksp/third_party,examples/dagger,examples/dagger/third_party,examples/dagger/src,examples/dagger/src/coffee,examples/plugin,examples/plugin/src,examples/plugin/src/parcelize,examples/plugin/src/noarg,examples/plugin/src/serialization,examples/plugin/src/allopen,examples/plugin/src/sam_with_receiver,examples/plugin/src/allopennoarg,examples/trivial,examples/trivial/app,examples/android,examples/android/libKtAndroid,examples/android/libKtAndroid/res,examples/android/libKtAndroid/res/values,examples/android/libKtAndroid/res2,examples/android/libKtAndroid/res2/values,examples/android/libKtAndroid/src,examples/android/libKtAndroid/src/test,examples/android/libKtAndroid/src/test/java,examples/android/libKtAndroid/src/test/java/examples,examples/android/libKtAndroid/src/test/java/examples/android,examples/android/libKtAndroid/src/test/java/examples/android/lib,examples/android/libKtAndroid/src/main,examples/android/libKtAndroid/src/main/java,examples/android/libKtAndroid/src/main/java/examples,examples/android/libKtAndroid/src/main/java/examples/android,examples/android/libKtAndroid/src/main/java/examples/android/lib,examples/android/app,examples/android/app/src,examples/android/app/src/main,examples/android/bzl,examples/android/components,examples/android/third_party,examples/android/libJava,examples/android/libJava/src,examples/android/libJava/src/main,examples/android/libJava/src/main/java,examples/android/libJava/src/main/java/examples,examples/android/libJava/src/main/java/examples/java,examples/android/libJava/src/main/java/examples/java/lib,examples/android/libAndroid,examples/android/libAndroid/res,examples/android/libAndroid/res/values-ja,examples/android/libAndroid/res/values-en-rCA,examples/android/libAndroid/res/values,examples/android/libAndroid/res/values-fr-rCA,examples/android/libAndroid/res/values-en-rGB,examples/android/libAndroid/res/values-en-rAU,examples/android/libAndroid/res/values-es,examples/android/libAndroid/src,examples/android/libAndroid/src/main,examples/android/libAndroid/src/main/java,examples/android/libAndroid/src/main/java/examples,examples/android/libAndroid/src/main/java/examples/android,examples/android/libAndroid/src/main/java/examples/android/lib2,examples/android/libAndroid/src/main/kotlin,examples/android/libAndroid/src/main/kotlin/examples,examples/android/libAndroid/src/main/kotlin/examples/android,examples/android/libAndroid/src/main/kotlin/examples/android/lib2,examples/deps,examples/deps/libKtAndroid1,examples/deps/libKtAndroid1/src,examples/deps/libKtAndroid1/src/main,examples/deps/libKtAndroid1/src/main/res,examples/deps/libKtAndroid1/src/main/res/values,examples/deps/libKtAndroid1/src/main/kt,examples/deps/libKtAndroid1/src/main/kt/examples,examples/deps/libKtAndroid1/src/main/kt/examples/deps,examples/deps/libKt2,examples/deps/libKt2/src,examples/deps/libKt2/src/main,examples/deps/libKt2/src/main/kt,examples/deps/libKt2/src/main/kt/examples,examples/deps/libKt2/src/main/kt/examples/deps,examples/deps/libKt3,examples/deps/libKt3/src,examples/deps/libKt3/src/main,examples/deps/libKt3/src/main/kt,examples/deps/libKt3/src/main/kt/examples,examples/deps/libKt3/src/main/kt/examples/deps,examples/deps/libKt4,examples/deps/libKt4/src,examples/deps/libKt4/src/main,examples/deps/libKt4/src/main/kt,examples/deps/libKt4/src/main/kt/examples,examples/deps/libKt4/src/main/kt/examples/deps,examples/deps/libAndroid2,examples/deps/libAndroid2/src,examples/deps/libAndroid2/src/main,examples/deps/libAndroid2/src/main/res,examples/deps/libAndroid2/src/main/res/values,examples/deps/libAndroid2/src/main/java,examples/deps/libAndroid2/src/main/java/examples,examples/deps/libAndroid2/src/main/java/examples/deps,examples/deps/libJava1,examples/deps/libJava1/src,examples/deps/libJava1/src/main,examples/deps/libJava1/src/main/java,examples/deps/libJava1/src/main/java/examples,examples/deps/libJava1/src/main/java/examples/deps,examples/deps/libAndroid3,examples/deps/libAndroid3/src,examples/deps/libAndroid3/src/main,examples/deps/libAndroid3/src/main/res,examples/deps/libAndroid3/src/main/res/values,examples/deps/libAndroid3/src/main/java,examples/deps/libAndroid3/src/main/java/examples,examples/deps/libAndroid3/src/main/java/examples/deps,examples/deps/libAndroid4,examples/deps/libAndroid4/src,examples/deps/libAndroid4/src/main,examples/deps/libAndroid4/src/main/res,examples/deps/libAndroid4/src/main/res/values,examples/deps/libAndroid4/src/main/java,examples/deps/libAndroid4/src/main/java/examples,examples/deps/libAndroid4/src/main/java/examples/deps,examples/deps/bzl,examples/deps/libKt1,examples/deps/libKt1/src,examples/deps/libKt1/src/main,examples/deps/libKt1/src/main/kt,examples/deps/libKt1/src/main/kt/examples,examples/deps/libKt1/src/main/kt/examples/deps,examples/deps/libKtAndroid2,examples/deps/libKtAndroid2/src,examples/deps/libKtAndroid2/src/main,examples/deps/libKtAndroid2/src/main/res,examples/deps/libKtAndroid2/src/main/res/values,examples/deps/libKtAndroid2/src/main/kt,examples/deps/libKtAndroid2/src/main/kt/examples,examples/deps/libKtAndroid2/src/main/kt/examples/deps,examples/deps/libKtAndroid4,examples/deps/libKtAndroid4/src,examples/deps/libKtAndroid4/src/main,examples/deps/libKtAndroid4/src/main/res,examples/deps/libKtAndroid4/src/main/res/values,examples/deps/libKtAndroid4/src/main/kt,examples/deps/libKtAndroid4/src/main/kt/examples,examples/deps/libKtAndroid4/src/main/kt/examples/deps,examples/deps/libKtAndroid3,examples/deps/libKtAndroid3/src,examples/deps/libKtAndroid3/src/main,examples/deps/libKtAndroid3/src/main/res,examples/deps/libKtAndroid3/src/main/res/values,examples/deps/libKtAndroid3/src/main/kt,examples/deps/libKtAndroid3/src/main/kt/examples,examples/deps/libKtAndroid3/src/main/kt/examples/deps,examples/deps/libJava2,examples/deps/libJava2/src,examples/deps/libJava2/src/main,examples/deps/libJava2/src/main/java,examples/deps/libJava2/src/main/java/examples,examples/deps/libJava2/src/main/java/examples/deps,examples/deps/libAndroid1,examples/deps/libAndroid1/src,examples/deps/libAndroid1/src/main,examples/deps/libAndroid1/src/main/res,examples/deps/libAndroid1/src/main/res/values,examples/deps/libAndroid1/src/main/java,examples/deps/libAndroid1/src/main/java/examples,examples/deps/libAndroid1/src/main/java/examples/deps,examples/deps/libJava3,examples/deps/libJava3/src,examples/deps/libJava3/src/main,examples/deps/libJava3/src/main/java,examples/deps/libJava3/src/main/java/examples,examples/deps/libJava3/src/main/java/examples/deps,examples/deps/libJava4,examples/deps/libJava4/src,examples/deps/libJava4/src/main,examples/deps/libJava4/src/main/java,examples/deps/libJava4/src/main/java/examples,examples/deps/libJava4/src/main/java/examples/deps,examples/node,examples/node/express,examples/node/express/auth,examples/node/coroutines-helloworld,examples/multiplex,examples/multiplex/src,examples/anvil,examples/anvil/app,examples/anvil/app/src,examples/anvil/app/src/androidTest,examples/anvil/app/src/androidTest/java,examples/anvil/app/src/androidTest/java/com,examples/anvil/app/src/androidTest/java/com/squareup,examples/anvil/app/src/androidTest/java/com/squareup/anvil,examples/anvil/app/src/androidTest/java/com/squareup/anvil/sample,examples/anvil/app/src/test,examples/anvil/app/src/test/java,examples/anvil/app/src/test/java/com,examples/anvil/app/src/test/java/com/squareup,examples/anvil/app/src/test/java/com/squareup/anvil,examples/anvil/app/src/test/java/com/squareup/anvil/sample,examples/anvil/app/src/main,examples/anvil/app/src/main/java,examples/anvil/app/src/main/java/com,examples/anvil/app/src/main/java/com/squareup,examples/anvil/app/src/main/java/com/squareup/anvil,examples/anvil/app/src/main/java/com/squareup/anvil/sample,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/mipmap-mdpi,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/drawable-v24,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/mipmap-hdpi,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/drawable,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/mipmap-xxxhdpi,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/values-ja,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/values-en-rCA,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/layout,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/mipmap-xxhdpi,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/values-night,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/values,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/values-fr-rCA,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/values-en-rGB,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/values-en-rAU,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/mipmap-xhdpi,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/values-es,examples/anvil/app/src/main/java/com/squareup/anvil/sample/res/mipmap-anydpi-v26,examples/anvil/library,examples/anvil/library/src,examples/anvil/library/src/main,examples/anvil/library/src/main/java,examples/anvil/library/src/main/java/com,examples/anvil/library/src/main/java/com/squareup,examples/anvil/library/src/main/java/com/squareup/anvil,examples/anvil/library/src/main/java/com/squareup/anvil/sample,examples/anvil/library/src/main/java/com/squareup/anvil/sample/father,examples/anvil/library/src/main/java/com/squareup/anvil/sample/mother,examples/anvil/third_party,examples/anvil/repro,examples/anvil/repro/src,examples/anvil/repro/src/main,examples/anvil/repro/src/main/java,examples/anvil/repro/src/main/java/com,examples/anvil/repro/src/main/java/com/repro,examples/anvil/repro/src/main/java/com/repro/lib,examples/anvil/scopes,examples/anvil/scopes/src,examples/anvil/scopes/src/main,examples/anvil/scopes/src/main/java,examples/anvil/scopes/src/main/java/com,examples/anvil/scopes/src/main/java/com/squareup,examples/anvil/scopes/src/main/java/com/squareup/scopes,examples/associates,examples/associates/projects,examples/associates/projects/core,examples/associates/projects/core/impl,examples/associates/projects/core/impl/src,examples/associates/projects/core/impl/src/test,examples/associates/projects/core/impl/src/test/kotlin,examples/associates/projects/core/impl/src/test/kotlin/core,examples/associates/projects/core/impl/src/test/kotlin/core/impl,examples/associates/projects/core/impl/src/main,examples/associates/projects/core/impl/src/main/kotlin,examples/associates/projects/core/impl/src/main/kotlin/core,examples/associates/projects/core/impl/src/main/kotlin/core/impl,examples/associates/projects/core/api,examples/associates/projects/core/api/src,examples/associates/projects/core/api/src/test,examples/associates/projects/core/api/src/test/kotlin,examples/associates/projects/core/api/src/test/kotlin/core,examples/associates/projects/core/api/src/test/kotlin/core/api,examples/associates/projects/core/api/src/main,examples/associates/projects/core/api/src/main/kotlin,examples/associates/projects/core/api/src/main/kotlin/core,examples/associates/projects/core/api/src/main/kotlin/core/api
4 changes: 3 additions & 1 deletion examples/android/.bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
common --lockfile_mode=off
common --lockfile_mode=off
common --incompatible_enable_android_toolchain_resolution
common --android_platforms=//:arm64-v8a
3 changes: 3 additions & 0 deletions examples/anvil/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
common --lockfile_mode=off
common --incompatible_enable_android_toolchain_resolution
common --android_platforms=//:arm64-v8a
Empty file added examples/associates/BUILD
Empty file.
3 changes: 3 additions & 0 deletions examples/deps/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
common --lockfile_mode=off
common --incompatible_enable_android_toolchain_resolution
common --android_platforms=//:arm64-v8a
7 changes: 7 additions & 0 deletions examples/deps/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
platform(
name = "arm64-v8a",
constraint_values = [
"@platforms//cpu:arm64",
"@platforms//os:android",
],
)
3 changes: 3 additions & 0 deletions examples/jetpack_compose/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ build --define=android_dexmerger_tool=d8_dexmerger
# Flags for the D8 dexer
build --define=android_incremental_dexing_tool=d8_dexbuilder
build --define=android_standalone_dexing_tool=d8_compat_dx

common --incompatible_enable_android_toolchain_resolution
common --android_platforms=//:arm64-v8a
9 changes: 7 additions & 2 deletions examples/jetpack_compose/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,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", "kotlinc_version", "versions")

kotlin_repositories()
kotlin_repositories(
compiler_release = kotlinc_version(
release = _KOTLIN_COMPILER_VERSION,
sha256 = _KOTLIN_COMPILER_SHA,
),
)

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

Expand Down
3 changes: 2 additions & 1 deletion kotlin/internal/jvm/impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def _write_launcher_action(ctx, rjars, main_class, jvm_flags):

# Following https://github.com/bazelbuild/bazel/blob/6d5b084025a26f2f6d5041f7a9e8d302c590bc80/src/main/starlark/builtins_bzl/bazel/java/bazel_java_binary.bzl#L66-L67
# Enable the security manager past deprecation.
if java_runtime.version >= 17:
# On bazel 6, this check isn't possible...
if getattr(java_runtime, "version", 0) >= 17:
jvm_flags = jvm_flags + " -Djava.security.manager=allow"

if ctx.configuration.coverage_enabled:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ object BazelRunFiles {
Runfiles.preload().unmapped()
}

/** Resolve as path in FileSystem. */
@JvmStatic
fun resolveVerifiedFromProperty(fileSystem: FileSystem, key: String) =
System.getProperty(key)
Expand Down Expand Up @@ -63,5 +64,3 @@ object BazelRunFiles {
throw FileNotFoundException("no reference for $key in ${System.getProperties()}")
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object BazelIntegrationTestRunner {
val fs = FileSystems.getDefault()
val bazel = fs.getPath(System.getenv("BIT_BAZEL_BINARY"))
val workspace = fs.getPath(System.getenv("BIT_WORKSPACE_DIR"))
val unpack = Files.createTempDirectory("rules_kotlin")
val unpack = fs.getPath(System.getenv("TEST_TMPDIR")).resolve("rules_kotlin")
val release = BazelRunFiles.resolveVerifiedFromProperty(
fs,
"@rules_kotlin...rules_kotlin_release",
Expand Down

0 comments on commit 128ab8b

Please sign in to comment.