Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: third_party/mojo/src/mojo/public/dart/rules.gni

Issue 1348903003: third_party/mojo: Remove python/go/dart bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/mojo/src/mojo/public/dart/rules.gni
diff --git a/third_party/mojo/src/mojo/public/dart/rules.gni b/third_party/mojo/src/mojo/public/dart/rules.gni
deleted file mode 100644
index 103b989273cb4ba025d6e6fcbfa1e87cbce81289..0000000000000000000000000000000000000000
--- a/third_party/mojo/src/mojo/public/dart/rules.gni
+++ /dev/null
@@ -1,614 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file has rules for making Dart packages and Dart-based Mojo applications.
-#
-# Entrypoint rules are:
-# - dart_pkg
-# - dartzip_package
-# - dartzip_packaged_application
-
-import("../mojo.gni")
-import("//build/module_args/mojo.gni")
-import("//build/module_args/dart.gni")
-
-template("dartx") {
- bundle_prefix = target_name
- bundle = "$target_gen_dir/${bundle_prefix}.dartx"
- snapshot = "$target_gen_dir/${bundle_prefix}_snapshot.bin"
-
- if (mojo_use_prebuilt_dart_snapshotter) {
- dart_snapshotter_path =
- rebase_path("mojo/public/tools:copy_dart_snapshotter", ".", mojo_root)
- dart_snapshotter_rule = "$dart_snapshotter_path($host_toolchain)"
- } else {
- dart_snapshotter_rule = dart_snapshotter_bin
- }
- dart_snapshotter_dir =
- get_label_info("$dart_snapshotter_rule", "root_out_dir")
- dart_snapshotter = "$dart_snapshotter_dir/dart_snapshotter"
-
- action("gen_${bundle_prefix}_snapshot") {
- main_dart = invoker.main_dart
-
- inputs = [
- dart_snapshotter,
- main_dart,
- ]
- outputs = [
- snapshot,
- ]
-
- if (defined(invoker.sources)) {
- inputs += invoker.sources
- }
-
- script =
- rebase_path("mojo/public/tools/dart_snapshotter.py", ".", mojo_sdk_root)
-
- args = [
- rebase_path(dart_snapshotter),
- rebase_path(main_dart),
- "--package-root",
- rebase_path("$root_gen_dir/dart-pkg/packages"),
- "--snapshot",
- rebase_path(snapshot),
- ]
-
- deps = [
- dart_snapshotter_rule,
- ]
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
- }
-
- action("gen_${bundle_prefix}_bundle") {
- sources = [
- rebase_path("mojo/public/tools/dartx.py", ".", mojo_sdk_root),
- snapshot,
- ]
-
- outputs = [
- bundle,
- ]
-
- script = rebase_path("mojo/public/tools/dartx.py", ".", mojo_sdk_root)
- args = [
- "--snapshot",
- rebase_path(snapshot),
- "--output",
- rebase_path(bundle),
- ]
-
- deps = [
- ":gen_${bundle_prefix}_snapshot",
- ]
- }
-
- group(target_name) {
- deps = [
- ":gen_${bundle_prefix}_bundle",
- ]
- }
-}
-
-template("dartx_application") {
- dartx_name = "${target_name}_dartx"
-
- dartx(dartx_name) {
- main_dart = invoker.main_dart
- if (defined(invoker.sources)) {
- sources = invoker.sources
- }
- if (defined(invoker.deps)) {
- deps = invoker.deps
- }
- }
-
- if (defined(invoker.output_name)) {
- mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
- } else {
- mojo_output = "$root_out_dir/" + target_name + ".mojo"
- }
-
- action(target_name) {
- script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_sdk_root)
-
- input = "$target_gen_dir/${dartx_name}.dartx"
- inputs = [
- input,
- ]
-
- output = mojo_output
- outputs = [
- output,
- ]
-
- deps = [
- ":$dartx_name",
- ]
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
-
- line = "#!mojo mojo:dart_content_handler"
- if (is_debug || (defined(invoker.strict) && invoker.strict == true)) {
- line = "#!mojo mojo:dart_content_handler?strict=true"
- }
-
- rebase_input = rebase_path(input, root_build_dir)
- rebase_output = rebase_path(output, root_build_dir)
- args = [
- "--input=$rebase_input",
- "--output=$rebase_output",
- "--line=$line",
- ]
- }
-}
-
-template("dart_pkg_helper") {
- assert(defined(invoker.package_name))
- package_name = invoker.package_name
- pkg_directory = rebase_path("$root_gen_dir/dart-pkg")
- package_root = rebase_path("$root_gen_dir/dart-pkg/packages")
- stamp_file = "$root_gen_dir/dart-pkg/${package_name}.stamp"
-
- assert(defined(invoker.sources) || defined(invoker.apps) ||
- defined(invoker.libs) || defined(invoker.pkg_dir))
-
- action(target_name) {
- deps = []
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
-
- datadeps = []
- if (defined(invoker.datadeps)) {
- datadeps += invoker.datadeps
- }
-
- list_mojoms_script =
- rebase_path("mojo/public/tools/dart_list_mojoms.py", ".", mojo_sdk_root)
- mojom_sources = []
- foreach(d, deps) {
- root_prefix = rebase_path(".", "", mojo_sdk_root)
- source_directory = rebase_path(get_label_info(d, "dir"))
- mojom_sources += exec_script(list_mojoms_script,
- [
- source_directory,
- root_prefix,
- ],
- "list lines")
- }
-
- sdk_ext_directory = []
- if (defined(invoker.sdk_ext_directory)) {
- sdk_ext_directory += [ invoker.sdk_ext_directory ]
- }
-
- sdk_ext_files = []
- if (defined(invoker.sdk_ext_files)) {
- sdk_ext_files += invoker.sdk_ext_files
- }
-
- sdk_ext_mappings = []
- if (defined(invoker.sdk_ext_mappings)) {
- sdk_ext_mappings += invoker.sdk_ext_mappings
- }
-
- script = rebase_path("mojo/public/tools/dart_pkg.py", ".", mojo_sdk_root)
-
- entrypoints = []
- if (defined(invoker.apps)) {
- entrypoints += invoker.apps
- }
- if (defined(invoker.libs)) {
- entrypoints += invoker.libs
- }
-
- sources = entrypoints
- if (defined(invoker.sources)) {
- sources += invoker.sources
- } else if (defined(invoker.pkg_dir)) {
- list_script = rebase_path("build/ls.py", ".", mojo_sdk_root)
- sources += exec_script(list_script,
- [
- "--target-directory",
- rebase_path(invoker.pkg_dir),
- ],
- "list lines")
- }
-
- # We have to use foreach to set up outputs instead of rebase_path because
- # GN doesn't like assignments to outputs that aren't obviously under
- # $root_gen_dir somewhere.
- outputs = []
- foreach(s, sources) {
- outputs += [ "$root_gen_dir/dart-pkg/${package_name}/$s" ]
- }
- outputs += [ stamp_file ]
-
- inputs = [
- list_mojoms_script,
- script,
- ] + rebase_path(sources)
-
- args = [
- "--package-name",
- package_name,
- "--dart-sdk",
- rebase_path(dart_sdk_root),
- "--gen-directory",
- rebase_path("$root_gen_dir/dart-gen"),
- "--pkg-directory",
- pkg_directory,
- "--package-root",
- package_root,
- "--stamp-file",
- rebase_path(stamp_file),
- "--package-sources",
- ] + rebase_path(sources) + [ "--package-entrypoints" ] +
- rebase_path(entrypoints) + [ "--mojom-sources" ] +
- rebase_path(mojom_sources, "", mojo_sdk_root) +
- [ "--sdk-ext-directories" ] + rebase_path(sdk_ext_directory) +
- [ "--sdk-ext-files" ] + rebase_path(sdk_ext_files) +
- [ "--sdk-ext-mappings" ] + sdk_ext_mappings
- }
-}
-
-# This is the entrypoint for organizing Dart code for Mojo.
-#
-# For each file in |apps|, it makes a .mojo Mojo application using the dartx
-# format as well as an assemblage of the app under $root_gen_dir/part-pkg for
-# use in local development.
-#
-# For each file in |libs|, it invokes the Dart analyzer. All other sources go in
-# |sources|. This should at least contain a 'pubspec.yaml' file. If no |apps|
-# are defined, this rule makes the library package available to applications.
-# The name of the package is taken from the 'pubspec.yaml' file. Even if a
-# package will not be uploaded to pub, an attempt should be made not to conflict
-# with the names of existing pub packages, for example by using the prefix
-# 'mojo_dart_'.
-#
-# sources
-# List of non-app and non-lib sources to include in the package. This
-# should at least contain the pubspec.yaml for the package.
-#
-# apps (optional)
-# List of Mojo application entrypoints containing a main() function.
-# Each of these entrypoints will result in a .mojo Mojo application.
-# See |output_name| for how this application is named.
-#
-# libs (optional)
-# List of package entrypoints to pass to the analyzer. If none are
-# defined, the analyzer is not run.
-#
-# strict (optional)
-# If |apps| are specified, |strict| can be set to true to
-# instruct the content handler to run the apps in Dart VM's strict
-# compilation mode (with assertions and type-checks, etc.).
-#
-# app_name_override (optional)
-# When |apps| are specified, this is the prefix to use for the
-# name of the assembled .mojo file. The target name is used by default.
-# For each entrypoint, the result is |output_name|_|entrypoint|.mojo. If
-# the entrypoint is main.dart, the result is simply |output_name|.mojo.
-#
-# deps (optional)
-# List of other dart_pkg targets for Dart packages imported by this
-# dart_pkg, as well as the mojom targets needed by this dart_pkg.
-#
-# pkg_dir (optional)
-# Directory containing the package sources. This overrides sources and
-# entrypoints. The analyzer will not be run.
-#
-# datadeps (optional)
-#
-# sdk_ext_directory (optional)
-# Directory containing sdk-ext .dart sources.
-#
-# sdk_ext_files (optional)
-# List of sources to include in sdk-ext.
-#
-# sdk_ext_mappings (optional)
-# Mappings for dart libraries that are part of of sdk_ext.
-template("dart_pkg") {
- if (defined(invoker.pkg_dir)) {
- pubspec_yaml_path = rebase_path("pubspec.yaml", "", invoker.pkg_dir)
- } else {
- pubspec_yaml_path = rebase_path("pubspec.yaml")
- }
- dart_package_name_script =
- rebase_path("mojo/public/tools/dart_package_name.py", ".", mojo_sdk_root)
- dart_package_name = exec_script(dart_package_name_script,
- [
- "--pubspec",
- pubspec_yaml_path,
- ],
- "trim string",
- [ pubspec_yaml_path ])
-
- dart_pkg_target_name = "${target_name}_pkg_helper"
- dart_pkg_helper(dart_pkg_target_name) {
- package_name = dart_package_name
- if (defined(invoker.sources)) {
- sources = invoker.sources
- }
- if (defined(invoker.apps)) {
- apps = invoker.apps
- }
- if (defined(invoker.libs)) {
- libs = invoker.libs
- }
- if (defined(invoker.pkg_dir)) {
- pkg_dir = invoker.pkg_dir
- }
- if (defined(invoker.deps)) {
- deps = invoker.deps
- }
- if (defined(invoker.datadeps)) {
- datadeps = invoker.datadeps
- }
- if (defined(invoker.sdk_ext_directory)) {
- sdk_ext_directory = invoker.sdk_ext_directory
- }
- if (defined(invoker.sdk_ext_files)) {
- sdk_ext_files = invoker.sdk_ext_files
- }
- if (defined(invoker.sdk_ext_mappings)) {
- sdk_ext_mappings = invoker.sdk_ext_mappings
- }
- }
-
- if (defined(invoker.apps)) {
- pkg_name = target_name
- if (defined(invoker.app_name_override)) {
- pkg_name = invoker.app_name_override
- }
- pkg_helper_output_dir = "$root_gen_dir/dart-pkg/${dart_package_name}"
- foreach(entrypoint, invoker.apps) {
- entrypoint_name = get_path_info(entrypoint, "name")
- dartx_target_name = "${pkg_name}_${entrypoint_name}"
- dartx_output_name = dartx_target_name
- if (entrypoint_name == "main") {
- dartx_output_name = pkg_name
- }
- dartx_application(dartx_target_name) {
- output_name = dartx_output_name
- main_dart = rebase_path(entrypoint, "", pkg_helper_output_dir)
- sources = rebase_path(invoker.sources, "", pkg_helper_output_dir)
- deps = [
- ":$dart_pkg_target_name",
- ]
- deps += invoker.deps
- if (defined(invoker.strict)) {
- strict = invoker.strict
- }
- }
- }
- }
-
- group(target_name) {
- deps = [
- ":$dart_pkg_target_name",
- ]
- if (defined(invoker.apps)) {
- pkg_name = target_name
- if (defined(invoker.app_name_override)) {
- pkg_name = invoker.app_name_override
- }
- foreach(entrypoint, invoker.apps) {
- entrypoint_name = get_path_info(entrypoint, "name")
- dartx_target_name = "${pkg_name}_${entrypoint_name}"
- deps += [ ":$dartx_target_name" ]
- }
- }
- }
-}
-
-# Creates a dartzip package.
-template("dartzip_package") {
- package_target_name = "$target_name"
- package_output = "$target_out_dir/$target_name.dartzip"
-
- if (defined(invoker.uses_pub) && invoker.uses_pub) {
- # Repackage all dependencies pulled in via "pub get" in a dartzip file.
- action("${package_target_name}_repackage") {
- target_dir = get_label_info(":$target_name", "dir")
- script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_sdk_root)
-
- package_name = "$package_target_name"
- if (defined(invoker.package_name_override)) {
- package_name = invoker.package_name_override
- }
-
- # Get a list of the files in packages/ as inputs.
- list_packages_contents_script =
- rebase_path("mojo/public/tools/dart_list_packages_contents.py",
- ".",
- mojo_sdk_root)
- rebase_target_dir = rebase_path(target_dir, root_build_dir)
- inputs = exec_script(list_packages_contents_script,
- [
- "--target-directory",
- rebase_target_dir,
- "--package-name",
- package_name,
- ],
- "list lines",
- [ target_dir + "/pubspec.lock" ])
-
- # Zip up all the pulled-in files relative to their location in the
- # packages dir.
- output = "$target_out_dir/$target_name.dartzip"
- outputs = [
- output,
- ]
- rebase_base_dir = rebase_target_dir
- rebase_inputs = rebase_path(inputs, root_build_dir)
- rebase_output = rebase_path(output, root_build_dir)
- args = [
- "--base-dir=$rebase_base_dir",
- "--inputs=$rebase_inputs",
- "--output=$rebase_output",
- ]
- }
- }
-
- action("${package_target_name}_package") {
- script =
- rebase_path("mojo/public/tools/dart_package.py", ".", mojo_sdk_root)
-
- inputs = invoker.sources
-
- deps = []
- zip_inputs = []
-
- if (defined(invoker.uses_pub) && invoker.uses_pub) {
- deps += [ ":${package_target_name}_repackage" ]
- }
-
- if (defined(invoker.deps)) {
- deps += invoker.deps
- foreach(d, deps) {
- dep_name = get_label_info(d, "name")
- dep_target_out_dir = get_label_info(d, "target_out_dir")
- zip_inputs += [ "$dep_target_out_dir/$dep_name.dartzip" ]
- }
- }
-
- if (defined(invoker.datadeps)) {
- datadeps = invoker.datadeps
- }
-
- output = package_output
- outputs = [
- output,
- ]
-
- rebase_base_dir =
- rebase_path(get_label_info(":$package_target_name", "dir"),
- root_build_dir)
- if (defined(invoker.base_dir)) {
- rebase_base_dir = invoker.base_dir
- }
- rebase_inputs = rebase_path(inputs, root_build_dir)
- rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir)
- rebase_output = rebase_path(output, root_build_dir)
-
- args = [
- "--base-dir=$rebase_base_dir",
- "--inputs=$rebase_inputs",
- "--zip-inputs=$rebase_zip_inputs",
- "--output=$rebase_output",
- ]
- }
-
- action(target_name) {
- script =
- rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_sdk_root)
-
- sources = [
- package_output,
- ]
-
- args = [
- "--dart-sdk",
- rebase_path(dart_sdk_root),
- "--dartzip-file",
- rebase_path(package_output),
- "--stamp-file",
- rebase_path("$target_gen_dir/${package_target_name}_analyze.stamp"),
- "--no-hints",
- ]
-
- public_deps = [
- ":${package_target_name}_package",
- ]
- if (defined(invoker.deps)) {
- deps = invoker.deps
- }
-
- if (defined(invoker.datadeps)) {
- datadeps = invoker.datadeps
- }
-
- outputs = [
- "$target_gen_dir/${package_target_name}_analyze.stamp",
- ]
- }
-}
-
-# Use this template to generate a .mojo dart application. One of the source
-# files should be named main.dart and contain a main function as the
-# entry point. Dependencies of dart_packaged_application targets should be
-# either mojom targets (and specified using the mojom_deps variable) or
-# dartzip_package targets.
-template("dartzip_packaged_application") {
- package_name = "${target_name}_package"
- package_output = "$target_out_dir/$package_name.dartzip"
-
- if (defined(invoker.output_name)) {
- mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
- } else {
- mojo_output = "$root_out_dir/" + target_name + ".mojo"
- }
-
- dartzip_package(package_name) {
- sources = invoker.sources
- if (defined(invoker.deps)) {
- deps = invoker.deps
- }
- if (defined(invoker.uses_pub)) {
- uses_pub = invoker.uses_pub
- }
- if (defined(invoker.mojom_deps)) {
- mojom_deps = invoker.mojom_deps
- }
- if (defined(invoker.datadeps)) {
- datadeps = invoker.datadeps
- }
- }
-
- action(target_name) {
- script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_sdk_root)
-
- input = package_output
- inputs = [
- input,
- ]
-
- output = mojo_output
- outputs = [
- output,
- ]
-
- deps = [
- ":$package_name",
- ]
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
- if (defined(invoker.mojom_deps)) {
- deps += invoker.mojom_deps
- }
- if (defined(invoker.datadeps)) {
- datadeps = invoker.datadeps
- }
-
- line = "#!mojo mojo:dart_content_handler"
- if (is_debug || (defined(invoker.strict) && invoker.strict == true)) {
- line = "#!mojo mojo:dart_content_handler?strict=true"
- }
-
- rebase_input = rebase_path(input, root_build_dir)
- rebase_output = rebase_path(output, root_build_dir)
- args = [
- "--input=$rebase_input",
- "--output=$rebase_output",
- "--line=$line",
- ]
- }
-}
« no previous file with comments | « third_party/mojo/src/mojo/public/dart/pubspec.yaml ('k') | third_party/mojo/src/mojo/public/dart/sdk_ext/internal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698