Revert "[build] Generate AOT snapshots in the SDK as dylibs on Mac."

This reverts commit 7cc84b94b3.

Reason for revert: fail to launch, need to setup code signing

Original change's description:
> [build] Generate AOT snapshots in the SDK as dylibs on Mac.
>
> Change-Id: I95efe7342e595b44bfce1a15229b926a721aea82
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499480
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Change-Id: I4a2742ddc4a39166ea4b642ee12661a8217e7417
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504681
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
This commit is contained in:
Ryan Macnak
2026-05-19 11:10:25 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 68a3d4e688
commit 1b850ae2be
2 changed files with 94 additions and 21 deletions
+8
View File
@@ -70,6 +70,14 @@ _all_configs = [
dart_shared_lib = "../../runtime/engine:dart_engine_aot_shared"
dart_static_lib = "../../runtime/engine:dart_engine_aot_static"
snapshot_target = "aot_snapshot"
# AOT snapshots as shared libraries on Windows are not
# supported, and in fact we don't build AOT samples on
# Windows. However, GN evaluation model will still
# evaluate the `aot_snapshot` template on Windows,
# and it will fail the assert if as_shared_library is
# true, and the current platform is Windows.
as_shared_library = !is_win
},
]
+86 -21
View File
@@ -104,39 +104,104 @@ template("aot_snapshot") {
}
}
# Create a snapshot from kernel built above.
gen_snapshot_action(target_name) {
if (defined(invoker.pool)) {
pool = invoker.pool
}
deps = extra_deps + [ ":${target_name}_dill" ]
# Whether to build an AOT snapshot, which can be opened by dlopen.
# Ignore this option on Linux, as the default app-aot-elf AOT
# snapshot already can be used with dlopen on Linux.
as_shared_library = defined(invoker.as_shared_library) &&
invoker.as_shared_library && !is_linux
inputs = extra_inputs
assert(!(as_shared_library && is_win),
"AOT Snapshots as shared libraries are not supported on Windows")
outputs = [ output ]
if (!as_shared_library) {
# Create a snapshot from kernel built above.
gen_snapshot_action(target_name) {
if (defined(invoker.pool)) {
pool = invoker.pool
}
deps = extra_deps + [ ":${target_name}_dill" ]
abs_output = rebase_path(output)
inputs = extra_inputs
outputs = [ output ]
abs_output = rebase_path(output)
# TODO(60813): Generate PE DLL on Windows.
if (is_mac) {
vm_args = [
"--deterministic",
"--snapshot-kind=app-aot-macho-dylib",
"--macho=$abs_output",
] + gen_snapshot_args
} else {
vm_args = [
"--deterministic",
"--snapshot-kind=app-aot-elf",
"--elf=$abs_output",
] + gen_snapshot_args
if (defined(invoker.vm_args)) {
vm_args += invoker.vm_args
}
args = [ rebase_path(dill) ]
force_product_mode = product_mode
}
if (defined(invoker.vm_args)) {
vm_args += invoker.vm_args
} else {
assembly = "$target_gen_dir/$name.S"
dill_target_name = ":${target_name}_dill"
# Create an assembly snapshot from kernel built above.
assembly_target_name = target_name + "_assembly"
gen_snapshot_action(assembly_target_name) {
if (defined(invoker.pool)) {
pool = invoker.pool
}
deps = extra_deps + [ dill_target_name ]
inputs = extra_inputs
outputs = [ assembly ]
abs_output = rebase_path(assembly)
vm_args = [
"--deterministic",
"--snapshot-kind=app-aot-assembly",
"--assembly=$abs_output",
] + gen_snapshot_args
args = [ rebase_path(dill) ]
force_product_mode = product_mode
}
args = [ rebase_path(dill) ]
# build a shared library from assembly.
shared_library_target_name = target_name + "_shared_library"
shared_library(shared_library_target_name) {
sources = [ assembly ]
deps = [ ":${assembly_target_name}" ]
}
force_product_mode = product_mode
output_prefix = "lib"
output_extension = ""
if (current_os == "mac" || current_os == "ios" || current_os == "watchos") {
output_extension = "dylib"
} else if (current_os == "win") {
output_extension = "dll"
output_prefix = ""
} else if (current_os == "unknown" && current_cpu == "wasm32") {
output_extension = "wasm"
} else {
output_extension = "so"
}
shared_library_output_file_name =
"$output_prefix$shared_library_target_name"
if (output_extension != "") {
shared_library_output_file_name += ".$output_extension"
}
# copy shared library to the same output, as when
# `as_shared_library` is False.
copy(target_name) {
sources = [ "$root_out_dir/$shared_library_output_file_name" ]
outputs = [ output ]
deps = [ ":${shared_library_target_name}" ]
}
}
}