From 877a0d24ca17c91c9a69014a304af76bb0d32389 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 30 Aug 2022 14:50:30 -0400 Subject: [PATCH 1/9] wip on re-org --- WORKSPACE | 19 +----- android/demo/BUILD | 8 +-- android/demo/deps.bzl | 62 ++++++++++++++----- android/deps.bzl | 19 ++++++ android/player/BUILD | 9 +-- android/player/deps.bzl | 24 ++++--- .../android/lifecycle/PlayerViewModel.kt | 2 +- jvm/dependencies/deps.bzl | 5 +- jvm/dependencies/versions.bzl | 20 ++++++ plugins/reference-assets/android/BUILD | 3 +- plugins/reference-assets/android/build.bzl | 2 +- plugins/reference-assets/android/deps.bzl | 13 ++-- .../reference/assets/action/ActionTest.kt | 0 .../android/reference/assets/action/BUILD | 0 .../android/reference/assets/collection/BUILD | 0 .../assets/collection/CollectionTest.kt | 0 .../android/reference/assets/info/BUILD | 0 .../android/reference/assets/info/InfoTest.kt | 0 .../android/reference/assets/input/BUILD | 0 .../reference/assets/input/InputTest.kt | 0 .../reference/assets/test/AssetTest.kt | 4 +- .../android/reference/assets/test/BUILD | 9 +++ .../reference/assets/test/assertions.kt | 0 .../android/reference/assets/test/deps.bzl | 18 ++++++ .../android/reference/assets/text/BUILD | 0 .../android/reference/assets/text/TextTest.kt | 0 .../android/reference/assets/test/BUILD | 25 -------- 27 files changed, 148 insertions(+), 94 deletions(-) create mode 100644 android/deps.bzl rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/action/ActionTest.kt (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/action/BUILD (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/collection/BUILD (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/collection/CollectionTest.kt (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/info/BUILD (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/info/InfoTest.kt (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/input/BUILD (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/input/InputTest.kt (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/test/AssetTest.kt (96%) create mode 100644 plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/BUILD rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/test/assertions.kt (100%) create mode 100644 plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/deps.bzl rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/text/BUILD (100%) rename plugins/reference-assets/android/src/{test => androidTest}/java/com/intuit/player/android/reference/assets/text/TextTest.kt (100%) delete mode 100644 plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/BUILD diff --git a/WORKSPACE b/WORKSPACE index 35582baaf..1d8155ff6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -156,23 +156,10 @@ register_toolchains("@androidndk//:all") load("//jvm/dependencies:deps.bzl", artifacts = "maven") load("@rules_jvm_external//:defs.bzl", "maven_install") +print(artifacts) + maven_install( - artifacts = artifacts + [ - "androidx.databinding:databinding-adapters:7.1.0", - "androidx.databinding:databinding-common:7.1.0", - "androidx.databinding:databinding-compiler:7.1.0", - "androidx.databinding:databinding-runtime:7.1.0", - "androidx.annotation:annotation:1.3.0", - "com.google.dagger:dagger:2.35.1", - "com.google.dagger:dagger-compiler:2.35.1", - "com.google.dagger:dagger-producers:2.35.1", - "javax.inject:javax.inject:1", - "org.robolectric:robolectric:4.8", - "androidx.test:core:1.4.0", - "androidx.test.ext:junit-ktx:1.1.3", - "junit:junit:4.12", - "org.junit.vintage:junit-vintage-engine:5.6.0", - ], + artifacts = artifacts, fetch_sources = True, override_targets = overridden_targets, repositories = [ diff --git a/android/demo/BUILD b/android/demo/BUILD index 4d031b7f0..baa6680b4 100644 --- a/android/demo/BUILD +++ b/android/demo/BUILD @@ -24,10 +24,10 @@ 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", +# "@android_j2v8//aar", +# "@maven//:androidx_databinding_databinding_common", +# "@maven//:androidx_databinding_databinding_runtime", +# "@maven//:org_jetbrains_kotlin_kotlin_reflect", ], ) diff --git a/android/demo/deps.bzl b/android/demo/deps.bzl index d9619ae9c..581a9a378 100644 --- a/android/demo/deps.bzl +++ b/android/demo/deps.bzl @@ -1,32 +1,60 @@ load("//jvm/dependencies:versions.bzl", "versions") load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") +load("@rules_jvm_external//:specs.bzl", _maven = "maven") maven_main = [ - "androidx.appcompat:appcompat:1.2.0", - "androidx.core:core-ktx:1.3.2", - "androidx.constraintlayout:constraintlayout:2.0.4", - "androidx.navigation:navigation-fragment-ktx:2.3.3", - "androidx.navigation:navigation-ui-ktx:2.3.3", - "androidx.navigation:navigation-fragment:2.3.3", - "androidx.navigation:navigation-ui:2.3.3", - "androidx.navigation:navigation-runtime:2.3.3", - "com.afollestad.material-dialogs:core:3.3.0", + "androidx.appcompat:appcompat:1.2.0", + "androidx.core:core-ktx:1.3.2", + "androidx.constraintlayout:constraintlayout:2.0.4", +# "androidx.navigation:navigation-fragment-ktx:2.3.3", +# "androidx.navigation:navigation-ui-ktx:2.3.3", +# "androidx.navigation:navigation-fragment:2.3.3", +# "androidx.navigation:navigation-ui:2.3.3", +# "androidx.navigation:navigation-runtime:2.3.3", + "com.afollestad.material-dialogs:core:3.3.0", + + "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, + "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, #"com.squareup.leakcanary:leakcanary-android:2.2", + + "androidx.activity:activity-ktx:%s" % versions.androidx.activity, + + _maven.artifact( + group = "androidx.navigation", + artifact = "navigation-runtime-ktx", + version = versions.androidx.navigation, +# exclusions = ["androidx.activity:activity-ktx","androidx.activity:activity"], + ), + + _maven.artifact( + group = "androidx.navigation", + artifact = "navigation-ui-ktx", + version = versions.androidx.navigation, +# exclusions = ["androidx.fragment:fragment-ktx"], + ), + + _maven.artifact( + group = "androidx.navigation", + artifact = "navigation-fragment-ktx", + version = versions.androidx.navigation, + exclusions = ["androidx.fragment:fragment-ktx"], + ), +# "androidx.window:window:1.0.0" ] maven_test = [ - "com.applitools:eyes-android-espresso:4.7.6", - "androidx.test:runner:1.3.0", - "androidx.test:rules:1.3.0", - "androidx.test.espresso:espresso-core:3.3.0", - "androidx.test.espresso:espresso-contrib:3.3.0", - "androidx.test.espresso:espresso-intents:3.3.0", - "androidx.test.ext:junit-ktx:1.1.2", + # "com.applitools:eyes-android-espresso:4.7.6", + # "androidx.test:runner:1.3.0", + # "androidx.test:rules:1.3.0", + # "androidx.test.espresso:espresso-core:3.3.0", + # "androidx.test.espresso:espresso-contrib:3.3.0", + # "androidx.test.espresso:espresso-intents:3.3.0", + # "androidx.test.ext:junit-ktx:1.1.2", ] maven = maven_main + maven_test -main_deps = parse_coordinates(maven) + [ +main_deps = parse_coordinates(maven_main) + [ "//android/player", "//plugins/reference-assets/android:assets", "//jvm/utils", diff --git a/android/deps.bzl b/android/deps.bzl new file mode 100644 index 000000000..ca4e85778 --- /dev/null +++ b/android/deps.bzl @@ -0,0 +1,19 @@ +load("//jvm/dependencies:versions.bzl", "versions") +load("//android/player:deps.bzl", player = "maven") +load("//android/demo:deps.bzl", demo = "maven") + +android = [ + # Grab Databinding + "androidx.databinding:databinding-adapters:%s" % versions.androidx.databinding, + "androidx.databinding:databinding-common:%s" % versions.androidx.databinding, +# "androidx.databinding:databinding-compiler:%s" % versions.androidx.databinding, + "androidx.databinding:databinding-runtime:%s" % versions.androidx.databinding, + + # Grab Dagger + "com.google.dagger:dagger:%s" % versions.dagger, + "com.google.dagger:dagger-compiler:%s" % versions.dagger, +# "com.google.dagger:dagger-producers:%s" % versions.dagger, + "javax.inject:javax.inject:%s" % versions.javax.inject, +] + +maven = android + player + demo \ No newline at end of file diff --git a/android/player/BUILD b/android/player/BUILD index e99e41501..ecbfa97b7 100644 --- a/android/player/BUILD +++ b/android/player/BUILD @@ -1,4 +1,4 @@ -load(":deps.bzl", "main_deps", "main_resources") +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("@junit//junit5-jupiter-starter-bazel:junit5.bzl", "kt_jvm_junit5_test") @@ -25,10 +25,5 @@ kt_jvm_junit5_test( associates = [":player-kotlin"], kotlinc_opts = "//jvm:test_options", test_package = "com.intuit.player.android", - deps = [ - ":player", - "//jvm/testutils", - "@grab_bazel_common//tools/test:mockable-android-jar", - "@maven//:io_mockk_mockk", - ], + deps = [":player"] + test_deps, ) diff --git a/android/player/deps.bzl b/android/player/deps.bzl index 273369469..0d340505a 100644 --- a/android/player/deps.bzl +++ b/android/player/deps.bzl @@ -2,15 +2,17 @@ load("//jvm/dependencies:versions.bzl", "versions") load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") maven = [ - "org.jetbrains.kotlinx:kotlinx-coroutines-android:%s" % versions.kotlin.coroutines, + # UI helpers + "androidx.core:core-ktx:%s" % versions.androidx.core, + "androidx.appcompat:appcompat:%s" % versions.androidx.appcompat, + "androidx.transition:transition:%s" % versions.androidx.transition, - # TODO: Potentially externalize versions - "androidx.appcompat:appcompat:1.2.0", - "androidx.core:core-ktx:1.3.2", - "androidx.constraintlayout:constraintlayout:2.0.4", - "androidx.navigation:navigation-fragment-ktx:2.3.3", - "androidx.navigation:navigation-ui-ktx:2.3.3", - "androidx.transition:transition:1.4.1", + # Lifecycle + "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, + "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, + + # Default fallback + "androidx.constraintlayout:constraintlayout:%s" % versions.androidx.constraintlayout, ] main_exports = [ @@ -29,3 +31,9 @@ main_resources = [ "//plugins/partial-match-fingerprint/core:PartialMatchFingerprintPlugin_Bundles", "//core/partial-match-registry:Registry_Bundles", ] + +test_deps = [ + "@grab_bazel_common//tools/test:mockable-android-jar", + "@maven//:io_mockk_mockk", + "//jvm/testutils", +] diff --git a/android/player/src/main/java/com/intuit/player/android/lifecycle/PlayerViewModel.kt b/android/player/src/main/java/com/intuit/player/android/lifecycle/PlayerViewModel.kt index 9296cb50e..5d0b553a6 100644 --- a/android/player/src/main/java/com/intuit/player/android/lifecycle/PlayerViewModel.kt +++ b/android/player/src/main/java/com/intuit/player/android/lifecycle/PlayerViewModel.kt @@ -177,7 +177,7 @@ public open class PlayerViewModel(flows: AsyncFlowIterator) : ViewModel(), Andro private val factory: (AsyncFlowIterator) -> T = { i -> PlayerViewModel(i) as T } ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): T { + override fun create(modelClass: Class): T { return factory(iterator).apply(PlayerViewModel::start) as T } } diff --git a/jvm/dependencies/deps.bzl b/jvm/dependencies/deps.bzl index b5baaf5b4..932d9a867 100644 --- a/jvm/dependencies/deps.bzl +++ b/jvm/dependencies/deps.bzl @@ -1,6 +1,5 @@ load(":common.bzl", common = "maven") -load("//android/player:deps.bzl", android = "maven") -load("//android/demo:deps.bzl", demo = "maven") +load("//android:deps.bzl", android = "maven") load("//jvm/core:deps.bzl", core = "maven") load("//jvm/graaljs:deps.bzl", graaljs = "maven") load("//jvm/j2v8:deps.bzl", j2v8 = "maven") @@ -13,4 +12,4 @@ load("@grab_bazel_common//:workspace_defs.bzl", grab = "GRAB_BAZEL_COMMON_ARTIFA tooling = distribution + grab -maven = common + core + graaljs + j2v8 + utils + testutils + perf + plugins + tooling + android + demo +maven = common + core + graaljs + j2v8 + utils + testutils + perf + plugins + tooling + android diff --git a/jvm/dependencies/versions.bzl b/jvm/dependencies/versions.bzl index 72aedee5b..431cebec9 100644 --- a/jvm/dependencies/versions.bzl +++ b/jvm/dependencies/versions.bzl @@ -13,9 +13,29 @@ versions = struct( ), hooks = "0.11.1", testing = struct( + junit = "4.12", jupiter = "5.6.0", kluent = "1.68", mockk = "1.9.3", + robolectric = "4.8", ), jmh = "1.21", + androidx = struct( + activity = "1.2.3", + appcompat = "1.3.0", + constraintlayout = "2.1.4", + core = "1.8.0", + databinding = "7.2.2", + lifecycle = "2.4.0", + navigation = "2.3.3", + test = struct( + core = "1.4.0", + junit = "1.1.3", + ), + transition = "1.4.1", + ), + dagger = "2.35.1", + javax = struct( + inject = "1", + ), ) diff --git a/plugins/reference-assets/android/BUILD b/plugins/reference-assets/android/BUILD index c62be268b..1d4f03014 100644 --- a/plugins/reference-assets/android/BUILD +++ b/plugins/reference-assets/android/BUILD @@ -1,5 +1,5 @@ load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") -load(":deps.bzl", "main_deps") +load(":deps.bzl", "main_deps", "main_exports") kt_android_library( name = "assets", @@ -8,5 +8,6 @@ kt_android_library( manifest = ":src/main/AndroidManifest.xml", resource_files = glob(["src/main/res/**"]), deps = main_deps, + exports = main_exports, visibility = ["//visibility:public"], ) diff --git a/plugins/reference-assets/android/build.bzl b/plugins/reference-assets/android/build.bzl index 42b18df52..9e84e5fe8 100644 --- a/plugins/reference-assets/android/build.bzl +++ b/plugins/reference-assets/android/build.bzl @@ -12,7 +12,7 @@ def kt_asset_test( custom_package = "com.intuit.player.android.reference.assets", test_class = test_class, deps = deps + [ - "//plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test", + "//plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test", "//jvm/j2v8:j2v8-all", ], resources = [ diff --git a/plugins/reference-assets/android/deps.bzl b/plugins/reference-assets/android/deps.bzl index 3bf44ad62..57a819c4b 100644 --- a/plugins/reference-assets/android/deps.bzl +++ b/plugins/reference-assets/android/deps.bzl @@ -1,20 +1,17 @@ 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 = [ - "org.jetbrains.kotlinx:kotlinx-coroutines-android:%s" % versions.kotlin.coroutines, - - "androidx.appcompat:appcompat:1.2.0", - "androidx.core:core-ktx:1.3.2", - "androidx.constraintlayout:constraintlayout:2.0.4", -] +maven_main = [] main_exports = [ "//android/player", ] -main_deps = main_exports + parse_coordinates(maven) + [ +main_deps = main_exports + parse_coordinates(maven_main) + [ "//jvm:kotlin_serialization", "//plugins/reference-assets/jvm:reference-assets", "//plugins/pending-transaction/jvm:pending-transaction", ] + +maven = maven_main + maven_test diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/action/ActionTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/action/ActionTest.kt similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/action/ActionTest.kt rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/action/ActionTest.kt diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/action/BUILD b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/action/BUILD similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/action/BUILD rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/action/BUILD diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/collection/BUILD b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/collection/BUILD similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/collection/BUILD rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/collection/BUILD diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/collection/CollectionTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/collection/CollectionTest.kt similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/collection/CollectionTest.kt rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/collection/CollectionTest.kt diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/info/BUILD b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/info/BUILD similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/info/BUILD rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/info/BUILD diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/info/InfoTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/info/InfoTest.kt similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/info/InfoTest.kt rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/info/InfoTest.kt diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/input/BUILD b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/input/BUILD similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/input/BUILD rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/input/BUILD diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/input/InputTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/input/InputTest.kt similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/input/InputTest.kt rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/input/InputTest.kt diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/AssetTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt similarity index 96% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/AssetTest.kt rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt index aba04276a..46e16b5e6 100644 --- a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/AssetTest.kt +++ b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt @@ -4,7 +4,7 @@ import android.content.Context import android.os.Build.VERSION_CODES.P import android.view.View import androidx.test.core.app.ApplicationProvider -import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.runner.AndroidJUnit4 import com.intuit.player.android.AndroidPlayer import com.intuit.player.android.asset.RenderableAsset import com.intuit.player.android.reference.assets.ReferenceAssetsPlugin @@ -25,10 +25,8 @@ import org.junit.Before import org.junit.Rule import org.junit.rules.TestName import org.junit.runner.RunWith -import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [P]) abstract class AssetTest(val group: String? = null) { @get:Rule diff --git a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/BUILD b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/BUILD new file mode 100644 index 000000000..7223f3e0e --- /dev/null +++ b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/BUILD @@ -0,0 +1,9 @@ +load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load(":deps.bzl", "main_deps") + +kt_android_library( + name = "test", + srcs = ["assertions.kt", "AssetTest.kt"], + deps = main_deps, + visibility = ["//plugins/reference-assets/android:__subpackages__"], +) diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/assertions.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/assertions.kt similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/assertions.kt rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/assertions.kt diff --git a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/deps.bzl b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/deps.bzl new file mode 100644 index 000000000..536c48fd5 --- /dev/null +++ b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/deps.bzl @@ -0,0 +1,18 @@ +load("//jvm/dependencies:versions.bzl", "versions") +load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") + +maven = [ + "androidx.test:core:%s" % versions.androidx.test.core, + "androidx.test:runner:%s" % versions.androidx.test.core, + "junit:junit:%s" % versions.testing.junit, + "org.robolectric:robolectric:%s" % versions.testing.robolectric, +] + +main_deps = parse_coordinates(maven) + [ + "@robolectric//bazel:android-all", + "//jvm/utils", + "//plugins/common-types/jvm:common-types", + "//plugins/pending-transaction/jvm:pending-transaction", + "//plugins/reference-assets/android:assets", + "//plugins/reference-assets/mocks:jar", +] diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/text/BUILD b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/text/BUILD similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/text/BUILD rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/text/BUILD diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/text/TextTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/text/TextTest.kt similarity index 100% rename from plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/text/TextTest.kt rename to plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/text/TextTest.kt diff --git a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/BUILD b/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/BUILD deleted file mode 100644 index 3a6be07f3..000000000 --- a/plugins/reference-assets/android/src/test/java/com/intuit/player/android/reference/assets/test/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") -load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") -load("//jvm/dependencies:versions.bzl", "versions") - -kt_android_library( - name = "test", - srcs = ["assertions.kt", "AssetTest.kt"], - deps = parse_coordinates([ - "androidx.test:core:1.4.0", - "androidx.test.ext:junit-ktx:1.1.3", - "junit:junit:4.12", - "org.junit.vintage:junit-vintage-engine:%s" % versions.testing.jupiter - ]) + [ - "//jvm/utils", - "//plugins/reference-assets/android:assets", - "//plugins/common-types/jvm:common-types", - "//plugins/pending-transaction/jvm:pending-transaction", - - # TODO: Fix all this - "@maven//:org_robolectric_robolectric", - "@robolectric//bazel:android-all", - "//plugins/reference-assets/mocks:jar", - ], - visibility = ["//plugins/reference-assets/android:__subpackages__"], -) From e868ac75ffd5ccc55182cbc4eaf9b4f7f7b8e972 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 30 Aug 2022 15:43:46 -0400 Subject: [PATCH 2/9] working dep cleanup --- android/demo/BUILD | 8 ++-- android/demo/deps.bzl | 69 +++++++++++++++++++---------------- android/player/deps.bzl | 7 +++- jvm/dependencies/versions.bzl | 8 ++-- 4 files changed, 52 insertions(+), 40 deletions(-) diff --git a/android/demo/BUILD b/android/demo/BUILD index baa6680b4..4d031b7f0 100644 --- a/android/demo/BUILD +++ b/android/demo/BUILD @@ -24,10 +24,10 @@ 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", + "@android_j2v8//aar", + "@maven//:androidx_databinding_databinding_common", + "@maven//:androidx_databinding_databinding_runtime", + "@maven//:org_jetbrains_kotlin_kotlin_reflect", ], ) diff --git a/android/demo/deps.bzl b/android/demo/deps.bzl index 581a9a378..4058ef4c0 100644 --- a/android/demo/deps.bzl +++ b/android/demo/deps.bzl @@ -3,43 +3,50 @@ load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") load("@rules_jvm_external//:specs.bzl", _maven = "maven") maven_main = [ - "androidx.appcompat:appcompat:1.2.0", - "androidx.core:core-ktx:1.3.2", - "androidx.constraintlayout:constraintlayout:2.0.4", -# "androidx.navigation:navigation-fragment-ktx:2.3.3", -# "androidx.navigation:navigation-ui-ktx:2.3.3", -# "androidx.navigation:navigation-fragment:2.3.3", -# "androidx.navigation:navigation-ui:2.3.3", -# "androidx.navigation:navigation-runtime:2.3.3", - "com.afollestad.material-dialogs:core:3.3.0", + "androidx.appcompat:appcompat:%s" % versions.androidx.appcompat, + "androidx.core:core-ktx:%s" % versions.androidx.core, + "androidx.constraintlayout:constraintlayout:%s" % versions.androidx.constraintlayout, - "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, - "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, - #"com.squareup.leakcanary:leakcanary-android:2.2", +# "androidx.lifecycle:lifecycle-runtime:%s" % versions.androidx.lifecycle, +# "androidx.lifecycle:lifecycle-viewmodel:%s" % versions.androidx.lifecycle, + +# "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, +# "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, - "androidx.activity:activity-ktx:%s" % versions.androidx.activity, + "androidx.navigation:navigation-runtime:%s" % versions.androidx.navigation, + "androidx.navigation:navigation-ui:%s" % versions.androidx.navigation, + "androidx.navigation:navigation-fragment:%s" % versions.androidx.navigation, - _maven.artifact( - group = "androidx.navigation", - artifact = "navigation-runtime-ktx", - version = versions.androidx.navigation, -# exclusions = ["androidx.activity:activity-ktx","androidx.activity:activity"], - ), + "androidx.navigation:navigation-runtime-ktx:%s" % versions.androidx.navigation, + "androidx.navigation:navigation-ui-ktx:%s" % versions.androidx.navigation, + "androidx.navigation:navigation-fragment-ktx:%s" % versions.androidx.navigation, - _maven.artifact( - group = "androidx.navigation", - artifact = "navigation-ui-ktx", - version = versions.androidx.navigation, +# "androidx.fragment:fragment:%s" % versions.androidx.fragment, +# "androidx.fragment:fragment-ktx:%s" % versions.androidx.fragment, +# +# "androidx.activity:activity:%s" % versions.androidx.activity, +# "androidx.activity:activity-ktx:%s" % versions.androidx.activity, +# _maven.artifact( +# group = "androidx.navigation", +# artifact = "navigation-runtime-ktx", +# version = versions.androidx.navigation, +# # exclusions = ["androidx.activity:activity-ktx","androidx.activity:activity"], +# ), +# _maven.artifact( +# group = "androidx.navigation", +# artifact = "navigation-ui-ktx", +# version = versions.androidx.navigation, +# # exclusions = ["androidx.fragment:fragment-ktx"], +# ), +# _maven.artifact( +# group = "androidx.navigation", +# artifact = "navigation-fragment-ktx", +# version = versions.androidx.navigation, # exclusions = ["androidx.fragment:fragment-ktx"], - ), +# ), - _maven.artifact( - group = "androidx.navigation", - artifact = "navigation-fragment-ktx", - version = versions.androidx.navigation, - exclusions = ["androidx.fragment:fragment-ktx"], - ), -# "androidx.window:window:1.0.0" + "com.afollestad.material-dialogs:core:%s" % versions.material_dialogs, + #"com.squareup.leakcanary:leakcanary-android:2.2", ] maven_test = [ diff --git a/android/player/deps.bzl b/android/player/deps.bzl index 0d340505a..4c21dedf4 100644 --- a/android/player/deps.bzl +++ b/android/player/deps.bzl @@ -8,11 +8,14 @@ maven = [ "androidx.transition:transition:%s" % versions.androidx.transition, # Lifecycle - "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, - "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, +# "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, +# "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, # Default fallback "androidx.constraintlayout:constraintlayout:%s" % versions.androidx.constraintlayout, + + "androidx.navigation:navigation-ui-ktx:%s" % versions.androidx.navigation, + "androidx.navigation:navigation-fragment-ktx:%s" % versions.androidx.navigation, ] main_exports = [ diff --git a/jvm/dependencies/versions.bzl b/jvm/dependencies/versions.bzl index 431cebec9..dde8e17b1 100644 --- a/jvm/dependencies/versions.bzl +++ b/jvm/dependencies/versions.bzl @@ -22,10 +22,11 @@ versions = struct( jmh = "1.21", androidx = struct( activity = "1.2.3", - appcompat = "1.3.0", - constraintlayout = "2.1.4", - core = "1.8.0", + appcompat = "1.2.0", + constraintlayout = "2.0.4", + core = "1.3.2", databinding = "7.2.2", + fragment = "1.3.4", lifecycle = "2.4.0", navigation = "2.3.3", test = struct( @@ -38,4 +39,5 @@ versions = struct( javax = struct( inject = "1", ), + material_dialogs = "3.3.0", ) From 84e2dbba32cbe1ae966acf7aa33c2fd1997ff9d6 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 30 Aug 2022 20:14:52 -0400 Subject: [PATCH 3/9] update to appcompat 1.3.0 --- android/demo/deps.bzl | 42 ++--------------------------------- android/deps.bzl | 6 +++-- android/player/deps.bzl | 7 ++---- jvm/dependencies/versions.bzl | 7 +++--- 4 files changed, 12 insertions(+), 50 deletions(-) diff --git a/android/demo/deps.bzl b/android/demo/deps.bzl index 4058ef4c0..486611dcc 100644 --- a/android/demo/deps.bzl +++ b/android/demo/deps.bzl @@ -3,49 +3,12 @@ load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") load("@rules_jvm_external//:specs.bzl", _maven = "maven") maven_main = [ - "androidx.appcompat:appcompat:%s" % versions.androidx.appcompat, - "androidx.core:core-ktx:%s" % versions.androidx.core, - "androidx.constraintlayout:constraintlayout:%s" % versions.androidx.constraintlayout, - -# "androidx.lifecycle:lifecycle-runtime:%s" % versions.androidx.lifecycle, -# "androidx.lifecycle:lifecycle-viewmodel:%s" % versions.androidx.lifecycle, - -# "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, -# "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, - "androidx.navigation:navigation-runtime:%s" % versions.androidx.navigation, - "androidx.navigation:navigation-ui:%s" % versions.androidx.navigation, - "androidx.navigation:navigation-fragment:%s" % versions.androidx.navigation, - - "androidx.navigation:navigation-runtime-ktx:%s" % versions.androidx.navigation, "androidx.navigation:navigation-ui-ktx:%s" % versions.androidx.navigation, "androidx.navigation:navigation-fragment-ktx:%s" % versions.androidx.navigation, -# "androidx.fragment:fragment:%s" % versions.androidx.fragment, -# "androidx.fragment:fragment-ktx:%s" % versions.androidx.fragment, -# -# "androidx.activity:activity:%s" % versions.androidx.activity, -# "androidx.activity:activity-ktx:%s" % versions.androidx.activity, -# _maven.artifact( -# group = "androidx.navigation", -# artifact = "navigation-runtime-ktx", -# version = versions.androidx.navigation, -# # exclusions = ["androidx.activity:activity-ktx","androidx.activity:activity"], -# ), -# _maven.artifact( -# group = "androidx.navigation", -# artifact = "navigation-ui-ktx", -# version = versions.androidx.navigation, -# # exclusions = ["androidx.fragment:fragment-ktx"], -# ), -# _maven.artifact( -# group = "androidx.navigation", -# artifact = "navigation-fragment-ktx", -# version = versions.androidx.navigation, -# exclusions = ["androidx.fragment:fragment-ktx"], -# ), - "com.afollestad.material-dialogs:core:%s" % versions.material_dialogs, + "com.google.android.material:material:%s" % versions.material, #"com.squareup.leakcanary:leakcanary-android:2.2", ] @@ -62,9 +25,8 @@ maven_test = [ maven = maven_main + maven_test main_deps = parse_coordinates(maven_main) + [ - "//android/player", - "//plugins/reference-assets/android:assets", "//jvm/utils", + "//plugins/reference-assets/android:assets", "//plugins/common-types/jvm:common-types", "//plugins/pending-transaction/jvm:pending-transaction", "//plugins/reference-assets/mocks:jar", diff --git a/android/deps.bzl b/android/deps.bzl index ca4e85778..533c78cbe 100644 --- a/android/deps.bzl +++ b/android/deps.bzl @@ -6,14 +6,16 @@ android = [ # Grab Databinding "androidx.databinding:databinding-adapters:%s" % versions.androidx.databinding, "androidx.databinding:databinding-common:%s" % versions.androidx.databinding, -# "androidx.databinding:databinding-compiler:%s" % versions.androidx.databinding, "androidx.databinding:databinding-runtime:%s" % versions.androidx.databinding, # Grab Dagger "com.google.dagger:dagger:%s" % versions.dagger, "com.google.dagger:dagger-compiler:%s" % versions.dagger, -# "com.google.dagger:dagger-producers:%s" % versions.dagger, "javax.inject:javax.inject:%s" % versions.javax.inject, + + # AndroidX Resolutions + "androidx.activity:activity-ktx:%s" % versions.androidx.activity, + "androidx.fragment:fragment-ktx:%s" % versions.androidx.fragment, ] maven = android + player + demo \ No newline at end of file diff --git a/android/player/deps.bzl b/android/player/deps.bzl index 4c21dedf4..0d340505a 100644 --- a/android/player/deps.bzl +++ b/android/player/deps.bzl @@ -8,14 +8,11 @@ maven = [ "androidx.transition:transition:%s" % versions.androidx.transition, # Lifecycle -# "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, -# "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, + "androidx.lifecycle:lifecycle-runtime-ktx:%s" % versions.androidx.lifecycle, + "androidx.lifecycle:lifecycle-viewmodel-ktx:%s" % versions.androidx.lifecycle, # Default fallback "androidx.constraintlayout:constraintlayout:%s" % versions.androidx.constraintlayout, - - "androidx.navigation:navigation-ui-ktx:%s" % versions.androidx.navigation, - "androidx.navigation:navigation-fragment-ktx:%s" % versions.androidx.navigation, ] main_exports = [ diff --git a/jvm/dependencies/versions.bzl b/jvm/dependencies/versions.bzl index dde8e17b1..376cac5fe 100644 --- a/jvm/dependencies/versions.bzl +++ b/jvm/dependencies/versions.bzl @@ -22,9 +22,9 @@ versions = struct( jmh = "1.21", androidx = struct( activity = "1.2.3", - appcompat = "1.2.0", - constraintlayout = "2.0.4", - core = "1.3.2", + appcompat = "1.3.0", + constraintlayout = "2.1.4", + core = "1.6.0", databinding = "7.2.2", fragment = "1.3.4", lifecycle = "2.4.0", @@ -40,4 +40,5 @@ versions = struct( inject = "1", ), material_dialogs = "3.3.0", + material = "1.6.1", ) From 8f65e1f1f32948893af7cb08d5c4cf6fa3967bf6 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 30 Aug 2022 21:32:11 -0400 Subject: [PATCH 4/9] demo test deps --- WORKSPACE | 2 -- android/demo/deps.bzl | 10 +++------- jvm/dependencies/deps.bzl | 3 ++- jvm/dependencies/versions.bzl | 2 ++ 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 1d8155ff6..a11eb6a5d 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -156,8 +156,6 @@ register_toolchains("@androidndk//:all") load("//jvm/dependencies:deps.bzl", artifacts = "maven") load("@rules_jvm_external//:defs.bzl", "maven_install") -print(artifacts) - maven_install( artifacts = artifacts, fetch_sources = True, diff --git a/android/demo/deps.bzl b/android/demo/deps.bzl index 486611dcc..9cd6726b0 100644 --- a/android/demo/deps.bzl +++ b/android/demo/deps.bzl @@ -13,13 +13,9 @@ maven_main = [ ] maven_test = [ - # "com.applitools:eyes-android-espresso:4.7.6", - # "androidx.test:runner:1.3.0", - # "androidx.test:rules:1.3.0", - # "androidx.test.espresso:espresso-core:3.3.0", - # "androidx.test.espresso:espresso-contrib:3.3.0", - # "androidx.test.espresso:espresso-intents:3.3.0", - # "androidx.test.ext:junit-ktx:1.1.2", + "androidx.test.espresso:espresso-intents:%s" % versions.androidx.test.espresso, + "androidx.test.ext:junit-ktx:%s" % versions.androidx.test.junit, + "com.applitools:eyes-android-espresso:%s" % versions.testing.applitools, ] maven = maven_main + maven_test diff --git a/jvm/dependencies/deps.bzl b/jvm/dependencies/deps.bzl index 932d9a867..d081e38c0 100644 --- a/jvm/dependencies/deps.bzl +++ b/jvm/dependencies/deps.bzl @@ -1,3 +1,4 @@ +load("@rules_player//javascript:utils.bzl", "remove_duplicates") load(":common.bzl", common = "maven") load("//android:deps.bzl", android = "maven") load("//jvm/core:deps.bzl", core = "maven") @@ -12,4 +13,4 @@ load("@grab_bazel_common//:workspace_defs.bzl", grab = "GRAB_BAZEL_COMMON_ARTIFA tooling = distribution + grab -maven = common + core + graaljs + j2v8 + utils + testutils + perf + plugins + tooling + android +maven = remove_duplicates(common + core + graaljs + j2v8 + utils + testutils + perf + plugins + tooling + android) diff --git a/jvm/dependencies/versions.bzl b/jvm/dependencies/versions.bzl index 376cac5fe..6696bf01c 100644 --- a/jvm/dependencies/versions.bzl +++ b/jvm/dependencies/versions.bzl @@ -13,6 +13,7 @@ versions = struct( ), hooks = "0.11.1", testing = struct( + applitools = "4.7.6", junit = "4.12", jupiter = "5.6.0", kluent = "1.68", @@ -31,6 +32,7 @@ versions = struct( navigation = "2.3.3", test = struct( core = "1.4.0", + espresso = "3.3.0", junit = "1.1.3", ), transition = "1.4.1", From c4e4be987429c9db5919d9aa9d86b3af38624430 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 30 Aug 2022 21:54:58 -0400 Subject: [PATCH 5/9] add more lint targets for kotlin gaps --- android/demo/BUILD | 7 +++++++ android/demo/deps.bzl | 1 - android/player/BUILD | 7 +++++++ plugins/reference-assets/android/BUILD | 8 ++++++++ plugins/reference-assets/android/build.bzl | 7 +++++++ .../com/intuit/player/android/reference/assets/test/BUILD | 7 +++++++ 6 files changed, 36 insertions(+), 1 deletion(-) diff --git a/android/demo/BUILD b/android/demo/BUILD index 4d031b7f0..3adae8139 100644 --- a/android/demo/BUILD +++ b/android/demo/BUILD @@ -3,6 +3,7 @@ load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_import") load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") load(":deps.bzl", "main_deps", "test_deps") load("//android:build.bzl", "applitools_config") +load("@rules_player//kotlin:lint.bzl", "lint") kt_android_library( name = "demo_lib", @@ -80,3 +81,9 @@ sh_test( ":demo_test_app", ], ) + +lint( + name = "demo", + srcs = glob(["src/**/*.kt"]), + lint_config = "//jvm:lint_config", +) diff --git a/android/demo/deps.bzl b/android/demo/deps.bzl index 9cd6726b0..e9bc946fa 100644 --- a/android/demo/deps.bzl +++ b/android/demo/deps.bzl @@ -1,6 +1,5 @@ load("//jvm/dependencies:versions.bzl", "versions") load("@rules_player//maven:parse_coordinates.bzl", "parse_coordinates") -load("@rules_jvm_external//:specs.bzl", _maven = "maven") maven_main = [ "androidx.navigation:navigation-runtime:%s" % versions.androidx.navigation, diff --git a/android/player/BUILD b/android/player/BUILD index ecbfa97b7..dab9b7a25 100644 --- a/android/player/BUILD +++ b/android/player/BUILD @@ -2,6 +2,7 @@ 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("@junit//junit5-jupiter-starter-bazel:junit5.bzl", "kt_jvm_junit5_test") +load("@rules_player//kotlin:lint.bzl", "lint") kt_db_android_library( name = "player", @@ -27,3 +28,9 @@ kt_jvm_junit5_test( test_package = "com.intuit.player.android", deps = [":player"] + test_deps, ) + +lint( + name = "player", + srcs = glob(["src/**/*.kt"]), + lint_config = "//jvm:lint_config", +) diff --git a/plugins/reference-assets/android/BUILD b/plugins/reference-assets/android/BUILD index 1d4f03014..3ff15d6f5 100644 --- a/plugins/reference-assets/android/BUILD +++ b/plugins/reference-assets/android/BUILD @@ -1,4 +1,5 @@ load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_player//kotlin:lint.bzl", "lint") load(":deps.bzl", "main_deps", "main_exports") kt_android_library( @@ -11,3 +12,10 @@ kt_android_library( exports = main_exports, visibility = ["//visibility:public"], ) + +lint( + name = "assets", + srcs = glob(["src/main/**/*.kt"]), + lint_config = "//jvm:lint_config", +) + diff --git a/plugins/reference-assets/android/build.bzl b/plugins/reference-assets/android/build.bzl index 9e84e5fe8..f2ab8b5c4 100644 --- a/plugins/reference-assets/android/build.bzl +++ b/plugins/reference-assets/android/build.bzl @@ -1,4 +1,5 @@ load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_local_test") +load("@rules_player//kotlin:lint.bzl", "lint") def kt_asset_test( name, @@ -22,3 +23,9 @@ def kt_asset_test( "minSdkVersion": "14", }, ) + + lint( + name = name, + srcs = native.glob(["**/*.kt"]), + lint_config = "//jvm:lint_config", + ) diff --git a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/BUILD b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/BUILD index 7223f3e0e..1cc696a4a 100644 --- a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/BUILD +++ b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/BUILD @@ -1,4 +1,5 @@ load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") +load("@rules_player//kotlin:lint.bzl", "lint") load(":deps.bzl", "main_deps") kt_android_library( @@ -7,3 +8,9 @@ kt_android_library( deps = main_deps, visibility = ["//plugins/reference-assets/android:__subpackages__"], ) + +lint( + name = "test", + srcs = glob(["*.kt"]), + lint_config = "//jvm:lint_config", +) From ea453fd03041fb1610296dc2201df94dd5f22b9e Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Tue, 30 Aug 2022 21:55:05 -0400 Subject: [PATCH 6/9] lint kotlin --- .../player/android/reference/demo/test/base/ApplitoolsTest.kt | 2 +- .../player/android/reference/demo/ui/main/MainActivity.kt | 1 - .../java/com/intuit/player/android/asset/RenderableAsset.kt | 1 - .../intuit/player/android/reference/assets/input/InputTest.kt | 2 -- .../intuit/player/android/reference/assets/test/AssetTest.kt | 1 - .../intuit/player/android/reference/assets/action/Action.kt | 3 ++- 6 files changed, 3 insertions(+), 7 deletions(-) diff --git a/android/demo/src/androidTest/java/com/intuit/player/android/reference/demo/test/base/ApplitoolsTest.kt b/android/demo/src/androidTest/java/com/intuit/player/android/reference/demo/test/base/ApplitoolsTest.kt index 17c42ad84..c0d44e796 100644 --- a/android/demo/src/androidTest/java/com/intuit/player/android/reference/demo/test/base/ApplitoolsTest.kt +++ b/android/demo/src/androidTest/java/com/intuit/player/android/reference/demo/test/base/ApplitoolsTest.kt @@ -48,7 +48,7 @@ abstract class ApplitoolsTest { fun Eyes.checkPlayer(name: String) = check(name, Target.region(ViewMatchers.withId(R.id.player_canvas))) companion object { - val batchInfo = BatchInfo("reference-assets@${PR_NUMBER}").apply { + val batchInfo = BatchInfo("reference-assets@$PR_NUMBER").apply { // Only manually set the batch ID if it's not a hardcoded fallback if (BATCH_ID != "local") id = BATCH_ID } diff --git a/android/demo/src/main/java/com/intuit/player/android/reference/demo/ui/main/MainActivity.kt b/android/demo/src/main/java/com/intuit/player/android/reference/demo/ui/main/MainActivity.kt index fc0b27748..e290995ce 100644 --- a/android/demo/src/main/java/com/intuit/player/android/reference/demo/ui/main/MainActivity.kt +++ b/android/demo/src/main/java/com/intuit/player/android/reference/demo/ui/main/MainActivity.kt @@ -14,7 +14,6 @@ import androidx.navigation.fragment.NavHostFragment import androidx.navigation.ui.* import com.google.android.material.navigation.NavigationView import com.intuit.player.android.reference.demo.R -import com.intuit.player.android.reference.demo.lifecycle.DemoPlayerViewModel import com.intuit.player.android.reference.demo.model.AssetMock import com.intuit.player.android.reference.demo.model.StringMock import com.intuit.player.android.ui.PlayerFragment diff --git a/android/player/src/main/java/com/intuit/player/android/asset/RenderableAsset.kt b/android/player/src/main/java/com/intuit/player/android/asset/RenderableAsset.kt index 4623a985d..cc79dfb29 100644 --- a/android/player/src/main/java/com/intuit/player/android/asset/RenderableAsset.kt +++ b/android/player/src/main/java/com/intuit/player/android/asset/RenderableAsset.kt @@ -10,7 +10,6 @@ import com.intuit.player.android.extensions.Styles import com.intuit.player.android.extensions.removeSelf import com.intuit.player.jvm.core.asset.Asset import com.intuit.player.jvm.core.asset.AssetWrapper -import com.intuit.player.jvm.core.bridge.Invokable import com.intuit.player.jvm.core.bridge.Node import com.intuit.player.jvm.core.bridge.NodeWrapper import com.intuit.player.jvm.core.bridge.serialization.encoding.requireNodeDecoder diff --git a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/input/InputTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/input/InputTest.kt index 122d4dd61..700f0b634 100644 --- a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/input/InputTest.kt +++ b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/input/InputTest.kt @@ -1,7 +1,6 @@ package com.intuit.player.android.reference.assets.input import android.widget.FrameLayout -import android.widget.LinearLayout import android.widget.TextView import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.view.get @@ -12,7 +11,6 @@ import com.intuit.player.android.reference.assets.test.shouldBeView import com.intuit.player.jvm.core.player.state.InProgressState import com.intuit.player.jvm.core.player.state.dataModel import org.junit.Assert.assertEquals -import org.junit.Assert.assertNull import org.junit.Test class InputTest : AssetTest("input") { diff --git a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt index 46e16b5e6..32da31ebb 100644 --- a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt +++ b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt @@ -1,7 +1,6 @@ package com.intuit.player.android.reference.assets.test import android.content.Context -import android.os.Build.VERSION_CODES.P import android.view.View import androidx.test.core.app.ApplicationProvider import androidx.test.runner.AndroidJUnit4 diff --git a/plugins/reference-assets/android/src/main/java/com/intuit/player/android/reference/assets/action/Action.kt b/plugins/reference-assets/android/src/main/java/com/intuit/player/android/reference/assets/action/Action.kt index 75c87892c..a12ef9df3 100644 --- a/plugins/reference-assets/android/src/main/java/com/intuit/player/android/reference/assets/action/Action.kt +++ b/plugins/reference-assets/android/src/main/java/com/intuit/player/android/reference/assets/action/Action.kt @@ -6,7 +6,8 @@ import com.intuit.player.android.AssetContext import com.intuit.player.android.asset.DecodableAsset import com.intuit.player.android.reference.assets.text.Text import com.intuit.player.plugins.transactions.commitPendingTransaction -import kotlinx.serialization.* +import kotlinx.serialization.Contextual +import kotlinx.serialization.Serializable class Action(assetContext: AssetContext) : DecodableAsset(assetContext, Data.serializer()) { From 47ceb3116ae5a3beb9fc25752334ab7879699999 Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 31 Aug 2022 12:10:58 -0400 Subject: [PATCH 7/9] downgrade material --- jvm/dependencies/versions.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jvm/dependencies/versions.bzl b/jvm/dependencies/versions.bzl index 6696bf01c..3de4aa14c 100644 --- a/jvm/dependencies/versions.bzl +++ b/jvm/dependencies/versions.bzl @@ -42,5 +42,5 @@ versions = struct( inject = "1", ), material_dialogs = "3.3.0", - material = "1.6.1", + material = "1.5.0", ) From 663612044ddc577490ff1c3a7bc8aa0e26d5a95e Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 31 Aug 2022 12:31:32 -0400 Subject: [PATCH 8/9] downgrade material --- jvm/dependencies/versions.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jvm/dependencies/versions.bzl b/jvm/dependencies/versions.bzl index 3de4aa14c..54af3b21c 100644 --- a/jvm/dependencies/versions.bzl +++ b/jvm/dependencies/versions.bzl @@ -42,5 +42,5 @@ versions = struct( inject = "1", ), material_dialogs = "3.3.0", - material = "1.5.0", + material = "1.4.0", ) From 4f8761212f9b45eb8b5a8aaf21ed7dfbfb17774b Mon Sep 17 00:00:00 2001 From: Jeremiah Zucker Date: Wed, 31 Aug 2022 13:37:00 -0400 Subject: [PATCH 9/9] reintroduce API specification --- .../intuit/player/android/reference/assets/test/AssetTest.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt index 32da31ebb..dd3d2d913 100644 --- a/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt +++ b/plugins/reference-assets/android/src/androidTest/java/com/intuit/player/android/reference/assets/test/AssetTest.kt @@ -1,6 +1,7 @@ package com.intuit.player.android.reference.assets.test import android.content.Context +import android.os.Build.VERSION_CODES.P import android.view.View import androidx.test.core.app.ApplicationProvider import androidx.test.runner.AndroidJUnit4 @@ -24,8 +25,10 @@ import org.junit.Before import org.junit.Rule import org.junit.rules.TestName import org.junit.runner.RunWith +import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) +@Config(sdk = [P]) abstract class AssetTest(val group: String? = null) { @get:Rule