diff --git a/.bazelrc b/.bazelrc index 2ac46d0..f551817 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,4 +1,4 @@ -# Action execution policy lives in tools/flutter/defs.bzl; do not set a global +# Action execution policy lives in flutter/private/rules.bzl; do not set a global # spawn strategy here. common --enable_bzlmod diff --git a/BUILD.bazel b/BUILD.bazel index ea211b3..cca1212 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,3 +1,10 @@ +# The root package is inside the Ruleset Module, not a consumer: it asserts an +# implementation helper below, which is the only reason it reaches into +# //flutter/private. +# buildifier: disable=bzl-visibility +load("//flutter/private:android.bzl", "flutter_assets_dir") +load("//tools/ci:assertions.bzl", "expect_equal") + # The root package exists so //tools/format:buildifier_test has a label in it to # locate the tree it should check. Nothing reads MODULE.bazel's contents through # this export. @@ -8,3 +15,13 @@ package(default_visibility = ["//visibility:public"]) exports_files(["MODULE.bazel"]) + +# Asserted rather than merely called: a silently wrong prefix is the failure +# this helper exists to prevent, and the root package is the case with no +# separator. Checked here rather than from a Consumer Module because the +# supported API deliberately does not export the helper. +expect_equal( + flutter_assets_dir(assets = ":assets"), + "assets", + "flutter_assets_dir in the root package", +) diff --git a/MODULE.bazel b/MODULE.bazel index 0cde628..5237008 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,9 +1,8 @@ module( - name = "rules_flutter", - version = "0.1.0", + name = "sameri11_rules_flutter", ) -flutter = use_extension("//tools/flutter:repo.bzl", "flutter") +flutter = use_extension("//flutter/private:repo.bzl", "flutter") use_repo( flutter, "flutter_embedding_debug", @@ -22,7 +21,7 @@ bazel_dep(name = "buildifier_prebuilt", version = "8.5.1.3", dev_dependency = Tr # For build_test, which is what makes the guard rules runnable under # `bazel test`. The guards fail as *actions*, which is stronger than a test -- # anything depending on them fails too -- so they are wrapped rather than -# converted. Not a dev_dependency: //tools/flutter:defs.bzl loads it, so it has +# converted. Not a dev_dependency: //flutter/private:rules.bzl loads it, so it has # to be visible to every consumer of the rules, which also means no consumer # declares it for this purpose themselves. bazel_dep(name = "bazel_skylib", version = "1.8.2") @@ -51,7 +50,7 @@ bazel_dep(name = "rules_kotlin", version = "2.4.0") bazel_dep(name = "rules_foreign_cc", version = "0.15.1") # Explicit rather than inherited: the native cc rules were removed from Bazel, -# so `rules_cc` has to be visible to this module for //tools/flutter:android.bzl +# so `rules_cc` has to be visible to this module for //flutter/private:android.bzl # to load find_cc_toolchain.bzl -- which is how the strip rules reach the NDK's # llvm-strip instead of hardcoding a path. Only the Android half needs it. bazel_dep(name = "rules_cc", version = "0.2.17") @@ -64,11 +63,11 @@ bazel_dep(name = "rules_cc", version = "0.2.17") bazel_dep(name = "rules_android_ndk", version = "0.1.5") # Wrapped rather than used directly, so an absent NDK yields a toolchain-less -# stub instead of a failed fetch. See //tools/flutter:ndk.bzl. +# stub instead of a failed fetch. See //flutter/private:ndk.bzl. # `platforms` is declared for the Android NDK toolchain's platform constraints. bazel_dep(name = "platforms", version = "1.0.0") -android_ndk = use_extension("//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") remote_android_extensions = use_extension( diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index a321c5d..dbb0a01 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -258,12 +258,32 @@ }, "selectedYankedVersions": {}, "moduleExtensions": { - "//tools/flutter:ndk.bzl%android_ndk": { + "//flutter:extensions.bzl%android_ndk": { "general": { - "bzlTransitiveDigest": "wubp2T1WtFjfb9+kfYhB63NRFwpD0mXcOWF3daEO03c=", - "usagesDigest": "iqWYoA9j7grhPWQtR56x1n6RjeC/ZLyxxoSOj5m8u4Q=", + "bzlTransitiveDigest": "PbHufQ8Ef0dxRku/+V8j/hIWIdUoSzsJVSDuoykOXkQ=", + "usagesDigest": "u+HEkcGg21uv1v1Y5n7OFzVXl5/8Fi8W5y561YLsmWA=", "recordedInputs": [ - "REPO_MAPPING:,rules_android_ndk rules_android_ndk+" + "REPO_MAPPING:,platforms platforms", + "REPO_MAPPING:,rules_android rules_android+", + "REPO_MAPPING:,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:,rules_java rules_java+", + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+" ], "generatedRepoSpecs": { "androidndk": { @@ -271,16 +291,16 @@ "attributes": {} }, "androidndk_cmake": { - "repoRuleId": "@@//tools/flutter:ndk.bzl%_androidndk_cmake_repository", + "repoRuleId": "@@//flutter/private:ndk.bzl%_androidndk_cmake_repository", "attributes": {} } } } }, - "//tools/flutter:repo.bzl%flutter": { + "//flutter/private:repo.bzl%flutter": { "general": { - "bzlTransitiveDigest": "xF3NHN89e0wpLlITfvPlzlq4YYs2Cm7XkvAn18uvo1k=", - "usagesDigest": "Y8LHxc3H3bgIj3XuGGWAV1ZzBvaqyDrKG4qM6t7D38k=", + "bzlTransitiveDigest": "d0akA1llff6BLmlVnXIvFQO70c00GoPx6Qps3UswgoY=", + "usagesDigest": "jrBaZOcWDOcKabJnjwy68BVDrd46XjcPFZOpHFqt7ZE=", "recordedInputs": [ "REPO_MAPPING:,bazel_tools bazel_tools", "REPO_MAPPING:,platforms platforms", @@ -288,7 +308,7 @@ ], "generatedRepoSpecs": { "flutter_sdk": { - "repoRuleId": "@@//tools/flutter:repo.bzl%flutter_sdk", + "repoRuleId": "@@//flutter/private:repo.bzl%flutter_sdk", "attributes": {} }, "flutter_embedding_release": { @@ -409,7 +429,7 @@ "@@rules_android+//rules/android_sdk_repository:rule.bzl%android_sdk_repository_extension": { "general": { "bzlTransitiveDigest": "qHbR00gVzVzkxX+PRtv4UGcUFMtBz7TK9CNYUWH8nIE=", - "usagesDigest": "IfPnzmlIVRUfW7Tn/6SypRPKgjSS0N/HHKSTCeLcTMA=", + "usagesDigest": "DUD1FTsZyv0xJrLKsQORrkRZGrlHVzkOzgyEbP2nelA=", "recordedInputs": [], "generatedRepoSpecs": { "androidsdk": { diff --git a/QUICKSTART.md b/QUICKSTART.md index c3c245e..6e13c52 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -1,12 +1,19 @@ # rules_flutter consumer quickstart +Status: community-maintained development preview, Android-only. Not affiliated +with, endorsed by, or supported by Google or the Flutter project. + +Bazel rules that build a Flutter application's Dart and Android halves as ordinary +Bazel targets: `frontend_server` and `gen_snapshot` compile the Dart half, and +`rules_android` packages the Android half. + This guide is for an Android Flutter application built directly by Bazel. Read the [README](README.md) for the rationale and current limitations; use this guide to choose a consumer layout and create the files it needs. ## Choose a shape first -| Shape | Use it when | Canonical example | +| Shape | Use it when | Example | | --- | --- | --- | | Plugin-free root app | The Flutter app is at the module root and has no Android plugin graph. | [`examples/no_plugins`](examples/no_plugins/) | | Root app with pub plugins | The app is at the module root and pub resolves one or more Flutter plugins. | [`examples/pub_plugins`](examples/pub_plugins/) | @@ -20,16 +27,46 @@ plugin setup. ## Common prerequisites and conventions +Before following a shape, account for these constraints: local Flutter, Android +SDK, and NDK installations are non-hermetic; Dart and asset actions run +unsandboxed with remote execution disabled, and Dart compilation is not +incremental. Hosted pub dependencies are keyed by `pubspec.lock`, but path +dependencies are not hashed and go stale unless the consumer declares their +sources; Bazel emits unsigned APKs, so release signing happens outside Bazel, +and Dart native assets must come from declared consumer-owned inputs or recipes. +Targets are Android-only—iOS, web, and desktop packaging are absent, with no +dedicated diagnostic; see the [README](README.md) for the full limitations and +support boundaries. + ### Versions and local tools The supported, verified toolchain is: | Tool | Required version or setup | Why it is load-bearing | | --- | --- | --- | -| Flutter SDK | Flutter **3.44.2** / Dart **3.12.2** | The rules invoke this SDK's frontend server, `gen_snapshot`, and bundle tooling. | -| Bazel | **9.2.0** (Bazelisk recommended) | The module extension and generated repositories use Bzlmod. | -| Android SDK | A recent SDK with `ANDROID_HOME` set | `rules_android` discovers Android build tools and `aapt2` through it. | -| Android NDK | **28 or newer** with `ANDROID_NDK_HOME` set | NDK 28+ produces native libraries usable on 16 KB-page Android devices. | +| Flutter SDK | Flutter **3.44.2** / Dart **3.12.2**; locate it with `FLUTTER_ROOT` or `flutter` on `PATH` | The rules invoke this SDK's frontend server, `gen_snapshot`, and bundle tooling; the SDK is not downloaded. | +| Bazel | **9.2.0**, Bzlmod only; no `WORKSPACE` path | The module extension and generated repositories use Bzlmod. | +| Hosts | macOS 15 arm64 or Ubuntu (Linux x64); other hosts fail the CI setup check | `gen_snapshot`, the NDK's clang, and the gzip encoder are not byte-reproducible across hosts; APK hash goldens are recorded per host. | +| Android SDK | API level **36** and build-tools **36.0.0**, configured by the consumer module; set `ANDROID_HOME` | `rules_android` discovers Android build tools and `aapt2` through the consumer's SDK. | +| Android NDK | **28 or newer** with `ANDROID_NDK_HOME` set | The ruleset enforces revision 28+ because its native build must support 16 KB-page Android devices; the NDK wrapper rejects lower revisions, and this is not a device-compatibility guarantee. | + +Only the Dart toolchain bundled with the Flutter SDK is supported; a standalone +Dart SDK is not supported. Build modes are `release` (default) and `debug`, +selected with `--@rules_flutter//flutter:mode=debug`; there is no profile mode. +AOT is release-only. Supported Android ABIs are `arm64-v8a`, `x86_64`, and +`armeabi-v7a`; `x86`, `x86_32`, and `riscv64` are unsupported Android CPUs. + +The rules request `minSdkVersion` 21, the level a plugin's CMake half also +compiles against, and `targetSdkVersion` 36. `rules_android` applies its own +min-SDK floor during resource processing, so the shipped APK declares 23 today. +The Android SDK pin above is the compile SDK, not the minimum supported device. + +Supported plugin inputs include pub plugins with Java/Kotlin Android halves, +pub plugins with CMake-built native halves, local path plugins in a monorepo, +consumer-written Package Recipes, and Dart build-hook packages surfaced through +a recipe (native assets). `ndk-build` plugins and prebuilt-JNI plugin shapes are +unsupported; if a plugin's Maven coordinates cannot be read statically, declare +them with `plugins.package(artifacts = ...)`. Either set `FLUTTER_ROOT` or put `flutter` on `PATH`; set the Android locations before building an APK: @@ -44,21 +81,23 @@ export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/" `flutter pub get` is required before the first Bazel build and after every pub change. It creates `.dart_tool/package_config.json`, which the Dart compiler uses; it also refreshes `.flutter-plugins-dependencies` and Flutter's Android -registrant when a plugin graph exists. Skipping it usually fails with an -otherwise unhelpful missing-file error. +registrant when a plugin graph exists. `.dart_tool` is bootstrap state rather +than a tracked input. For the first plugin graph, create the two zero-byte +placeholder files by hand before evaluation; this bootstrap path has no automated +regression gate. Until `rules_flutter` is published to the Bazel Central Registry, create a consumer as a sibling of a checkout and retain a development override: ```python -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../rules_flutter", ) ``` -The `path = "../.."` spelling in the canonical examples is specific to their +The `path = "../.."` spelling in the in-repository fixtures is specific to their location two levels below this checkout. An outside sibling consumer normally uses `path = "../rules_flutter"`; change the path only to match your layout. @@ -68,8 +107,8 @@ Pin Bazel with `.bazelversion`: 9.2.0 ``` -Use this complete `.bazelrc` in an outside consumer; the examples import -repository-shared cache settings instead: +Use this complete `.bazelrc` in an outside consumer; the in-repository fixtures +import repository-shared cache settings instead: ``` common --enable_bzlmod @@ -80,16 +119,16 @@ common:android --repo_env=ANDROID_NDK_HOME common --config=android ``` -The Android configuration enables the Android toolchain, uses the JDK 17 toolchain required by `rules_android`, and preserves permissions declared by plugin manifests. The rules provide their own JDK 17; no local JDK selection is needed. The `ANDROID_NDK_HOME` environment variable will be read at repository-fetch time when a target requires Android toolchains; if unset, the repository fetch will fail with a diagnostic naming the variable and the NDK path requirement. +The Android configuration enables the Android toolchain, uses the JDK 17 toolchain required by `rules_android`, and preserves permissions declared by plugin manifests. The rules provide their own JDK 17; no local JDK selection is needed. The `ANDROID_NDK_HOME` environment variable is read at repository-fetch time when a target requires Android toolchains; if unset, the NDK wrapper supplies a stub declaring no toolchains, so failure surfaces only when a target needs an Android toolchain. ### Generated state, assets, labels, and ABIs - Add `/bazel-*` to the Flutter-generated `.gitignore`; do **not** ignore - `MODULE.bazel.lock`. Commit the lockfile. It is machine-independent: the NDK - module extension records no NDK path, so the same lock bytes are produced with - `ANDROID_NDK_HOME` set or unset. In a plugin graph, also commit the generated - `plugin_deps.MODULE.bazel` and `lib/dart_plugin_registrant.dart`. Their guards - intentionally fail when pub state changes. + `MODULE.bazel.lock`. Commit the lockfile. The lock guard compares locks + resolved with `ANDROID_NDK_HOME` set and unset on one machine; this does not + establish cross-host reproducibility. In a plugin graph, also commit the + generated `plugin_deps.MODULE.bazel` and `lib/dart_plugin_registrant.dart`. + Their guards intentionally fail when pub state changes. - If the project declares no assets, set `assets = []` in `flutter_app()`: the default `glob(["assets/**"])` deliberately rejects an empty directory. Once the app declares files under `assets/` in `pubspec.yaml`, omit that override @@ -131,9 +170,9 @@ details out of the root `MODULE.bazel`: ```python module(name = "hello_bazel", version = "0.0.1") -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../rules_flutter", ) @@ -165,7 +204,7 @@ android_sdk.configure( use_repo(android_sdk, "androidsdk") register_toolchains("@androidsdk//:all") -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") @@ -197,7 +236,7 @@ arm64 device slice and an x86_64 emulator slice; use one identical list in all three locations if you choose a different supported set. ```python -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) @@ -226,8 +265,7 @@ path with the ones Flutter generated for your app: ```python load("@rules_android//rules:rules.bzl", "android_library") -load("@rules_flutter//tools/flutter:android.bzl", "flutter_android_binary") -load("@rules_flutter//tools/flutter:embedding.bzl", "flutter_embedding_library") +load("@rules_flutter//flutter:defs.bzl", "flutter_android_binary", "flutter_embedding_library") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") package(default_visibility = ["//visibility:public"]) @@ -285,7 +323,7 @@ build does not prove that the APK launches. To build the debug-shaped APK, select debug mode on the APK target: ```sh -bazel build //android/app:hello_bazel --@rules_flutter//tools/flutter:mode=debug +bazel build //android/app:hello_bazel --@rules_flutter//flutter:mode=debug ``` #### Hot reload with `flutter run` @@ -323,9 +361,9 @@ release-only. ## Root app with pub plugins -Use this shape when the flat root app gains a pub plugin. The canonical -working fixture is [`examples/pub_plugins`](examples/pub_plugins/); the steps -below contain the complete first-plugin transition. +Use this shape when the flat root app gains a pub plugin. The working fixture is +[`examples/pub_plugins`](examples/pub_plugins/); the steps below contain the +complete first-plugin transition. The fixture's one-ABI APK label is `//android/app:pub_plugins`; the transition below uses `hello_bazel` as a placeholder, so substitute your own Android target name consistently. @@ -396,7 +434,7 @@ proxy and import, then add the plugin extension and generated segment: maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") use_repo(maven, "flutter_maven") -plugins = use_extension("@rules_flutter//tools/flutter:plugins.bzl", "flutter_plugins_ext") +plugins = use_extension("@rules_flutter//flutter:extensions.bzl", "flutter_plugins_ext") plugins.project( abis = ["arm64-v8a", "x86_64"], metadata = "//:.flutter-plugins-dependencies", @@ -582,9 +620,9 @@ module( version = "0.0.1", ) -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../..", ) @@ -618,14 +656,14 @@ android_sdk.configure( use_repo(android_sdk, "androidsdk") register_toolchains("@androidsdk//:all") -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") use_repo(maven, "flutter_maven") -plugins = use_extension("@rules_flutter//tools/flutter:plugins.bzl", "flutter_plugins_ext") +plugins = use_extension("@rules_flutter//flutter:extensions.bzl", "flutter_plugins_ext") plugins.project( abis = ["arm64-v8a"], embedding = "//packages/host_app/android/app:flutter_embedding", @@ -657,7 +695,7 @@ dependency, so omitting `path_deps` would leave an undeclared input and make the path-dependency guard fail. ```python -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) @@ -713,7 +751,7 @@ android_library( ``` Retain the imports and `kt_android_library(name = "main_activity", ...)` from -the generated Android app; the canonical full file is +the generated Android app; the full file is [`packages/host_app/android/app/BUILD.bazel`](examples/local_plugin/packages/host_app/android/app/BUILD.bazel). Generate the root Maven segment and the app's Dart registrant through their @@ -864,13 +902,13 @@ filegroup( ``` For multiple ABIs, declare one `sqlite3` `http_file` per ABI with the matching -published file, checksum, and repository name from the canonical module; keep -the `rive_native` archive's requested filegroups in step with the same list. +published file, checksum, and repository name from the module; keep the +`rive_native` archive's requested filegroups in step with the same list. ### Write recipes with consumer repository labels Export recipe files from `bazel/flutter/BUILD.bazel`, as in the -[canonical recipe directory](examples/demo_app/bazel/flutter/). Use `Label()` +[recipe directory](examples/demo_app/bazel/flutter/). Use `Label()` for every repository reference: a recipe is loaded from a generated repository, whose apparent-name mapping is not the consumer's mapping. `Label()` resolves the consumer's declared repository while the recipe file is loaded. @@ -878,7 +916,7 @@ the consumer's declared repository while the recipe file is loaded. A concise arm64 `rive_native` recipe is: ```python -load("@rules_flutter//tools/flutter:recipe.bzl", "flutter_native_contribution") +load("@rules_flutter//flutter:defs.bzl", "flutter_native_contribution") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") _LIBRARIES = { @@ -916,7 +954,7 @@ Flutter's native-assets manifest uses, then creates the empty conventional package target: ```python -load("@rules_flutter//tools/flutter:recipe.bzl", "flutter_native_contribution") +load("@rules_flutter//flutter:defs.bzl", "flutter_native_contribution") _LIBRARIES = { "arm64-v8a": Label("@libsqlite3_android_arm64_v8a//file"), @@ -961,11 +999,11 @@ adb install -r bazel-bin/android/app/demo_app.apk On a device, exercise both runtime paths—not just the counter UI. The demo's [`lib/main.dart`](examples/demo_app/lib/main.dart) calls `sqlite3.version` and -`rive_native.RiveNative.init()` and shows their results. That confirms the -native library is in `lib//`, the native-asset mapping names the correct +`rive_native.RiveNative.init()` and shows their results. Use those results to +check whether the native library is in `lib//`, the native-asset mapping file, and the selected ABI can load it. The build guards catch missing declared -libraries, but only executing both APIs proves that the packaged binaries load -on the target device. +libraries; exercising both APIs checks whether the packaged binaries load on the +target device. ## Common variants and maintenance @@ -1003,7 +1041,7 @@ bazel build //android/app:demo_app For the debug-shaped APK, select debug on the Android target: ```sh -bazel build //android/app:demo_app --@rules_flutter//tools/flutter:mode=debug +bazel build //android/app:demo_app --@rules_flutter//flutter:mode=debug ``` Debug bundles use a kernel blob rather than a release AOT snapshot. Therefore @@ -1027,6 +1065,7 @@ a pub lock hash. Finally, treat building as artifact production, not runtime proof. Discover the APK, install it on a device or emulator for a shipped ABI, launch it, and -exercise every newly added plugin or native-asset path. That is the only step -that detects a missing registrant, unsupported device ABI, or native library -that is packaged but fails when loaded. +exercise every newly added plugin or native-asset path. This runtime exercise +catches a missing registrant, an unsupported device ABI, or a native library +that is packaged but fails when loaded; build guards cover declared-library and +bundle consistency checks. diff --git a/README.md b/README.md index 1494128..99f39c3 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@ [![CI](https://github.com/Sameri11/rules_flutter/actions/workflows/ci.yml/badge.svg)](https://github.com/Sameri11/rules_flutter/actions/workflows/ci.yml) -Bazel rules that build Flutter's Dart and Android halves directly: `frontend_server` and `gen_snapshot` compile the Dart application, while `rules_android` packages the result. Android-only today. +Bazel rules that build a Flutter application's Dart and Android halves as ordinary Bazel targets: `frontend_server` and `gen_snapshot` compile the Dart half, and `rules_android` packages the Android half. + +Status: community-maintained development preview, Android-only. Not affiliated with, endorsed by, or supported by Google or the Flutter project. ## Why rules_flutter? -Wrapping `flutter build` in one Bazel action makes the whole build opaque: Bazel cannot see or cache the Dart compilation and packaging units independently. `rules_flutter` exposes those units directly, so Dart actions and the Android packaging seam can be analysed, cached, and composed with ordinary Bazel targets. +Wrapping `flutter build` in one Bazel action makes the whole build opaque: Bazel cannot see the Dart compilation and Android packaging units independently. `rules_flutter` exposes those units as ordinary Bazel targets, so they can be analysed and composed separately. This project publishes no build-speed or hermeticity measurements; the constraints below are the honest picture. ``` lib/**.dart ──frontend_server──> app.dill ──gen_snapshot──> libapp.so ─┐ @@ -18,10 +20,29 @@ flutter_assets ───────────────────── ### Supported and verified -- Flutter 3.44.2 / Dart 3.12.2 with Bazel 9.2.0. -- Android release and debug builds for `arm64-v8a`, `x86_64`, and `armeabi-v7a`, including fat and per-ABI APKs. -- Java and Kotlin plugins, CMake-backed native plugins, and native assets have worked; a real arm64 APK has been built, installed, and launched on an API 35 emulator. -- Every example module builds on CI, and all seven APK shapes they declare are compared byte-for-byte against a recorded table (`tools/ci/example_hashes.py`) that a developer machine reproduces. +- Flutter 3.44.2 / Dart 3.12.2, using the Dart toolchain bundled with that Flutter SDK; standalone Dart SDKs are not supported. +- Bazel 9.2.0 with bzlmod only; there is no WORKSPACE path. +- Tested hosts are macOS 15 arm64 and Ubuntu Linux x64; the CI setup action rejects other hosts. +- Android release (the default) and debug builds (`--@rules_flutter//flutter:mode=debug`) are supported; there is no profile mode, and AOT is release-only. +- Supported Android ABIs are `arm64-v8a`, `x86_64`, and `armeabi-v7a`; `x86` is absent, and `x86_32` and `riscv64` are unsupported Android CPUs. +- The rules request `minSdkVersion` 21 (the same level a plugin's CMake half compiles against) and `targetSdkVersion` 36, but `rules_android` applies its own min-SDK floor during resource processing, so the shipped APK declares 23 today. The consumer's Android SDK pin (36 in the examples) is the compile SDK, not the minimum supported device. +- Proven plugin shapes are pub plugins with Java/Kotlin Android halves, pub plugins with CMake-built native halves, local path plugins in a monorepo layout, consumer-written Package Recipes, and Dart build-hook packages surfaced through a recipe (native assets). `ndk-build` plugins and prebuilt-JNI plugin shapes are not supported. A plugin whose Maven coordinates cannot be read statically works only when the consumer declares them with `plugins.package(artifacts = ...)`. +- A real arm64 APK has been built, installed, and launched on an API 35 emulator. +- Every example module builds on CI, and all seven APK shapes they declare are compared byte-for-byte against a recorded per-host table (`tools/ci/example_hashes.py`). This proves identical bytes for the same host and the same pinned SDK, not cross-machine reproducibility. + +### Before you install + +These are the hard constraints; [Current constraints](#current-constraints) has the +detail behind each one. + +- Local Flutter 3.44.2/Dart 3.12.2, an Android SDK, and Android NDK 28+ are required and are not hermetic: use `FLUTTER_ROOT` or `flutter` on `PATH`, `ANDROID_HOME`, and `ANDROID_NDK_HOME`. With `ANDROID_NDK_HOME` unset, the NDK wrapper substitutes a no-toolchains stub and the build fails only when a target needs an Android toolchain. The examples pin SDK platform 36 and build-tools 36.0.0; the consumer module chooses its own. +- Dart and asset actions run unsandboxed with remote execution disabled because they read the local Flutter SDK and `~/.pub-cache` by absolute path. +- Hosted pub dependencies are keyed by `pubspec.lock`, path dependencies are not hashed and go stale unless the consumer declares their sources, `.dart_tool` state is a bootstrap prerequisite rather than a tracked input, and Dart compilation is not incremental. +- Bazel emits an unsigned APK; release signing happens outside Bazel, and custom release signing inside Bazel is not supported. +- Native assets require consumer-written Package Recipes. +- Before the first plugin graph, `flutter pub get` must produce the generated state and two zero-byte placeholders must be created by hand; this bootstrap path has no automated regression gate. +- The consumer module owns its `rules_jvm_external` installation and Maven repository; this ruleset does not own the application's Maven graph. +- Targets are Android-only; iOS, web, and desktop packaging are not implemented. ## Quickstart @@ -36,9 +57,9 @@ monorepos, and consumer recipes/native assets, see the ### Prerequisites -Install Flutter 3.44.2 (Dart 3.12.2), Bazel 9.2.0 (Bazelisk recommended), a recent Android SDK, and an Android NDK 28 or newer. Set `FLUTTER_ROOT` or put `flutter` on `PATH`, and set `ANDROID_HOME` and `ANDROID_NDK_HOME` (for the NDK). The rules pin their own JDK 17 toolchain. +Install Flutter 3.44.2 (Dart 3.12.2), Bazel 9.2.0 with bzlmod, Android SDK platform 36 with build-tools 36.0.0, and Android NDK 28 or newer. Set `FLUTTER_ROOT` or put `flutter` on `PATH`, and set `ANDROID_HOME` and `ANDROID_NDK_HOME`. The rules pin their own JDK 17 toolchain. -With no `api_level`, `rules_android` compiles against the highest Android platform installed, which makes the APK's manifest depend on the machine. This repository's examples therefore pin SDK platform 36 and build-tools 36.0.0; building them needs both installed. An Android Consumer Module must explicitly register NDK toolchains in its `MODULE.bazel` and inherit the stable repositories from `rules_flutter`'s NDK extension; an NDK that is not configured will be discovered only when a target tries to use Android toolchains, at which point the repository fetch will fail with a diagnostic naming `ANDROID_NDK_HOME`. +Without `api_level`, `rules_android` compiles against the highest Android platform installed, which makes the APK's manifest depend on the machine. This repository's examples therefore pin SDK platform 36 and build-tools 36.0.0; building them needs both installed. A consumer module must explicitly register NDK toolchains in its `MODULE.bazel` and inherit the stable repositories from `rules_flutter`'s NDK extension. With `ANDROID_NDK_HOME` unset, the NDK wrapper substitutes a stub declaring no toolchains; the failure surfaces only when a target needs an Android toolchain. ### Create the project @@ -79,9 +100,9 @@ Create the root `MODULE.bazel` (the `local_path_override` is development-only un ```python module(name = "hello_bazel", version = "0.0.1") -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../rules_flutter", ) @@ -113,7 +134,7 @@ android_sdk.configure( use_repo(android_sdk, "androidsdk") register_toolchains("@androidsdk//:all") -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") @@ -143,7 +164,7 @@ use_repo(maven, "flutter_maven") Create `BUILD.bazel` at the project root: ```python -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) @@ -166,8 +187,7 @@ Create `android/app/BUILD.bazel`, replacing `com.example.hello_bazel`, `hello_ba ```python load("@rules_android//rules:rules.bzl", "android_library") -load("@rules_flutter//tools/flutter:android.bzl", "flutter_android_binary") -load("@rules_flutter//tools/flutter:embedding.bzl", "flutter_embedding_library") +load("@rules_flutter//flutter:defs.bzl", "flutter_android_binary", "flutter_embedding_library") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") package(default_visibility = ["//visibility:public"]) @@ -208,8 +228,8 @@ The release build is the default. The APK target depends on the Dart/AOT and asset targets, so build it directly: ```sh -export ANDROID_HOME="$HOME/Library/Android/sdk" -export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/" +: "${ANDROID_HOME:?set ANDROID_HOME to your Android SDK}" +: "${ANDROID_NDK_HOME:?set ANDROID_NDK_HOME to an Android NDK 28+ installation}" bazel build //android/app:hello_bazel ls bazel-bin/android/app/ adb install -r bazel-bin/android/app/.apk @@ -219,7 +239,7 @@ bazel test //:guards_test Replace `.apk` with the APK discovered in `bazel-bin/android/app/`. To build the optional debug-shaped APK: ```sh -bazel build //android/app:hello_bazel --@rules_flutter//tools/flutter:mode=debug +bazel build //android/app:hello_bazel --@rules_flutter//flutter:mode=debug ``` Run the Bazel-built debug APK through Flutter. This installs it, launches it, @@ -248,13 +268,15 @@ Android release and debug packaging across the supported ABIs, including fat and ### Current constraints -- The local Flutter, Android SDK, and NDK installations are not hermetic. -- Most Dart and asset actions are unsandboxed and do not support remote execution; source tracking is imperfect and Dart compilation is not incremental. +- The local Flutter 3.44.2/Dart 3.12.2 SDK, Android SDK, and Android NDK installations are not hermetic. The SDK is located through `FLUTTER_ROOT` or `flutter` on `PATH`; the consumer supplies `ANDROID_HOME` and Android SDK API 36/build-tools 36.0.0, and `ANDROID_NDK_HOME` must point to NDK 28 or newer. If `ANDROID_NDK_HOME` is unset, the NDK wrapper substitutes a stub declaring no toolchains, so failure surfaces only when a target needs an Android toolchain. +- Dart and asset actions are unsandboxed with remote execution disabled because they read the local Flutter SDK and `~/.pub-cache` by absolute path. +- Hosted pub dependencies are keyed by `pubspec.lock`; path dependencies are not hashed and go stale unless the consumer declares their sources. `.dart_tool` state is a bootstrap prerequisite, not a tracked input, and Dart compilation is not incremental. +- Before a build, `flutter pub get` must have produced `.dart_tool/package_config.json` and `.flutter-plugins-dependencies`. The first plugin graph additionally needs two zero-byte placeholders created by hand: `plugin_deps.MODULE.bazel` because `include()` requires its target file to exist, and `lib/dart_plugin_registrant.dart` because the plugin guard's committed-file attribute is mandatory. This bootstrap path has no automated regression gate; follow the [public plugin-graph walkthrough](QUICKSTART.md#create-generated-state-and-wire-the-plugin-graph) by hand. +- Native assets from Dart build-hook packages require consumer-written Package Recipes. The consumer module also owns its `rules_jvm_external` installation and Maven repository; this ruleset does not own the application's Maven graph. +- Bazel emits an unsigned APK. Release signing happens outside the build so credentials never enter the action graph; custom release signing inside Bazel is not supported. +- `ndk-build` plugins and prebuilt-JNI plugin shapes are not supported. Plugin Maven coordinates that cannot be read statically require `plugins.package(artifacts = ...)`. +- iOS, web, and desktop packaging are not implemented; targets are Android-only. - A cold analysis with an empty `HOME` may leave the `Analyzing` count unchanged for minutes while Maven/Coursier, JDK, Flutter engine, Kotlin, NDK, and tool repositories are fetched; continued download or process activity indicates network-bound setup, not proof of a deadlock. When intentionally perturbing `HOME`, pin `BAZELISK_HOME` and Bazel's startup `--output_user_root` to isolate launcher and download caches from rules behavior. -- Native assets require manual consumer recipes. A first plugin graph still needs two irreducible zero-byte placeholders: `plugin_deps.MODULE.bazel`, because `include()` requires its target file to exist, and `lib/dart_plugin_registrant.dart`, because the plugin guard's committed-file attribute is mandatory. The bootstrap path has no automated regression gate, so follow the [public plugin-graph walkthrough](QUICKSTART.md#create-generated-state-and-wire-the-plugin-graph) by hand. -- Custom release signing is not supported, and `ndk-build` plugins are not supported. -- Plugin Maven coordinates that cannot be read statically require `plugins.package(artifacts = ...)`. -- iOS and other platform packaging are not implemented. ### Possible future direction diff --git a/examples/demo_app/BUILD.bazel b/examples/demo_app/BUILD.bazel index 543b792..e464d26 100644 --- a/examples/demo_app/BUILD.bazel +++ b/examples/demo_app/BUILD.bazel @@ -1,7 +1,7 @@ # Dart targets for the flat demo app. Standard flutter_app paths are derived # from the flutter create layout. -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) diff --git a/examples/demo_app/MODULE.bazel b/examples/demo_app/MODULE.bazel index 9a31c79..0038b68 100644 --- a/examples/demo_app/MODULE.bazel +++ b/examples/demo_app/MODULE.bazel @@ -4,9 +4,9 @@ module( ) # Uses the local checkout because rules_flutter is not published. -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../..", ) diff --git a/examples/demo_app/MODULE.bazel.lock b/examples/demo_app/MODULE.bazel.lock index 110713d..c4eaa23 100644 --- a/examples/demo_app/MODULE.bazel.lock +++ b/examples/demo_app/MODULE.bazel.lock @@ -343,7 +343,7 @@ "@@rules_android+//rules/android_sdk_repository:rule.bzl%android_sdk_repository_extension": { "general": { "bzlTransitiveDigest": "qHbR00gVzVzkxX+PRtv4UGcUFMtBz7TK9CNYUWH8nIE=", - "usagesDigest": "lHkB0+0EQJ7eVAE5g+b6Q7HuPmeyVV9Rv0I0HdsLnMU=", + "usagesDigest": "oY0Ssn7MXtzbp3/rQ8wR+3+7SdRRi36+jbqYXcA3np4=", "recordedInputs": [], "generatedRepoSpecs": { "androidsdk": { @@ -357,148 +357,6 @@ } } }, - "@@rules_flutter+//tools/flutter:ndk.bzl%android_ndk": { - "general": { - "bzlTransitiveDigest": "wubp2T1WtFjfb9+kfYhB63NRFwpD0mXcOWF3daEO03c=", - "usagesDigest": "mkjKkchHR7H1XcdGkM5V55k1la2WT0Tsje+hxJeCI3E=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,rules_android_ndk rules_android_ndk+" - ], - "generatedRepoSpecs": { - "androidndk": { - "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", - "attributes": {} - }, - "androidndk_cmake": { - "repoRuleId": "@@rules_flutter+//tools/flutter:ndk.bzl%_androidndk_cmake_repository", - "attributes": {} - } - } - } - }, - "@@rules_flutter+//tools/flutter:plugins.bzl%flutter_plugins_ext": { - "general": { - "bzlTransitiveDigest": "tQNMt955Aw9GgNkaaslFjOQlTt/8uwsvu2YmduiXfjg=", - "usagesDigest": "XZeXzyR0RtbfpK9X/cRefQ0IzVT+2325G7HjeZJ9G1U=", - "recordedInputs": [ - "REPO_MAPPING:,flutter_maven rules_jvm_external++maven+flutter_maven", - "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", - "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", - "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", - "REPO_MAPPING:protobuf+,rules_java rules_java+", - "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", - "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", - "REPO_MAPPING:rules_cc+,platforms platforms", - "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", - "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+", - "REPO_MAPPING:rules_flutter+,rules_java rules_java+", - "REPO_MAPPING:rules_java+,bazel_features bazel_features+", - "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", - "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", - "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", - "REPO_MAPPING:rules_java+,rules_cc rules_cc+", - "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", - "REPO_MAPPING:rules_flutter+,androidndk_cmake rules_flutter++android_ndk+androidndk_cmake" - ], - "generatedRepoSpecs": { - "flutter_plugins": { - "repoRuleId": "@@rules_flutter+//tools/flutter:plugins.bzl%flutter_plugins", - "attributes": { - "abis": [ - "arm64-v8a", - "x86_64", - "armeabi-v7a" - ], - "metadata": "@@//:.flutter-plugins-dependencies", - "package_config": "@@//:.dart_tool/package_config.json", - "coursier_options": [], - "extra_artifacts": [], - "maven_resolver": "coursier", - "maven_lock_file": "", - "maven_repo": "'@@rules_jvm_external++maven+flutter_maven'", - "overrides": {}, - "recipes": { - "rive_native": "{\"bzl\":\"@@//bazel/flutter:rive_native.bzl\",\"macro\":\"rive_native_recipe\",\"root\":true}", - "sqlite3": "{\"bzl\":\"@@//bazel/flutter:sqlite3.bzl\",\"macro\":\"sqlite3_recipe\",\"root\":true}" - }, - "embedding": "'@@//android/app:flutter_embedding'", - "android_bzl": "'@@rules_flutter+//tools/flutter:android.bzl'", - "recipe_bzl": "'@@rules_flutter+//tools/flutter:recipe.bzl'", - "ndk_source_properties": "'@@rules_flutter++android_ndk+androidndk_cmake//:ndk_source_properties'" - } - } - } - } - }, - "@@rules_flutter+//tools/flutter:repo.bzl%flutter": { - "general": { - "bzlTransitiveDigest": "xF3NHN89e0wpLlITfvPlzlq4YYs2Cm7XkvAn18uvo1k=", - "usagesDigest": "cw4CePI4DWiQZm/66uKnW1chHGB6MLzXF+K2CxUxGyw=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+" - ], - "generatedRepoSpecs": { - "flutter_sdk": { - "repoRuleId": "@@rules_flutter+//tools/flutter:repo.bzl%flutter_sdk", - "attributes": {} - }, - "flutter_embedding_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_embedding_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - } - } - } - }, "@@rules_python+//python/extensions:config.bzl%config": { "general": { "bzlTransitiveDigest": "dzD8Q2YmrP3fz8saWLHPmlwPLO91ImtTmP/c9JKTStM=", @@ -696,6 +554,169 @@ } } } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%android_ndk": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "zX96yfJW4/h1cfrBMvBaUg9hTRGQp0ZuwjmqXN/HquQ=", + "recordedInputs": [ + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+" + ], + "generatedRepoSpecs": { + "androidndk": { + "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", + "attributes": {} + }, + "androidndk_cmake": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:ndk.bzl%_androidndk_cmake_repository", + "attributes": {} + } + } + } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%flutter_plugins_ext": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "frgjMNjXCjd7j75y9p+LFe3RH+RtcxxOnaCzq3dakik=", + "recordedInputs": [ + "REPO_MAPPING:,flutter_maven rules_jvm_external++maven+flutter_maven", + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,androidndk_cmake sameri11_rules_flutter++android_ndk+androidndk_cmake" + ], + "generatedRepoSpecs": { + "flutter_plugins": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:plugins.bzl%flutter_plugins", + "attributes": { + "abis": [ + "arm64-v8a", + "x86_64", + "armeabi-v7a" + ], + "metadata": "@@//:.flutter-plugins-dependencies", + "package_config": "@@//:.dart_tool/package_config.json", + "coursier_options": [], + "extra_artifacts": [], + "maven_resolver": "coursier", + "maven_lock_file": "", + "maven_repo": "'@@rules_jvm_external++maven+flutter_maven'", + "overrides": {}, + "recipes": { + "rive_native": "{\"bzl\":\"@@//bazel/flutter:rive_native.bzl\",\"macro\":\"rive_native_recipe\",\"root\":true}", + "sqlite3": "{\"bzl\":\"@@//bazel/flutter:sqlite3.bzl\",\"macro\":\"sqlite3_recipe\",\"root\":true}" + }, + "embedding": "'@@//android/app:flutter_embedding'", + "android_bzl": "'@@sameri11_rules_flutter+//flutter:defs.bzl'", + "recipe_bzl": "'@@sameri11_rules_flutter+//flutter:defs.bzl'", + "ndk_source_properties": "'@@sameri11_rules_flutter++android_ndk+androidndk_cmake//:ndk_source_properties'" + } + } + } + } + }, + "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter": { + "general": { + "bzlTransitiveDigest": "d0akA1llff6BLmlVnXIvFQO70c00GoPx6Qps3UswgoY=", + "usagesDigest": "9JJGb3s90dw7aP1J/ALzWN+mv7TCBGSvZtZjU0/9yS8=", + "recordedInputs": [ + "REPO_MAPPING:sameri11_rules_flutter+,bazel_tools bazel_tools", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+" + ], + "generatedRepoSpecs": { + "flutter_sdk": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter_sdk", + "attributes": {} + }, + "flutter_embedding_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_embedding_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + } + } + } } }, "facts": { diff --git a/examples/demo_app/android/app/BUILD.bazel b/examples/demo_app/android/app/BUILD.bazel index 445486b..ea796ee 100644 --- a/examples/demo_app/android/app/BUILD.bazel +++ b/examples/demo_app/android/app/BUILD.bazel @@ -7,15 +7,14 @@ # files, so this BUILD survives, but keep that in mind when upgrading templates. load("@rules_android//rules:rules.bzl", "android_library") -load("@rules_flutter//tools/flutter:android.bzl", "flutter_android_binary") -load("@rules_flutter//tools/flutter:embedding.bzl", "flutter_embedding_library") +load("@rules_flutter//flutter:defs.bzl", "flutter_android_binary", "flutter_embedding_library") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") package(default_visibility = ["//visibility:public"]) # Every plugin `pub get` reported as having an Android native build. The # aggregate is generated from .flutter-plugins-dependencies, so adding a plugin -# to pubspec.yaml is the only step -- see @rules_flutter//tools/flutter:plugins.bzl. Named +# to pubspec.yaml is the only step -- see @rules_flutter//flutter:extensions.bzl. Named # here only because :generated_plugin_registrant and :main_activity need it; # the APK derives it. PLUGINS = ["@flutter_plugins//:all"] @@ -34,7 +33,7 @@ ABIS = [ # this project's MODULE.bazel creates from this project's plugin coordinates. A # label naming it from inside the rules would resolve against the *rules'* # dependencies instead -- which is exactly the bug that made these rules -# unusable as a bazel_dep. See @rules_flutter//tools/flutter:embedding.bzl. +# unusable as a bazel_dep. See @rules_flutter//flutter:defs.bzl. flutter_embedding_library(name = "flutter_embedding") # Every Flutter contribution to the APK, joined into one target -- the AOT @@ -42,7 +41,7 @@ flutter_embedding_library(name = "flutter_embedding") # and their native halves, the recipe libraries, the registrant -- and then one # APK per shape: :demo_app carries every ABI, :demo_app_ carries one. A # bundle check per shape fails the build if any of them is missing a piece; see -# @rules_flutter//tools/flutter:bundle.bzl. +# @rules_flutter//flutter:defs.bzl. # # Four things are stated: the ABIs, the Dart half's package, the applicationId # and this module's own targets. The rest is derived -- //:app, //:assets and diff --git a/examples/demo_app/android/config.MODULE.bazel b/examples/demo_app/android/config.MODULE.bazel index 57cec34..fb2e9e9 100644 --- a/examples/demo_app/android/config.MODULE.bazel +++ b/examples/demo_app/android/config.MODULE.bazel @@ -29,12 +29,12 @@ use_repo(android_sdk, "androidsdk") register_toolchains("@androidsdk//:all") -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") -plugins = use_extension("@rules_flutter//tools/flutter:plugins.bzl", "flutter_plugins_ext") +plugins = use_extension("@rules_flutter//flutter:extensions.bzl", "flutter_plugins_ext") plugins.project( abis = [ "arm64-v8a", diff --git a/examples/demo_app/bazel/flutter/BUILD.bazel b/examples/demo_app/bazel/flutter/BUILD.bazel index bd59815..0fcb6dc 100644 --- a/examples/demo_app/bazel/flutter/BUILD.bazel +++ b/examples/demo_app/bazel/flutter/BUILD.bazel @@ -1,5 +1,5 @@ # Recipes for pub packages that fall outside the standard build, supplied by -# this project to //tools/flutter:plugins.bzl through plugins.package(). +# this project to //flutter:extensions.bzl through plugins.package(). # # These are consumer-side files: they are loaded by BUILD files the rules # generate, by canonical label, and their own load() statements resolve in this diff --git a/examples/demo_app/bazel/flutter/rive_native.bzl b/examples/demo_app/bazel/flutter/rive_native.bzl index 59e443c..22a6180 100644 --- a/examples/demo_app/bazel/flutter/rive_native.bzl +++ b/examples/demo_app/bazel/flutter/rive_native.bzl @@ -1,7 +1,7 @@ """Recipe for rive_native's Kotlin plugin and prebuilt Android libraries.""" # Load from the defining module; @@// is root-module-relative. -load("@rules_flutter//tools/flutter:recipe.bzl", "flutter_native_contribution") +load("@rules_flutter//flutter:defs.bzl", "flutter_native_contribution") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") # The archive's supported ABIs. Label() resolves repositories in this module. diff --git a/examples/demo_app/bazel/flutter/sqlite3.bzl b/examples/demo_app/bazel/flutter/sqlite3.bzl index d104f37..32b3b0d 100644 --- a/examples/demo_app/bazel/flutter/sqlite3.bzl +++ b/examples/demo_app/bazel/flutter/sqlite3.bzl @@ -7,7 +7,7 @@ code asset below. # Resolve these repositories in this module, where MODULE.bazel declares them. # Bare apparent names would resolve in the generated repository's mapping. -load("@rules_flutter//tools/flutter:recipe.bzl", "flutter_native_contribution") +load("@rules_flutter//flutter:defs.bzl", "flutter_native_contribution") _LIBRARIES = { "arm64-v8a": Label("@libsqlite3_android_arm64_v8a//file"), diff --git a/examples/demo_app/lib/dart_plugin_registrant.dart b/examples/demo_app/lib/dart_plugin_registrant.dart index a2b713e..e9c6a21 100755 --- a/examples/demo_app/lib/dart_plugin_registrant.dart +++ b/examples/demo_app/lib/dart_plugin_registrant.dart @@ -1,5 +1,5 @@ // -// Generated by //tools/flutter:plugins.bzl -- do not edit. +// Generated by //flutter:extensions.bzl -- do not edit. // // The Dart half of plugin registration. GeneratedPluginRegistrant.java // instantiates each plugin's *native* class; a federated plugin also ships a diff --git a/examples/demo_app/plugin_deps.MODULE.bazel b/examples/demo_app/plugin_deps.MODULE.bazel index 9cdf358..cd57ed5 100644 --- a/examples/demo_app/plugin_deps.MODULE.bazel +++ b/examples/demo_app/plugin_deps.MODULE.bazel @@ -1,4 +1,4 @@ -# Generated by @rules_flutter//tools/flutter:plugins.bzl -- do not edit by hand. +# Generated by @rules_flutter//flutter:extensions.bzl -- do not edit by hand. # # Maven artifacts from the Flutter embedding and plugin build files. # Run the generated updater target when `pub_plugins_check` reports drift. diff --git a/examples/local_plugin/MODULE.bazel b/examples/local_plugin/MODULE.bazel index 958feff..3f31b76 100644 --- a/examples/local_plugin/MODULE.bazel +++ b/examples/local_plugin/MODULE.bazel @@ -5,9 +5,9 @@ module( # Monorepo app with a local path plugin. It exercises non-root metadata and # plugin paths outside the pub cache. -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../..", ) diff --git a/examples/local_plugin/MODULE.bazel.lock b/examples/local_plugin/MODULE.bazel.lock index 172fcf3..176d16f 100644 --- a/examples/local_plugin/MODULE.bazel.lock +++ b/examples/local_plugin/MODULE.bazel.lock @@ -343,7 +343,7 @@ "@@rules_android+//rules/android_sdk_repository:rule.bzl%android_sdk_repository_extension": { "general": { "bzlTransitiveDigest": "qHbR00gVzVzkxX+PRtv4UGcUFMtBz7TK9CNYUWH8nIE=", - "usagesDigest": "cICSw5FcSDU8WYVx86yPYAZ/DVql5qa68faWpcWO8m0=", + "usagesDigest": "ztC13ZYTOD+NVRATnb8OU1YKrENeFOrJYBvFDEpeOkY=", "recordedInputs": [], "generatedRepoSpecs": { "androidsdk": { @@ -357,143 +357,6 @@ } } }, - "@@rules_flutter+//tools/flutter:ndk.bzl%android_ndk": { - "general": { - "bzlTransitiveDigest": "wubp2T1WtFjfb9+kfYhB63NRFwpD0mXcOWF3daEO03c=", - "usagesDigest": "g9yt3AXvofLsZ2gfAAVDS//JfgBCz2xCm6imku1zlkA=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,rules_android_ndk rules_android_ndk+" - ], - "generatedRepoSpecs": { - "androidndk": { - "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", - "attributes": {} - }, - "androidndk_cmake": { - "repoRuleId": "@@rules_flutter+//tools/flutter:ndk.bzl%_androidndk_cmake_repository", - "attributes": {} - } - } - } - }, - "@@rules_flutter+//tools/flutter:plugins.bzl%flutter_plugins_ext": { - "general": { - "bzlTransitiveDigest": "tQNMt955Aw9GgNkaaslFjOQlTt/8uwsvu2YmduiXfjg=", - "usagesDigest": "Z9hQSeXyPKbND6D/cNmthbIQrw93atyT653mkQZgs8Q=", - "recordedInputs": [ - "REPO_MAPPING:,flutter_maven rules_jvm_external++maven+flutter_maven", - "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", - "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", - "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", - "REPO_MAPPING:protobuf+,rules_java rules_java+", - "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", - "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", - "REPO_MAPPING:rules_cc+,platforms platforms", - "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", - "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+", - "REPO_MAPPING:rules_flutter+,rules_java rules_java+", - "REPO_MAPPING:rules_java+,bazel_features bazel_features+", - "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", - "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", - "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", - "REPO_MAPPING:rules_java+,rules_cc rules_cc+", - "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", - "REPO_MAPPING:rules_flutter+,androidndk_cmake rules_flutter++android_ndk+androidndk_cmake" - ], - "generatedRepoSpecs": { - "flutter_plugins": { - "repoRuleId": "@@rules_flutter+//tools/flutter:plugins.bzl%flutter_plugins", - "attributes": { - "abis": [ - "arm64-v8a" - ], - "metadata": "@@//packages/host_app:.flutter-plugins-dependencies", - "package_config": "@@//packages/host_app:.dart_tool/package_config.json", - "coursier_options": [], - "extra_artifacts": [], - "maven_resolver": "coursier", - "maven_lock_file": "", - "maven_repo": "'@@rules_jvm_external++maven+flutter_maven'", - "overrides": {}, - "recipes": {}, - "embedding": "'@@//packages/host_app/android/app:flutter_embedding'", - "android_bzl": "'@@rules_flutter+//tools/flutter:android.bzl'", - "recipe_bzl": "'@@rules_flutter+//tools/flutter:recipe.bzl'", - "ndk_source_properties": "'@@rules_flutter++android_ndk+androidndk_cmake//:ndk_source_properties'" - } - } - } - } - }, - "@@rules_flutter+//tools/flutter:repo.bzl%flutter": { - "general": { - "bzlTransitiveDigest": "xF3NHN89e0wpLlITfvPlzlq4YYs2Cm7XkvAn18uvo1k=", - "usagesDigest": "cw4CePI4DWiQZm/66uKnW1chHGB6MLzXF+K2CxUxGyw=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+" - ], - "generatedRepoSpecs": { - "flutter_sdk": { - "repoRuleId": "@@rules_flutter+//tools/flutter:repo.bzl%flutter_sdk", - "attributes": {} - }, - "flutter_embedding_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_embedding_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - } - } - } - }, "@@rules_python+//python/extensions:config.bzl%config": { "general": { "bzlTransitiveDigest": "dzD8Q2YmrP3fz8saWLHPmlwPLO91ImtTmP/c9JKTStM=", @@ -691,6 +554,164 @@ } } } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%android_ndk": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "c6Q7xXhVgobmcU8bDM+vxe4f5nLrPx8SVE7jZZJGerQ=", + "recordedInputs": [ + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+" + ], + "generatedRepoSpecs": { + "androidndk": { + "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", + "attributes": {} + }, + "androidndk_cmake": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:ndk.bzl%_androidndk_cmake_repository", + "attributes": {} + } + } + } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%flutter_plugins_ext": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "ZniNXWl6OiVCASrWeGxNNsIQlgh4uDdHgYxug69NNWw=", + "recordedInputs": [ + "REPO_MAPPING:,flutter_maven rules_jvm_external++maven+flutter_maven", + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,androidndk_cmake sameri11_rules_flutter++android_ndk+androidndk_cmake" + ], + "generatedRepoSpecs": { + "flutter_plugins": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:plugins.bzl%flutter_plugins", + "attributes": { + "abis": [ + "arm64-v8a" + ], + "metadata": "@@//packages/host_app:.flutter-plugins-dependencies", + "package_config": "@@//packages/host_app:.dart_tool/package_config.json", + "coursier_options": [], + "extra_artifacts": [], + "maven_resolver": "coursier", + "maven_lock_file": "", + "maven_repo": "'@@rules_jvm_external++maven+flutter_maven'", + "overrides": {}, + "recipes": {}, + "embedding": "'@@//packages/host_app/android/app:flutter_embedding'", + "android_bzl": "'@@sameri11_rules_flutter+//flutter:defs.bzl'", + "recipe_bzl": "'@@sameri11_rules_flutter+//flutter:defs.bzl'", + "ndk_source_properties": "'@@sameri11_rules_flutter++android_ndk+androidndk_cmake//:ndk_source_properties'" + } + } + } + } + }, + "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter": { + "general": { + "bzlTransitiveDigest": "d0akA1llff6BLmlVnXIvFQO70c00GoPx6Qps3UswgoY=", + "usagesDigest": "9JJGb3s90dw7aP1J/ALzWN+mv7TCBGSvZtZjU0/9yS8=", + "recordedInputs": [ + "REPO_MAPPING:sameri11_rules_flutter+,bazel_tools bazel_tools", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+" + ], + "generatedRepoSpecs": { + "flutter_sdk": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter_sdk", + "attributes": {} + }, + "flutter_embedding_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_embedding_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + } + } + } } }, "facts": { diff --git a/examples/local_plugin/packages/host_app/BUILD.bazel b/examples/local_plugin/packages/host_app/BUILD.bazel index d151c64..d20bf18 100644 --- a/examples/local_plugin/packages/host_app/BUILD.bazel +++ b/examples/local_plugin/packages/host_app/BUILD.bazel @@ -1,4 +1,4 @@ -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) diff --git a/examples/local_plugin/packages/host_app/android/app/BUILD.bazel b/examples/local_plugin/packages/host_app/android/app/BUILD.bazel index 27ca78b..aecb9bd 100644 --- a/examples/local_plugin/packages/host_app/android/app/BUILD.bazel +++ b/examples/local_plugin/packages/host_app/android/app/BUILD.bazel @@ -1,6 +1,5 @@ load("@rules_android//rules:rules.bzl", "android_library") -load("@rules_flutter//tools/flutter:android.bzl", "flutter_android_binary") -load("@rules_flutter//tools/flutter:embedding.bzl", "flutter_embedding_library") +load("@rules_flutter//flutter:defs.bzl", "flutter_android_binary", "flutter_embedding_library") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") package(default_visibility = ["//visibility:public"]) diff --git a/examples/local_plugin/packages/host_app/android/config.MODULE.bazel b/examples/local_plugin/packages/host_app/android/config.MODULE.bazel index 0d98ab3..97e412b 100644 --- a/examples/local_plugin/packages/host_app/android/config.MODULE.bazel +++ b/examples/local_plugin/packages/host_app/android/config.MODULE.bazel @@ -20,12 +20,12 @@ use_repo(android_sdk, "androidsdk") register_toolchains("@androidsdk//:all") -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") -plugins = use_extension("@rules_flutter//tools/flutter:plugins.bzl", "flutter_plugins_ext") +plugins = use_extension("@rules_flutter//flutter:extensions.bzl", "flutter_plugins_ext") plugins.project( abis = ["arm64-v8a"], embedding = "//packages/host_app/android/app:flutter_embedding", diff --git a/examples/local_plugin/packages/host_app/lib/dart_plugin_registrant.dart b/examples/local_plugin/packages/host_app/lib/dart_plugin_registrant.dart index 34dea82..73b4882 100755 --- a/examples/local_plugin/packages/host_app/lib/dart_plugin_registrant.dart +++ b/examples/local_plugin/packages/host_app/lib/dart_plugin_registrant.dart @@ -1,5 +1,5 @@ // -// Generated by //tools/flutter:plugins.bzl -- do not edit. +// Generated by //flutter:extensions.bzl -- do not edit. // // The Dart half of plugin registration. GeneratedPluginRegistrant.java // instantiates each plugin's *native* class; a federated plugin also ships a diff --git a/examples/local_plugin/plugin_deps.MODULE.bazel b/examples/local_plugin/plugin_deps.MODULE.bazel index 2966fbf..d930ba1 100644 --- a/examples/local_plugin/plugin_deps.MODULE.bazel +++ b/examples/local_plugin/plugin_deps.MODULE.bazel @@ -1,4 +1,4 @@ -# Generated by @rules_flutter//tools/flutter:plugins.bzl -- do not edit by hand. +# Generated by @rules_flutter//flutter:extensions.bzl -- do not edit by hand. # # Maven artifacts from the Flutter embedding and plugin build files. # Run the generated updater target when `pub_plugins_check` reports drift. diff --git a/examples/no_plugins/BUILD.bazel b/examples/no_plugins/BUILD.bazel index 00112ed..d96523d 100644 --- a/examples/no_plugins/BUILD.bazel +++ b/examples/no_plugins/BUILD.bazel @@ -1,6 +1,6 @@ # Dart targets for a plugin-free app. -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) diff --git a/examples/no_plugins/MODULE.bazel b/examples/no_plugins/MODULE.bazel index c2d695d..262ca56 100644 --- a/examples/no_plugins/MODULE.bazel +++ b/examples/no_plugins/MODULE.bazel @@ -5,9 +5,9 @@ module( # Minimal plugin-free module: no plugins.project(), generated segment, or # @flutter_plugins repository. -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../..", ) diff --git a/examples/no_plugins/MODULE.bazel.lock b/examples/no_plugins/MODULE.bazel.lock index 6179c27..3fc3891 100644 --- a/examples/no_plugins/MODULE.bazel.lock +++ b/examples/no_plugins/MODULE.bazel.lock @@ -343,7 +343,7 @@ "@@rules_android+//rules/android_sdk_repository:rule.bzl%android_sdk_repository_extension": { "general": { "bzlTransitiveDigest": "qHbR00gVzVzkxX+PRtv4UGcUFMtBz7TK9CNYUWH8nIE=", - "usagesDigest": "Fa4fW6E8A+wsY22aoShdXiSvAllwtbKhnwpbfpkkcy0=", + "usagesDigest": "9UjDg9wkN5K6e7GB90KMHVuyddbJ1ToGJg13DnhuYTE=", "recordedInputs": [], "generatedRepoSpecs": { "androidsdk": { @@ -357,90 +357,6 @@ } } }, - "@@rules_flutter+//tools/flutter:ndk.bzl%android_ndk": { - "general": { - "bzlTransitiveDigest": "wubp2T1WtFjfb9+kfYhB63NRFwpD0mXcOWF3daEO03c=", - "usagesDigest": "M/4V/lGzy1WeTjBWAtTIb4YSbgK6sJ+w8mvyyiivGw8=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,rules_android_ndk rules_android_ndk+" - ], - "generatedRepoSpecs": { - "androidndk": { - "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", - "attributes": {} - }, - "androidndk_cmake": { - "repoRuleId": "@@rules_flutter+//tools/flutter:ndk.bzl%_androidndk_cmake_repository", - "attributes": {} - } - } - } - }, - "@@rules_flutter+//tools/flutter:repo.bzl%flutter": { - "general": { - "bzlTransitiveDigest": "xF3NHN89e0wpLlITfvPlzlq4YYs2Cm7XkvAn18uvo1k=", - "usagesDigest": "cw4CePI4DWiQZm/66uKnW1chHGB6MLzXF+K2CxUxGyw=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+" - ], - "generatedRepoSpecs": { - "flutter_sdk": { - "repoRuleId": "@@rules_flutter+//tools/flutter:repo.bzl%flutter_sdk", - "attributes": {} - }, - "flutter_embedding_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_embedding_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - } - } - } - }, "@@rules_python+//python/extensions:config.bzl%config": { "general": { "bzlTransitiveDigest": "dzD8Q2YmrP3fz8saWLHPmlwPLO91ImtTmP/c9JKTStM=", @@ -638,6 +554,110 @@ } } } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%android_ndk": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "kiRgwS+Co+SVG39rQ6d/0TSTi0aPlNWC8w8fxg1J0UE=", + "recordedInputs": [ + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+" + ], + "generatedRepoSpecs": { + "androidndk": { + "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", + "attributes": {} + }, + "androidndk_cmake": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:ndk.bzl%_androidndk_cmake_repository", + "attributes": {} + } + } + } + }, + "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter": { + "general": { + "bzlTransitiveDigest": "d0akA1llff6BLmlVnXIvFQO70c00GoPx6Qps3UswgoY=", + "usagesDigest": "9JJGb3s90dw7aP1J/ALzWN+mv7TCBGSvZtZjU0/9yS8=", + "recordedInputs": [ + "REPO_MAPPING:sameri11_rules_flutter+,bazel_tools bazel_tools", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+" + ], + "generatedRepoSpecs": { + "flutter_sdk": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter_sdk", + "attributes": {} + }, + "flutter_embedding_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_embedding_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + } + } + } } }, "facts": { diff --git a/examples/no_plugins/android/app/BUILD.bazel b/examples/no_plugins/android/app/BUILD.bazel index a672443..78ed3da 100644 --- a/examples/no_plugins/android/app/BUILD.bazel +++ b/examples/no_plugins/android/app/BUILD.bazel @@ -1,8 +1,7 @@ # Android targets for the plugin-free app. load("@rules_android//rules:rules.bzl", "android_library") -load("@rules_flutter//tools/flutter:android.bzl", "flutter_android_binary") -load("@rules_flutter//tools/flutter:embedding.bzl", "flutter_embedding_library") +load("@rules_flutter//flutter:defs.bzl", "flutter_android_binary", "flutter_embedding_library") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") package(default_visibility = ["//visibility:public"]) diff --git a/examples/no_plugins/android/config.MODULE.bazel b/examples/no_plugins/android/config.MODULE.bazel index 4476bcb..60ee64e 100644 --- a/examples/no_plugins/android/config.MODULE.bazel +++ b/examples/no_plugins/android/config.MODULE.bazel @@ -14,7 +14,7 @@ use_repo(android_sdk, "androidsdk") register_toolchains("@androidsdk//:all") -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") diff --git a/examples/pub_plugins/BUILD.bazel b/examples/pub_plugins/BUILD.bazel index 819a9e6..b7a4d7f 100644 --- a/examples/pub_plugins/BUILD.bazel +++ b/examples/pub_plugins/BUILD.bazel @@ -1,6 +1,6 @@ # Dart targets for the flat pub-plugin example. -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) diff --git a/examples/pub_plugins/MODULE.bazel b/examples/pub_plugins/MODULE.bazel index 5eda329..bd09c70 100644 --- a/examples/pub_plugins/MODULE.bazel +++ b/examples/pub_plugins/MODULE.bazel @@ -4,9 +4,9 @@ module( ) # Copyable flat app: pub plugins, one ABI, no recipes or path dependencies. -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../..", ) diff --git a/examples/pub_plugins/MODULE.bazel.lock b/examples/pub_plugins/MODULE.bazel.lock index 217893d..c037323 100644 --- a/examples/pub_plugins/MODULE.bazel.lock +++ b/examples/pub_plugins/MODULE.bazel.lock @@ -343,7 +343,7 @@ "@@rules_android+//rules/android_sdk_repository:rule.bzl%android_sdk_repository_extension": { "general": { "bzlTransitiveDigest": "qHbR00gVzVzkxX+PRtv4UGcUFMtBz7TK9CNYUWH8nIE=", - "usagesDigest": "CuC/4zcWAoRpzi/OotS0qOscKTRz2ACgIvWQcv2ViIg=", + "usagesDigest": "QkNnYtA1qpXTRgy8A1msfvVb/c2L/5NdQvMLkTyIybU=", "recordedInputs": [], "generatedRepoSpecs": { "androidsdk": { @@ -357,143 +357,6 @@ } } }, - "@@rules_flutter+//tools/flutter:ndk.bzl%android_ndk": { - "general": { - "bzlTransitiveDigest": "wubp2T1WtFjfb9+kfYhB63NRFwpD0mXcOWF3daEO03c=", - "usagesDigest": "m0Ze4Kz7Jl8wkrUPNjTuX5NJxPCj+EfmcxJ2eSPAhtI=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,rules_android_ndk rules_android_ndk+" - ], - "generatedRepoSpecs": { - "androidndk": { - "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", - "attributes": {} - }, - "androidndk_cmake": { - "repoRuleId": "@@rules_flutter+//tools/flutter:ndk.bzl%_androidndk_cmake_repository", - "attributes": {} - } - } - } - }, - "@@rules_flutter+//tools/flutter:plugins.bzl%flutter_plugins_ext": { - "general": { - "bzlTransitiveDigest": "tQNMt955Aw9GgNkaaslFjOQlTt/8uwsvu2YmduiXfjg=", - "usagesDigest": "YAm/jbk0GwO9p9qd76oXRuG29FRMV6Bi9F3BHgRBbI0=", - "recordedInputs": [ - "REPO_MAPPING:,flutter_maven rules_jvm_external++maven+flutter_maven", - "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", - "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", - "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", - "REPO_MAPPING:protobuf+,rules_java rules_java+", - "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", - "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", - "REPO_MAPPING:rules_cc+,platforms platforms", - "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", - "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+", - "REPO_MAPPING:rules_flutter+,rules_java rules_java+", - "REPO_MAPPING:rules_java+,bazel_features bazel_features+", - "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", - "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", - "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", - "REPO_MAPPING:rules_java+,rules_cc rules_cc+", - "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", - "REPO_MAPPING:rules_flutter+,androidndk_cmake rules_flutter++android_ndk+androidndk_cmake" - ], - "generatedRepoSpecs": { - "flutter_plugins": { - "repoRuleId": "@@rules_flutter+//tools/flutter:plugins.bzl%flutter_plugins", - "attributes": { - "abis": [ - "arm64-v8a" - ], - "metadata": "@@//:.flutter-plugins-dependencies", - "package_config": "@@//:.dart_tool/package_config.json", - "coursier_options": [], - "extra_artifacts": [], - "maven_resolver": "coursier", - "maven_lock_file": "", - "maven_repo": "'@@rules_jvm_external++maven+flutter_maven'", - "overrides": {}, - "recipes": {}, - "embedding": "'@@//android/app:flutter_embedding'", - "android_bzl": "'@@rules_flutter+//tools/flutter:android.bzl'", - "recipe_bzl": "'@@rules_flutter+//tools/flutter:recipe.bzl'", - "ndk_source_properties": "'@@rules_flutter++android_ndk+androidndk_cmake//:ndk_source_properties'" - } - } - } - } - }, - "@@rules_flutter+//tools/flutter:repo.bzl%flutter": { - "general": { - "bzlTransitiveDigest": "xF3NHN89e0wpLlITfvPlzlq4YYs2Cm7XkvAn18uvo1k=", - "usagesDigest": "cw4CePI4DWiQZm/66uKnW1chHGB6MLzXF+K2CxUxGyw=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+" - ], - "generatedRepoSpecs": { - "flutter_sdk": { - "repoRuleId": "@@rules_flutter+//tools/flutter:repo.bzl%flutter_sdk", - "attributes": {} - }, - "flutter_embedding_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_embedding_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - } - } - } - }, "@@rules_python+//python/extensions:config.bzl%config": { "general": { "bzlTransitiveDigest": "dzD8Q2YmrP3fz8saWLHPmlwPLO91ImtTmP/c9JKTStM=", @@ -691,6 +554,164 @@ } } } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%android_ndk": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "BVQSiaq0xrv//PzqHk1mfLYCXhD/oOSxnp1+ldQM4N8=", + "recordedInputs": [ + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+" + ], + "generatedRepoSpecs": { + "androidndk": { + "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", + "attributes": {} + }, + "androidndk_cmake": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:ndk.bzl%_androidndk_cmake_repository", + "attributes": {} + } + } + } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%flutter_plugins_ext": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "YHpUoRs5EUMqVpMzUL4GczEbTmnqwnkljjI69j4wkZo=", + "recordedInputs": [ + "REPO_MAPPING:,flutter_maven rules_jvm_external++maven+flutter_maven", + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,androidndk_cmake sameri11_rules_flutter++android_ndk+androidndk_cmake" + ], + "generatedRepoSpecs": { + "flutter_plugins": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:plugins.bzl%flutter_plugins", + "attributes": { + "abis": [ + "arm64-v8a" + ], + "metadata": "@@//:.flutter-plugins-dependencies", + "package_config": "@@//:.dart_tool/package_config.json", + "coursier_options": [], + "extra_artifacts": [], + "maven_resolver": "coursier", + "maven_lock_file": "", + "maven_repo": "'@@rules_jvm_external++maven+flutter_maven'", + "overrides": {}, + "recipes": {}, + "embedding": "'@@//android/app:flutter_embedding'", + "android_bzl": "'@@sameri11_rules_flutter+//flutter:defs.bzl'", + "recipe_bzl": "'@@sameri11_rules_flutter+//flutter:defs.bzl'", + "ndk_source_properties": "'@@sameri11_rules_flutter++android_ndk+androidndk_cmake//:ndk_source_properties'" + } + } + } + } + }, + "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter": { + "general": { + "bzlTransitiveDigest": "d0akA1llff6BLmlVnXIvFQO70c00GoPx6Qps3UswgoY=", + "usagesDigest": "9JJGb3s90dw7aP1J/ALzWN+mv7TCBGSvZtZjU0/9yS8=", + "recordedInputs": [ + "REPO_MAPPING:sameri11_rules_flutter+,bazel_tools bazel_tools", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+" + ], + "generatedRepoSpecs": { + "flutter_sdk": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter_sdk", + "attributes": {} + }, + "flutter_embedding_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_embedding_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + } + } + } } }, "facts": { diff --git a/examples/pub_plugins/android/app/BUILD.bazel b/examples/pub_plugins/android/app/BUILD.bazel index 8d48f76..76293cf 100644 --- a/examples/pub_plugins/android/app/BUILD.bazel +++ b/examples/pub_plugins/android/app/BUILD.bazel @@ -2,8 +2,7 @@ # manifest, resources and sources. load("@rules_android//rules:rules.bzl", "android_library") -load("@rules_flutter//tools/flutter:android.bzl", "flutter_android_binary") -load("@rules_flutter//tools/flutter:embedding.bzl", "flutter_embedding_library") +load("@rules_flutter//flutter:defs.bzl", "flutter_android_binary", "flutter_embedding_library") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") package(default_visibility = ["//visibility:public"]) diff --git a/examples/pub_plugins/android/config.MODULE.bazel b/examples/pub_plugins/android/config.MODULE.bazel index a77f024..d097026 100644 --- a/examples/pub_plugins/android/config.MODULE.bazel +++ b/examples/pub_plugins/android/config.MODULE.bazel @@ -20,12 +20,12 @@ use_repo(android_sdk, "androidsdk") register_toolchains("@androidsdk//:all") -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") -plugins = use_extension("@rules_flutter//tools/flutter:plugins.bzl", "flutter_plugins_ext") +plugins = use_extension("@rules_flutter//flutter:extensions.bzl", "flutter_plugins_ext") plugins.project( abis = ["arm64-v8a"], embedding = "//android/app:flutter_embedding", diff --git a/examples/pub_plugins/lib/dart_plugin_registrant.dart b/examples/pub_plugins/lib/dart_plugin_registrant.dart index 20b8d02..663c793 100755 --- a/examples/pub_plugins/lib/dart_plugin_registrant.dart +++ b/examples/pub_plugins/lib/dart_plugin_registrant.dart @@ -1,5 +1,5 @@ // -// Generated by //tools/flutter:plugins.bzl -- do not edit. +// Generated by //flutter:extensions.bzl -- do not edit. // // The Dart half of plugin registration. GeneratedPluginRegistrant.java // instantiates each plugin's *native* class; a federated plugin also ships a diff --git a/examples/pub_plugins/plugin_deps.MODULE.bazel b/examples/pub_plugins/plugin_deps.MODULE.bazel index faf1cde..9b85f85 100644 --- a/examples/pub_plugins/plugin_deps.MODULE.bazel +++ b/examples/pub_plugins/plugin_deps.MODULE.bazel @@ -1,4 +1,4 @@ -# Generated by @rules_flutter//tools/flutter:plugins.bzl -- do not edit by hand. +# Generated by @rules_flutter//flutter:extensions.bzl -- do not edit by hand. # # Maven artifacts from the Flutter embedding and plugin build files. # Run the generated updater target when `pub_plugins_check` reports drift. diff --git a/flutter/BUILD.bazel b/flutter/BUILD.bazel new file mode 100644 index 0000000..d0809b7 --- /dev/null +++ b/flutter/BUILD.bazel @@ -0,0 +1,26 @@ +load("@bazel_skylib//rules:common_settings.bzl", "string_flag") +load("//flutter/private:abis.bzl", "MODES") + +package(default_visibility = ["//visibility:public"]) + +exports_files([ + "defs.bzl", + "extensions.bzl", +]) + +# Flutter runtime mode, independent of --compilation_mode. +string_flag( + name = "mode", + build_setting_default = "release", + values = MODES, +) + +config_setting( + name = "mode_debug", + flag_values = {":mode": "debug"}, +) + +config_setting( + name = "mode_release", + flag_values = {":mode": "release"}, +) diff --git a/flutter/defs.bzl b/flutter/defs.bzl new file mode 100644 index 0000000..3040268 --- /dev/null +++ b/flutter/defs.bzl @@ -0,0 +1,55 @@ +"""The supported BUILD-file API for Flutter Consumer Modules. + +Consumer BUILD files load this one entrypoint rather than the implementation +under ``//flutter/private``. The public names below are the complete contract +exercised by the consumer API fixture; implementation files can move without +another consumer migration. +""" + +load("//flutter/private:abis.bzl", _ABIS = "ABIS") +load( + "//flutter/private:android.bzl", + _android_native_lib_jar = "android_native_lib_jar", + _flutter_android_binary = "flutter_android_binary", + _flutter_android_libs = "flutter_android_libs", + _jni_lib_jar = "jni_lib_jar", + _strip_native_libs = "strip_native_libs", +) +load( + "//flutter/private:embedding.bzl", + _flutter_embedding_library = "flutter_embedding_library", +) +load("//flutter/private:pubspec.bzl", _flutter_pubspec = "flutter_pubspec") +load( + "//flutter/private:recipe.bzl", + _flutter_native_contribution = "flutter_native_contribution", + _flutter_native_libs = "flutter_native_libs", +) +load( + "//flutter/private:rules.bzl", + _dart_kernel = "dart_kernel", + _flutter_aot_library = "flutter_aot_library", + _flutter_app = "flutter_app", + _flutter_assets = "flutter_assets", + _pub_path_deps_check = "pub_path_deps_check", + _pub_plugins_check = "pub_plugins_check", +) + +# Explicit assignments make the curated names exports of this module. Merely +# importing names with load() does not re-export them to downstream BUILD files. +ABIS = _ABIS +android_native_lib_jar = _android_native_lib_jar +dart_kernel = _dart_kernel +flutter_android_binary = _flutter_android_binary +flutter_android_libs = _flutter_android_libs +flutter_aot_library = _flutter_aot_library +flutter_app = _flutter_app +flutter_assets = _flutter_assets +flutter_embedding_library = _flutter_embedding_library +flutter_native_contribution = _flutter_native_contribution +flutter_native_libs = _flutter_native_libs +flutter_pubspec = _flutter_pubspec +jni_lib_jar = _jni_lib_jar +pub_path_deps_check = _pub_path_deps_check +pub_plugins_check = _pub_plugins_check +strip_native_libs = _strip_native_libs diff --git a/flutter/extensions.bzl b/flutter/extensions.bzl new file mode 100644 index 0000000..c252e2e --- /dev/null +++ b/flutter/extensions.bzl @@ -0,0 +1,14 @@ +"""The supported module-extension API for Flutter Consumer Modules. + +Consumer Modules load this entrypoint rather than the implementation under +``//flutter/private``. The Flutter SDK/engine provisioning extension stays +private to the Ruleset Module because it supplies the rules' own tool inputs. +""" + +load("//flutter/private:ndk.bzl", _android_ndk = "android_ndk") +load("//flutter/private:plugins.bzl", _flutter_plugins_ext = "flutter_plugins_ext") + +# Explicit assignments make the curated names exports of this module. Merely +# importing names with load() does not re-export them to downstream MODULE files. +android_ndk = _android_ndk +flutter_plugins_ext = _flutter_plugins_ext diff --git a/tools/flutter/BUILD.bazel b/flutter/private/BUILD.bazel similarity index 57% rename from tools/flutter/BUILD.bazel rename to flutter/private/BUILD.bazel index ce17262..8ea6d44 100644 --- a/tools/flutter/BUILD.bazel +++ b/flutter/private/BUILD.bazel @@ -1,5 +1,9 @@ -load("@bazel_skylib//rules:common_settings.bzl", "string_flag") -load(":abis.bzl", "MODES") +"""Implementation of the Flutter rules. + +Nothing here is supported API. Consumer Modules load //flutter:defs.bzl and +//flutter:extensions.bzl; these files are exported only because generated +repositories and the ruleset's own CI guards name them by label. +""" package(default_visibility = ["//visibility:public"]) @@ -10,29 +14,12 @@ exports_files([ "merge_native_assets.py", "read_pubspec.py", "repo.bzl", - "defs.bzl", + "rules.bzl", "android.bzl", "plugins.bzl", "ndk.bzl", ]) -# Flutter runtime mode, independent of --compilation_mode. -string_flag( - name = "mode", - build_setting_default = "release", - values = MODES, -) - -config_setting( - name = "mode_debug", - flag_values = {":mode": "debug"}, -) - -config_setting( - name = "mode_release", - flag_values = {":mode": "release"}, -) - # Excluded from wildcard checks because resolving it requires @androidsdk. alias( name = "_android_sdk_marker", diff --git a/tools/flutter/abis.bzl b/flutter/private/abis.bzl similarity index 98% rename from tools/flutter/abis.bzl rename to flutter/private/abis.bzl index 86bd73f..c570b6e 100644 --- a/tools/flutter/abis.bzl +++ b/flutter/private/abis.bzl @@ -267,7 +267,7 @@ def aot_target_compatible_with(): """ conditions = {"//conditions:default": [Label("@platforms//:incompatible")]} for mode in AOT_MODES: - conditions[Label("//tools/flutter:mode_" + mode)] = [] + conditions[Label("//flutter:mode_" + mode)] = [] return select(conditions) def aot_gen_snapshot(abi): @@ -285,7 +285,7 @@ def aot_gen_snapshot(abi): A select() value for a `gen_snapshot` attribute. """ conditions = { - Label("//tools/flutter:mode_" + mode): gen_snapshot_label(abi, mode) + Label("//flutter:mode_" + mode): gen_snapshot_label(abi, mode) for mode in AOT_MODES } conditions["//conditions:default"] = gen_snapshot_label(abi, AOT_MODES[0]) diff --git a/tools/flutter/android.bzl b/flutter/private/android.bzl similarity index 98% rename from tools/flutter/android.bzl rename to flutter/private/android.bzl index 24d6779..f3eee79 100644 --- a/tools/flutter/android.bzl +++ b/flutter/private/android.bzl @@ -1,12 +1,12 @@ """Rules for the Android half of a Flutter build. -Half 2 of the decomposition in defs.bzl: taking `libapp.so`, the engine, the +Half 2 of the decomposition in rules.bzl: taking `libapp.so`, the engine, the plugin libraries and the asset bundle and getting them into an APK. Everything here is Android-specific -- the jar-on-the-classpath mechanism `android_binary` uses to pick up native libraries, the NDK strip, and the guard that ties the asset bundle's code assets to the libraries a recipe supplied. -Kept apart from defs.bzl so a consumer building for another platform does not +Kept apart from rules.bzl so a consumer building for another platform does not load Android rules to get `dart_kernel`. The cc toolchain dependency lives entirely on this side. """ @@ -44,8 +44,8 @@ load(":bundle.bzl", "ASSETS", "CLASSES", "FlutterBundleContributionInfo", "NATIV load(":embedding.bzl", "flutter_embedding_deps") load(":pubspec.bzl", "FlutterPubspecInfo") -_MODE_DEBUG = Label("//tools/flutter:mode_debug") -_MODE_RELEASE = Label("//tools/flutter:mode_release") +_MODE_DEBUG = Label("//flutter:mode_debug") +_MODE_RELEASE = Label("//flutter:mode_release") def _jni_lib_jar_impl(ctx): jar = ctx.actions.declare_file(ctx.label.name + ".jar") @@ -386,7 +386,7 @@ stays readable against the template `flutter create` generated.""", doc = "A flutter_pubspec target; supplies both version facts.", ), "_injector": attr.label( - default = "//tools/flutter:inject_version.py", + default = "//flutter/private:inject_version.py", allow_single_file = True, ), }, @@ -564,7 +564,7 @@ def _flutter_bundle_check_impl(ctx): # Pin release builds to `opt`; preserve explicitly non-fastbuild modes. def _pin_release_compilation_mode_impl(settings, _attr): - mode = settings["//tools/flutter:mode"] + mode = settings["//flutter:mode"] compilation_mode = str(settings["//command_line_option:compilation_mode"]) if mode == "release" and compilation_mode == "fastbuild": compilation_mode = "opt" @@ -573,7 +573,7 @@ def _pin_release_compilation_mode_impl(settings, _attr): _pin_release_compilation_mode = transition( implementation = _pin_release_compilation_mode_impl, inputs = [ - "//tools/flutter:mode", + "//flutter:mode", "//command_line_option:compilation_mode", ], outputs = ["//command_line_option:compilation_mode"], @@ -623,11 +623,11 @@ Deliberately unsplit: `android_binary.assets` is `cfg = "target"` APK does not package.""", ), "_checker": attr.label( - default = "//tools/flutter:check_native_assets.py", + default = "//flutter/private:check_native_assets.py", allow_single_file = True, ), "_mode": attr.label( - default = "//tools/flutter:mode", + default = "//flutter:mode", providers = [BuildSettingInfo], ), }, @@ -659,7 +659,7 @@ def flutter_assets_dir(assets): """ # package_relative_label, not Label: Label() resolves against *this file's* - # package, so a caller writing ":assets" would get tools/flutter/assets. + # package, so a caller writing ":assets" would get flutter/private/assets. # Absolute labels hid that -- both real consumers happen to write one. label = native.package_relative_label(assets) @@ -1277,7 +1277,7 @@ def flutter_android_binary( "predeclare `_proguard.jar`/`_proguard.config`/`_proguard.map` " + "on the private android_binary without republishing those " + "labels on the public target. Extend `_flutter_apk` in " + - "tools/flutter/android.bzl (see docs_internal/" + + "flutter/private/android.bzl (see docs_internal/" + "compilation-mode-pinning.md) if this is genuinely needed.").format(name), ) diff --git a/tools/flutter/archive.bzl b/flutter/private/archive.bzl similarity index 100% rename from tools/flutter/archive.bzl rename to flutter/private/archive.bzl diff --git a/tools/flutter/bundle.bzl b/flutter/private/bundle.bzl similarity index 100% rename from tools/flutter/bundle.bzl rename to flutter/private/bundle.bzl diff --git a/tools/flutter/check_native_assets.py b/flutter/private/check_native_assets.py similarity index 100% rename from tools/flutter/check_native_assets.py rename to flutter/private/check_native_assets.py diff --git a/tools/flutter/check_path_deps.py b/flutter/private/check_path_deps.py similarity index 100% rename from tools/flutter/check_path_deps.py rename to flutter/private/check_path_deps.py diff --git a/tools/flutter/embedding.bzl b/flutter/private/embedding.bzl similarity index 96% rename from tools/flutter/embedding.bzl rename to flutter/private/embedding.bzl index 706d1f5..943f4a2 100644 --- a/tools/flutter/embedding.bzl +++ b/flutter/private/embedding.bzl @@ -11,7 +11,7 @@ against the embedding too, and the plugin repository rule must not depend on the layout of whichever app is being built. **Coordinates, not labels, are the source of truth.** They are read by -//tools/flutter:plugins.bzl, merged with every plugin's Maven dependencies, and +//flutter/private:plugins.bzl, merged with every plugin's Maven dependencies, and emitted as a single maven.install in the generated plugin_deps.MODULE.bazel. MODULE.bazel declares no artifacts of its own: two install tags sharing a repository name merge into one resolution, and whichever came last won @@ -23,8 +23,8 @@ load("@rules_java//java:defs.bzl", "java_import") load(":abis.bzl", "embedding_repo") load(":maven.bzl", "maven_label") -_MODE_DEBUG = Label("//tools/flutter:mode_debug") -_MODE_RELEASE = Label("//tools/flutter:mode_release") +_MODE_DEBUG = Label("//flutter:mode_debug") +_MODE_RELEASE = Label("//flutter:mode_release") FLUTTER_EMBEDDING_ARTIFACTS = [ "androidx.lifecycle:lifecycle-common:2.7.0", diff --git a/tools/flutter/inject_version.py b/flutter/private/inject_version.py similarity index 100% rename from tools/flutter/inject_version.py rename to flutter/private/inject_version.py diff --git a/tools/flutter/maven.bzl b/flutter/private/maven.bzl similarity index 100% rename from tools/flutter/maven.bzl rename to flutter/private/maven.bzl diff --git a/tools/flutter/merge_native_assets.py b/flutter/private/merge_native_assets.py similarity index 100% rename from tools/flutter/merge_native_assets.py rename to flutter/private/merge_native_assets.py diff --git a/tools/flutter/ndk.bzl b/flutter/private/ndk.bzl similarity index 97% rename from tools/flutter/ndk.bzl rename to flutter/private/ndk.bzl index d29d3fe..4ae88a8 100644 --- a/tools/flutter/ndk.bzl +++ b/flutter/private/ndk.bzl @@ -10,7 +10,7 @@ load("@rules_android_ndk//:rules.bzl", "android_ndk_repository") _MIN_NDK_MAJOR = 28 -_CMAKE_STUB_BUILD = """# Generated by //tools/flutter:ndk.bzl -- do not edit. +_CMAKE_STUB_BUILD = """# Generated by //flutter:extensions.bzl -- do not edit. package(default_visibility = ["//visibility:public"]) genrule( diff --git a/tools/flutter/plugins.bzl b/flutter/private/plugins.bzl similarity index 98% rename from tools/flutter/plugins.bzl rename to flutter/private/plugins.bzl index dd1921e..7bf13e5 100644 --- a/tools/flutter/plugins.bzl +++ b/flutter/private/plugins.bzl @@ -52,7 +52,7 @@ _DEP_CONFIGURATIONS = [ "runtimeOnly", ] -_BUILD_LOADS = """# Generated by //tools/flutter:plugins.bzl -- do not edit. +_BUILD_LOADS = """# Generated by //flutter:extensions.bzl -- do not edit. load("@rules_android//rules:rules.bzl", "android_library") """ @@ -204,7 +204,7 @@ genrule( outs = ["{name}_unsupported.java"], cmd = "echo 'Flutter plugin {name} is not supported: {reasons}.' >&2; " + "echo 'To fix, {hint}, or drop a reason code from ' >&2; " + - "echo '_GATED_REASONS in tools/flutter/plugins.bzl.' >&2; " + + "echo '_GATED_REASONS in flutter/private/plugins.bzl.' >&2; " + "exit 1", ) @@ -240,7 +240,7 @@ load(":package_info.bzl", "PACKAGE_INFO") ) """ -_PACKAGE_INFO_TEMPLATE = '''# Generated by //tools/flutter:plugins.bzl -- do not edit. +_PACKAGE_INFO_TEMPLATE = '''# Generated by //flutter:extensions.bzl -- do not edit. # # Everything the standard generator knows about {name}, handed to its recipe. # Paths are relative to this package. Sources are enumerated rather than left to @@ -325,7 +325,7 @@ java_library( ) """ -_MODULE_SEGMENT_HEADER = """# Generated by @rules_flutter//tools/flutter:plugins.bzl -- do not edit by hand. +_MODULE_SEGMENT_HEADER = """# Generated by @rules_flutter//flutter:extensions.bzl -- do not edit by hand. # # Maven artifacts from the Flutter embedding and plugin build files. # Run the generated updater target when `pub_plugins_check` reports drift. @@ -594,7 +594,7 @@ def _extract_dependencies(build_gradle_text): return coordinates, reasons _DART_REGISTRANT_TEMPLATE = """// -// Generated by //tools/flutter:plugins.bzl -- do not edit. +// Generated by //flutter:extensions.bzl -- do not edit. // // The Dart half of plugin registration. GeneratedPluginRegistrant.java // instantiates each plugin's *native* class; a federated plugin also ships a @@ -1448,11 +1448,11 @@ flutter_plugins = repository_rule( mandatory = True, ), "android_bzl": attr.string( - doc = "Label of //tools/flutter:android.bzl, for android_native_lib_jar.", + doc = "Label of //flutter:defs.bzl, for android_native_lib_jar.", mandatory = True, ), "recipe_bzl": attr.string( - doc = "Label of //tools/flutter:recipe.bzl, for flutter_native_libs.", + doc = "Label of //flutter:defs.bzl, for flutter_native_libs.", mandatory = True, ), "ndk_source_properties": attr.string( @@ -1620,10 +1620,10 @@ Supplied by the consuming project because the target must live there: its deps are Maven artifacts resolved from that project's own coordinate list, and a label naming them from inside these rules would resolve against these rules' dependencies instead. Instantiate it with -`//tools/flutter:embedding.bzl%flutter_embedding_library` and pass the result +`//flutter:defs.bzl%flutter_embedding_library` and pass the result here. The default is the bare release engine jar, which compiles but leaves plugins without androidx.annotation -- enough to fail loudly rather than -silently. Module extension tags cannot read `//tools/flutter:mode`, so this +silently. Module extension tags cannot read `//flutter:mode`, so this default cannot itself vary by mode; a debug build supplies its own `flutter_embedding_library()` result here regardless.""", ), @@ -1715,8 +1715,8 @@ def _flutter_plugins_ext_impl(ctx): recipes = recipes, # Labels resolve in the Consumer Module before generation. embedding = str(project.embedding), - android_bzl = str(Label("//tools/flutter:android.bzl")), - recipe_bzl = str(Label("//tools/flutter:recipe.bzl")), + android_bzl = str(Label("//flutter:defs.bzl")), + recipe_bzl = str(Label("//flutter:defs.bzl")), ndk_source_properties = str(Label("@androidndk_cmake//:ndk_source_properties")), ) diff --git a/tools/flutter/pubspec.bzl b/flutter/private/pubspec.bzl similarity index 96% rename from tools/flutter/pubspec.bzl rename to flutter/private/pubspec.bzl index 57d7818..69a5490 100644 --- a/tools/flutter/pubspec.bzl +++ b/flutter/private/pubspec.bzl @@ -70,7 +70,7 @@ _flutter_pubspec = rule( doc = "The app's pubspec.yaml.", ), "_reader": attr.label( - default = "//tools/flutter:read_pubspec.py", + default = "//flutter/private:read_pubspec.py", allow_single_file = True, ), }, @@ -92,7 +92,7 @@ def flutter_pubspec(name = "pubspec", src = "pubspec.yaml", **kwargs): The defaults live here rather than on the rule's attribute deliberately. A label default on a rule resolves in the package that *defines* the rule, so - `src = "pubspec.yaml"` there means `//tools/flutter:pubspec.yaml` for every + `src = "pubspec.yaml"` there means `//flutter/private:pubspec.yaml` for every consumer. A macro expands in the caller's package, where the same string means what a reader expects. diff --git a/tools/flutter/read_pubspec.py b/flutter/private/read_pubspec.py similarity index 100% rename from tools/flutter/read_pubspec.py rename to flutter/private/read_pubspec.py diff --git a/tools/flutter/recipe.bzl b/flutter/private/recipe.bzl similarity index 99% rename from tools/flutter/recipe.bzl rename to flutter/private/recipe.bzl index d893070..60eb52f 100644 --- a/tools/flutter/recipe.bzl +++ b/flutter/private/recipe.bzl @@ -3,7 +3,7 @@ A *recipe* is a Starlark macro, written in the consuming project, that builds one pub package the generated rules cannot describe -- a package whose native half is downloaded rather than compiled, or that ships a Dart build hook instead of an -Android module. `//tools/flutter:plugins.bzl` generates a BUILD file that loads +Android module. `//flutter/private:plugins.bzl` generates a BUILD file that loads the macro by canonical label and calls it; everything the macro then does happens in the *user's* repo mapping, so a recipe can use rulesets this module has never heard of. See docs_internal/package-recipes.md. diff --git a/tools/flutter/repo.bzl b/flutter/private/repo.bzl similarity index 100% rename from tools/flutter/repo.bzl rename to flutter/private/repo.bzl diff --git a/tools/flutter/defs.bzl b/flutter/private/rules.bzl similarity index 98% rename from tools/flutter/defs.bzl rename to flutter/private/rules.bzl index ad0bb0e..8bf123a 100644 --- a/tools/flutter/defs.bzl +++ b/flutter/private/rules.bzl @@ -361,9 +361,9 @@ half of the input set that is not declared file-by-file.""", allow_files = True, ), "_mode": attr.label( - default = "//tools/flutter:mode", + default = "//flutter:mode", providers = [BuildSettingInfo], - doc = """Build mode, read from //tools/flutter:mode. Governs both + doc = """Build mode, read from //flutter:mode. Governs both compiler flags and cache policy. Release output is stripped of absolute paths by gen_snapshot, so it is safe to @@ -442,7 +442,7 @@ dart_aot_elf = rule( executable = True, cfg = "exec", allow_single_file = True, - doc = "The ABI's gen_snapshot; see //tools/flutter:abis.bzl.", + doc = "The ABI's gen_snapshot from the ABI table.", ), "snapshot_flags": attr.string_list( doc = """Extra gen_snapshot flags for this ABI. @@ -459,7 +459,7 @@ def flutter_aot_library(name, srcs, abis, pubspec, entrypoint, package_config, p Produces an AOT-shaped `.dill` and its `libapp.so` per ABI. `dart_kernel`'s `--aot`/`--tfa` branch is what gen_snapshot needs; it is selected by the - ambient `//tools/flutter:mode`, not pinned here. Under `mode=debug` this + ambient `//flutter:mode`, not pinned here. Under `mode=debug` this target's kernel compiles without them, so each `dart_aot_elf` here is `target_compatible_with` only the modes `AOT_MODES` lists -- an explicit debug build, or a `//...` sweep under debug, reports incompatibility @@ -608,7 +608,7 @@ def flutter_app( | `:guards_test` | the guards, under `bazel test` | `:app_` and `:assets` compile to their debug shape under - `--@rules_flutter//tools/flutter:mode=debug`; see + `--@rules_flutter//flutter:mode=debug`; see docs_internal/build-modes-plan.md. The names are fixed rather than derived from a `name` parameter: the Android @@ -964,7 +964,7 @@ architecture. The manifests are merged and everything else is compared, so a bundle that started varying by architecture fails here rather than shipping.""", ), "_android_sdk": attr.label( - default = "//tools/flutter:_android_sdk_marker", + default = "//flutter/private:_android_sdk_marker", allow_single_file = True, cfg = "exec", ), @@ -973,11 +973,11 @@ bundle that started varying by architecture fails here rather than shipping.""", allow_single_file = True, ), "_merger": attr.label( - default = "//tools/flutter:merge_native_assets.py", + default = "//flutter/private:merge_native_assets.py", allow_single_file = True, ), "_mode": attr.label( - default = "//tools/flutter:mode", + default = "//flutter:mode", providers = [BuildSettingInfo], doc = "See dart_kernel._mode. Debug bundles ship kernel_blob.bin.", ), @@ -1026,7 +1026,7 @@ target from CI, or wire it into a test suite, before enabling a shared cache.""" "pubspec_lock": attr.label(allow_single_file = True, mandatory = True), "path_deps": attr.label_list(allow_files = True), "_checker": attr.label( - default = "//tools/flutter:check_path_deps.py", + default = "//flutter/private:check_path_deps.py", allow_single_file = True, ), }, diff --git a/tests/consumer/BUILD.bazel b/tests/consumer/BUILD.bazel index 645d911..4e2ccc9 100644 --- a/tests/consumer/BUILD.bazel +++ b/tests/consumer/BUILD.bazel @@ -1,16 +1,28 @@ -"""Every public symbol, instantiated the way a consumer would. +"""The supported BUILD API for a Consumer Module. -This is an API test, not a behaviour test. +All supported symbols load from @rules_flutter//flutter:defs.bzl. Internal +implementation helpers are exercised indirectly through the supported macros. """ load("@bazel_skylib//rules:build_test.bzl", "build_test") -load("@rules_flutter//tools/flutter:abis.bzl", "ABIS", "aot_gen_snapshot", "aot_target_compatible_with", "plugin_repo_target") -load("@rules_flutter//tools/flutter:android.bzl", "android_native_lib_jar", "flutter_android_binary", "flutter_android_libs", "flutter_assets_dir", "jni_lib_jar", "strip_native_libs") -load("@rules_flutter//tools/flutter:bundle.bzl", "CLASSES", "NATIVE_LIB", "flutter_bundle_contribution") -load("@rules_flutter//tools/flutter:defs.bzl", "dart_aot_elf", "dart_kernel", "flutter_aot_library", "flutter_assets", "pub_path_deps_check", "pub_plugins_check") -load("@rules_flutter//tools/flutter:embedding.bzl", "flutter_embedding_library") -load("@rules_flutter//tools/flutter:pubspec.bzl", "flutter_pubspec") -load("@rules_flutter//tools/flutter:recipe.bzl", "flutter_native_contribution", "flutter_native_libs") +load( + "@rules_flutter//flutter:defs.bzl", + "ABIS", + "android_native_lib_jar", + "dart_kernel", + "flutter_android_binary", + "flutter_android_libs", + "flutter_aot_library", + "flutter_assets", + "flutter_embedding_library", + "flutter_native_contribution", + "flutter_native_libs", + "flutter_pubspec", + "jni_lib_jar", + "pub_path_deps_check", + "pub_plugins_check", + "strip_native_libs", +) load("@rules_java//java:defs.bzl", "java_import") load(":assertions.bzl", "expect_equal", "expect_label_equal") @@ -46,26 +58,6 @@ dart_kernel( target_os = "ios", ) -dart_aot_elf( - name = "aot", - dill = ":kernel", - gen_snapshot = aot_gen_snapshot("arm64-v8a"), - snapshot_flags = ABIS["arm64-v8a"].snapshot_flags, - strip = True, - target_compatible_with = aot_target_compatible_with(), -) - -# The ABI carrying gen_snapshot flags. Named so a table entry losing them is an -# analysis-visible change here rather than a silent one in a snapshot. -dart_aot_elf( - name = "aot_armv7", - dill = ":kernel", - gen_snapshot = aot_gen_snapshot("armeabi-v7a"), - snapshot_flags = ABIS["armeabi-v7a"].snapshot_flags, - strip = True, - target_compatible_with = aot_target_compatible_with(), -) - expect_equal( ABIS["armeabi-v7a"].snapshot_flags, [ @@ -269,15 +261,6 @@ java_import( jars = ["fixtures/fake_native_libs.jar"], ) -# Asserted rather than merely called: a silently wrong prefix is the failure it -# exists to prevent, and this module's assets target sits in the root package, -# the case with no separator. -expect_equal( - flutter_assets_dir(assets = ":assets"), - "assets", - "flutter_assets_dir(':assets')", -) - # Two ABIs, so the per-ABI shape is exercised rather than degenerating to one # entry, and `aot` is the real flutter_aot_library above -- the join derives # `_` from it, and a rename breaks that. @@ -312,34 +295,6 @@ flutter_android_libs( registrant = ":fake_registrant", ) -# The contribution rule on its own, in all three forms: slice-keyed, not, and -# the `empty = True` one VI.2 names as the first thing a non-Android platform -# needs. -flutter_bundle_contribution( - name = "contribution", - srcs = ["fixtures/libfake.so"], - kind = "aot_library", - location = NATIVE_LIB, -) - -flutter_bundle_contribution( - name = "contribution_sliced", - kind = "recipe_libraries", - libraries = { - "arm64-v8a": "fixtures/libfake.so", - "x86_64": "fixtures/libfake.so", - }, - location = NATIVE_LIB, -) - -flutter_bundle_contribution( - name = "contribution_empty", - srcs = [], - empty = True, - kind = "runtime_classes", - location = CLASSES, -) - # The macro on top of the join: it emits `` plus `_`, so a # consumer's APK targets are named by it and a rename here is a rename in their # CI scripts. Two ABIs, because the per-ABI variants only exist above one. @@ -539,7 +494,7 @@ build_test( "@flutter_plugins//fake_plugin:fake_plugin", # A Kotlin-only plugin leaves this per-ABI native aggregate empty. It # must still provide JavaInfo through an empty `java_library`. - "@flutter_plugins//:" + plugin_repo_target("plugin_native_libraries", "arm64-v8a"), + "@flutter_plugins//:plugin_libs_arm64-v8a", ], ) @@ -547,8 +502,8 @@ build_test( alias( name = "embedding_mode_hazard_expected", actual = select({ - "@rules_flutter//tools/flutter:mode_debug": "@flutter_embedding_debug//jar:file", - "@rules_flutter//tools/flutter:mode_release": "@flutter_embedding_release//jar:file", + "@rules_flutter//flutter:mode_debug": "@flutter_embedding_debug//jar:file", + "@rules_flutter//flutter:mode_release": "@flutter_embedding_release//jar:file", }), ) @@ -563,7 +518,7 @@ genrule( if ! cmp -s "$(location :flutter_embedding_no_plugins)" "$(location :embedding_mode_hazard_expected)"; then echo "flutter_embedding_no_plugins is not this configuration's embedding" >&2 echo "jar. embedding.bzl's jars select() resolved a select() key against" >&2 - echo "the decoy //tools/flutter package instead of @rules_flutter's --" >&2 + echo "this module's decoy package instead of @rules_flutter's --" >&2 echo "see the comment above." >&2 exit 1 fi diff --git a/tests/consumer/MODULE.bazel b/tests/consumer/MODULE.bazel index 1783067..44bed83 100644 --- a/tests/consumer/MODULE.bazel +++ b/tests/consumer/MODULE.bazel @@ -3,11 +3,11 @@ module( version = "0.0.1", ) -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") bazel_dep(name = "bazel_skylib", version = "1.8.2") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../..", ) diff --git a/tests/consumer/MODULE.bazel.lock b/tests/consumer/MODULE.bazel.lock index cc82499..89adb6e 100644 --- a/tests/consumer/MODULE.bazel.lock +++ b/tests/consumer/MODULE.bazel.lock @@ -343,7 +343,7 @@ "@@rules_android+//rules/android_sdk_repository:rule.bzl%android_sdk_repository_extension": { "general": { "bzlTransitiveDigest": "qHbR00gVzVzkxX+PRtv4UGcUFMtBz7TK9CNYUWH8nIE=", - "usagesDigest": "EBTlApq2vn2qBVYyrQpE1ObMDJqcsofNBXA5ZVvrCtc=", + "usagesDigest": "eon/ZjFgLE5Z2qus2sZIRse3i+eWwptUynOoaT/YHVM=", "recordedInputs": [], "generatedRepoSpecs": { "androidsdk": { @@ -357,146 +357,6 @@ } } }, - "@@rules_flutter+//tools/flutter:ndk.bzl%android_ndk": { - "general": { - "bzlTransitiveDigest": "wubp2T1WtFjfb9+kfYhB63NRFwpD0mXcOWF3daEO03c=", - "usagesDigest": "VgPFahqiPOAwdw8uHVx97I5/V22McbFAswM4YyAHig0=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,rules_android_ndk rules_android_ndk+" - ], - "generatedRepoSpecs": { - "androidndk": { - "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", - "attributes": {} - }, - "androidndk_cmake": { - "repoRuleId": "@@rules_flutter+//tools/flutter:ndk.bzl%_androidndk_cmake_repository", - "attributes": {} - } - } - } - }, - "@@rules_flutter+//tools/flutter:plugins.bzl%flutter_plugins_ext": { - "general": { - "bzlTransitiveDigest": "tQNMt955Aw9GgNkaaslFjOQlTt/8uwsvu2YmduiXfjg=", - "usagesDigest": "MM5qL4l0rXCX1ki2Bk8iDaeEbFfREdpk3KGY5JkftEE=", - "recordedInputs": [ - "REPO_MAPPING:,fake_plugin_metadata +fake_plugin_metadata+fake_plugin_metadata", - "REPO_MAPPING:,plugin_maven rules_jvm_external++maven+plugin_maven", - "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", - "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", - "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", - "REPO_MAPPING:protobuf+,rules_java rules_java+", - "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", - "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", - "REPO_MAPPING:rules_cc+,platforms platforms", - "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", - "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+", - "REPO_MAPPING:rules_flutter+,rules_java rules_java+", - "REPO_MAPPING:rules_java+,bazel_features bazel_features+", - "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", - "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", - "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", - "REPO_MAPPING:rules_java+,rules_cc rules_cc+", - "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", - "REPO_MAPPING:rules_flutter+,androidndk_cmake rules_flutter++android_ndk+androidndk_cmake" - ], - "generatedRepoSpecs": { - "flutter_plugins": { - "repoRuleId": "@@rules_flutter+//tools/flutter:plugins.bzl%flutter_plugins", - "attributes": { - "abis": [ - "arm64-v8a" - ], - "metadata": "@@+fake_plugin_metadata+fake_plugin_metadata//:.flutter-plugins-dependencies", - "package_config": "@@+fake_plugin_metadata+fake_plugin_metadata//:package_config.json", - "coursier_options": [], - "extra_artifacts": [], - "maven_resolver": "coursier", - "maven_lock_file": "", - "maven_repo": "'@@rules_jvm_external++maven+plugin_maven'", - "overrides": {}, - "recipes": { - "absent_package": "{\"bzl\":\"@@external_app+//:absent_package.bzl\",\"macro\":\"absent_package_recipe\",\"root\":false}" - }, - "embedding": "'@@//:flutter_embedding_no_plugins'", - "android_bzl": "'@@rules_flutter+//tools/flutter:android.bzl'", - "recipe_bzl": "'@@rules_flutter+//tools/flutter:recipe.bzl'", - "ndk_source_properties": "'@@rules_flutter++android_ndk+androidndk_cmake//:ndk_source_properties'" - } - } - } - } - }, - "@@rules_flutter+//tools/flutter:repo.bzl%flutter": { - "general": { - "bzlTransitiveDigest": "xF3NHN89e0wpLlITfvPlzlq4YYs2Cm7XkvAn18uvo1k=", - "usagesDigest": "rtIpk0P/vW/ZU9NOnSaYkKHj/l5HTkcglhORumjwxjI=", - "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,bazel_tools bazel_tools", - "REPO_MAPPING:rules_flutter+,platforms platforms", - "REPO_MAPPING:rules_flutter+,rules_android rules_android+" - ], - "generatedRepoSpecs": { - "flutter_sdk": { - "repoRuleId": "@@rules_flutter+//tools/flutter:repo.bzl%flutter_sdk", - "attributes": {} - }, - "flutter_embedding_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_embedding_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_arm64_v8a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_x86_64_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_release": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - }, - "flutter_engine_armeabi_v7a_debug": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", - "attributes": { - "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" - } - } - } - } - }, "@@rules_python+//python/extensions:config.bzl%config": { "general": { "bzlTransitiveDigest": "dzD8Q2YmrP3fz8saWLHPmlwPLO91ImtTmP/c9JKTStM=", @@ -694,6 +554,167 @@ } } } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%android_ndk": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "CE2Z/tOTJqwioicux0yXg4nzWLIvZDfcM/KtRNy1Og4=", + "recordedInputs": [ + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+" + ], + "generatedRepoSpecs": { + "androidndk": { + "repoRuleId": "@@rules_android_ndk+//:rules.bzl%android_ndk_repository", + "attributes": {} + }, + "androidndk_cmake": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:ndk.bzl%_androidndk_cmake_repository", + "attributes": {} + } + } + } + }, + "@@sameri11_rules_flutter+//flutter:extensions.bzl%flutter_plugins_ext": { + "general": { + "bzlTransitiveDigest": "ZJKKDZwqEchXeR0Vc2+H8meCWFRAv/62JcM4MQ6CVKQ=", + "usagesDigest": "Ledc+BavJyeReHRqHvz5/Wcm+5OIAQF8UJuGmSbzKpI=", + "recordedInputs": [ + "REPO_MAPPING:,fake_plugin_metadata +fake_plugin_metadata+fake_plugin_metadata", + "REPO_MAPPING:,plugin_maven rules_jvm_external++maven+plugin_maven", + "REPO_MAPPING:bazel_features+,bazel_features_globals bazel_features++version_extension+bazel_features_globals", + "REPO_MAPPING:bazel_features+,bazel_features_version bazel_features++version_extension+bazel_features_version", + "REPO_MAPPING:protobuf+,proto_bazel_features bazel_features+", + "REPO_MAPPING:protobuf+,rules_java rules_java+", + "REPO_MAPPING:rules_cc+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_cc+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_cc+,cc_compatibility_proxy rules_cc++compatibility_proxy+cc_compatibility_proxy", + "REPO_MAPPING:rules_cc+,platforms platforms", + "REPO_MAPPING:rules_cc+,rules_cc rules_cc+", + "REPO_MAPPING:rules_cc++compatibility_proxy+cc_compatibility_proxy,rules_cc rules_cc+", + "REPO_MAPPING:rules_java+,bazel_features bazel_features+", + "REPO_MAPPING:rules_java+,bazel_skylib bazel_skylib+", + "REPO_MAPPING:rules_java+,bazel_tools bazel_tools", + "REPO_MAPPING:rules_java+,com_google_protobuf protobuf+", + "REPO_MAPPING:rules_java+,compatibility_proxy rules_java++compatibility_proxy+compatibility_proxy", + "REPO_MAPPING:rules_java+,rules_cc rules_cc+", + "REPO_MAPPING:rules_java++compatibility_proxy+compatibility_proxy,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_java rules_java+", + "REPO_MAPPING:sameri11_rules_flutter+,androidndk_cmake sameri11_rules_flutter++android_ndk+androidndk_cmake" + ], + "generatedRepoSpecs": { + "flutter_plugins": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:plugins.bzl%flutter_plugins", + "attributes": { + "abis": [ + "arm64-v8a" + ], + "metadata": "@@+fake_plugin_metadata+fake_plugin_metadata//:.flutter-plugins-dependencies", + "package_config": "@@+fake_plugin_metadata+fake_plugin_metadata//:package_config.json", + "coursier_options": [], + "extra_artifacts": [], + "maven_resolver": "coursier", + "maven_lock_file": "", + "maven_repo": "'@@rules_jvm_external++maven+plugin_maven'", + "overrides": {}, + "recipes": { + "absent_package": "{\"bzl\":\"@@external_app+//:absent_package.bzl\",\"macro\":\"absent_package_recipe\",\"root\":false}" + }, + "embedding": "'@@//:flutter_embedding_no_plugins'", + "android_bzl": "'@@sameri11_rules_flutter+//flutter:defs.bzl'", + "recipe_bzl": "'@@sameri11_rules_flutter+//flutter:defs.bzl'", + "ndk_source_properties": "'@@sameri11_rules_flutter++android_ndk+androidndk_cmake//:ndk_source_properties'" + } + } + } + } + }, + "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter": { + "general": { + "bzlTransitiveDigest": "d0akA1llff6BLmlVnXIvFQO70c00GoPx6Qps3UswgoY=", + "usagesDigest": "Sk6Cc5WB7WvuCu4kD4WBlrApj6MiqRVWqpOdLMQHtd0=", + "recordedInputs": [ + "REPO_MAPPING:sameri11_rules_flutter+,bazel_tools bazel_tools", + "REPO_MAPPING:sameri11_rules_flutter+,platforms platforms", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android rules_android+" + ], + "generatedRepoSpecs": { + "flutter_sdk": { + "repoRuleId": "@@sameri11_rules_flutter+//flutter/private:repo.bzl%flutter_sdk", + "attributes": {} + }, + "flutter_embedding_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_embedding_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/flutter_embedding_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_arm64_v8a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/arm64_v8a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_x86_64_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/x86_64_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_release": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_release/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_release-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + }, + "flutter_engine_armeabi_v7a_debug": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_jar", + "attributes": { + "url": "https://storage.googleapis.com/download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-77e2e94772b6eb43759e34ed1ad7da4674e19cab/armeabi_v7a_debug-1.0.0-04efd7c093d4e9281d5526ebcad6ecc60ba8badf.jar" + } + } + } + } } }, "facts": { diff --git a/tests/consumer/README.md b/tests/consumer/README.md index 2ffdeb9..494f267 100644 --- a/tests/consumer/README.md +++ b/tests/consumer/README.md @@ -58,17 +58,16 @@ Bazel would descend in and evaluate these packages as *root* packages, where ## What it covers -Loading and analysis — `--nobuild` — of every public symbol, plus focused -behavior checks: +Loading and analysis — `--nobuild` — of every supported BUILD symbol through +`@rules_flutter//flutter:defs.bzl`, plus focused behavior checks: -| file | symbols | +| entry point | symbols | | --- | --- | -| `defs.bzl` | `dart_kernel`, `dart_aot_elf`, `flutter_aot_library`, `flutter_assets`, `pub_path_deps_check`, `pub_plugins_check`, `flutter_app` | -| `android.bzl` | `jni_lib_jar`, `android_native_lib_jar`, `strip_native_libs` | -| `bundle.bzl` | `flutter_bundle_contribution` (all three forms: `srcs`, slice-keyed `libraries`, `empty`), the location constants | -| `android.bzl` (join) | `flutter_android_libs` over **two** ABIs, and `flutter_android_binary` on top of it — the entry point that names a consumer's APK targets; `:apk_external_app` drives that high-level API from an external module through a real bundle and signed APK | -| `recipe.bzl` | `flutter_native_contribution` (both the populated and `empty = True` forms), `flutter_native_libs` | -| `plugins.bzl` | `flutter_plugins_ext` (`plugins.project()`/`plugins.package()`) over a real, checked-in external plugin graph — `:fake_plugin_deps_check`, `:fake_plugin_test` | +| `defs.bzl` | `ABIS`, `dart_kernel`, `flutter_aot_library`, `flutter_assets`, `pub_path_deps_check`, `pub_plugins_check`, `flutter_app`, `jni_lib_jar`, `android_native_lib_jar`, `strip_native_libs`, `flutter_android_libs`, `flutter_android_binary`, `flutter_embedding_library`, `flutter_native_contribution`, `flutter_native_libs`, `flutter_pubspec` | +| `extensions.bzl` | `flutter_plugins_ext` (`plugins.project()`/`plugins.package()`) over a real, checked-in external plugin graph — `:fake_plugin_deps_check`, `:fake_plugin_test` | + +Implementation-only rules and helpers are covered indirectly by these supported +macros; this Consumer Module does not load specialist implementation files. That catches the two things a refactor of these rules actually breaks: a symbol moving between files (load phase) and an attribute renamed, removed or made diff --git a/tests/consumer/android/config.MODULE.bazel b/tests/consumer/android/config.MODULE.bazel index f2ec380..06953c0 100644 --- a/tests/consumer/android/config.MODULE.bazel +++ b/tests/consumer/android/config.MODULE.bazel @@ -62,7 +62,7 @@ local_path_override( path = "external_app", ) -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") @@ -74,7 +74,7 @@ fake_plugin_metadata( marker = "//:fixtures/fake_plugin/pubspec.yaml", ) -plugins = use_extension("@rules_flutter//tools/flutter:plugins.bzl", "flutter_plugins_ext") +plugins = use_extension("@rules_flutter//flutter:extensions.bzl", "flutter_plugins_ext") plugins.project( abis = ["arm64-v8a"], embedding = "//:flutter_embedding_no_plugins", @@ -84,5 +84,8 @@ plugins.project( ) use_repo(plugins, "flutter_plugins") -flutter = use_extension("@rules_flutter//tools/flutter:repo.bzl", "flutter") -use_repo(flutter, "flutter_embedding_debug", "flutter_embedding_release", "flutter_sdk") +# The private SDK/engine extension is direct fixture-only internal coverage for +# explicit embedding debug/release labels. It lives with the implementation +# under //flutter/private and is intentionally absent from extensions.bzl. +flutter = use_extension("@rules_flutter//flutter/private:repo.bzl", "flutter") +use_repo(flutter, "flutter_embedding_debug", "flutter_embedding_release") diff --git a/tests/consumer/external_app/MODULE.bazel b/tests/consumer/external_app/MODULE.bazel index 6058474..616a6f9 100644 --- a/tests/consumer/external_app/MODULE.bazel +++ b/tests/consumer/external_app/MODULE.bazel @@ -3,10 +3,10 @@ module( version = "0.0.1", ) -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") # Report and ignore unmatched dependency recipes. -plugins = use_extension("@rules_flutter//tools/flutter:plugins.bzl", "flutter_plugins_ext") +plugins = use_extension("@rules_flutter//flutter:extensions.bzl", "flutter_plugins_ext") plugins.package( name = "absent_package", bzl_file = "//:absent_package.bzl", diff --git a/tests/consumer/external_app/absent_package.bzl b/tests/consumer/external_app/absent_package.bzl index 168a85f..1517643 100644 --- a/tests/consumer/external_app/absent_package.bzl +++ b/tests/consumer/external_app/absent_package.bzl @@ -5,7 +5,7 @@ depend on. `_flutter_plugins_impl` must report and discard it. The impossible symbol below turns any attempted load into a test failure. """ -load("@rules_flutter//tools/flutter:recipe.bzl", "this_symbol_does_not_exist") +load("@rules_flutter//flutter:defs.bzl", "this_symbol_does_not_exist") # Keep the alias so buildifier treats the deliberately invalid import as used. absent_package_recipe = this_symbol_does_not_exist diff --git a/tests/consumer/external_app/app/BUILD.bazel b/tests/consumer/external_app/app/BUILD.bazel index 58a5ce2..fd43baf 100644 --- a/tests/consumer/external_app/app/BUILD.bazel +++ b/tests/consumer/external_app/app/BUILD.bazel @@ -1,4 +1,4 @@ -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) diff --git a/tests/consumer/fixtures/plugin_deps.MODULE.bazel b/tests/consumer/fixtures/plugin_deps.MODULE.bazel index 6bad892..3aeb04c 100644 --- a/tests/consumer/fixtures/plugin_deps.MODULE.bazel +++ b/tests/consumer/fixtures/plugin_deps.MODULE.bazel @@ -1,7 +1,7 @@ -# Generated by @rules_flutter//tools/flutter:plugins.bzl -- do not edit by hand. +# Generated by @rules_flutter//flutter:extensions.bzl -- do not edit by hand. # # The complete Maven artifact list: the Flutter embedding's own dependencies -# (from @rules_flutter//tools/flutter:embedding.bzl) merged with the coordinates +# (from @rules_flutter//flutter:defs.bzl) merged with the coordinates # extracted from every plugin's android/build.gradle. # # Drift is detected by a `pub_plugins_check` guard over this file. A project diff --git a/tests/consumer/tools/flutter/BUILD.bazel b/tests/consumer/flutter/BUILD.bazel similarity index 83% rename from tests/consumer/tools/flutter/BUILD.bazel rename to tests/consumer/flutter/BUILD.bazel index 24825f4..fce842a 100644 --- a/tests/consumer/tools/flutter/BUILD.bazel +++ b/tests/consumer/flutter/BUILD.bazel @@ -1,14 +1,14 @@ -# A colliding package -- this module has no reason to own `tools/flutter`, +# A colliding package -- this module has no reason to own `flutter`, # and that is the point. `select()` keys written as bare strings inside a # macro resolve in the *caller's* repo mapping, not the defining module's # (docs_internal/build-modes-plan.md P2). Every real select() in -# `@rules_flutter`'s macros uses `Label("//tools/flutter:mode_debug")` +# `@rules_flutter`'s macros use `Label("//flutter:mode_debug")` # precisely so this package is never consulted; its only job is to make a # regression to a bare `":mode_debug"` observable instead of silent. # # The trap: `mode_debug` here matches under this module's *default* test # invocation (`--compilation_mode=fastbuild`, unset by every target below), -# while the real `//tools/flutter:mode` defaults to "release". A bare-string +# while the real `//flutter:mode` defaults to "release". A bare-string # select() would therefore flip to the debug branch under an ordinary # release build -- dropping the `aot_library` contribution while # `flutter_bundle_check`'s own `_mode` (a rule attribute, resolved against diff --git a/tests/consumer/standard_layout/BUILD.bazel b/tests/consumer/standard_layout/BUILD.bazel index f2feebf..4b774a0 100644 --- a/tests/consumer/standard_layout/BUILD.bazel +++ b/tests/consumer/standard_layout/BUILD.bazel @@ -13,7 +13,7 @@ # package pairs that with `plugins = None`, proving the complete shape creates no # @flutter_plugins label and defaults to no federated Dart registrant. -load("@rules_flutter//tools/flutter:defs.bzl", "flutter_app") +load("@rules_flutter//flutter:defs.bzl", "flutter_app") package(default_visibility = ["//visibility:public"]) diff --git a/tests/core_consumer/MODULE.bazel b/tests/core_consumer/MODULE.bazel index 2c5cfd4..8809683 100644 --- a/tests/core_consumer/MODULE.bazel +++ b/tests/core_consumer/MODULE.bazel @@ -3,9 +3,9 @@ module( version = "0.0.1", ) -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", version = "0.1.0", repo_name = "rules_flutter") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "../..", ) diff --git a/tools/ci/BUILD.bazel b/tools/ci/BUILD.bazel index c18c0a9..8c3b69f 100644 --- a/tools/ci/BUILD.bazel +++ b/tools/ci/BUILD.bazel @@ -6,7 +6,7 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test") # comparison that stops a Flutter macro's new shape escaping the hash gate. # # A genrule rather than a py_test because this repository does not depend on -# rules_python and Bazel 9 has no native py_binary (tools/flutter/defs.bzl). +# rules_python and Bazel 9 has no native py_binary (flutter/private/rules.bzl). # `python3` is taken from the environment, which is the same assumption the # packaging genrules in tests/consumer make of `unzip` and `cmp`. genrule( @@ -43,11 +43,11 @@ genrule( name = "key_portability_check", srcs = [ "key_portability_test.py", - "//tools/flutter:repo.bzl", - "//tools/flutter:defs.bzl", - "//tools/flutter:android.bzl", - "//tools/flutter:plugins.bzl", - "//tools/flutter:ndk.bzl", + "//flutter/private:repo.bzl", + "//flutter/private:rules.bzl", + "//flutter/private:android.bzl", + "//flutter/private:plugins.bzl", + "//flutter/private:ndk.bzl", ], outs = ["key_portability_check.checked"], cmd = """set -euo pipefail diff --git a/tools/ci/android_toolchain_probe.py b/tools/ci/android_toolchain_probe.py index a82bb18..a4b5ce1 100755 --- a/tools/ci/android_toolchain_probe.py +++ b/tools/ci/android_toolchain_probe.py @@ -380,9 +380,9 @@ def run_missing_ndk(workspace, output_base): version = "0.0.1", ) -bazel_dep(name = "rules_flutter", version = "0.1.0") +bazel_dep(name = "sameri11_rules_flutter", repo_name = "rules_flutter", version = "0.1.0") local_path_override( - module_name = "rules_flutter", + module_name = "sameri11_rules_flutter", path = "{ruleset}", ) @@ -403,7 +403,7 @@ def run_missing_ndk(workspace, output_base): use_repo(android_sdk, "androidsdk") register_toolchains("@androidsdk//:all") -android_ndk = use_extension("@rules_flutter//tools/flutter:ndk.bzl", "android_ndk") +android_ndk = use_extension("@rules_flutter//flutter:extensions.bzl", "android_ndk") use_repo(android_ndk, "androidndk", "androidndk_cmake") register_toolchains("@androidndk//:all") """ diff --git a/tools/ci/assertions.bzl b/tools/ci/assertions.bzl new file mode 100644 index 0000000..011f94b --- /dev/null +++ b/tools/ci/assertions.bzl @@ -0,0 +1,11 @@ +"""Assertions for values a rule computes at loading time. + +A BUILD file cannot use `if`, and a bare `x == y or fail(...)` is an expression +statement buildifier rejects, so equality checks go through here. Maintainer +tooling only: nothing a Consumer Module loads reaches this file. +""" + +def expect_equal(actual, expected, what): + """Fails the load if `actual` differs from `expected`.""" + if actual != expected: + fail("{}: got {}, expected {}".format(what, actual, expected)) diff --git a/tools/ci/committed_lock_guard.py b/tools/ci/committed_lock_guard.py index edc7c99..2096db1 100755 --- a/tools/ci/committed_lock_guard.py +++ b/tools/ci/committed_lock_guard.py @@ -67,10 +67,10 @@ def _selftest(): clean = json.dumps( { "moduleExtensions": { - "//tools/flutter:ndk.bzl%android_ndk": { + "//flutter:extensions.bzl%android_ndk": { "general": { "recordedInputs": [ - "REPO_MAPPING:rules_flutter+,rules_android_ndk rules_android_ndk+", + "REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+", ], "generatedRepoSpecs": { "androidndk": { @@ -87,7 +87,7 @@ def _selftest(): raise SystemExit("FAIL: selftest rejected a portable lock") captured = clean.replace( - '"REPO_MAPPING:rules_flutter+,rules_android_ndk rules_android_ndk+"', + '"REPO_MAPPING:sameri11_rules_flutter+,rules_android_ndk rules_android_ndk+"', '"ENV:ANDROID_NDK_HOME /Users/someone/Library/Android/sdk/ndk/28.2.13676358"', ) findings = check_lock("captured", captured) diff --git a/tools/ci/example_hashes.py b/tools/ci/example_hashes.py index b3f26f6..0cdbde7 100755 --- a/tools/ci/example_hashes.py +++ b/tools/ci/example_hashes.py @@ -291,7 +291,7 @@ def selftest() -> int: from `EXAMPLES`. A self-check rather than a py_test: this repository does not depend on - rules_python and Bazel 9 has no native py_binary (tools/flutter/defs.bzl). + rules_python and Bazel 9 has no native py_binary (flutter/private/rules.bzl). """ first = EXAMPLES[0][0] a0, a1 = EXAMPLES[0][2][0], EXAMPLES[0][2][1] diff --git a/tools/ci/key_portability_test.py b/tools/ci/key_portability_test.py index 76445fb..3831570 100755 --- a/tools/ci/key_portability_test.py +++ b/tools/ci/key_portability_test.py @@ -9,11 +9,11 @@ FILES = { - "repo": "tools/flutter/repo.bzl", - "defs": "tools/flutter/defs.bzl", - "android": "tools/flutter/android.bzl", - "plugins": "tools/flutter/plugins.bzl", - "ndk": "tools/flutter/ndk.bzl", + "repo": "flutter/private/repo.bzl", + "defs": "flutter/private/rules.bzl", + "android": "flutter/private/android.bzl", + "plugins": "flutter/private/plugins.bzl", + "ndk": "flutter/private/ndk.bzl", } @@ -181,7 +181,7 @@ def check_c(self): return function = _function(tree, "_dart_kernel_impl") if function is None: - self.fail("C", "defs.bzl must define _dart_kernel_impl") + self.fail("C", "{} must define _dart_kernel_impl".format(FILES["defs"])) return package_add = False @@ -256,7 +256,7 @@ def check_d(self): return function = _function(tree, "_flutter_assets_impl") if function is None: - self.fail("D", "defs.bzl must define _flutter_assets_impl") + self.fail("D", "{} must define _flutter_assets_impl".format(FILES["defs"])) return stage = _named_value(function, "stage_manifest_files") @@ -302,8 +302,8 @@ def check_d(self): for target, expected in ( ("_flutter", "@flutter_sdk//:flutter"), - ("_android_sdk", "//tools/flutter:_android_sdk_marker"), - ("_merger", "//tools/flutter:merge_native_assets.py"), + ("_android_sdk", "//flutter/private:_android_sdk_marker"), + ("_merger", "//flutter/private:merge_native_assets.py"), ("_sdk_version", "@flutter_sdk//:flutter.version.json"), ): if not _rule_attr_default(tree, "flutter_assets", target, expected): @@ -790,7 +790,7 @@ def _action_regions(name, tree): def main(argv=None): parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--root", type=Path, default=Path("."), help="workspace root containing tools/flutter") + parser.add_argument("--root", type=Path, default=Path("."), help="workspace root containing flutter/private") args = parser.parse_args(argv) failures = Checker(args.root).run() if failures: