Revert "watchOS target os"

This reverts commit 7ae1d75869.

Reason for revert: breaks flutter build

Original change's description:
> watchOS target os
>
> - add support for --os=watchos | --os=watchos_simulator
> - do not depend on perfetto if dart_support_perfetto is false
> - change the default value for dart_support_perfetto to !is_watchos
>
> To minimize changes and to avoid modifying third-party zlib BUILD file, is_watchos implies is_ios for now.
>
> TEST=manual, no watchOS SDK on bots yet.
>
> Cq-Include-Trybots: luci.dart.try:vm-mac-debug-arm64-try,vm-mac-release-arm64-try
> Change-Id: If2130068ef546162a07a9ba53f94b11ff25fb565
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415021
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>

Cq-Include-Trybots: luci.dart.try:vm-mac-debug-arm64-try,vm-mac-release-arm64-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I4bede9ede04ac3c533b8ff7ae2f1adbd84eb2397
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425262
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
This commit is contained in:
Ivan Inozemtsev
2025-04-29 03:21:37 -07:00
committed by Commit Queue
parent 7ae1d75869
commit 10c579c7e8
13 changed files with 44 additions and 200 deletions
+9 -34
View File
@@ -177,7 +177,6 @@ if (current_os == "win") {
is_mac = false
is_nacl = false
is_posix = false
is_watchos = false
is_win = true
} else if (current_os == "mac") {
is_android = false
@@ -188,7 +187,6 @@ if (current_os == "win") {
is_mac = true
is_nacl = false
is_posix = true
is_watchos = false
is_win = false
} else if (current_os == "android") {
is_android = true
@@ -199,7 +197,6 @@ if (current_os == "win") {
is_mac = false
is_nacl = false
is_posix = true
is_watchos = false
is_win = false
} else if (current_os == "linux") {
is_android = false
@@ -210,7 +207,6 @@ if (current_os == "win") {
is_mac = false
is_nacl = false
is_posix = true
is_watchos = false
is_win = false
} else if (current_os == "fuchsia") {
is_android = false
@@ -221,7 +217,6 @@ if (current_os == "win") {
is_mac = false
is_nacl = false
is_posix = true
is_watchos = false
is_win = false
} else if (current_os == "ios") {
is_android = false
@@ -232,23 +227,6 @@ if (current_os == "win") {
is_mac = false
is_nacl = false
is_posix = true
is_watchos = false
is_win = false
} else if (current_os == "watchos") {
is_android = false
is_chromeos = false
is_fuchsia = false
# watchOS and iOS are similar enough, so almost all codepaths in
# BUILD files are the same for watchOS and iOS. Additionally,
# BUILD.gn zlib file doesn't support `is_watchos`, but works fine
# with `is_ios`.
is_ios = true
is_linux = false
is_mac = false
is_nacl = false
is_posix = true
is_watchos = true
is_win = false
}
@@ -467,19 +445,17 @@ if (is_win) {
host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
set_default_toolchain("//build/toolchain/mac:clang_$current_cpu")
} else if (is_ios) {
import("//build/config/ios/ios_sdk.gni") # For use_simulator
import("//build/config/ios/ios_sdk.gni") # For use_ios_simulator
host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
toolchain_target = "clang"
if (is_watchos) {
toolchain_target = "watchos_$toolchain_target"
if (use_ios_simulator) {
if (target_cpu == "arm64") {
set_default_toolchain("//build/toolchain/mac:ios_clang_arm64_sim")
} else {
set_default_toolchain("//build/toolchain/mac:ios_clang_x64_sim")
}
} else {
toolchain_target = "ios_$toolchain_target"
set_default_toolchain("//build/toolchain/mac:ios_clang_arm64")
}
toolchain_target = "${toolchain_target}_$target_cpu"
if (use_simulator) {
toolchain_target = "${toolchain_target}_sim"
}
set_default_toolchain("//build/toolchain/mac:$toolchain_target")
} else if (is_fuchsia) {
assert(host_cpu == "x64")
if (host_os == "linux") {
@@ -578,8 +554,7 @@ if (!is_shared_library) {
output_prefix = "lib"
if (!defined(output_extension)) {
if (current_os == "mac" || current_os == "ios" ||
current_os == "watchos") {
if (current_os == "mac" || current_os == "ios") {
output_extension = "dylib"
} else if (current_os == "win") {
output_extension = "dll"
+19 -51
View File
@@ -6,41 +6,28 @@ import("//build/toolchain/rbe.gni")
declare_args() {
# SDK path to use. When empty this will use the default SDK based on the
# value of use_simulator.
# value of use_ios_simulator.
ios_sdk_path = ""
# Set to true when targeting a simulator build on iOS. False means that the
# target is for running on the device. The default value is to use the
# Simulator except when targeting GYP's Xcode builds (for compat with the
# existing GYP build).
use_simulator = false
use_ios_simulator = false
# Minimum supported version of the iOS SDK.
ios_sdk_min = "12.0"
# Minimum supported version of the watchOS SDK.
watchos_sdk_min = "11.0"
# The path to the iOS device SDK.
ios_device_sdk_path = ""
# The path to the iOS simulator SDK.
ios_simulator_sdk_path = ""
# The path to the watchOS device SDK.
watchos_device_sdk_path = ""
# The path to the watchOS simulator SDK.
watchos_simulator_sdk_path = ""
ios_enable_relative_sdk_path = use_rbe
}
if (ios_sdk_path == "") {
if (is_watchos) {
ios_sdk_min = watchos_sdk_min
}
_find_sdk_args = [
"--print_sdk_path",
ios_sdk_min,
@@ -55,44 +42,25 @@ if (ios_sdk_path == "") {
]
}
platform = "iphone"
if (is_watchos) {
platform = "watch"
}
if (use_simulator) {
platform = "${platform}_simulator"
if (use_ios_simulator && ios_simulator_sdk_path == "") {
_find_sdk_args += [ "--platform=iphone_simulator" ]
_find_sdk_result =
exec_script("//build/mac/find_sdk.py", _find_sdk_args, "list lines")
ios_simulator_sdk_path = _find_sdk_result[0]
}
_find_sdk_args += [ "--platform=$platform" ]
_find_sdk_result =
exec_script("//build/mac/find_sdk.py", _find_sdk_args, "list lines")
platform_sdk_path = _find_sdk_result[0]
if (!use_ios_simulator && ios_device_sdk_path == "") {
_find_sdk_args += [ "--platform=iphone" ]
_find_sdk_result =
exec_script("//build/mac/find_sdk.py", _find_sdk_args, "list lines")
ios_device_sdk_path = _find_sdk_result[0]
}
if (use_simulator && is_watchos) {
# watchos_simulator
if (watchos_simulator_sdk_path != "") {
platform_sdk_path = watchos_simulator_sdk_path
}
ios_sdk_path = platform_sdk_path
ios_sdk_min = watchos_sdk_min
} else if (!use_simulator && is_watchos) {
# watchos
if (watchos_device_sdk_path != "") {
platform_sdk_path = watchos_device_sdk_path
}
ios_sdk_path = platform_sdk_path
ios_sdk_min = watchos_sdk_min
} else if (use_simulator && !is_watchos) {
# ios_simulator
if (ios_simulator_sdk_path != "") {
platform_sdk_path = ios_simulator_sdk_path
}
ios_sdk_path = platform_sdk_path
} else if (!use_simulator && !is_watchos) {
# ios
if (ios_device_sdk_path != "") {
platform_sdk_path = ios_device_sdk_path
}
ios_sdk_path = platform_sdk_path
if (use_ios_simulator) {
assert(ios_simulator_sdk_path != "")
ios_sdk_path = ios_simulator_sdk_path
} else {
assert(ios_device_sdk_path != "")
ios_sdk_path = ios_device_sdk_path
}
}
-49
View File
@@ -78,55 +78,6 @@ mac_toolchain_suite("ios_clang_x64_sim") {
"-isysroot $ios_sdk_path -mios-simulator-version-min=$ios_sdk_min"
}
if (is_watchos) {
# Toolchain used for watchOS device targets.
mac_toolchain_suite("watchos_clang_arm64") {
toolchain_cpu = "arm64"
toolchain_os = "watchos"
prefix = rebased_clang_dir
cc = "${compiler_prefix}${prefix}/clang"
cxx = "${compiler_prefix}${prefix}/clang++"
if (use_rbe) {
cc = "${cc} --target=arm64-apple-darwin"
cxx = "${cxx} --target=arm64-apple-darwin"
}
asm = "${assembler_prefix}${prefix}/clang"
ar = "${prefix}/llvm-ar"
ld = "${link_prefix}${prefix}/clang++"
strip = "${prefix}/llvm-strip"
nm = "${prefix}/llvm-nm"
is_clang = true
if (ios_enable_relative_sdk_path) {
ios_sdk_path = rebase_path(ios_sdk_path, root_build_dir)
}
sysroot_flags = "-isysroot $ios_sdk_path -mwatchos-version-min=$ios_sdk_min"
}
# Toolchain used for watchOS simulator targets (arm64).
mac_toolchain_suite("watchos_clang_arm64_sim") {
toolchain_cpu = "arm64"
toolchain_os = "watchos"
prefix = rebased_clang_dir
cc = "${compiler_prefix}${prefix}/clang"
cxx = "${compiler_prefix}${prefix}/clang++"
if (use_rbe) {
cc = "${cc} --target=arm64-apple-darwin"
cxx = "${cxx} --target=arm64-apple-darwin"
}
asm = "${assembler_prefix}${prefix}/clang"
ar = "${prefix}/llvm-ar"
ld = "${link_prefix}${prefix}/clang++"
strip = "${prefix}/llvm-strip"
nm = "${prefix}/llvm-nm"
is_clang = true
if (ios_enable_relative_sdk_path) {
ios_sdk_path = rebase_path(ios_sdk_path, root_build_dir)
}
sysroot_flags =
"-isysroot $ios_sdk_path -mwatchos-simulator-version-min=$ios_sdk_min"
}
}
mac_toolchain_suite("clang_x64") {
toolchain_cpu = "x64"
toolchain_os = "mac"
+1 -12
View File
@@ -104,14 +104,6 @@ config("dart_os_config") {
} else if (target_os == "ios") {
defines += [ "DART_TARGET_OS_MACOS" ]
defines += [ "DART_TARGET_OS_MACOS_IOS" ]
} else if (target_os == "watchos") {
defines += [ "DART_TARGET_OS_MACOS" ]
# This doesn't look entirely correct, but so far it looks
# sufficient and allows to add watchOS support with less changes.
# If we need to differentiate iOS and watchOS targets later, we'll
# change this.
defines += [ "DART_TARGET_OS_MACOS_IOS" ]
} else if (target_os == "linux") {
defines += [ "DART_TARGET_OS_LINUX" ]
} else if (target_os == "mac") {
@@ -325,10 +317,7 @@ source_set("dart_api") {
library_for_all_configs("libdart") {
target_type = dart_component_kind
extra_nonproduct_deps = []
if (dart_support_perfetto) {
extra_nonproduct_deps += [ "vm:libprotozero" ]
}
extra_nonproduct_deps = [ "vm:libprotozero" ]
extra_deps = [
":generate_version_cc_file",
"../third_party/double-conversion/src:libdouble_conversion",
-6
View File
@@ -903,11 +903,6 @@ int Process::Exec(Namespace* namespc,
const char* working_directory,
char* errmsg,
intptr_t errmsg_len) {
#if defined(DART_HOST_OS_WATCH)
// execvp is not available on watchOS.
Utils::StrError(ENOSYS, errmsg, errmsg_len);
return -1;
#else
if (working_directory != nullptr &&
TEMP_FAILURE_RETRY(chdir(working_directory)) == -1) {
Utils::StrError(errno, errmsg, errmsg_len);
@@ -917,7 +912,6 @@ int Process::Exec(Namespace* namespc,
execvp(const_cast<const char*>(path), const_cast<char* const*>(arguments));
Utils::StrError(errno, errmsg, errmsg_len);
return -1;
#endif
}
static int SignalMap(intptr_t id) {
-3
View File
@@ -122,9 +122,6 @@
#if TARGET_OS_IPHONE
#define DART_HOST_OS_IOS 1
#endif
#if TARGET_OS_WATCH
#define DART_HOST_OS_WATCH 1
#endif
#elif defined(_WIN32)
+5 -5
View File
@@ -72,11 +72,11 @@ declare_args() {
# Whether the sampling heap profiler should be included in product mode.
dart_include_sampling_heap_profiler = false
# Whether features that depend on Perfetto should be built. We need
# to define this to allow excluding code that depends on Perfetto
# from being built on platforms which have a problem linking in the
# Perfetto library, e.g. watchOS.
dart_support_perfetto = !is_watchos
# Whether features that depend on Perfetto should be built. We temporarily
# need to define this to allow excluding code that depends on Perfetto from
# being built on platforms which have a problem linking in the Perfetto
# library.
dart_support_perfetto = true
# Whether to support dynamic loading and interpretation of Dart bytecode.
dart_dynamic_modules = false
+3 -3
View File
@@ -51,7 +51,7 @@ def Main():
return -1
with open(options.output, "w") as output_file:
if options.target_os in ["mac", "ios", "watchos"]:
if options.target_os in ["mac", "ios"]:
if options.executable:
output_file.write(".text\n")
else:
@@ -106,7 +106,7 @@ def Main():
if incbin:
output_file.write(".incbin \"%s\"\n" % options.input)
if options.target_os not in ["mac", "ios", "watchos", "win", "win_gnu"]:
if options.target_os not in ["mac", "ios", "win", "win_gnu"]:
output_file.write(".size {0}, .-{0}\n".format(options.symbol_name))
if options.size_symbol_name:
@@ -128,7 +128,7 @@ def Main():
else:
output_file.write("dword %d\n" % size)
else:
if options.target_os in ["mac", "ios", "watchos"]:
if options.target_os in ["mac", "ios"]:
output_file.write(
".global _%s\n" % options.size_symbol_name)
output_file.write("_%s:\n" % options.size_symbol_name)
+3 -13
View File
@@ -172,10 +172,7 @@ source_set("libprotozero") {
library_for_all_configs("libdart_vm") {
target_type = "source_set"
extra_product_deps = []
extra_nonproduct_deps = []
if (dart_support_perfetto) {
extra_nonproduct_deps += [ ":libprotozero" ]
}
extra_nonproduct_deps = [ ":libprotozero" ]
extra_deps = [
"//third_party/icu:icui18n",
"//third_party/icu:icuuc",
@@ -216,11 +213,7 @@ library_for_all_configs_with_compiler("libdart_compiler") {
public_configs = [ ":libdart_vm_config" ]
sources = rebase_path(compiler_sources, ".", "./compiler/")
include_dirs = [ ".." ]
extra_nonproduct_deps = []
if (dart_support_perfetto) {
extra_nonproduct_deps += [ ":libprotozero" ]
}
extra_nonproduct_deps = [ ":libprotozero" ]
extra_deps = []
if (is_fuchsia) {
extra_deps += [ "$fuchsia_sdk/pkg/trace-engine" ]
@@ -229,10 +222,7 @@ library_for_all_configs_with_compiler("libdart_compiler") {
library_for_all_configs("libdart_lib") {
target_type = "source_set"
extra_nonproduct_deps = []
if (dart_support_perfetto) {
extra_nonproduct_deps += [ ":libprotozero" ]
}
extra_nonproduct_deps = [ ":libprotozero" ]
extra_deps = []
if (is_fuchsia) {
extra_deps += [ "$fuchsia_sdk/pkg/trace-engine" ]
-13
View File
@@ -49,11 +49,7 @@ class ThreadInterrupterMacOS {
ASSERT(os_thread != nullptr);
mach_thread_ = pthread_mach_thread_np(os_thread->id());
ASSERT(reinterpret_cast<void*>(mach_thread_) != nullptr);
#if !defined(DART_HOST_OS_WATCH)
res = thread_suspend(mach_thread_);
#else
res = KERN_FAILURE;
#endif
}
void CollectSample() {
@@ -62,14 +58,9 @@ class ThreadInterrupterMacOS {
}
auto count = static_cast<mach_msg_type_number_t>(THREAD_STATE_FLAVOR_SIZE);
thread_state_flavor_t state;
#if !defined(DART_HOST_OS_WATCH)
kern_return_t res =
thread_get_state(mach_thread_, THREAD_STATE_FLAVOR,
reinterpret_cast<thread_state_t>(&state), &count);
#else
USE(count);
kern_return_t res = KERN_FAILURE;
#endif
ASSERT(res == KERN_SUCCESS);
Thread* thread = static_cast<Thread*>(os_thread_->thread());
if (thread == nullptr) {
@@ -83,11 +74,7 @@ class ThreadInterrupterMacOS {
if (res != KERN_SUCCESS) {
return;
}
#if !defined(DART_HOST_OS_WATCH)
res = thread_resume(mach_thread_);
#else
res = KERN_FAILURE;
#endif
ASSERT(res == KERN_SUCCESS);
}
+3 -8
View File
@@ -198,12 +198,7 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash,
gn_args['target_os'] = host_os
elif target_os == 'ios_simulator':
gn_args['target_os'] = 'ios'
gn_args['use_simulator'] = True
elif target_os == 'watchos_simulator':
gn_args['target_os'] = 'watchos'
gn_args['use_simulator'] = True
elif target_os == 'watchos':
gn_args['target_os'] = 'watchos'
gn_args['use_ios_simulator'] = True
else:
gn_args['target_os'] = target_os
@@ -363,7 +358,7 @@ def ProcessOptions(args):
for os_name in oses:
if not os_name in [
'android', 'freebsd', 'linux', 'macos', 'win32', 'fuchsia',
'ios', 'ios_simulator', 'watchos', 'watchos_simulator'
'ios', 'ios_simulator'
]:
print("Unknown os %s" % os_name)
return False
@@ -398,7 +393,7 @@ def ProcessOptions(args):
"Cross-compilation to %s is not supported for architecture %s."
% (os_name, arch))
return False
elif os_name == 'ios' or os_name == 'ios_simulator' or os_name == 'watchos' or os_name == 'watchos_simulator':
elif os_name == 'ios' or os_name == 'ios_simulator':
if not HOST_OS in ['macos']:
print(f'Target os {os_name} is only supported on macOS')
return False
-2
View File
@@ -339,8 +339,6 @@ def GetBuildConf(mode, arch, conf_os=None, sanitizer=None):
os_fragment = conf_os.title()
if (conf_os == 'ios_simulator'):
os_fragment = 'IosSim'
if (conf_os == 'watchos_simulator'):
os_fragment = 'WatchosSim'
return '{}{}{}'.format(GetBuildMode(mode), os_fragment, arch.upper())
# Ask for a cross build if the host and target architectures don't match.
+1 -1
View File
@@ -174,7 +174,7 @@ template("aot_snapshot") {
output_prefix = "lib"
output_extension = ""
if (current_os == "mac" || current_os == "ios" || current_os == "watchos") {
if (current_os == "mac" || current_os == "ios") {
output_extension = "dylib"
} else if (current_os == "win") {
output_extension = "dll"