Skip to content

Commit

Permalink
Move snapshot to //flutter/lib/snapshot (flutter#2905)
Browse files Browse the repository at this point in the history
This change disentangles the build for the snapshotter from the main engine
build. Also, we now have all the Dart files for dart:ui in the same directory.
  • Loading branch information
abarth authored Aug 10, 2016
1 parent 483bbd3 commit 54d5068
Show file tree
Hide file tree
Showing 17 changed files with 126 additions and 128 deletions.
115 changes: 115 additions & 0 deletions lib/snapshot/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Copyright 2016 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.

import("//flutter/lib/jni/dart_jni.gni")
import("//flutter/lib/snapshot/toolchain.gni")
import("//flutter/lib/ui/dart_ui.gni")
import("//flutter/lib/ui/dart_ui.gni")
import("//mojo/dart/packages/mojo/sdk_ext_sources.gni")

bindings_output_dir = "$root_gen_dir/sky/bindings"

copy("generate_dart_ui") {
sources = dart_ui_files

outputs = [
"$bindings_output_dir/dart_ui/{{source_file_part}}",
]
}

copy("generate_dart_jni") {
sources = dart_jni_files

outputs = [
"$bindings_output_dir/dart_jni/{{source_file_part}}",
]
}

action("generate_snapshot_bin") {
deps = [
"//dart/runtime/bin:gen_snapshot($dart_host_toolchain)",
":generate_dart_ui",
":generate_dart_jni",
]
inputs = [
"//dart/runtime/tools/create_snapshot_bin.py",
"snapshot.dart",
] + dart_ui_files
+ dart_jni_files
+ rebase_path(dart_mojo_internal_sdk_sources,
"",
"//mojo/dart/packages/mojo")
vm_isolate_snapshot = "$target_gen_dir/vm_isolate_snapshot.bin"
isolate_snapshot = "$target_gen_dir/isolate_snapshot.bin"
outputs = [
vm_isolate_snapshot,
isolate_snapshot,
]

dart_mojo_internal_path =
rebase_path("//mojo/dart/packages/mojo/sdk_ext/internal.dart")
rebased_dart_ui_path = rebase_path(dart_ui_path)
rebased_dart_jni_path = rebase_path(dart_jni_path)

gen_snapshot_dir =
get_label_info("//dart/runtime/bin:gen_snapshot($dart_host_toolchain)",
"root_out_dir")
script = "//dart/runtime/tools/create_snapshot_bin.py"

args = [
"--executable",
rebase_path("$gen_snapshot_dir/gen_snapshot"),
"--package_root",
rebase_path("$root_gen_dir"),
"--script",
rebase_path("snapshot.dart"),
"--vm_output_bin",
rebase_path(vm_isolate_snapshot, root_build_dir),
"--output_bin",
rebase_path(isolate_snapshot, root_build_dir),
"--target_os",
target_os,
"--url_mapping=dart:mojo.internal,$dart_mojo_internal_path",
"--url_mapping=dart:ui,$rebased_dart_ui_path",
"--url_mapping=dart:jni,$rebased_dart_jni_path",
]
}

action("generate_snapshot_file") {
deps = [
":generate_snapshot_bin",
]
inputs = [
"//dart/runtime/tools/create_snapshot_file.py",
"snapshot.c.tmpl",
"$target_gen_dir/vm_isolate_snapshot.bin",
"$target_gen_dir/isolate_snapshot.bin",
]
output = "$target_gen_dir/snapshot.c"
outputs = [
output,
]

script = "//dart/runtime/tools/create_snapshot_file.py"
args = [
"--vm_input_bin",
rebase_path("$target_gen_dir/vm_isolate_snapshot.bin"),
"--input_bin",
rebase_path("$target_gen_dir/isolate_snapshot.bin"),
"--input_cc",
rebase_path("snapshot.c.tmpl"),
"--output",
rebase_path(output),
]
}

source_set("snapshot") {
sources = [
"$target_gen_dir/snapshot.c",
]

deps = [
":generate_snapshot_file",
]
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import("//mojo/dart/packages/mojo/sdk_ext_sources.gni")
import("//flutter/sky/engine/config.gni")

bindings_output_dir = "$root_gen_dir/sky/bindings"

dart_host_toolchain = host_toolchain

# During precompilation, a 64 bit Dart VM cannot generate code for a 32 bit
Expand Down
7 changes: 7 additions & 0 deletions lib/ui/dart_ui.gni
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
dart_ui_files = [
"//flutter/lib/ui/compositing.dart",
"//flutter/lib/ui/geometry.dart",
"//flutter/lib/ui/hash_codes.dart",
"//flutter/lib/ui/hooks.dart",
"//flutter/lib/ui/lerp.dart",
"//flutter/lib/ui/mojo_services.dart",
"//flutter/lib/ui/natives.dart",
"//flutter/lib/ui/painting.dart",
"//flutter/lib/ui/text.dart",
"//flutter/lib/ui/ui.dart",
"//flutter/lib/ui/window.dart",
]

dart_ui_path = "//flutter/lib/ui/ui.dart"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion sky/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/sky/engine/bindings/bindings.gni")
import("//flutter/lib/snapshot/toolchain.gni")

group("sky") {
testonly = true
Expand Down
113 changes: 1 addition & 112 deletions sky/engine/bindings/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/lib/jni/dart_jni.gni")
import("//flutter/lib/ui/dart_ui.gni")
import("//mojo/dart/packages/mojo/sdk_ext_sources.gni")
import("//flutter/sky/engine/bindings/bindings.gni")
import("//flutter/sky/engine/core/core.gni")

source_set("bindings") {
sources = [
"dart_mojo_internal.cc",
Expand Down Expand Up @@ -54,7 +48,7 @@ source_set("bindings") {
# snapshotter.
if (!is_ios || use_ios_simulator) {
deps += [
":snapshot_cc",
"//flutter/lib/snapshot",
]
}

Expand All @@ -64,108 +58,3 @@ source_set("bindings") {
rebase_path("//dart/runtime"),
]
}

action("generate_snapshot_bin") {
deps = [
"//dart/runtime/bin:gen_snapshot($dart_host_toolchain)",
":generate_dart_ui",
":generate_dart_jni",
]
inputs = [
"//dart/runtime/tools/create_snapshot_bin.py",
"snapshot.dart",
] + dart_jni_files
+ rebase_path(dart_mojo_internal_sdk_sources,
"",
"//mojo/dart/packages/mojo")
vm_isolate_snapshot = "$target_gen_dir/vm_isolate_snapshot.bin"
isolate_snapshot = "$target_gen_dir/isolate_snapshot.bin"
outputs = [
vm_isolate_snapshot,
isolate_snapshot,
]

dart_mojo_internal_path =
rebase_path("//mojo/dart/packages/mojo/sdk_ext/internal.dart")
# TODO(abarth): Make rebased_dart_ui_path match rebased_dart_jni_path once
# dart:ui is fully migrated to //flutter/lib/ui.
rebased_dart_ui_path = rebase_path("$bindings_output_dir/dart_ui/ui.dart")
rebased_dart_jni_path = rebase_path(dart_jni_path)

gen_snapshot_dir =
get_label_info("//dart/runtime/bin:gen_snapshot($dart_host_toolchain)",
"root_out_dir")
script = "//dart/runtime/tools/create_snapshot_bin.py"

args = [
"--executable",
rebase_path("$gen_snapshot_dir/gen_snapshot"),
"--package_root",
rebase_path("$root_gen_dir"),
"--script",
rebase_path("snapshot.dart"),
"--vm_output_bin",
rebase_path(vm_isolate_snapshot, root_build_dir),
"--output_bin",
rebase_path(isolate_snapshot, root_build_dir),
"--target_os",
target_os,
"--url_mapping=dart:mojo.internal,$dart_mojo_internal_path",
"--url_mapping=dart:ui,$rebased_dart_ui_path",
"--url_mapping=dart:jni,$rebased_dart_jni_path",
]
}

action("generate_snapshot_file") {
deps = [
":generate_snapshot_bin",
]
inputs = [
"//dart/runtime/tools/create_snapshot_file.py",
"snapshot.c.tmpl",
"$target_gen_dir/vm_isolate_snapshot.bin",
"$target_gen_dir/isolate_snapshot.bin",
]
output = "$target_gen_dir/snapshot.c"
outputs = [
output,
]

script = "//dart/runtime/tools/create_snapshot_file.py"
args = [
"--vm_input_bin",
rebase_path("$target_gen_dir/vm_isolate_snapshot.bin"),
"--input_bin",
rebase_path("$target_gen_dir/isolate_snapshot.bin"),
"--input_cc",
rebase_path("snapshot.c.tmpl"),
"--output",
rebase_path(output),
]
}

source_set("snapshot_cc") {
sources = [
"$target_gen_dir/snapshot.c",
]

deps = [
":generate_snapshot_file",
]
}

copy("generate_dart_ui") {
sources = core_dart_files + dart_ui_files

outputs = [
"$bindings_output_dir/dart_ui/{{source_file_part}}",
]
}

copy("generate_dart_jni") {
sources = dart_jni_files

outputs = [
"$bindings_output_dir/dart_jni/{{source_file_part}}",
]
}
11 changes: 0 additions & 11 deletions sky/engine/core/core.gni
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,3 @@ sky_core_files = [
"window/window.cc",
"window/window.h",
]

core_dart_files = get_path_info([
"dart/hash_codes.dart",
"dart/hooks.dart",
"dart/lerp.dart",
"dart/mojo_services.dart",
"dart/natives.dart",
"dart/text.dart",
"dart/window.dart",
],
"abspath")
2 changes: 1 addition & 1 deletion sky/packages/sky_engine/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dart_sdk_lib_copy("typed_data") {
}

copy("copy_dart_ui") {
sources = core_dart_files + dart_ui_files
sources = dart_ui_files

outputs = [
"$root_gen_dir/dart-pkg/sky_engine/dart_ui/{{source_file_part}}",
Expand Down
2 changes: 1 addition & 1 deletion sky/tools/sky_snapshot/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ executable("sky_snapshot") {
deps = [
"//dart/runtime:libdart",
"//dart/runtime/vm:libdart_platform",
"//flutter/lib/snapshot",
"//lib/ftl",
"//lib/tonic/converter",
"//lib/tonic/file_loader",
"//flutter/sky/engine/bindings:snapshot_cc",
]

if (!is_ios && !is_mac) {
Expand Down

0 comments on commit 54d5068

Please sign in to comment.