[infra] Initial support for native arm64 builds on macOS

Change-Id: Ia17f0839c87923deb877259069cab0d702d27aa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202483
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
This commit is contained in:
Alexander Thomas 2021-06-07 14:04:32 +00:00 committed by commit-bot@chromium.org
parent af98f73849
commit 45e11715db
5 changed files with 19 additions and 143 deletions

17
DEPS
View file

@ -497,14 +497,25 @@ deps = {
Var("dart_root") + "/third_party/pkg/yaml":
Var("dart_git") + "yaml.git" + "@" + Var("yaml_rev"),
Var("dart_root") + "/buildtools/" + Var("host_os") + "-" + Var("host_cpu") + "/clang": {
Var("dart_root") + "/buildtools/" + Var("host_os") + "-x64/clang": {
"packages": [
{
"package": "fuchsia/third_party/clang/${{platform}}",
"package": "fuchsia/third_party/clang/" + Var("host_os") + "-amd64",
"version": "git_revision:" + Var("clang_revision"),
},
],
"condition": "(host_os == 'linux' or host_os == 'mac') and (host_cpu == 'x64' or host_cpu == 'arm64')",
# TODO(https://fxbug.dev/73385): Use arm64 toolchain on arm64 when it exists.
"condition": "host_cpu == x64 and (host_os == linux or host_os == mac) or host_cpu == arm64 and host_os == mac",
"dep_type": "cipd",
},
Var("dart_root") + "/buildtools/linux-arm64/clang": {
"packages": [
{
"package": "fuchsia/third_party/clang/linux-arm64",
"version": "git_revision:" + Var("clang_revision"),
},
],
"condition": "host_os == 'linux' and host_cpu == 'arm64'",
"dep_type": "cipd",
},

View file

@ -1,104 +0,0 @@
#!/usr/bin/env dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Smoke test runner for Dart AOT (dart2native, dartaotruntime).
// aot_smoke_tests.dart and dart_aot_test.dart together form the test that the
// AOT toolchain is compiled and included correctly in the SDK.
// This tests that the AOT tools can both successfully compile Dart -> AOT and
// run the resulting AOT blob with the AOT runtime.
import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
final String newline = Platform.isWindows ? '\r\n' : '\n';
final String executableSuffix = Platform.isWindows ? ".exe" : "";
final String sdkBinDir = path.dirname(Platform.executable);
final String dartaotruntime =
path.join(sdkBinDir, 'dartaotruntime${executableSuffix}');
final String dart = path.join(sdkBinDir, 'dart${executableSuffix}');
Future<void> withTempDir(Future fun(String dir)) async {
final Directory tempDir = Directory.systemTemp.createTempSync();
try {
await fun(tempDir.path);
} finally {
tempDir.deleteSync(recursive: true);
}
}
void main(List<String> args) {
test("Dart native: Can compile and run AOT snapshot", () async {
await withTempDir((String tmp) async {
final String testCode = path.join('tools', 'bots', 'dart_aot_test.dart');
final String tmpAot = path.join(tmp, 'dart_aot_test.aot');
{
final ProcessResult result = await Process.run(
dart, ['compile', 'aot-snapshot', testCode, '--output', tmpAot]);
expect(result.stderr, '');
expect(result.exitCode, 0);
}
{
const String testStr = 'Dart AOT';
final ProcessResult result =
await Process.run(dartaotruntime, [tmpAot, testStr]);
expect(result.stderr, '');
expect(result.exitCode, 0);
expect(result.stdout, 'Hello, ${testStr}.${newline}');
}
});
});
test("Dart native: Can compile and run exe", () async {
await withTempDir((String tmp) async {
final String testCode = path.join('tools', 'bots', 'dart_aot_test.dart');
final String tmpExe = path.join(tmp, 'dart_aot_test.exe');
{
final ProcessResult result = await Process.run(
dart, ['compile', 'exe', testCode, '--output', tmpExe]);
expect(result.stderr, '');
expect(result.exitCode, 0);
}
{
const String testStr = 'Dart AOT';
final ProcessResult result = await Process.run(tmpExe, [testStr]);
expect(result.stderr, '');
expect(result.exitCode, 0);
expect(result.stdout, 'Hello, ${testStr}.${newline}');
}
});
});
test("Dart native: Returns non-zero on missing file.", () async {
await withTempDir((String tmp) async {
final String testCode = path.join(tmp, 'does_not_exist.dart');
final String tmpExe = path.join(tmp, 'dart_aot_test.exe');
{
final ProcessResult result = await Process.run(
dart, ['compile', 'exe', testCode, '--output', tmpExe]);
expect(result.exitCode, isNonZero);
}
});
});
test("Dart native: Returns non-zero on non-file.", () async {
await withTempDir((String tmp) async {
final String testCode = tmp; // This is a directory, not a file.
final String tmpExe = path.join(tmp, 'dart_aot_test.exe');
{
final ProcessResult result = await Process.run(
dart, ['compile', 'exe', testCode, '--output', tmpExe]);
expect(result.exitCode, isNonZero);
}
});
});
}

View file

@ -1,11 +0,0 @@
#!/usr/bin/env dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test program for Dart AOT (dart compile, dartaotruntime).
void main(List<String> args) async {
final String who = !args.isEmpty ? args[0] : '世界';
print('Hello, ${who}.');
}

View file

@ -24,7 +24,7 @@ def BuildArchitectures():
if BUILD_OS == 'linux':
return ['ia32', 'x64', 'arm', 'arm64']
elif BUILD_OS == 'macos':
return ['x64']
return BUILD_ARCHITECTURE
else:
return ['ia32', 'x64']

View file

@ -1833,6 +1833,7 @@
"vm-kernel-linux-debug-x64c",
"vm-kernel-mac-product-x64",
"vm-kernel-mac-product-x64c",
"vm-kernel-mac-release-arm64",
"vm-kernel-mac-release-x64",
"vm-kernel-mac-release-x64c",
"vm-kernel-mac-debug-x64",
@ -2838,13 +2839,6 @@
"name": "upload sdk",
"script": "tools/bots/dart_sdk.py"
},
{
"name": "run AOT and Exe smoke tests",
"script": "out/ReleaseX64/dart-sdk/bin/dart",
"arguments": [
"tools/bots/aot_smoke_tests.dart"
]
},
{
"name": "build api docs",
"script": "tools/bots/dart_sdk.py",
@ -2856,7 +2850,8 @@
},
{
"builders": [
"dart-sdk-mac"
"dart-sdk-mac",
"dart-sdk-mac-arm64"
],
"meta": {
"description": "This configuration is used by the sdk-builders for MacOS."
@ -2866,7 +2861,6 @@
"name": "build dart",
"script": "tools/build.py",
"arguments": [
"--arch=x64",
"--mode=release",
"--check-clean",
"create_sdk"
@ -2878,13 +2872,6 @@
{
"name": "upload sdk",
"script": "tools/bots/dart_sdk.py"
},
{
"name": "run AOT and Exe smoke tests",
"script": "xcodebuild/ReleaseX64/dart-sdk/bin/dart",
"arguments": [
"tools/bots/aot_smoke_tests.dart"
]
}
]
},
@ -2909,13 +2896,6 @@
{
"name": "upload sdk",
"script": "tools/bots/dart_sdk.py"
},
{
"name": "run AOT and Exe smoke tests",
"script": "out/ReleaseX64/dart-sdk/bin/dart.exe",
"arguments": [
"tools/bots/aot_smoke_tests.dart"
]
}
]
},
@ -3628,7 +3608,7 @@
{
"name": "analyze flutter/plugins",
"script": "tools/bots/flutter/analyze_flutter_plugins.sh"
}
}
]
},
{