mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 12:57:42 +00:00
[deps] rev native
`packge:native_assets_builder` had a number of breaking changes. The most notable one: It now returns a data structure with a `success` boolean instead of throwing exceptions. Also bumps Dart to 3.0 in Dartdev so we can use records. Change-Id: Ic32d7c2dd58860883c10f42411b80e979df2a797 Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318980 Auto-Submit: Daco Harkes <dacoharkes@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Hossein Yousefi <yousefi@google.com>
This commit is contained in:
parent
86eb49ac19
commit
585c34b4d1
2
DEPS
2
DEPS
|
@ -158,7 +158,7 @@ vars = {
|
|||
"matcher_rev": "ce8f40934c90e12992071172795b3bca29fac295",
|
||||
"mime_rev": "799b398140817fdb134f639d84e91c552e129136",
|
||||
"mockito_rev": "ff79de69e9ef9e8647bd6008c29c16651c9ac220",
|
||||
"native_rev": "f0dc3e9b26084c6be820348b3748bcb7315e0da8",
|
||||
"native_rev": "5a1361b6d98a84f8070c97872e3d3587fc0ba435",
|
||||
"package_config_rev": "981c49dfec1e3e3e90f336dcd7c225923d2fd321",
|
||||
"path_rev": "282dd18bd9ae2e265ea40a29b2c637194e9be8b7",
|
||||
"pool_rev": "77001024a16126cc5718e654ea3e57bbf6e7fac3",
|
||||
|
|
|
@ -103,7 +103,7 @@ class BuildCommand extends DartdevCommand {
|
|||
stdout.writeln('Building native assets.');
|
||||
final workingDirectory = Directory.current.uri;
|
||||
final target = Target.current;
|
||||
final nativeAssets = await NativeAssetsBuildRunner(
|
||||
final buildResult = await NativeAssetsBuildRunner(
|
||||
dartExecutable: Uri.file(sdk.dart),
|
||||
logger: logger(verbose),
|
||||
).build(
|
||||
|
@ -113,6 +113,11 @@ class BuildCommand extends DartdevCommand {
|
|||
buildMode: BuildMode.release,
|
||||
includeParentEnvironment: true,
|
||||
);
|
||||
final nativeAssets = buildResult.assets;
|
||||
if (!buildResult.success) {
|
||||
stderr.write('Native assets build failed.');
|
||||
return 255;
|
||||
}
|
||||
final staticAssets = nativeAssets.whereLinkMode(LinkMode.static);
|
||||
if (staticAssets.isNotEmpty) {
|
||||
stderr.write(
|
||||
|
|
|
@ -334,8 +334,8 @@ Remove debugging information from the output and save it separately to the speci
|
|||
return 255;
|
||||
}
|
||||
} else {
|
||||
final assets = await compileNativeAssetsJit(verbose: verbose);
|
||||
if (assets?.isNotEmpty ?? false) {
|
||||
final (_, assets) = await compileNativeAssetsJit(verbose: verbose);
|
||||
if (assets.isNotEmpty) {
|
||||
stderr.writeln(
|
||||
"'dart compile' does currently not support native assets.");
|
||||
return 255;
|
||||
|
|
|
@ -306,15 +306,13 @@ class RunCommand extends DartdevCommand {
|
|||
return errorExitCode;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
nativeAssets = (await compileNativeAssetsJitYamlFile(verbose: verbose))
|
||||
?.toFilePath();
|
||||
} on Exception catch (e, stacktrace) {
|
||||
final (success, assets) =
|
||||
await compileNativeAssetsJitYamlFile(verbose: verbose);
|
||||
if (!success) {
|
||||
log.stderr('Error: Compiling native assets failed.');
|
||||
log.stderr(e.toString());
|
||||
log.stderr(stacktrace.toString());
|
||||
return errorExitCode;
|
||||
}
|
||||
nativeAssets = assets?.toFilePath();
|
||||
}
|
||||
|
||||
final hasServerInfoOption = args.wasParsed(serverInfoOption);
|
||||
|
|
|
@ -51,15 +51,13 @@ Run "${runner!.executableName} help" to see global options.''');
|
|||
return DartdevCommand.errorExitCode;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
nativeAssets = (await compileNativeAssetsJitYamlFile(verbose: verbose))
|
||||
?.toFilePath();
|
||||
} on Exception catch (e, stacktrace) {
|
||||
final (success, assets) =
|
||||
await compileNativeAssetsJitYamlFile(verbose: verbose);
|
||||
if (!success) {
|
||||
log.stderr('Error: Compiling native assets failed.');
|
||||
log.stderr(e.toString());
|
||||
log.stderr(stacktrace.toString());
|
||||
return DartdevCommand.errorExitCode;
|
||||
}
|
||||
nativeAssets = assets?.toFilePath();
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -13,18 +13,17 @@ import 'package:native_assets_cli/native_assets_cli.dart';
|
|||
import 'core.dart';
|
||||
|
||||
/// Compiles all native assets for host OS in JIT mode.
|
||||
///
|
||||
/// Returns `null` on missing package_config.json, failing gracefully.
|
||||
Future<List<Asset>?> compileNativeAssetsJit({required bool verbose}) async {
|
||||
Future<(bool success, List<Asset> assets)> compileNativeAssetsJit(
|
||||
{required bool verbose}) async {
|
||||
final workingDirectory = Directory.current.uri;
|
||||
// TODO(https://github.com/dart-lang/package_config/issues/126): Use
|
||||
// package config resolution from package:package_config.
|
||||
if (!await File.fromUri(
|
||||
workingDirectory.resolve('.dart_tool/package_config.json'))
|
||||
.exists()) {
|
||||
return null;
|
||||
return (true, <Asset>[]);
|
||||
}
|
||||
final assets = await NativeAssetsBuildRunner(
|
||||
final buildResult = await NativeAssetsBuildRunner(
|
||||
// This always runs in JIT mode.
|
||||
dartExecutable: Uri.file(sdk.dart),
|
||||
logger: logger(verbose),
|
||||
|
@ -38,18 +37,19 @@ Future<List<Asset>?> compileNativeAssetsJit({required bool verbose}) async {
|
|||
buildMode: BuildMode.release,
|
||||
includeParentEnvironment: true,
|
||||
);
|
||||
return assets;
|
||||
return (buildResult.success, buildResult.assets);
|
||||
}
|
||||
|
||||
/// Compiles all native assets for host OS in JIT mode, and creates the
|
||||
/// native assets yaml file.
|
||||
///
|
||||
/// Used in `dart run` and `dart test`.
|
||||
///
|
||||
/// Returns `null` on missing package_config.json, failing gracefully.
|
||||
Future<Uri?> compileNativeAssetsJitYamlFile({required bool verbose}) async {
|
||||
final assets = await compileNativeAssetsJit(verbose: verbose);
|
||||
if (assets == null) return null;
|
||||
Future<(bool success, Uri? nativeAssetsYaml)> compileNativeAssetsJitYamlFile(
|
||||
{required bool verbose}) async {
|
||||
final (success, assets) = await compileNativeAssetsJit(verbose: verbose);
|
||||
if (!success) {
|
||||
return (false, null);
|
||||
}
|
||||
|
||||
final workingDirectory = Directory.current.uri;
|
||||
final assetsUri = workingDirectory.resolve('.dart_tool/native_assets.yaml');
|
||||
|
@ -58,7 +58,7 @@ Future<Uri?> compileNativeAssetsJitYamlFile({required bool verbose}) async {
|
|||
${assets.toNativeAssetsFile()}''';
|
||||
final assetFile = File(assetsUri.toFilePath());
|
||||
await assetFile.writeAsString(nativeAssetsYaml);
|
||||
return assetsUri;
|
||||
return (true, assetsUri);
|
||||
}
|
||||
|
||||
Future<bool> warnOnNativeAssets() async {
|
||||
|
|
|
@ -4,7 +4,7 @@ name: dartdev
|
|||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: '>=2.17.0 <4.0.0'
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
|
||||
# Use 'any' constraints here; we get our versions from the DEPS file.
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in a new issue