From 66b690f4ad37ece81a801fa6dbf0c27008150a4d Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 6 Dec 2023 20:09:21 -0500 Subject: [PATCH 01/21] neverlink j2v8 debugger --- jvm/j2v8/BUILD | 2 ++ jvm/j2v8/build.bzl | 6 +++++- jvm/j2v8/deps.bzl | 13 ++++++++----- jvm/j2v8/libs/BUILD | 9 ++++++++- .../com/alexii/j2v8debugger/ScriptSourceProvider.kt | 8 ++++++++ .../player/jvm/j2v8/bridge/runtime/V8Runtime.kt | 8 ++++++-- 6 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 jvm/j2v8/src/main/kotlin/com/alexii/j2v8debugger/ScriptSourceProvider.kt diff --git a/jvm/j2v8/BUILD b/jvm/j2v8/BUILD index e5b6fa109..7c518b19f 100644 --- a/jvm/j2v8/BUILD +++ b/jvm/j2v8/BUILD @@ -19,4 +19,6 @@ j2v8_platform("linux") j2v8_platform("android") +j2v8_platform("android-debug") + j2v8_platform("all") diff --git a/jvm/j2v8/build.bzl b/jvm/j2v8/build.bzl index e353ad225..7f118e29f 100644 --- a/jvm/j2v8/build.bzl +++ b/jvm/j2v8/build.bzl @@ -4,11 +4,15 @@ deps = { "macos": ["//jvm/j2v8/libs:j2v8_macos"], "linux": ["//jvm/j2v8/libs:j2v8_linux"], "android": ["@android_j2v8//aar"], + "android-debug": [ + "//jvm/j2v8:j2v8-android", + "@maven//:com_github_AlexTrotsenko_j2v8_debugger", + ], "all": [ "//jvm/j2v8:j2v8-macos", "//jvm/j2v8:j2v8-linux", "//jvm/j2v8:j2v8-android", - ] + ], } def j2v8_platform(platform): diff --git a/jvm/j2v8/deps.bzl b/jvm/j2v8/deps.bzl index 1bff1a39d..6ad4b0e13 100644 --- a/jvm/j2v8/deps.bzl +++ b/jvm/j2v8/deps.bzl @@ -1,7 +1,11 @@ load("//jvm/dependencies:versions.bzl", "versions") load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") -maven = [ +maven = [] + +maven_main = [] + +maven = maven_main + [ "com.github.AlexTrotsenko:j2v8-debugger:%s" % versions.j2v8.debugger, ] @@ -9,11 +13,10 @@ main_exports = [ "//jvm/core", ] -main_deps = main_exports + parse_coordinates(maven) + [ +main_deps = main_exports + parse_coordinates(maven_main) + [ "//jvm:kotlin_serialization", - - # TODO: Ensure all of these are _just_ compileOnly deps - "//jvm/j2v8/libs:j2v8_empty", + "//jvm/j2v8/libs:j2v8_empty_compile_only", + "//jvm/j2v8/libs:j2v8_debugger_compile_only", ] main_resources = [ diff --git a/jvm/j2v8/libs/BUILD b/jvm/j2v8/libs/BUILD index 5664dd127..db47fce14 100644 --- a/jvm/j2v8/libs/BUILD +++ b/jvm/j2v8/libs/BUILD @@ -1,7 +1,7 @@ package(default_visibility = ["//jvm/j2v8:__pkg__"]) java_import( - name = "j2v8_empty", + name = "j2v8_empty_compile_only", jars = [":j2v8_empty-6.1.0.jar"], neverlink = True, ) @@ -18,3 +18,10 @@ java_import( name = "j2v8_linux", jars = [":j2v8_linux_x86_64-6.1.0.jar"], ) + +java_import( + name = "j2v8_debugger_compile_only", + jars = [], + neverlink = True, + deps = ["@maven//:com_github_AlexTrotsenko_j2v8_debugger"], +) diff --git a/jvm/j2v8/src/main/kotlin/com/alexii/j2v8debugger/ScriptSourceProvider.kt b/jvm/j2v8/src/main/kotlin/com/alexii/j2v8debugger/ScriptSourceProvider.kt new file mode 100644 index 000000000..3fc02bfe0 --- /dev/null +++ b/jvm/j2v8/src/main/kotlin/com/alexii/j2v8debugger/ScriptSourceProvider.kt @@ -0,0 +1,8 @@ +package com.alexii.j2v8debugger + +/** Redundant declaration of [ScriptSourceProvider] to ensure it exists on classpath at runtime */ +public interface ScriptSourceProvider { + public val allScriptIds: Collection + + public fun getSource(scriptId: String): String +} diff --git a/jvm/j2v8/src/main/kotlin/com/intuit/player/jvm/j2v8/bridge/runtime/V8Runtime.kt b/jvm/j2v8/src/main/kotlin/com/intuit/player/jvm/j2v8/bridge/runtime/V8Runtime.kt index a2f2a645e..776daf3f2 100644 --- a/jvm/j2v8/src/main/kotlin/com/intuit/player/jvm/j2v8/bridge/runtime/V8Runtime.kt +++ b/jvm/j2v8/src/main/kotlin/com/intuit/player/jvm/j2v8/bridge/runtime/V8Runtime.kt @@ -1,7 +1,6 @@ package com.intuit.player.jvm.j2v8.bridge.runtime import com.alexii.j2v8debugger.ScriptSourceProvider -import com.alexii.j2v8debugger.V8Debugger import com.eclipsesource.v8.V8 import com.eclipsesource.v8.V8Array import com.eclipsesource.v8.V8Object @@ -9,6 +8,7 @@ import com.eclipsesource.v8.V8Value import com.eclipsesource.v8.utils.MemoryManager import com.intuit.player.jvm.core.bridge.Invokable import com.intuit.player.jvm.core.bridge.Node +import com.intuit.player.jvm.core.bridge.PlayerRuntimeException import com.intuit.player.jvm.core.bridge.runtime.PlayerRuntimeConfig import com.intuit.player.jvm.core.bridge.runtime.PlayerRuntimeContainer import com.intuit.player.jvm.core.bridge.runtime.PlayerRuntimeFactory @@ -100,7 +100,11 @@ internal class V8Runtime(override val config: J2V8RuntimeConfig) : Runtime Date: Wed, 6 Dec 2023 20:16:25 -0500 Subject: [PATCH 02/21] fix deps.bzl miss --- jvm/j2v8/deps.bzl | 2 -- 1 file changed, 2 deletions(-) diff --git a/jvm/j2v8/deps.bzl b/jvm/j2v8/deps.bzl index 6ad4b0e13..29a9ca762 100644 --- a/jvm/j2v8/deps.bzl +++ b/jvm/j2v8/deps.bzl @@ -1,8 +1,6 @@ load("//jvm/dependencies:versions.bzl", "versions") load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") -maven = [] - maven_main = [] maven = maven_main + [ From a61533711698adf850609113999ace46ef8e0ae2 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 17 Jan 2024 20:42:26 -0500 Subject: [PATCH 03/21] wip --- WORKSPACE | 6 +++--- android/demo/BUILD | 2 ++ android/player/BUILD | 9 ++++++--- android/player/deps.bzl | 5 +++++ .../player/jvm/core/player/state/PlayerFlowState.kt | 6 +++++- jvm/dependencies/versions.bzl | 1 + jvm/j2v8/BUILD | 1 + jvm/j2v8/deps.bzl | 1 + plugins/reference-assets/android/BUILD | 6 +++--- plugins/reference-assets/android/deps.bzl | 7 +++++-- 10 files changed, 32 insertions(+), 12 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index a1b36280b..39ea0c316 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -11,9 +11,9 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") http_archive( name = "rules_player", - sha256 = "c015a09ce2a5f999a89473cb9f71346c6831e27830a228ebe8f1ba25e83b77b2", - strip_prefix = "rules_player-0.10.4", - urls = ["https://github.com/player-ui/rules_player/archive/refs/tags/v0.10.4.tar.gz"], + sha256 = "e0cf3efd5f82654b21a48d8b4a822c772d5828a826f84efa162354b7883df7c2", + strip_prefix = "rules_player-0.11.0", + urls = ["https://github.com/player-ui/rules_player/archive/refs/tags/v0.11.0.tar.gz"], ) load("@rules_player//:workspace.bzl", "deps") diff --git a/android/demo/BUILD b/android/demo/BUILD index 3db069113..5331fb11d 100644 --- a/android/demo/BUILD +++ b/android/demo/BUILD @@ -11,6 +11,7 @@ kt_android_library( assets = glob(["src/main/assets/mocks/**"]), assets_dir = "src/main/assets", custom_package = "com.intuit.player.android.reference.demo", + enable_data_binding = False, manifest = ":src/main/AndroidManifest.xml", resource_files = glob(["src/main/res/**"]), deps = main_deps, @@ -25,6 +26,7 @@ android_binary( multidex = "native", deps = [ ":demo_lib", + "//android/player:player_base", "@android_j2v8//aar", "@maven//:androidx_databinding_databinding_common", "@maven//:androidx_databinding_databinding_runtime", diff --git a/android/player/BUILD b/android/player/BUILD index f0ec0c75e..06e326ada 100644 --- a/android/player/BUILD +++ b/android/player/BUILD @@ -1,13 +1,16 @@ load(":deps.bzl", "main_deps", "main_resources", "test_deps") load("//jvm:build.bzl", "distribution") -load("@grab_bazel_common//tools/databinding:databinding.bzl", "kt_db_android_library") +load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") + +#load("@grab_bazel_common//tools/databinding:databinding.bzl", "kt_db_android_library") load("@junit//junit5-jupiter-starter-bazel:junit5.bzl", "kt_jvm_junit5_test") load("@rules_player//kotlin:lint.bzl", "lint") -kt_db_android_library( +kt_android_library( name = "player", srcs = glob(["src/main/java/**/*.kt"]), custom_package = "com.intuit.player.android", + enable_data_binding = True, manifest = ":src/main/AndroidManifest.xml", resource_files = glob(["src/main/res/**"]), resources = main_resources, @@ -23,7 +26,7 @@ distribution( kt_jvm_junit5_test( name = "player-tests", srcs = glob(["src/test/java/**"]), - associates = [":player-kotlin"], + associates = [":player_kt"], kotlinc_opts = "//jvm:test_options", test_package = "com.intuit.player.android", deps = [":player"] + test_deps, diff --git a/android/player/deps.bzl b/android/player/deps.bzl index b6aa15d2a..2ffeae628 100644 --- a/android/player/deps.bzl +++ b/android/player/deps.bzl @@ -11,6 +11,11 @@ maven = [ "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, + # View binding + "androidx.annotation:annotation:%s" % versions.androidx.annotation, + "androidx.databinding:databinding-common:%s" % versions.androidx.databinding, + "androidx.databinding:databinding-runtime:%s" % versions.androidx.databinding, + # Default fallback "androidx.constraintlayout:constraintlayout:%s" % versions.androidx.constraintlayout, ] diff --git a/jvm/core/src/main/kotlin/com/intuit/player/jvm/core/player/state/PlayerFlowState.kt b/jvm/core/src/main/kotlin/com/intuit/player/jvm/core/player/state/PlayerFlowState.kt index 72c86562a..4d1f78694 100644 --- a/jvm/core/src/main/kotlin/com/intuit/player/jvm/core/player/state/PlayerFlowState.kt +++ b/jvm/core/src/main/kotlin/com/intuit/player/jvm/core/player/state/PlayerFlowState.kt @@ -59,8 +59,12 @@ public class CompletedState(override val node: Node) : public val data: JsonElement by NodeSerializableField(JsonElement.serializer()) { JsonNull } + internal val controllers: ControllerState by NodeSerializableField(ControllerState.serializer()) + // TODO: Completed state dataModel change needs rectification here - public val dataModel: DataModelWithParser by NodeSerializableField(DataModelWithParser.serializer()) + public val dataModel: DataModelWithParser by lazy { + DataModelWithParser(controllers.data.node) + } internal object Serializer : NodeWrapperSerializer(::CompletedState, COMPLETED.value) } diff --git a/jvm/dependencies/versions.bzl b/jvm/dependencies/versions.bzl index ae1e7aef0..f1825f85c 100644 --- a/jvm/dependencies/versions.bzl +++ b/jvm/dependencies/versions.bzl @@ -26,6 +26,7 @@ versions = struct( jmh = "1.21", androidx = struct( activity = "1.2.3", + annotation = "1.5.0", appcompat = "1.3.0", constraintlayout = "2.1.4", core = "1.6.0", diff --git a/jvm/j2v8/BUILD b/jvm/j2v8/BUILD index 7c518b19f..53e1d61d7 100644 --- a/jvm/j2v8/BUILD +++ b/jvm/j2v8/BUILD @@ -17,6 +17,7 @@ j2v8_platform("macos") j2v8_platform("linux") +# TODO: These should probably be AARs? j2v8_platform("android") j2v8_platform("android-debug") diff --git a/jvm/j2v8/deps.bzl b/jvm/j2v8/deps.bzl index 29a9ca762..749604221 100644 --- a/jvm/j2v8/deps.bzl +++ b/jvm/j2v8/deps.bzl @@ -17,6 +17,7 @@ main_deps = main_exports + parse_coordinates(maven_main) + [ "//jvm/j2v8/libs:j2v8_debugger_compile_only", ] +# TODO: These should probably just be dependencies of headless main_resources = [ "//core/player:Player_Bundles", ] diff --git a/plugins/reference-assets/android/BUILD b/plugins/reference-assets/android/BUILD index 3ff15d6f5..98c932ee1 100644 --- a/plugins/reference-assets/android/BUILD +++ b/plugins/reference-assets/android/BUILD @@ -6,11 +6,12 @@ kt_android_library( name = "assets", srcs = glob(["src/main/java/**/*.kt"]), custom_package = "com.intuit.player.android.reference.assets", + enable_data_binding = False, manifest = ":src/main/AndroidManifest.xml", resource_files = glob(["src/main/res/**"]), - deps = main_deps, - exports = main_exports, visibility = ["//visibility:public"], + exports = main_exports, + deps = main_deps, ) lint( @@ -18,4 +19,3 @@ lint( srcs = glob(["src/main/**/*.kt"]), lint_config = "//jvm:lint_config", ) - diff --git a/plugins/reference-assets/android/deps.bzl b/plugins/reference-assets/android/deps.bzl index 57a819c4b..9d3f783f6 100644 --- a/plugins/reference-assets/android/deps.bzl +++ b/plugins/reference-assets/android/deps.bzl @@ -2,13 +2,16 @@ load("//jvm/dependencies:versions.bzl", "versions") load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") load("//plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test:deps.bzl", maven_test = "maven") -maven_main = [] +maven_main = [ + "androidx.databinding:databinding-runtime:%s" % versions.androidx.databinding, +] main_exports = [ - "//android/player", + # "//android/player", ] main_deps = main_exports + parse_coordinates(maven_main) + [ + "//android/player", "//jvm:kotlin_serialization", "//plugins/reference-assets/jvm:reference-assets", "//plugins/pending-transaction/jvm:pending-transaction", From c1e4fdc6b0bcfafe2401d4bfc5078804d41888d7 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 23 Jan 2024 15:56:25 -0500 Subject: [PATCH 04/21] wip: broken rules_jvm_external --- .bazelrc | 1 + WORKSPACE | 127 ++++++++++++++---- android/BUILD | 9 ++ android/demo/BUILD | 1 - android/player/BUILD | 26 +++- android/player/deps.bzl | 3 +- build_constants.bzl | 36 +++++ jvm/build.bzl | 47 ++----- jvm/dependencies/deps.bzl | 4 +- jvm/j2v8/build.bzl | 8 +- patches/BUILD | 3 + ...m_external.default_public_visibility.patch | 13 ++ plugins/build.bzl | 18 +-- 13 files changed, 206 insertions(+), 90 deletions(-) create mode 100644 build_constants.bzl create mode 100644 patches/BUILD create mode 100644 patches/rules_jvm_external.default_public_visibility.patch diff --git a/.bazelrc b/.bazelrc index 45014bcd7..c54ac07b0 100644 --- a/.bazelrc +++ b/.bazelrc @@ -12,6 +12,7 @@ coverage:ci --experimental_remote_cache_compression --experimental_remote_cache_ # build --noincompatible_disable_managed_directories # Android databinding flags +build --experimental_allow_android_library_deps_without_srcs build --experimental_android_databinding_v2 build --android_databinding_use_v3_4_args build --android_databinding_use_androidx diff --git a/WORKSPACE b/WORKSPACE index 39ea0c316..9199d70c0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -6,14 +6,35 @@ workspace( }, ) +load("//:build_constants.bzl", "build_constants") + +build_constants() + load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -http_archive( +git_repository( + name = "rules_jvm_external", + branch = "maven-export-aar", + patches = [ + "//patches:rules_jvm_external.default_public_visibility.patch", + ], + remote = "https://github.com/sugarmanz/rules_jvm_external", +) + +# +load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") + +rules_jvm_external_deps() + +load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") + +rules_jvm_external_setup() + +git_repository( name = "rules_player", - sha256 = "e0cf3efd5f82654b21a48d8b4a822c772d5828a826f84efa162354b7883df7c2", - strip_prefix = "rules_player-0.11.0", - urls = ["https://github.com/player-ui/rules_player/archive/refs/tags/v0.11.0.tar.gz"], + branch = "maven-export-distribution", + remote = "https://github.com/player-ui/rules_player", ) load("@rules_player//:workspace.bzl", "deps") @@ -75,28 +96,46 @@ junit5() ###################### # Android Setup # ###################### -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") - -grab_remote = "https://github.com/sugarmanz/grab-bazel-common.git" - -grab_commit = "5326c6ba7a4e39e150c33e123134525473baffb6" - -git_repository( - name = "grab_bazel_common", - commit = grab_commit, - remote = grab_remote, - shallow_since = "1700536974 -0500", +http_archive( + name = "android_tools", + sha256 = "ed5290594244c2eeab41f0104519bcef51e27c699ff4b379fcbd25215270513e", + url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.23.0.tar.gz", ) -load("@grab_bazel_common//android:repositories.bzl", "bazel_common_dependencies") - -bazel_common_dependencies() - -load("@grab_bazel_common//android:initialize.bzl", "bazel_common_initialize") - -bazel_common_initialize( - pinned_maven_install = False, -) +#DAGGER_TAG = "2.42" +# +#DAGGER_SHA = "8121789cc443f177005f683bdbed8f36273a5ceb96fb16a9528fd76bb2c35c79" +# +#http_archive( +# name = "bazel_common_dagger", +# sha256 = DAGGER_SHA, +# strip_prefix = "dagger-dagger-%s" % DAGGER_TAG, +# url = "https://github.com/google/dagger/archive/dagger-%s.zip" % DAGGER_TAG, +#) +# +#grab_remote = "https://github.com/sugarmanz/grab-bazel-common.git" +# +#grab_commit = "5326c6ba7a4e39e150c33e123134525473baffb6" +# +#git_repository( +# name = "grab_bazel_common", +# commit = grab_commit, +# remote = grab_remote, +# shallow_since = "1700536974 -0500", +#) + +#load("@grab_bazel_common//android:repositories.bzl", "bazel_common_dependencies") +# +#bazel_common_dependencies() + +# +#load("@grab_bazel_common//android:initialize.bzl", "bazel_common_initialize") +# +## +#bazel_common_initialize( +# patched_android_tools = False, +# pinned_maven_install = False, +#) http_archive( name = "robolectric", @@ -154,6 +193,11 @@ android_ndk_repository(name = "androidndk") register_toolchains("@androidndk//:all") +bind( + name = "databinding_annotation_processor", + actual = "//android:compiler_annotation_processor", +) + ###################### # Maven Dependencies # ###################### @@ -184,6 +228,41 @@ maven_install( ], ) +maven_install( + name = "bazel_common_maven", + artifacts = [ + "com.google.guava:guava:29.0-jre", + "com.google.auto:auto-common:0.10", + "com.google.auto.service:auto-service:1.0-rc6", + "com.google.protobuf:protobuf-java:3.6.0", + "com.google.protobuf:protobuf-java-util:3.6.0", + "io.reactivex.rxjava3:rxjava:3.0.12", + "com.squareup.moshi:moshi-kotlin:1.14.0", + "com.squareup.okio:okio-jvm:3.2.0", + "com.squareup:javapoet:1.13.0", + "com.github.ajalt:clikt:2.8.0", + "org.ow2.asm:asm:6.0", + "org.ow2.asm:asm-tree:6.0", + "xmlpull:xmlpull:1.1.3.1", + "net.sf.kxml:kxml2:2.3.0", + "com.squareup.moshi:moshi:1.11.0", + "org.jetbrains.kotlin:kotlin-parcelize-compiler:1.7.21", + "org.jetbrains.kotlin:kotlin-parcelize-runtime:1.7.21", + "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4", + "com.github.tschuchortdev:kotlin-compile-testing:1.5.0", + "com.google.android.material:material:1.2.1", + "javax.inject:javax.inject:1", + "junit:junit:4.13", + "org.json:json:20210307", + ], + repositories = [ + "https://jcenter.bintray.com/", + "https://maven.google.com", + "https://repo1.maven.org/maven2", + ], + strict_visibility = True, +) + load("@vaticle_bazel_distribution//common:rules.bzl", "workspace_refs") workspace_refs(name = "plugin_workspace_refs") diff --git a/android/BUILD b/android/BUILD index e69de29bb..6cb14f3ef 100644 --- a/android/BUILD +++ b/android/BUILD @@ -0,0 +1,9 @@ +java_plugin( + name = "compiler_annotation_processor", + generates_api = True, + processor_class = "android.databinding.annotationprocessor.ProcessDataBinding", + visibility = ["//visibility:public"], + deps = [ + "@bazel_tools//src/tools/android/java/com/google/devtools/build/android:all_android_tools", + ], +) diff --git a/android/demo/BUILD b/android/demo/BUILD index 5331fb11d..68a65c53f 100644 --- a/android/demo/BUILD +++ b/android/demo/BUILD @@ -26,7 +26,6 @@ android_binary( multidex = "native", deps = [ ":demo_lib", - "//android/player:player_base", "@android_j2v8//aar", "@maven//:androidx_databinding_databinding_common", "@maven//:androidx_databinding_databinding_runtime", diff --git a/android/player/BUILD b/android/player/BUILD index 06e326ada..ed666f6a8 100644 --- a/android/player/BUILD +++ b/android/player/BUILD @@ -1,32 +1,44 @@ -load(":deps.bzl", "main_deps", "main_resources", "test_deps") +load(":deps.bzl", "main_deps", "main_exports", "main_resources", "test_deps") +load("@build_constants//:constants.bzl", "VERSION") load("//jvm:build.bzl", "distribution") load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") - -#load("@grab_bazel_common//tools/databinding:databinding.bzl", "kt_db_android_library") +load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") load("@junit//junit5-jupiter-starter-bazel:junit5.bzl", "kt_jvm_junit5_test") load("@rules_player//kotlin:lint.bzl", "lint") kt_android_library( - name = "player", + name = "player-lib", srcs = glob(["src/main/java/**/*.kt"]), custom_package = "com.intuit.player.android", enable_data_binding = True, manifest = ":src/main/AndroidManifest.xml", resource_files = glob(["src/main/res/**"]), resources = main_resources, - tags = ["maven_coordinates=com.intuit.player.android:player:{pom_version}"], - visibility = ["//visibility:public"], + exports = main_exports, deps = main_deps, ) +# TODO: This is currently needed to ensure the AAR is created for the primary output +# Additionally, we need to ensure the maven_coordinates tag only sticks to outer +# artifact to capture the transitive closure. +android_library( + name = "player", + custom_package = "com.intuit.player.android", + manifest = ":src/main/AndroidManifest.xml", + tags = ["maven_coordinates=com.intuit.player.android:player:aar:%s" % VERSION], + visibility = ["//visibility:public"], + exports = ["player-lib"], +) + distribution( name = "player", + maven_coordinates = "com.intuit.player.android:player:%s" % VERSION, ) kt_jvm_junit5_test( name = "player-tests", srcs = glob(["src/test/java/**"]), - associates = [":player_kt"], + associates = [":player-lib_kt"], kotlinc_opts = "//jvm:test_options", test_package = "com.intuit.player.android", deps = [":player"] + test_deps, diff --git a/android/player/deps.bzl b/android/player/deps.bzl index 2ffeae628..20a6fd69f 100644 --- a/android/player/deps.bzl +++ b/android/player/deps.bzl @@ -38,7 +38,8 @@ main_resources = [ ] test_deps = [ - "@grab_bazel_common//tools/test:mockable-android-jar", + # "@grab_bazel_common//tools/test:mockable-android-jar", + # "@robolectric//bazel:android-all", "@maven//:io_mockk_mockk", "//jvm/testutils", "@maven//:org_jetbrains_kotlinx_kotlinx_coroutines_test", diff --git a/build_constants.bzl b/build_constants.bzl new file mode 100644 index 000000000..3f89456f2 --- /dev/null +++ b/build_constants.bzl @@ -0,0 +1,36 @@ +def _build_constants_impl(repository_ctx): + _BUILD_FILE = """ +# DO NOT EDIT: automatically generated for _build_constants rule +filegroup( + name = 'files', + srcs = glob(['**']), + visibility = ['//visibility:public'] +) +""" + repository_ctx.file("BUILD", _BUILD_FILE, False) + + version = repository_ctx.read(repository_ctx.attr.version_file) + + _MAVEN_CONSTANTS_FILE = """ +# DO NOT EDIT: automatically generated for _build_constants rule +VERSION = \"{version}\" +""" + + repository_ctx.file( + "constants.bzl", + _MAVEN_CONSTANTS_FILE.format(version = version), + False, + ) + +_build_constants = repository_rule( + implementation = _build_constants_impl, + attrs = { + "version_file": attr.label( + default = Label("//:VERSION"), + allow_single_file = True, + ), + }, +) + +def build_constants(): + _build_constants(name = "build_constants") diff --git a/jvm/build.bzl b/jvm/build.bzl index 08f834df3..ee4abf541 100644 --- a/jvm/build.bzl +++ b/jvm/build.bzl @@ -1,13 +1,15 @@ load("@rules_player//kotlin:kt_jvm.bzl", _kt_jvm = "kt_jvm") load("@rules_player//kotlin:distribution.bzl", _distribution = "distribution") +load("@build_constants//:constants.bzl", "VERSION") load("//jvm/dependencies:common.bzl", common_main_deps = "main_deps", common_test_deps = "test_deps") -load("//:index.bzl", "GIT_REPO", "DOCS_URL") +load("//:index.bzl", "DOCS_URL", "GIT_REPO") +DEFAULT_GROUP = "com.intuit.player" DEFAULT_PROJECT_NAME = "Player" DEFAUTL_PROJECT_DESCRIPTION = "A cross-platform semantic rendering engine" DEFAULT_DEVELOPERS = { - "sugarmanz": ["name=Jeremiah Zucker", "email=zucker.jeremiah@gmail.com"], - "brocollie08": ["name=Tony Lin"] + "sugarmanz": ["name=Jeremiah Zucker", "email=zucker.jeremiah@gmail.com"], + "brocollie08": ["name=Tony Lin"], } DEFAULT_RELEASE_REPO = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" DEFAULT_SNAPSHOT_REPO = "https://oss.sonatype.org/content/repositories/snapshots/" @@ -22,14 +24,7 @@ def kt_player_module( include_common_deps = True, # Distribution config - group = "com.intuit.player", - - # (optional) - project_name = DEFAULT_PROJECT_NAME, - project_description = DEFAUTL_PROJECT_DESCRIPTION, - project_url = DOCS_URL, - scm_url = GIT_REPO, - developers = DEFAULT_DEVELOPERS, + group = DEFAULT_GROUP, # Package level config module_name = None, @@ -53,15 +48,7 @@ def kt_player_module( name = name, lint_config = "//jvm:lint_config", group = group, - release_repo = DEFAULT_RELEASE_REPO, - snapshot_repo = DEFAULT_SNAPSHOT_REPO, - version_file = "//:VERSION", - project_name = project_name, - project_description = project_description, - project_url = project_url, - scm_url = scm_url, - developers = developers, - workspace_refs = "@plugin_workspace_refs//:refs.json", + version = VERSION, module_name = module_name, main_opts = "//jvm:main_options", main_srcs = main_srcs, @@ -86,22 +73,10 @@ def kt_player_module( def distribution( *, name, - - # (optional) - project_name = DEFAULT_PROJECT_NAME, - project_description = DEFAUTL_PROJECT_DESCRIPTION, - project_url = DOCS_URL, - scm_url = GIT_REPO, - developers = DEFAULT_DEVELOPERS,): + maven_coordinates, + lib_name = None): _distribution( name = name, - release_repo = DEFAULT_RELEASE_REPO, - snapshot_repo = DEFAULT_SNAPSHOT_REPO, - version_file = "//:VERSION", - project_name = project_name, - project_description = project_description, - project_url = project_url, - scm_url = scm_url, - developers = developers, - workspace_refs = "@plugin_workspace_refs//:refs.json", + maven_coordinates = maven_coordinates, + lib_name = lib_name, ) diff --git a/jvm/dependencies/deps.bzl b/jvm/dependencies/deps.bzl index d081e38c0..8dd6e5704 100644 --- a/jvm/dependencies/deps.bzl +++ b/jvm/dependencies/deps.bzl @@ -9,8 +9,8 @@ load("//jvm/testutils:deps.bzl", testutils = "maven") load("//jvm/perf:deps.bzl", perf = "maven") load("//plugins:deps.bzl", plugins = "maven") load("@rules_player//distribution:deps.bzl", distribution = "maven") -load("@grab_bazel_common//:workspace_defs.bzl", grab = "GRAB_BAZEL_COMMON_ARTIFACTS") +#load("@grab_bazel_common//:workspace_defs.bzl", grab = "GRAB_BAZEL_COMMON_ARTIFACTS") -tooling = distribution + grab +tooling = distribution #+ grab maven = remove_duplicates(common + core + graaljs + j2v8 + utils + testutils + perf + plugins + tooling + android) diff --git a/jvm/j2v8/build.bzl b/jvm/j2v8/build.bzl index 7f118e29f..2011de4ed 100644 --- a/jvm/j2v8/build.bzl +++ b/jvm/j2v8/build.bzl @@ -1,4 +1,5 @@ -load("//jvm:build.bzl", "distribution") +load("//jvm:build.bzl", "DEFAULT_GROUP", "distribution") +load("@build_constants//:constants.bzl", "VERSION") deps = { "macos": ["//jvm/j2v8/libs:j2v8_macos"], @@ -15,7 +16,7 @@ deps = { ], } -def j2v8_platform(platform): +def j2v8_platform(platform, group = DEFAULT_GROUP, version = VERSION): if platform not in deps: fail("platform must be defined in " + deps.keys()) @@ -23,10 +24,11 @@ def j2v8_platform(platform): native.java_library( name = name, exports = [":j2v8"] + deps[platform], - tags = ["maven_coordinates=%s:%s:{pom_version}" % ("com.intuit.player", name)], + tags = ["maven_coordinates=%s:%s:%s" % (group, name, version)], visibility = ["//visibility:public"], ) distribution( name = name, + maven_coordinates = "%s:%s:%s" % (group, name, version), ) diff --git a/patches/BUILD b/patches/BUILD new file mode 100644 index 000000000..6f665d778 --- /dev/null +++ b/patches/BUILD @@ -0,0 +1,3 @@ +exports_files([ + "rules_jvm_external.default_public_visibility.patch", +]) diff --git a/patches/rules_jvm_external.default_public_visibility.patch b/patches/rules_jvm_external.default_public_visibility.patch new file mode 100644 index 000000000..e82ecd881 --- /dev/null +++ b/patches/rules_jvm_external.default_public_visibility.patch @@ -0,0 +1,13 @@ +diff --git coursier.bzl coursier.bzl +index a7c5f30..57977ae 100644 +--- coursier.bzl ++++ coursier.bzl +@@ -28,7 +28,7 @@ load("//private/rules:v1_lock_file.bzl", "v1_lock_file") + load("//private/rules:v2_lock_file.bzl", "v2_lock_file") + + _BUILD = """ +-# package(default_visibility = [{visibilities}]) # https://github.com/bazelbuild/bazel/issues/13681 ++package(default_visibility = [{visibilities}]) # https://github.com/bazelbuild/bazel/issues/13681 + + load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + load("@rules_jvm_external//private/rules:jvm_import.bzl", "jvm_import") diff --git a/plugins/build.bzl b/plugins/build.bzl index 0e97dc2e8..e6132a214 100644 --- a/plugins/build.bzl +++ b/plugins/build.bzl @@ -1,4 +1,4 @@ -load("//jvm:build.bzl", _kt_player_module = "kt_player_module") +load("//jvm:build.bzl", "DEFAULT_GROUP", _kt_player_module = "kt_player_module") load("//jvm/dependencies:common.bzl", "test_deps") load("@bazel_skylib//lib:dicts.bzl", "dicts") @@ -11,14 +11,6 @@ def kt_player_plugin( # Project level config include_common_deps = True, - # Distribution config - - # (optional) TODO: Maybe hardcode these - project_name = None, - project_description = None, - project_url = None, - scm_url = None, - # Package level config module_name = None, main_srcs = None, @@ -40,13 +32,7 @@ def kt_player_plugin( _kt_player_module( name = name, include_common_deps = include_common_deps, - group = "com.intuit.player.plugins", - - # (optional) TODO: Maybe hardcode these - project_name = project_name, - project_description = project_description, - project_url = project_url, - scm_url = scm_url, + group = DEFAULT_GROUP + ".plugins", # Package level config module_name = module_name, From 6f1858ea7af89581ddda217c03b9b75b8eab73aa Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 23 Jan 2024 19:04:50 -0500 Subject: [PATCH 05/21] move jvm external setup --- WORKSPACE | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 9199d70c0..c6e6cdf11 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -22,15 +22,6 @@ git_repository( remote = "https://github.com/sugarmanz/rules_jvm_external", ) -# -load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") - -rules_jvm_external_deps() - -load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") - -rules_jvm_external_setup() - git_repository( name = "rules_player", branch = "maven-export-distribution", @@ -201,6 +192,14 @@ bind( ###################### # Maven Dependencies # ###################### +load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") + +rules_jvm_external_deps() + +load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") + +rules_jvm_external_setup() + load("//jvm/dependencies:deps.bzl", artifacts = "maven") load("@rules_jvm_external//:defs.bzl", "maven_install") From dd571f39398296a65ae641c72c98808cc105f257 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 23 Jan 2024 19:05:47 -0500 Subject: [PATCH 06/21] try to use the embedded jdk --- .bazelrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelrc b/.bazelrc index c54ac07b0..07e41d4a6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,5 @@ +# Use embedded JDK +build --repo_env=JAVA_HOME=../bazel_tools/jdk test --test_output=errors coverage --combined_report=lcov From b4b4979f2cc89f4cebcd115597f8c4b318995527 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 23 Jan 2024 20:03:56 -0500 Subject: [PATCH 07/21] fix //jvm/core:test --- jvm/core/deps.bzl | 4 ++-- .../player/jvm/core/player/state/CompletedStateTest.kt | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/jvm/core/deps.bzl b/jvm/core/deps.bzl index c3ebaabc0..4e30c943f 100644 --- a/jvm/core/deps.bzl +++ b/jvm/core/deps.bzl @@ -10,12 +10,12 @@ main_exports = [ "//jvm:kotlin_serialization", ] main_deps = main_exports + [ - "@maven//:org_jetbrains_kotlin_kotlin_reflect" + "@com_github_jetbrains_kotlin//:kotlin-reflect", ] main_runtime_deps = [] # Test dependencies test_deps = [ - "//plugins/reference-assets/jvm:reference-assets", + "//plugins/reference-assets/jvm:reference-assets", ] test_runtime_deps = [] diff --git a/jvm/core/src/test/kotlin/com/intuit/player/jvm/core/player/state/CompletedStateTest.kt b/jvm/core/src/test/kotlin/com/intuit/player/jvm/core/player/state/CompletedStateTest.kt index 791d9f464..5abbc69f1 100644 --- a/jvm/core/src/test/kotlin/com/intuit/player/jvm/core/player/state/CompletedStateTest.kt +++ b/jvm/core/src/test/kotlin/com/intuit/player/jvm/core/player/state/CompletedStateTest.kt @@ -6,6 +6,7 @@ import com.intuit.player.jvm.core.bridge.Node import com.intuit.player.jvm.core.bridge.getInvokable import com.intuit.player.jvm.core.bridge.runtime.Runtime import com.intuit.player.jvm.core.bridge.serialization.format.RuntimeFormat +import com.intuit.player.jvm.core.data.DataController import com.intuit.player.jvm.core.data.DataModelWithParser import com.intuit.player.jvm.core.flow.Flow import com.intuit.player.jvm.core.player.PlayerFlowStatus @@ -23,6 +24,10 @@ internal class CompletedStateTest : NodeBaseTest() { CompletedState(node) } + private val controllerState by lazy { + ControllerState(node) + } + @MockK private lateinit var mockDataModel: Node @@ -35,6 +40,10 @@ internal class CompletedStateTest : NodeBaseTest() { every { node.runtime } returns runtime every { runtime.containsKey("getSymbol") } returns true every { runtime.getInvokable("getSymbol") } returns Invokable { "Symbol(hello)" } + every { node.getObject("controllers") } returns node + every { node.getSerializable("controllers", any()) } returns controllerState + every { node.getObject("data") } returns node + every { node.getSerializable("data", any()) } returns DataController(node) every { node.getSerializable("flow", Flow.serializer()) } returns Flow("flowId") every { node.getSerializable("dataModel", DataModelWithParser.serializer()) } returns DataModelWithParser(node) every { node.getObject("dataModel") } returns mockDataModel From 29580fd09deba72ca33ef5395ecce93d6e8d68e0 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 23 Jan 2024 20:12:57 -0500 Subject: [PATCH 08/21] reintroduce grab for mockable android jar --- WORKSPACE | 55 ++++++++++++++++------------------------- android/player/deps.bzl | 3 +-- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index c6e6cdf11..2a427963d 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -93,40 +93,27 @@ http_archive( url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.23.0.tar.gz", ) -#DAGGER_TAG = "2.42" -# -#DAGGER_SHA = "8121789cc443f177005f683bdbed8f36273a5ceb96fb16a9528fd76bb2c35c79" -# -#http_archive( -# name = "bazel_common_dagger", -# sha256 = DAGGER_SHA, -# strip_prefix = "dagger-dagger-%s" % DAGGER_TAG, -# url = "https://github.com/google/dagger/archive/dagger-%s.zip" % DAGGER_TAG, -#) -# -#grab_remote = "https://github.com/sugarmanz/grab-bazel-common.git" -# -#grab_commit = "5326c6ba7a4e39e150c33e123134525473baffb6" -# -#git_repository( -# name = "grab_bazel_common", -# commit = grab_commit, -# remote = grab_remote, -# shallow_since = "1700536974 -0500", -#) - -#load("@grab_bazel_common//android:repositories.bzl", "bazel_common_dependencies") -# -#bazel_common_dependencies() - -# -#load("@grab_bazel_common//android:initialize.bzl", "bazel_common_initialize") -# -## -#bazel_common_initialize( -# patched_android_tools = False, -# pinned_maven_install = False, -#) +grab_remote = "https://github.com/sugarmanz/grab-bazel-common.git" + +grab_commit = "5326c6ba7a4e39e150c33e123134525473baffb6" + +git_repository( + name = "grab_bazel_common", + commit = grab_commit, + remote = grab_remote, + shallow_since = "1700536974 -0500", +) + +load("@grab_bazel_common//android:repositories.bzl", "bazel_common_dependencies") + +bazel_common_dependencies() + +load("@grab_bazel_common//android:initialize.bzl", "bazel_common_initialize") + +bazel_common_initialize( + patched_android_tools = False, + pinned_maven_install = False, +) http_archive( name = "robolectric", diff --git a/android/player/deps.bzl b/android/player/deps.bzl index 20a6fd69f..2ffeae628 100644 --- a/android/player/deps.bzl +++ b/android/player/deps.bzl @@ -38,8 +38,7 @@ main_resources = [ ] test_deps = [ - # "@grab_bazel_common//tools/test:mockable-android-jar", - # "@robolectric//bazel:android-all", + "@grab_bazel_common//tools/test:mockable-android-jar", "@maven//:io_mockk_mockk", "//jvm/testutils", "@maven//:org_jetbrains_kotlinx_kotlinx_coroutines_test", From 180dd67f78f5f8a7aa772a50968fec1f645ed504 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 23 Jan 2024 21:19:48 -0500 Subject: [PATCH 09/21] use kotlin-reflect from maven --- jvm/core/deps.bzl | 2 +- jvm/dependencies/common.bzl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/jvm/core/deps.bzl b/jvm/core/deps.bzl index 4e30c943f..b28d93602 100644 --- a/jvm/core/deps.bzl +++ b/jvm/core/deps.bzl @@ -10,7 +10,7 @@ main_exports = [ "//jvm:kotlin_serialization", ] main_deps = main_exports + [ - "@com_github_jetbrains_kotlin//:kotlin-reflect", + "@maven//:org_jetbrains_kotlin_kotlin_reflect", ] main_runtime_deps = [] diff --git a/jvm/dependencies/common.bzl b/jvm/dependencies/common.bzl index bae3bae9a..f22761b9f 100644 --- a/jvm/dependencies/common.bzl +++ b/jvm/dependencies/common.bzl @@ -1,6 +1,7 @@ load("//jvm/dependencies:versions.bzl", "versions") maven = [ + "org.jetbrains.kotlin:kotlin-reflect:%s" % "1.7.10", "org.jetbrains.kotlinx:kotlinx-coroutines-core:%s" % versions.kotlin.coroutines, "org.jetbrains.kotlinx:kotlinx-serialization-json:%s" % versions.kotlin.serialization, "com.intuit.hooks:hooks:%s" % versions.hooks, From ababee13844f111b5acef12510d491a15b9e60be Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 00:44:01 -0500 Subject: [PATCH 10/21] sync --experimental_google_legacy_api --- .bazelrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelrc b/.bazelrc index 07e41d4a6..ac9bb9e5e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -20,6 +20,7 @@ build --android_databinding_use_v3_4_args build --android_databinding_use_androidx build --experimental_google_legacy_api query --experimental_google_legacy_api +sync --experimental_google_legacy_api # Android demo app flags build --noincremental_dexing --fat_apk_cpu=armeabi-v7a,arm64-v8a,x86,x86_64 From d0c58e8cf9e90fd8fdb759b76268f6da7020da0b Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 01:50:05 -0500 Subject: [PATCH 11/21] cleanup --- .bazelrc | 1 - WORKSPACE | 39 ----------------------- android/demo/BUILD | 1 - build_constants.bzl | 4 +-- jvm/dependencies/deps.bzl | 3 +- plugins/reference-assets/android/BUILD | 1 - plugins/reference-assets/android/deps.bzl | 7 ++-- 7 files changed, 5 insertions(+), 51 deletions(-) diff --git a/.bazelrc b/.bazelrc index ac9bb9e5e..fab1fbcef 100644 --- a/.bazelrc +++ b/.bazelrc @@ -14,7 +14,6 @@ coverage:ci --experimental_remote_cache_compression --experimental_remote_cache_ # build --noincompatible_disable_managed_directories # Android databinding flags -build --experimental_allow_android_library_deps_without_srcs build --experimental_android_databinding_v2 build --android_databinding_use_v3_4_args build --android_databinding_use_androidx diff --git a/WORKSPACE b/WORKSPACE index 2a427963d..e45ba07f0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -213,42 +213,3 @@ maven_install( "https://repo1.maven.org/maven2", ], ) - -maven_install( - name = "bazel_common_maven", - artifacts = [ - "com.google.guava:guava:29.0-jre", - "com.google.auto:auto-common:0.10", - "com.google.auto.service:auto-service:1.0-rc6", - "com.google.protobuf:protobuf-java:3.6.0", - "com.google.protobuf:protobuf-java-util:3.6.0", - "io.reactivex.rxjava3:rxjava:3.0.12", - "com.squareup.moshi:moshi-kotlin:1.14.0", - "com.squareup.okio:okio-jvm:3.2.0", - "com.squareup:javapoet:1.13.0", - "com.github.ajalt:clikt:2.8.0", - "org.ow2.asm:asm:6.0", - "org.ow2.asm:asm-tree:6.0", - "xmlpull:xmlpull:1.1.3.1", - "net.sf.kxml:kxml2:2.3.0", - "com.squareup.moshi:moshi:1.11.0", - "org.jetbrains.kotlin:kotlin-parcelize-compiler:1.7.21", - "org.jetbrains.kotlin:kotlin-parcelize-runtime:1.7.21", - "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4", - "com.github.tschuchortdev:kotlin-compile-testing:1.5.0", - "com.google.android.material:material:1.2.1", - "javax.inject:javax.inject:1", - "junit:junit:4.13", - "org.json:json:20210307", - ], - repositories = [ - "https://jcenter.bintray.com/", - "https://maven.google.com", - "https://repo1.maven.org/maven2", - ], - strict_visibility = True, -) - -load("@vaticle_bazel_distribution//common:rules.bzl", "workspace_refs") - -workspace_refs(name = "plugin_workspace_refs") diff --git a/android/demo/BUILD b/android/demo/BUILD index 68a65c53f..3db069113 100644 --- a/android/demo/BUILD +++ b/android/demo/BUILD @@ -11,7 +11,6 @@ kt_android_library( assets = glob(["src/main/assets/mocks/**"]), assets_dir = "src/main/assets", custom_package = "com.intuit.player.android.reference.demo", - enable_data_binding = False, manifest = ":src/main/AndroidManifest.xml", resource_files = glob(["src/main/res/**"]), deps = main_deps, diff --git a/build_constants.bzl b/build_constants.bzl index 3f89456f2..4ef3adfd4 100644 --- a/build_constants.bzl +++ b/build_constants.bzl @@ -11,14 +11,14 @@ filegroup( version = repository_ctx.read(repository_ctx.attr.version_file) - _MAVEN_CONSTANTS_FILE = """ + _CONSTANTS_FILE = """ # DO NOT EDIT: automatically generated for _build_constants rule VERSION = \"{version}\" """ repository_ctx.file( "constants.bzl", - _MAVEN_CONSTANTS_FILE.format(version = version), + _CONSTANTS_FILE.format(version = version), False, ) diff --git a/jvm/dependencies/deps.bzl b/jvm/dependencies/deps.bzl index 8dd6e5704..da280b141 100644 --- a/jvm/dependencies/deps.bzl +++ b/jvm/dependencies/deps.bzl @@ -9,8 +9,7 @@ load("//jvm/testutils:deps.bzl", testutils = "maven") load("//jvm/perf:deps.bzl", perf = "maven") load("//plugins:deps.bzl", plugins = "maven") load("@rules_player//distribution:deps.bzl", distribution = "maven") -#load("@grab_bazel_common//:workspace_defs.bzl", grab = "GRAB_BAZEL_COMMON_ARTIFACTS") -tooling = distribution #+ grab +tooling = distribution maven = remove_duplicates(common + core + graaljs + j2v8 + utils + testutils + perf + plugins + tooling + android) diff --git a/plugins/reference-assets/android/BUILD b/plugins/reference-assets/android/BUILD index 98c932ee1..7e9dd2ed0 100644 --- a/plugins/reference-assets/android/BUILD +++ b/plugins/reference-assets/android/BUILD @@ -6,7 +6,6 @@ kt_android_library( name = "assets", srcs = glob(["src/main/java/**/*.kt"]), custom_package = "com.intuit.player.android.reference.assets", - enable_data_binding = False, manifest = ":src/main/AndroidManifest.xml", resource_files = glob(["src/main/res/**"]), visibility = ["//visibility:public"], diff --git a/plugins/reference-assets/android/deps.bzl b/plugins/reference-assets/android/deps.bzl index 9d3f783f6..57a819c4b 100644 --- a/plugins/reference-assets/android/deps.bzl +++ b/plugins/reference-assets/android/deps.bzl @@ -2,16 +2,13 @@ load("//jvm/dependencies:versions.bzl", "versions") load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") load("//plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test:deps.bzl", maven_test = "maven") -maven_main = [ - "androidx.databinding:databinding-runtime:%s" % versions.androidx.databinding, -] +maven_main = [] main_exports = [ - # "//android/player", + "//android/player", ] main_deps = main_exports + parse_coordinates(maven_main) + [ - "//android/player", "//jvm:kotlin_serialization", "//plugins/reference-assets/jvm:reference-assets", "//plugins/pending-transaction/jvm:pending-transaction", From 14621917cad6aba24f2ee27056eee15a994cabcc Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 03:02:57 -0500 Subject: [PATCH 12/21] fix gpg tty for release --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3085b7378..76d459ba0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,7 +53,10 @@ commands: - run: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - - run: echo -e $GPG_KEY | gpg --import --batch + - run: | + echo 'export GPG_TTY=$(tty)' >> $BASH_ENV + source $BASH_ENV + echo -e $GPG_KEY | gpg --import --batch - run: | source ~/.bashrc bundle install From 780becf1741cf8ec4946fb8d15b4ab904a504e55 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 13:18:02 -0500 Subject: [PATCH 13/21] use pinentry instead --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 76d459ba0..127ea5515 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,8 +54,8 @@ commands: - run: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - run: | - echo 'export GPG_TTY=$(tty)' >> $BASH_ENV - source $BASH_ENV + echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf + echo RELOADAGENT | gpg-connect-agent echo -e $GPG_KEY | gpg --import --batch - run: | source ~/.bashrc From 77af9f2b0718732c5faa05996796f2667dac914a Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 13:59:03 -0500 Subject: [PATCH 14/21] strip down ci --- .circleci/config.yml | 120 +------------------------------------------ 1 file changed, 1 insertion(+), 119 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 127ea5515..79507b1ba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -336,55 +336,6 @@ workflows: requires: - setup - - applitools_init: - filters: - branches: - ignore: - - /pull\/.*/ - context: - - applitools - requires: - - bazelrc - - - build: - name: build-trunk - filters: - branches: - ignore: - - /pull\/.*/ - requires: - - bazelrc - - - build: - name: build-fork - filters: - branches: - only: - - /pull\/.*/ - requires: - - setup - - - build_ios: - name: build-ios-trunk - filters: - branches: - ignore: - - /pull\/.*/ - context: - - applitools - requires: - - applitools_init - - bazelrc - - - build_ios: - name: build-ios-fork - filters: - branches: - only: - - /pull\/.*/ - requires: - - setup - - maybe_release: filters: branches: @@ -393,76 +344,7 @@ workflows: context: - Publish requires: - - build-trunk - - build-ios-trunk - - - test: - name: test-trunk - filters: - branches: - ignore: - - /pull\/.*/ - requires: - - build-trunk - - - test: - name: test-fork - filters: - branches: - only: - - /pull\/.*/ - requires: - - build-fork - - - android_test: - name: android-test-trunk - filters: - branches: - ignore: - - /pull\/.*/ - context: - - applitools - requires: - - applitools_init - - build-trunk - - - android_test: - name: android-test-fork - filters: - branches: - only: - - /pull\/.*/ - requires: - - build-fork - - - coverage: - name: coverage-trunk - filters: - branches: - ignore: - - /pull\/.*/ - requires: - - build-trunk - - - coverage: - name: coverage-fork - filters: - branches: - only: - - /pull\/.*/ - requires: - - build-fork - - - applitools_cleanup: - filters: - branches: - ignore: - - /pull\/.*/ - context: - - applitools - requires: - - android-test-trunk - - build-ios-trunk + - bazelrc build_and_test_main: when: From 28d22ff2f04c3180218b5fb92a85ad43919d4a3d Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 14:28:39 -0500 Subject: [PATCH 15/21] fix writing to gpg conf --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 79507b1ba..bafe9984d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,9 +54,8 @@ commands: - run: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - run: | - echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf - echo RELOADAGENT | gpg-connect-agent echo -e $GPG_KEY | gpg --import --batch + echo -e "pinentry-mode loopback\npassphrase $DEPLOY_MAVEN_GPG_PASSPHRASE" > ~/.gnupg/gpg.conf - run: | source ~/.bashrc bundle install From 5db46886a034d2581af57bd0324a25918c60d4de Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 16:21:04 -0500 Subject: [PATCH 16/21] exclude kotlin stdlib --- jvm/build.bzl | 4 ++++ jvm/core/BUILD | 3 +++ 2 files changed, 7 insertions(+) diff --git a/jvm/build.bzl b/jvm/build.bzl index ee4abf541..5dca8bb81 100644 --- a/jvm/build.bzl +++ b/jvm/build.bzl @@ -25,6 +25,8 @@ def kt_player_module( # Distribution config group = DEFAULT_GROUP, + deploy_env = None, + excluded_workspaces = None, # Package level config module_name = None, @@ -49,6 +51,8 @@ def kt_player_module( lint_config = "//jvm:lint_config", group = group, version = VERSION, + deploy_env = deploy_env, + excluded_workspaces = excluded_workspaces, module_name = module_name, main_opts = "//jvm:main_options", main_srcs = main_srcs, diff --git a/jvm/core/BUILD b/jvm/core/BUILD index 1f7ece996..ceef2bc3e 100644 --- a/jvm/core/BUILD +++ b/jvm/core/BUILD @@ -4,6 +4,9 @@ load(":deps.bzl", "main_deps", "main_exports", "test_deps") # TODO: Sources jar for src/main/kotlin includes main/kotlin kt_player_module( name = "core", + excluded_workspaces = { + "com_github_jetbrains_kotlin": None, + }, main_deps = main_deps, main_exports = main_exports, test_deps = test_deps, From eafff92a6e62fe2bfda8fcc3cc7ed7d3dc8beed4 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 18:12:24 -0500 Subject: [PATCH 17/21] ensure resources exist in top-level AAR --- android/player/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/android/player/BUILD b/android/player/BUILD index ed666f6a8..c2a2044ef 100644 --- a/android/player/BUILD +++ b/android/player/BUILD @@ -25,6 +25,7 @@ android_library( name = "player", custom_package = "com.intuit.player.android", manifest = ":src/main/AndroidManifest.xml", + resource_files = glob(["src/main/res/**"]), tags = ["maven_coordinates=com.intuit.player.android:player:aar:%s" % VERSION], visibility = ["//visibility:public"], exports = ["player-lib"], From 1fbe6d54a1592d3b73bf945e9953759caa6159e1 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 22:50:57 -0500 Subject: [PATCH 18/21] working player distrib --- WORKSPACE | 53 ++++++++++++++++++++++++++--------------- android/player/BUILD | 19 ++++++++++++++- android/player/deps.bzl | 6 ++--- jvm/build.bzl | 4 +++- jvm/j2v8/build.bzl | 2 +- jvm/j2v8/libs/BUILD | 2 ++ 6 files changed, 61 insertions(+), 25 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index e45ba07f0..395b97497 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -13,21 +13,36 @@ build_constants() load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -git_repository( +local_repository( + name = "grab_bazel_common", + path = "../../sugarmanz/grab-bazel-common", +) + +local_repository( name = "rules_jvm_external", - branch = "maven-export-aar", - patches = [ - "//patches:rules_jvm_external.default_public_visibility.patch", - ], - remote = "https://github.com/sugarmanz/rules_jvm_external", + path = "../../sugarmanz/rules_jvm_external", ) -git_repository( +local_repository( name = "rules_player", - branch = "maven-export-distribution", - remote = "https://github.com/player-ui/rules_player", + path = "../rules_player", ) +#git_repository( +# name = "rules_jvm_external", +# branch = "maven-export-aar", +# patches = [ +# "//patches:rules_jvm_external.default_public_visibility.patch", +# ], +# remote = "https://github.com/sugarmanz/rules_jvm_external", +#) + +#git_repository( +# name = "rules_player", +# branch = "maven-export-distribution", +# remote = "https://github.com/player-ui/rules_player", +#) + load("@rules_player//:workspace.bzl", "deps") deps() @@ -87,11 +102,11 @@ junit5() ###################### # Android Setup # ###################### -http_archive( - name = "android_tools", - sha256 = "ed5290594244c2eeab41f0104519bcef51e27c699ff4b379fcbd25215270513e", - url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.23.0.tar.gz", -) +#http_archive( +# name = "android_tools", +# sha256 = "ed5290594244c2eeab41f0104519bcef51e27c699ff4b379fcbd25215270513e", +# url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.23.0.tar.gz", +#) grab_remote = "https://github.com/sugarmanz/grab-bazel-common.git" @@ -111,7 +126,7 @@ bazel_common_dependencies() load("@grab_bazel_common//android:initialize.bzl", "bazel_common_initialize") bazel_common_initialize( - patched_android_tools = False, + patched_android_tools = True, pinned_maven_install = False, ) @@ -171,10 +186,10 @@ android_ndk_repository(name = "androidndk") register_toolchains("@androidndk//:all") -bind( - name = "databinding_annotation_processor", - actual = "//android:compiler_annotation_processor", -) +#bind( +# name = "databinding_annotation_processor", +# actual = "//android:compiler_annotation_processor", +#) ###################### # Maven Dependencies # diff --git a/android/player/BUILD b/android/player/BUILD index c2a2044ef..b2781b4ba 100644 --- a/android/player/BUILD +++ b/android/player/BUILD @@ -5,6 +5,19 @@ load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") load("@junit//junit5-jupiter-starter-bazel:junit5.bzl", "kt_jvm_junit5_test") load("@rules_player//kotlin:lint.bzl", "lint") +load("@grab_bazel_common//tools/databinding:databinding.bzl", "kt_db_android_library") + +kt_db_android_library( + name = "player-db", + srcs = glob(["src/main/java/**/*.kt"]), + custom_package = "com.intuit.player.android", + manifest = ":src/main/AndroidManifest.xml", + resource_files = glob(["src/main/res/**"]), + resources = main_resources, + tags = ["maven_coordinates=com.intuit.player.android:player:aar:%s" % VERSION], + exports = main_exports, + deps = main_deps, +) kt_android_library( name = "player-lib", @@ -25,15 +38,19 @@ android_library( name = "player", custom_package = "com.intuit.player.android", manifest = ":src/main/AndroidManifest.xml", - resource_files = glob(["src/main/res/**"]), + # TODO: This is ugly garbage because the databinding processed resources aren't easily locatable + resource_files = glob(["src/main/processed-res/**"]), tags = ["maven_coordinates=com.intuit.player.android:player:aar:%s" % VERSION], visibility = ["//visibility:public"], exports = ["player-lib"], + deps = main_deps, ) distribution( name = "player", + lib_name = "player-db-databinding", maven_coordinates = "com.intuit.player.android:player:%s" % VERSION, + # tags = ["no-javadocs"], ) kt_jvm_junit5_test( diff --git a/android/player/deps.bzl b/android/player/deps.bzl index 2ffeae628..1707f26f2 100644 --- a/android/player/deps.bzl +++ b/android/player/deps.bzl @@ -12,9 +12,9 @@ maven = [ "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, # View binding - "androidx.annotation:annotation:%s" % versions.androidx.annotation, - "androidx.databinding:databinding-common:%s" % versions.androidx.databinding, - "androidx.databinding:databinding-runtime:%s" % versions.androidx.databinding, + # "androidx.annotation:annotation:%s" % versions.androidx.annotation, + # "androidx.databinding:databinding-common:%s" % versions.androidx.databinding, + # "androidx.databinding:databinding-runtime:%s" % versions.androidx.databinding, # Default fallback "androidx.constraintlayout:constraintlayout:%s" % versions.androidx.constraintlayout, diff --git a/jvm/build.bzl b/jvm/build.bzl index 5dca8bb81..f5a529e61 100644 --- a/jvm/build.bzl +++ b/jvm/build.bzl @@ -78,9 +78,11 @@ def distribution( *, name, maven_coordinates, - lib_name = None): + lib_name = None, + **kwargs): _distribution( name = name, maven_coordinates = maven_coordinates, lib_name = lib_name, + **kwargs ) diff --git a/jvm/j2v8/build.bzl b/jvm/j2v8/build.bzl index 2011de4ed..d414c5800 100644 --- a/jvm/j2v8/build.bzl +++ b/jvm/j2v8/build.bzl @@ -4,7 +4,7 @@ load("@build_constants//:constants.bzl", "VERSION") deps = { "macos": ["//jvm/j2v8/libs:j2v8_macos"], "linux": ["//jvm/j2v8/libs:j2v8_linux"], - "android": ["@android_j2v8//aar"], + "android": ["@maven//:com_eclipsesource_j2v8_j2v8"], "android-debug": [ "//jvm/j2v8:j2v8-android", "@maven//:com_github_AlexTrotsenko_j2v8_debugger", diff --git a/jvm/j2v8/libs/BUILD b/jvm/j2v8/libs/BUILD index db47fce14..27f1cb409 100644 --- a/jvm/j2v8/libs/BUILD +++ b/jvm/j2v8/libs/BUILD @@ -4,6 +4,7 @@ java_import( name = "j2v8_empty_compile_only", jars = [":j2v8_empty-6.1.0.jar"], neverlink = True, + tags = ["maven:compile-only"], ) java_import( @@ -23,5 +24,6 @@ java_import( name = "j2v8_debugger_compile_only", jars = [], neverlink = True, + tags = ["maven:compile-only"], deps = ["@maven//:com_github_AlexTrotsenko_j2v8_debugger"], ) From 54f569aeb749001b9a0a823aaf5ee9edcbdbe6fa Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 23:49:20 -0500 Subject: [PATCH 19/21] working grab_bazel_common + some cleanup --- WORKSPACE | 55 +++++++++--------------------------------- android/demo/BUILD | 1 - android/demo/README.md | 9 ------- android/player/BUILD | 35 +++------------------------ 4 files changed, 15 insertions(+), 85 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 395b97497..2b96c7084 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -13,36 +13,21 @@ build_constants() load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -local_repository( - name = "grab_bazel_common", - path = "../../sugarmanz/grab-bazel-common", -) - -local_repository( +git_repository( name = "rules_jvm_external", - path = "../../sugarmanz/rules_jvm_external", + branch = "maven-export-aar", + patches = [ + "//patches:rules_jvm_external.default_public_visibility.patch", + ], + remote = "https://github.com/sugarmanz/rules_jvm_external", ) -local_repository( +git_repository( name = "rules_player", - path = "../rules_player", + branch = "maven-export-distribution", + remote = "https://github.com/player-ui/rules_player", ) -#git_repository( -# name = "rules_jvm_external", -# branch = "maven-export-aar", -# patches = [ -# "//patches:rules_jvm_external.default_public_visibility.patch", -# ], -# remote = "https://github.com/sugarmanz/rules_jvm_external", -#) - -#git_repository( -# name = "rules_player", -# branch = "maven-export-distribution", -# remote = "https://github.com/player-ui/rules_player", -#) - load("@rules_player//:workspace.bzl", "deps") deps() @@ -102,21 +87,15 @@ junit5() ###################### # Android Setup # ###################### -#http_archive( -# name = "android_tools", -# sha256 = "ed5290594244c2eeab41f0104519bcef51e27c699ff4b379fcbd25215270513e", -# url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.23.0.tar.gz", -#) - grab_remote = "https://github.com/sugarmanz/grab-bazel-common.git" -grab_commit = "5326c6ba7a4e39e150c33e123134525473baffb6" +grab_commit = "35317b3d1c0da07b42af6e6a2137ebdec0ffe400" git_repository( name = "grab_bazel_common", commit = grab_commit, remote = grab_remote, - shallow_since = "1700536974 -0500", + shallow_since = "1706157787 -0500", ) load("@grab_bazel_common//android:repositories.bzl", "bazel_common_dependencies") @@ -126,7 +105,6 @@ bazel_common_dependencies() load("@grab_bazel_common//android:initialize.bzl", "bazel_common_initialize") bazel_common_initialize( - patched_android_tools = True, pinned_maven_install = False, ) @@ -169,12 +147,6 @@ overridden_targets = { load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_aar") -# Because J2V8 is published as type `aar.asc` -maven_aar( - name = "android_j2v8", - artifact = "com.eclipsesource.j2v8:j2v8:6.1.0", -) - # Because eyes androidx components is published as type `pom` maven_aar( name = "androidx_eyes_components", @@ -186,11 +158,6 @@ android_ndk_repository(name = "androidndk") register_toolchains("@androidndk//:all") -#bind( -# name = "databinding_annotation_processor", -# actual = "//android:compiler_annotation_processor", -#) - ###################### # Maven Dependencies # ###################### diff --git a/android/demo/BUILD b/android/demo/BUILD index 3db069113..c6445dde4 100644 --- a/android/demo/BUILD +++ b/android/demo/BUILD @@ -25,7 +25,6 @@ android_binary( multidex = "native", deps = [ ":demo_lib", - "@android_j2v8//aar", "@maven//:androidx_databinding_databinding_common", "@maven//:androidx_databinding_databinding_runtime", "@maven//:org_jetbrains_kotlin_kotlin_reflect", diff --git a/android/demo/README.md b/android/demo/README.md index a7f36a57a..8a230f9a5 100644 --- a/android/demo/README.md +++ b/android/demo/README.md @@ -56,12 +56,3 @@ Make sure you have done a `bundle install` **Possible Solution:** Check your SDK and NDK versions in SDK Manager in Android Studio. As well as your `ANDROID_HOME` and `ANDROID_NDK_HOME` in your bash or zsh profiles to make sure they are properly set. You can also do `ls $ANDROID_HOME/platforms` and make sure that there are no versions higher than 30. - - - -### 4. Mvn Error Message: -``` - //jvm/j2v8:j2v8-android depends on @android_j2v8//aar:aar in repository @android_j2v8 which failed to fetch. no such package '@android_j2v8//aar': android_j2v8 requires mvn as a dependency. Please check your PATH. -``` -Check to make sure `mvn` is installed. -`brew install maven` \ No newline at end of file diff --git a/android/player/BUILD b/android/player/BUILD index b2781b4ba..561fa6ac1 100644 --- a/android/player/BUILD +++ b/android/player/BUILD @@ -8,55 +8,28 @@ load("@rules_player//kotlin:lint.bzl", "lint") load("@grab_bazel_common//tools/databinding:databinding.bzl", "kt_db_android_library") kt_db_android_library( - name = "player-db", - srcs = glob(["src/main/java/**/*.kt"]), - custom_package = "com.intuit.player.android", - manifest = ":src/main/AndroidManifest.xml", - resource_files = glob(["src/main/res/**"]), - resources = main_resources, - tags = ["maven_coordinates=com.intuit.player.android:player:aar:%s" % VERSION], - exports = main_exports, - deps = main_deps, -) - -kt_android_library( - name = "player-lib", + name = "player", srcs = glob(["src/main/java/**/*.kt"]), custom_package = "com.intuit.player.android", - enable_data_binding = True, manifest = ":src/main/AndroidManifest.xml", resource_files = glob(["src/main/res/**"]), resources = main_resources, - exports = main_exports, - deps = main_deps, -) - -# TODO: This is currently needed to ensure the AAR is created for the primary output -# Additionally, we need to ensure the maven_coordinates tag only sticks to outer -# artifact to capture the transitive closure. -android_library( - name = "player", - custom_package = "com.intuit.player.android", - manifest = ":src/main/AndroidManifest.xml", - # TODO: This is ugly garbage because the databinding processed resources aren't easily locatable - resource_files = glob(["src/main/processed-res/**"]), tags = ["maven_coordinates=com.intuit.player.android:player:aar:%s" % VERSION], visibility = ["//visibility:public"], - exports = ["player-lib"], + exports = main_exports, deps = main_deps, ) distribution( name = "player", - lib_name = "player-db-databinding", + lib_name = "player-databinding", maven_coordinates = "com.intuit.player.android:player:%s" % VERSION, - # tags = ["no-javadocs"], ) kt_jvm_junit5_test( name = "player-tests", srcs = glob(["src/test/java/**"]), - associates = [":player-lib_kt"], + associates = [":player-kotlin"], kotlinc_opts = "//jvm:test_options", test_package = "com.intuit.player.android", deps = [":player"] + test_deps, From 2b686043ebd86cb10cadea6ad6f7825a449876c3 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 23:54:50 -0500 Subject: [PATCH 20/21] more cleanup --- android/BUILD | 9 --------- android/player/deps.bzl | 5 ----- jvm/dependencies/versions.bzl | 1 - 3 files changed, 15 deletions(-) diff --git a/android/BUILD b/android/BUILD index 6cb14f3ef..e69de29bb 100644 --- a/android/BUILD +++ b/android/BUILD @@ -1,9 +0,0 @@ -java_plugin( - name = "compiler_annotation_processor", - generates_api = True, - processor_class = "android.databinding.annotationprocessor.ProcessDataBinding", - visibility = ["//visibility:public"], - deps = [ - "@bazel_tools//src/tools/android/java/com/google/devtools/build/android:all_android_tools", - ], -) diff --git a/android/player/deps.bzl b/android/player/deps.bzl index 1707f26f2..b6aa15d2a 100644 --- a/android/player/deps.bzl +++ b/android/player/deps.bzl @@ -11,11 +11,6 @@ maven = [ "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, - # View binding - # "androidx.annotation:annotation:%s" % versions.androidx.annotation, - # "androidx.databinding:databinding-common:%s" % versions.androidx.databinding, - # "androidx.databinding:databinding-runtime:%s" % versions.androidx.databinding, - # Default fallback "androidx.constraintlayout:constraintlayout:%s" % versions.androidx.constraintlayout, ] diff --git a/jvm/dependencies/versions.bzl b/jvm/dependencies/versions.bzl index f1825f85c..ae1e7aef0 100644 --- a/jvm/dependencies/versions.bzl +++ b/jvm/dependencies/versions.bzl @@ -26,7 +26,6 @@ versions = struct( jmh = "1.21", androidx = struct( activity = "1.2.3", - annotation = "1.5.0", appcompat = "1.3.0", constraintlayout = "2.1.4", core = "1.6.0", From 78345ac70c5bb34fcd58147ab49e38f22d3524fd Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 24 Jan 2024 23:58:01 -0500 Subject: [PATCH 21/21] reset circle config --- .circleci/config.yml | 120 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bafe9984d..b362c4f08 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -335,6 +335,55 @@ workflows: requires: - setup + - applitools_init: + filters: + branches: + ignore: + - /pull\/.*/ + context: + - applitools + requires: + - bazelrc + + - build: + name: build-trunk + filters: + branches: + ignore: + - /pull\/.*/ + requires: + - bazelrc + + - build: + name: build-fork + filters: + branches: + only: + - /pull\/.*/ + requires: + - setup + + - build_ios: + name: build-ios-trunk + filters: + branches: + ignore: + - /pull\/.*/ + context: + - applitools + requires: + - applitools_init + - bazelrc + + - build_ios: + name: build-ios-fork + filters: + branches: + only: + - /pull\/.*/ + requires: + - setup + - maybe_release: filters: branches: @@ -343,7 +392,76 @@ workflows: context: - Publish requires: - - bazelrc + - build-trunk + - build-ios-trunk + + - test: + name: test-trunk + filters: + branches: + ignore: + - /pull\/.*/ + requires: + - build-trunk + + - test: + name: test-fork + filters: + branches: + only: + - /pull\/.*/ + requires: + - build-fork + + - android_test: + name: android-test-trunk + filters: + branches: + ignore: + - /pull\/.*/ + context: + - applitools + requires: + - applitools_init + - build-trunk + + - android_test: + name: android-test-fork + filters: + branches: + only: + - /pull\/.*/ + requires: + - build-fork + + - coverage: + name: coverage-trunk + filters: + branches: + ignore: + - /pull\/.*/ + requires: + - build-trunk + + - coverage: + name: coverage-fork + filters: + branches: + only: + - /pull\/.*/ + requires: + - build-fork + + - applitools_cleanup: + filters: + branches: + ignore: + - /pull\/.*/ + context: + - applitools + requires: + - android-test-trunk + - build-ios-trunk build_and_test_main: when: