[examples] Migrate examples to flutter_component.
Migrate example experiences from flutter_app to
dart_library, flutter_component, and fuchsia_app.
Change package names to kabob-case and prepare
src/session/examples/elements/BUILD.gn:7 for soft
transition.
Bug: 58062, 58701
Change-Id: Ie70baea967c37dd03166fb54a28a797b732e0340
Reviewed-on: https://fuchsia-review.googlesource.com/c/experiences/+/417414
Reviewed-by: Shai Barack <shayba@google.com>
Reviewed-by: Chase Latta <chaselatta@google.com>
Commit-Queue: Darren Chan <chandarren@google.com>
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 80c9b36..56b1bd1 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -4,9 +4,9 @@
group("examples") {
deps = [
- "hello_experiences",
- "localized_flutter",
- "spinning_cube",
+ "hello_experiences:hello-experiences",
+ "localized_flutter:localized-flutter",
+ "spinning_cube:spinning-cube",
]
}
diff --git a/examples/hello_experiences/BUILD.gn b/examples/hello_experiences/BUILD.gn
index b99f8f9..70e3b3b 100644
--- a/examples/hello_experiences/BUILD.gn
+++ b/examples/hello_experiences/BUILD.gn
@@ -2,29 +2,34 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/dart/dart_library.gni")
+import("//build/flutter/flutter_component.gni")
+import("//src/sys/build/components.gni")
import("//topaz/runtime/dart/flutter_test.gni")
-import("//topaz/runtime/flutter_runner/flutter_app.gni")
-flutter_app("hello_experiences") {
- main_dart = "lib/main.dart"
-
- meta = [
- {
- path = rebase_path("meta/hello_experiences.cmx")
- dest = "hello_experiences.cmx"
- },
- ]
-
+dart_library("lib") {
package_name = "hello_experiences"
-
- manifest = "pubspec.yaml"
-
+ sources = [ "main.dart" ]
deps = [
"//third_party/dart-pkg/git/flutter/packages/flutter",
"//topaz/public/dart/fuchsia_logger",
]
}
+flutter_component("component") {
+ component_name = "hello-experiences"
+ manifest = "meta/hello_experiences.cmx"
+ deps = [
+ ":lib"
+ ]
+}
+
+fuchsia_package("hello-experiences") {
+ deps = [
+ ":component"
+ ]
+}
+
flutter_test("hello_experiences_unittests") {
# TODO(fxb/57840): This package has transitive dependencies.
# Please explicitly define its transitive dependencies as direct dependencies then remove this exemption
diff --git a/examples/localized_flutter/BUILD.gn b/examples/localized_flutter/BUILD.gn
index 82113e1..23c9bf6 100644
--- a/examples/localized_flutter/BUILD.gn
+++ b/examples/localized_flutter/BUILD.gn
@@ -2,9 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-group("localized_flutter") {
+group("localized-flutter") {
public_deps = [
- "localized_flutter_app",
- "localized_flutter_localization",
+ "localized_flutter_app:localized-flutter-app",
+ "localized_flutter_localization:localized-flutter-localization",
]
}
diff --git a/examples/localized_flutter/localized_flutter_app/BUILD.gn b/examples/localized_flutter/localized_flutter_app/BUILD.gn
index 59d4b03..c3134dd 100644
--- a/examples/localized_flutter/localized_flutter_app/BUILD.gn
+++ b/examples/localized_flutter/localized_flutter_app/BUILD.gn
@@ -2,27 +2,39 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/dart/dart_library.gni")
+import("//build/flutter/flutter_component.gni")
+import("//src/sys/build/components.gni")
import("//topaz/runtime/dart/flutter_test.gni")
-import("//topaz/runtime/flutter_runner/flutter_app.gni")
-flutter_app("localized_flutter_app") {
- main_dart = "lib/main.dart"
+dart_library("lib") {
package_name = "localized_flutter_app"
-
- sources = []
-
+ sources = [
+ "main.dart",
+ "provider.dart",
+ "supported_locales.dart",
+ "localized_mod_localizations_delegate.dart",
+ "localized_mod_strings.dart",
+ ]
deps = [
- "//src/experiences/examples/localized_flutter/localized_flutter_localization",
+ "//src/experiences/examples/localized_flutter/localized_flutter_localization:localized-flutter-localization",
"//third_party/dart-pkg/git/flutter/packages/flutter",
"//third_party/dart-pkg/git/flutter/packages/flutter_localizations",
"//third_party/dart-pkg/pub/intl",
]
+}
- meta = [
- {
- path = rebase_path("meta/localized_flutter_app.cmx")
- dest = "localized_flutter_app.cmx"
- },
+flutter_component("component") {
+ component_name = "localized-flutter-app"
+ manifest = "meta/localized_flutter_app.cmx"
+ deps = [
+ ":lib"
+ ]
+}
+
+fuchsia_package("localized-flutter-app") {
+ deps = [
+ ":component"
]
}
diff --git a/examples/localized_flutter/localized_flutter_localization/BUILD.gn b/examples/localized_flutter/localized_flutter_localization/BUILD.gn
index 6b330ee..56dc4a4 100644
--- a/examples/localized_flutter/localized_flutter_localization/BUILD.gn
+++ b/examples/localized_flutter/localized_flutter_localization/BUILD.gn
@@ -4,7 +4,7 @@
import("//build/dart/dart_library.gni")
-dart_library("localized_flutter_localization") {
+dart_library("localized-flutter-localization") {
package_name = "localized_flutter_localization"
disable_analysis = true
diff --git a/examples/spinning_cube/BUILD.gn b/examples/spinning_cube/BUILD.gn
index 01e8e1a..f4bf37a 100644
--- a/examples/spinning_cube/BUILD.gn
+++ b/examples/spinning_cube/BUILD.gn
@@ -2,25 +2,34 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import("//topaz/runtime/flutter_runner/flutter_app.gni")
+import("//build/dart/dart_library.gni")
+import("//build/flutter/flutter_component.gni")
+import("//src/sys/build/components.gni")
-flutter_app("spinning_cube") {
- # TODO(fxb/57840): This package has transitive dependencies.
- # Please explicitly define its transitive dependencies as direct dependencies then remove this exemption
- disable_strict_deps_check = true
-
- main_dart = "lib/main.dart"
-
- manifest = "pubspec.yaml"
-
- meta = [
- {
- path = rebase_path("meta/spinning_cube.cmx")
- dest = "spinning_cube.cmx"
- },
+dart_library("lib") {
+ package_name = "spinning_cube"
+ sources = [ "main.dart", "spinning_cube_gem.dart" ]
+ deps = [
+ "//third_party/dart-pkg/git/flutter/packages/flutter",
+ "//third_party/dart-pkg/pub/vector_math",
]
+}
- sources = [ "spinning_cube_gem.dart" ]
+flutter_component("component") {
+ component_name = "spinning-cube"
+ manifest = "meta/spinning_cube.cmx"
+ deps = [
+ ":lib"
+ ]
+}
- deps = [ "//third_party/dart-pkg/git/flutter/packages/flutter" ]
+fuchsia_package("spinning-cube") {
+ deps = [
+ ":component"
+ ]
+}
+
+# @TODO(fxb/58701): For purposes of soft transition.
+group("spinning_cube") {
+ deps = [ ":spinning-cube" ]
}