diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml index 26eb0676d..2aab3d265 100644 --- a/.github/workflows/native.yaml +++ b/.github/workflows/native.yaml @@ -7,7 +7,7 @@ permissions: read-all on: pull_request: - branches: [main] + # No `branches:` to enable stacked PRs on GitHub. paths: - ".github/workflows/native.yaml" - "pkgs/native_assets_builder/**" diff --git a/pkgs/jnigen/CHANGELOG.md b/pkgs/jnigen/CHANGELOG.md index 173dddb6c..d6d7ee1a0 100644 --- a/pkgs/jnigen/CHANGELOG.md +++ b/pkgs/jnigen/CHANGELOG.md @@ -3,6 +3,8 @@ - **Breaking Change**([#1644](https://github.com/dart-lang/native/issues/1644)): Generate null-safe Dart bindings for Java and Kotlin. - Fixed a potential name collision when generating in multi-file mode. +- Added the ability to add user-defined visitors to config. Currently only + capable of excluding classes, methods, and fields. ## 0.12.2 diff --git a/pkgs/jnigen/lib/src/bindings/excluder.dart b/pkgs/jnigen/lib/src/bindings/excluder.dart index c9fba9ab5..85f4a681c 100644 --- a/pkgs/jnigen/lib/src/bindings/excluder.dart +++ b/pkgs/jnigen/lib/src/bindings/excluder.dart @@ -35,6 +35,7 @@ class Excluder extends Visitor { void visit(Classes node) { node.decls.removeWhere((_, classDecl) { final excluded = classDecl.isPrivate || + classDecl.isExcluded || !(config.exclude?.classes?.included(classDecl) ?? true); if (excluded) { log.fine('Excluded class ${classDecl.binaryName}'); @@ -61,13 +62,17 @@ class _ClassExcluder extends Visitor { @override void visit(ClassDecl node) { node.methods = node.methods.where((method) { + final isExcluded = method.isExcluded; final isPrivate = method.isPrivate; final isAbstractCtor = method.isConstructor && node.isAbstract; final isBridgeMethod = method.isSynthetic && method.isBridge; final isExcludedInConfig = config.exclude?.methods?.included(node, method) ?? false; - final excluded = - isPrivate || isAbstractCtor || isBridgeMethod || isExcludedInConfig; + final excluded = isPrivate || + isAbstractCtor || + isBridgeMethod || + isExcludedInConfig || + isExcluded; if (excluded) { log.fine('Excluded method ${node.binaryName}#${method.name}'); } @@ -80,8 +85,9 @@ class _ClassExcluder extends Visitor { return !excluded; }).toList(); node.fields = node.fields.where((field) { - final excluded = field.isPrivate && - (config.exclude?.fields?.included(node, field) ?? true); + final excluded = field.isExcluded || + (field.isPrivate && + (config.exclude?.fields?.included(node, field) ?? true)); if (excluded) { log.fine('Excluded field ${node.binaryName}#${field.name}'); } diff --git a/pkgs/jnigen/lib/src/config/config_types.dart b/pkgs/jnigen/lib/src/config/config_types.dart index f5bd848fd..bead7f371 100644 --- a/pkgs/jnigen/lib/src/config/config_types.dart +++ b/pkgs/jnigen/lib/src/config/config_types.dart @@ -10,6 +10,7 @@ import 'package:pub_semver/pub_semver.dart'; import 'package:yaml/yaml.dart'; import '../elements/elements.dart'; +import '../elements/j_elements.dart' as j_ast; import '../logging/logging.dart'; import '../util/find_package.dart'; import 'config_exception.dart'; @@ -265,24 +266,24 @@ void _validateClassName(String className) { /// Configuration for jnigen binding generation. class Config { - Config({ - required this.outputConfig, - required this.classes, - this.experiments, - this.exclude, - this.sourcePath, - this.classPath, - this.preamble, - this.customClassBody, - this.androidSdkConfig, - this.mavenDownloads, - this.summarizerOptions, - this.nonNullAnnotations, - this.nullableAnnotations, - this.logLevel = Level.INFO, - this.dumpJsonTo, - this.imports, - }) { + Config( + {required this.outputConfig, + required this.classes, + this.experiments, + this.exclude, + this.sourcePath, + this.classPath, + this.preamble, + this.customClassBody, + this.androidSdkConfig, + this.mavenDownloads, + this.summarizerOptions, + this.nonNullAnnotations, + this.nullableAnnotations, + this.logLevel = Level.INFO, + this.dumpJsonTo, + this.imports, + this.visitors}) { for (final className in classes) { _validateClassName(className); } @@ -349,6 +350,9 @@ class Config { /// Used for testing package:jnigen. final Map? customClassBody; + // User custom visitors. + List? visitors; + Future importClasses() async { importedClasses = {}; for (final import in [ diff --git a/pkgs/jnigen/lib/src/elements/elements.dart b/pkgs/jnigen/lib/src/elements/elements.dart index cbdbea653..970c6bfa3 100644 --- a/pkgs/jnigen/lib/src/elements/elements.dart +++ b/pkgs/jnigen/lib/src/elements/elements.dart @@ -59,6 +59,7 @@ class Classes implements Element { @JsonSerializable(createToJson: false) class ClassDecl with ClassMember, Annotated implements Element { ClassDecl({ + this.isExcluded = false, this.annotations, this.javadoc, required this.declKind, @@ -77,6 +78,8 @@ class ClassDecl with ClassMember, Annotated implements Element { this.kotlinPackage, }); + bool isExcluded; + @override final Set modifiers; @@ -602,6 +605,7 @@ mixin ClassMember { @JsonSerializable(createToJson: false) class Method with ClassMember, Annotated implements Element { Method({ + this.isExcluded = false, this.annotations, this.javadoc, this.modifiers = const {}, @@ -612,6 +616,8 @@ class Method with ClassMember, Annotated implements Element { required this.returnType, }); + bool isExcluded; + @override final String name; @override @@ -704,6 +710,7 @@ class Param with Annotated implements Element { @JsonSerializable(createToJson: false) class Field with ClassMember, Annotated implements Element { Field({ + this.isExcluded = false, this.annotations, this.javadoc, this.modifiers = const {}, @@ -712,6 +719,8 @@ class Field with ClassMember, Annotated implements Element { this.defaultValue, }); + bool isExcluded; + @override final String name; @override diff --git a/pkgs/jnigen/lib/src/elements/j_elements.dart b/pkgs/jnigen/lib/src/elements/j_elements.dart new file mode 100644 index 000000000..883786aea --- /dev/null +++ b/pkgs/jnigen/lib/src/elements/j_elements.dart @@ -0,0 +1,85 @@ +// Copyright (c) 2024, 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. + +import 'elements.dart' as ast; + +abstract class Element { + void accept(Visitor visitor); +} + +abstract class Visitor { + void visitClass(ClassDecl c) {} + void visitMethod(Method method) {} + void visitField(Field field) {} +} + +class Classes implements Element { + Classes(this._classes); + final ast.Classes _classes; + + @override + void accept(Visitor visitor) { + for (final value in _classes.decls.values) { + final classDecl = ClassDecl(value); + classDecl.accept(visitor); + } + } + + void let(void Function(dynamic userClasses) param0) {} +} + +class ClassDecl implements Element { + ClassDecl(this._classDecl) : binaryName = _classDecl.binaryName; + final ast.ClassDecl _classDecl; + + // Ex: com.x.Foo. + final String binaryName; + + bool get isExcluded => _classDecl.isExcluded; + set isExcluded(bool value) => _classDecl.isExcluded = value; + + @override + void accept(Visitor visitor) { + visitor.visitClass(this); + if (_classDecl.isExcluded) return; + for (final method in _classDecl.methods) { + Method(method).accept(visitor); + } + for (var field in _classDecl.fields) { + Field(field).accept(visitor); + } + } +} + +class Method implements Element { + Method(this._method); + + final ast.Method _method; + + String get name => _method.name; + + bool get isExcluded => _method.isExcluded; + set isExcluded(bool value) => _method.isExcluded = value; + + @override + void accept(Visitor visitor) { + visitor.visitMethod(this); + } +} + +class Field implements Element { + Field(this._field); + + final ast.Field _field; + + String get name => _field.name; + + bool get isExcluded => _field.isExcluded; + set isExcluded(bool value) => _field.isExcluded = value; + + @override + void accept(Visitor visitor) { + visitor.visitField(this); + } +} diff --git a/pkgs/jnigen/lib/src/generate_bindings.dart b/pkgs/jnigen/lib/src/generate_bindings.dart index 2e237f211..6d185f242 100644 --- a/pkgs/jnigen/lib/src/generate_bindings.dart +++ b/pkgs/jnigen/lib/src/generate_bindings.dart @@ -13,6 +13,7 @@ import 'bindings/linker.dart'; import 'bindings/renamer.dart'; import 'config/config.dart'; import 'elements/elements.dart'; +import 'elements/j_elements.dart' as j_ast; import 'logging/logging.dart'; import 'summary/summary.dart'; import 'tools/tools.dart'; @@ -38,6 +39,9 @@ Future generateJniBindings(Config config) async { log.fatal(e.message); } + final userClasses = j_ast.Classes(classes); + config.visitors?.forEach(userClasses.accept); + classes.accept(Excluder(config)); classes.accept(KotlinProcessor()); await classes.accept(Linker(config)); diff --git a/pkgs/jnigen/test/user_excluder.dart b/pkgs/jnigen/test/user_excluder.dart new file mode 100644 index 000000000..f13adcda4 --- /dev/null +++ b/pkgs/jnigen/test/user_excluder.dart @@ -0,0 +1,86 @@ +// Copyright (c) 2024, 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. + +import 'package:jnigen/src/elements/elements.dart' as ast; +import 'package:jnigen/src/elements/j_elements.dart'; +import 'package:test/test.dart'; + +extension on Iterable { + List get isExcludedValues => map((c) => c.isExcluded).toList(); +} + +extension on Iterable { + List get isExcludedValues => map((c) => c.isExcluded).toList(); +} + +// This is customizable by the user +class UserExcluder extends Visitor { + @override + void visitClass(ClassDecl c) { + if (c.binaryName.contains('y')) { + c.isExcluded = true; + } + } + + @override + void visitMethod(Method method) { + if (method.name == 'Bar') { + method.isExcluded = true; + } + } + + @override + void visitField(Field field) { + if (field.name == 'Bar') { + field.isExcluded = true; + } + } +} + +void main() { + test('Exclude something using the user excluder, Simple AST', () async { + final classes = ast.Classes({ + 'Foo': ast.ClassDecl( + binaryName: 'Foo', + declKind: ast.DeclKind.classKind, + superclass: ast.TypeUsage.object, + methods: [ + ast.Method(name: 'foo', returnType: ast.TypeUsage.object), + ast.Method(name: 'Bar', returnType: ast.TypeUsage.object), + ast.Method(name: 'foo1', returnType: ast.TypeUsage.object), + ast.Method(name: 'Bar', returnType: ast.TypeUsage.object), + ], + fields: [ + ast.Field(name: 'foo', type: ast.TypeUsage.object), + ast.Field(name: 'Bar', type: ast.TypeUsage.object), + ast.Field(name: 'foo1', type: ast.TypeUsage.object), + ast.Field(name: 'Bar', type: ast.TypeUsage.object), + ], + ), + 'y.Foo': ast.ClassDecl( + binaryName: 'y.Foo', + declKind: ast.DeclKind.classKind, + superclass: ast.TypeUsage.object, + methods: [ + ast.Method(name: 'foo', returnType: ast.TypeUsage.object), + ast.Method(name: 'Bar', returnType: ast.TypeUsage.object), + ], + fields: [ + ast.Field(name: 'foo', type: ast.TypeUsage.object), + ast.Field(name: 'Bar', type: ast.TypeUsage.object), + ]), + }); + + final simpleClasses = Classes(classes); + simpleClasses.accept(UserExcluder()); + + expect(classes.decls['y.Foo']?.isExcluded, true); + expect(classes.decls['Foo']?.isExcluded, false); + + expect(classes.decls['Foo']?.fields.isExcludedValues, + [false, true, false, true]); + expect(classes.decls['Foo']?.methods.isExcludedValues, + [false, true, false, true]); + }); +} diff --git a/pkgs/native_assets_builder/CHANGELOG.md b/pkgs/native_assets_builder/CHANGELOG.md index 5ccb227cd..7f60b74ef 100644 --- a/pkgs/native_assets_builder/CHANGELOG.md +++ b/pkgs/native_assets_builder/CHANGELOG.md @@ -1,5 +1,11 @@ ## 0.9.1-wip +- **Breaking change**: Rename `supportedAssetTypes` to `buildAssetTypes`. Hooks + should no longer fail. Instead, the code should fail at runtime if an asset is + missing. This enables (1) code to run if an asset is missing but that code is + not invoked at runtime, and (2) doing fallback implementations in Dart if an + asset is missing. + ## 0.9.0 - Also lock `BuildConfig` and `LinkConfig` `outputDirectoryShared` when invoking diff --git a/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart b/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart index b19c2a47d..ef524724e 100644 --- a/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart +++ b/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart @@ -98,7 +98,7 @@ class NativeAssetsBuildRunner { required Uri workingDirectory, PackageLayout? packageLayout, String? runPackageName, - required List supportedAssetTypes, + required List buildAssetTypes, required bool linkingEnabled, }) async { packageLayout ??= await PackageLayout.fromRootPackageRoot(workingDirectory); @@ -124,7 +124,7 @@ class NativeAssetsBuildRunner { final configBuilder = configCreator() ..setupHookConfig( targetOS: targetOS, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, buildMode: buildMode, packageName: package.name, packageRoot: packageLayout.packageRoot(package.name), @@ -157,7 +157,7 @@ class NativeAssetsBuildRunner { 'Build configuration for ${package.name} contains errors', errors); } - final hookOutput = await _runHookForPackageCached( + final result = await _runHookForPackageCached( Hook.build, config, (config, output) => @@ -167,8 +167,9 @@ class NativeAssetsBuildRunner { null, packageLayout, ); - if (hookOutput == null) return null; - hookResult = hookResult.copyAdd(hookOutput); + if (result == null) return null; + final (hookOutput, hookDeps) = result; + hookResult = hookResult.copyAdd(hookOutput, hookDeps); globalMetadata[package.name] = (hookOutput as BuildOutput).metadata; } @@ -206,7 +207,7 @@ class NativeAssetsBuildRunner { PackageLayout? packageLayout, Uri? resourceIdentifiers, String? runPackageName, - required List supportedAssetTypes, + required List buildAssetTypes, required BuildResult buildResult, }) async { packageLayout ??= await PackageLayout.fromRootPackageRoot(workingDirectory); @@ -224,7 +225,7 @@ class NativeAssetsBuildRunner { final configBuilder = configCreator() ..setupHookConfig( targetOS: targetOS, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, buildMode: buildMode, packageName: package.name, packageRoot: packageLayout.packageRoot(package.name), @@ -259,7 +260,7 @@ class NativeAssetsBuildRunner { 'Link configuration for ${package.name} contains errors', errors); } - final hookOutput = await _runHookForPackageCached( + final result = await _runHookForPackageCached( Hook.link, config, (config, output) => @@ -269,8 +270,9 @@ class NativeAssetsBuildRunner { resourceIdentifiers, packageLayout, ); - if (hookOutput == null) return null; - hookResult = hookResult.copyAdd(hookOutput); + if (result == null) return null; + final (hookOutput, hookDeps) = result; + hookResult = hookResult.copyAdd(hookOutput, hookDeps); } final errors = await applicationAssetValidator(hookResult.encodedAssets); @@ -328,7 +330,7 @@ class NativeAssetsBuildRunner { required bool linkingEnabled, PackageLayout? packageLayout, String? runPackageName, - required List supportedAssetTypes, + required List buildAssetTypes, }) => _runDryRun( targetOS: targetOS, @@ -338,7 +340,7 @@ class NativeAssetsBuildRunner { workingDirectory: workingDirectory, packageLayout: packageLayout, runPackageName: runPackageName, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, linkingEnabled: linkingEnabled, ); @@ -350,7 +352,7 @@ class NativeAssetsBuildRunner { PackageLayout? packageLayout, String? runPackageName, required bool linkingEnabled, - required List supportedAssetTypes, + required List buildAssetTypes, }) async { const hook = Hook.build; @@ -369,7 +371,7 @@ class NativeAssetsBuildRunner { final configBuilder = configCreator(); configBuilder.setupHookConfig( targetOS: targetOS, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, buildMode: null, // not set in dry-run mode packageName: package.name, packageRoot: packageLayout.packageRoot(package.name), @@ -403,18 +405,15 @@ class NativeAssetsBuildRunner { final config = BuildConfig(configBuilder.json); final packageConfigUri = packageLayout.packageConfigUri; - final ( - compileSuccess, - hookKernelFile, - _, - ) = await _compileHookForPackageCached( + final hookCompileResult = await _compileHookForPackageCached( config.packageName, config.outputDirectory, config.packageRoot.resolve('hook/${hook.scriptName}'), packageConfigUri, workingDirectory, ); - if (!compileSuccess) return null; + if (hookCompileResult == null) return null; + final (hookKernelFile, _) = hookCompileResult; // TODO(https://github.com/dart-lang/native/issues/1321): Should dry runs be cached? final buildOutput = await runUnderDirectoriesLock( @@ -437,12 +436,12 @@ class NativeAssetsBuildRunner { ), ); if (buildOutput == null) return null; - hookResult = hookResult.copyAdd(buildOutput); + hookResult = hookResult.copyAdd(buildOutput, [/*dry run is not cached*/]); } return hookResult; } - Future _runHookForPackageCached( + Future<(HookOutput, List)?> _runHookForPackageCached( Hook hook, HookConfig config, _HookValidator validator, @@ -461,20 +460,17 @@ class NativeAssetsBuildRunner { timeout: singleHookTimeout, logger: logger, () async { - final ( - compileSuccess, - hookKernelFile, - hookHashesFile, - ) = await _compileHookForPackageCached( + final hookCompileResult = await _compileHookForPackageCached( config.packageName, config.outputDirectory, config.packageRoot.resolve('hook/${hook.scriptName}'), packageConfigUri, workingDirectory, ); - if (!compileSuccess) { + if (hookCompileResult == null) { return null; } + final (hookKernelFile, hookHashes) = hookCompileResult; final buildOutputFile = File.fromUri(config.outputDirectory.resolve(hook.outputName)); @@ -510,7 +506,7 @@ ${e.message} ); // All build flags go into [outDir]. Therefore we do not have to // check here whether the config is equal. - return output; + return (output, hookHashes.fileSystemEntities); } logger.info( 'Rerunning ${hook.name} for ${config.packageName}' @@ -533,12 +529,13 @@ ${e.message} if (await dependenciesHashFile.exists()) { await dependenciesHashFile.delete(); } + return null; } else { final modifiedDuringBuild = await dependenciesHashes.hashDependencies( [ ...result.dependencies, // Also depend on the hook source code. - hookHashesFile.uri, + hookHashes.file.uri, ], lastModifiedCutoffTime, environment, @@ -547,7 +544,7 @@ ${e.message} logger.severe('File modified during build. Build must be rerun.'); } } - return result; + return (result, hookHashes.fileSystemEntities); }, ); } @@ -685,7 +682,7 @@ ${e.message} /// /// TODO(https://github.com/dart-lang/native/issues/1578): Compile only once /// instead of per config. This requires more locking. - Future<(bool success, File kernelFile, File cacheFile)> + Future<(File kernelFile, DependenciesHashFile cacheFile)?> _compileHookForPackageCached( String packageName, Uri outputDirectory, @@ -721,7 +718,7 @@ ${e.message} } if (!mustCompile) { - return (true, kernelFile, dependenciesHashFile); + return (kernelFile, dependenciesHashes); } final success = await _compileHookForPackage( @@ -733,8 +730,7 @@ ${e.message} depFile, ); if (!success) { - await dependenciesHashFile.delete(); - return (success, kernelFile, dependenciesHashFile); + return null; } final dartSources = await _readDepFile(depFile); @@ -751,19 +747,7 @@ ${e.message} logger.severe('File modified during build. Build must be rerun.'); } - return (success, kernelFile, dependenciesHashFile); - } - - Future> _readDepFile(File depFile) async { - // Format: `path/to/my.dill: path/to/my.dart, path/to/more.dart` - final depFileContents = await depFile.readAsString(); - final dartSources = depFileContents - .trim() - .split(' ') - .skip(1) // ':' - .map(Uri.file) - .toList(); - return dartSources; + return (kernelFile, dependenciesHashes); } Future _compileHookForPackage( @@ -811,6 +795,12 @@ ${compileResult.stdout} ''', ); success = false; + if (await depFile.exists()) { + await depFile.delete(); + } + if (await kernelFile.exists()) { + await kernelFile.delete(); + } } return success; } @@ -927,3 +917,57 @@ ${compileResult.stdout} extension on Uri { Uri get parent => File(toFilePath()).parent.uri; } + +/// Parses depfile contents. +/// +/// Format: `path/to/my.dill: path/to/my.dart, path/to/more.dart` +/// +/// However, the spaces in paths are escaped with backslashes, and the +/// backslashes are escaped with backslashes: +/// +/// ```dart +/// String _escapePath(String path) { +/// return path.replaceAll('\\', '\\\\').replaceAll(' ', '\\ '); +/// } +/// ``` +List parseDepFileInputs(String contents) { + final output = contents.substring(0, contents.indexOf(': ')); + contents = contents.substring(output.length + ': '.length).trim(); + final pathsEscaped = _splitOnNonEscapedSpaces(contents); + return pathsEscaped.map(_unescapeDepsPath).toList(); +} + +String _unescapeDepsPath(String path) => + path.replaceAll(r'\ ', ' ').replaceAll(r'\\', r'\'); + +List _splitOnNonEscapedSpaces(String contents) { + var index = 0; + final result = []; + while (index < contents.length) { + final start = index; + while (index < contents.length) { + final u = contents.codeUnitAt(index); + if (u == ' '.codeUnitAt(0)) { + break; + } + if (u == r'\'.codeUnitAt(0)) { + index++; + if (index == contents.length) { + throw const FormatException('malformed, ending with backslash'); + } + final v = contents.codeUnitAt(index); + assert(v == ' '.codeUnitAt(0) || v == r'\'.codeUnitAt(0)); + } + index++; + } + result.add(contents.substring(start, index)); + index++; + } + return result; +} + +Future> _readDepFile(File depFile) async { + final depFileContents = await depFile.readAsString(); + final dartSources = parseDepFileInputs(depFileContents); + return dartSources.map(Uri.file).toList(); +} diff --git a/pkgs/native_assets_builder/lib/src/dependencies_hash_file/dependencies_hash_file.dart b/pkgs/native_assets_builder/lib/src/dependencies_hash_file/dependencies_hash_file.dart index 2b1c49259..94449bf04 100644 --- a/pkgs/native_assets_builder/lib/src/dependencies_hash_file/dependencies_hash_file.dart +++ b/pkgs/native_assets_builder/lib/src/dependencies_hash_file/dependencies_hash_file.dart @@ -13,19 +13,21 @@ import '../utils/uri.dart'; class DependenciesHashFile { DependenciesHashFile({ - required File file, - }) : _file = file; + required this.file, + }); - final File _file; + final File file; FileSystemHashes _hashes = FileSystemHashes(); + List get fileSystemEntities => _hashes.files.map((e) => e.path).toList(); + Future _readFile() async { - if (!await _file.exists()) { + if (!await file.exists()) { _hashes = FileSystemHashes(); return; } final jsonObject = - (json.decode(utf8.decode(await _file.readAsBytes())) as Map) + (json.decode(utf8.decode(await file.readAsBytes())) as Map) .cast(); _hashes = FileSystemHashes.fromJson(jsonObject); } @@ -70,7 +72,7 @@ class DependenciesHashFile { return modifiedAfterTimeStamp; } - Future _persist() => _file.writeAsString(json.encode(_hashes.toJson())); + Future _persist() => file.writeAsString(json.encode(_hashes.toJson())); /// Reads the file with hashes and reports if there is an outdated file, /// directory or environment variable. diff --git a/pkgs/native_assets_builder/lib/src/model/hook_result.dart b/pkgs/native_assets_builder/lib/src/model/hook_result.dart index 033d635db..655688a19 100644 --- a/pkgs/native_assets_builder/lib/src/model/hook_result.dart +++ b/pkgs/native_assets_builder/lib/src/model/hook_result.dart @@ -39,7 +39,7 @@ final class HookResult implements BuildResult, BuildDryRunResult, LinkResult { dependencies: dependencies ?? [], ); - HookResult copyAdd(HookOutput hookOutput) { + HookResult copyAdd(HookOutput hookOutput, List hookDependencies) { final mergedMaps = mergeMaps( encodedAssetsForLinking, hookOutput is BuildOutput @@ -61,6 +61,7 @@ final class HookResult implements BuildResult, BuildDryRunResult, LinkResult { dependencies: [ ...dependencies, ...hookOutput.dependencies, + ...hookDependencies, ]..sort(_uriCompare), ); } diff --git a/pkgs/native_assets_builder/test/build_runner/build_dependencies_test.dart b/pkgs/native_assets_builder/test/build_runner/build_dependencies_test.dart index fd248d658..a9cce0ba3 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_dependencies_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_dependencies_test.dart @@ -31,7 +31,7 @@ void main() async { logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -50,13 +50,28 @@ void main() async { expect(result.encodedAssets.length, 2); expect( result.dependencies, - [ - tempUri.resolve('native_add/').resolve('src/native_add.c'), - tempUri - .resolve('native_subtract/') - .resolve('src/native_subtract.c'), - ], + containsAll([ + tempUri.resolve('native_add/src/native_add.c'), + tempUri.resolve('native_subtract/src/native_subtract.c'), + if (!Platform.isWindows) ...[ + tempUri.resolve('native_add/hook/build.dart'), + tempUri.resolve('native_subtract/hook/build.dart'), + ], + ]), ); + if (Platform.isWindows) { + expect( + // https://github.com/dart-lang/sdk/issues/59657 + // Deps file on windows sometimes have lowercase drive letters. + // File.exists will work, but Uri equality doesn't. + result.dependencies + .map((e) => Uri.file(e.toFilePath().toLowerCase())), + containsAll([ + tempUri.resolve('native_add/hook/build.dart'), + tempUri.resolve('native_subtract/hook/build.dart'), + ].map((e) => Uri.file(e.toFilePath().toLowerCase()))), + ); + } } }); }); diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_asset_id_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_asset_id_test.dart index b31dd3c4a..1563350df 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_asset_id_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_asset_id_test.dart @@ -27,7 +27,7 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -63,7 +63,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_build_dry_run_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_build_dry_run_test.dart index 6fe8f68a6..caf8e980a 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_build_dry_run_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_build_dry_run_test.dart @@ -28,14 +28,14 @@ void main() async { logger, dartExecutable, linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], buildValidator: validateCodeAssetBuildOutput, ))!; final buildResult = (await build( packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart index 68ddeba44..65f766341 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart @@ -33,7 +33,7 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [], + buildAssetTypes: [], configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_caching_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_caching_test.dart index 851458b14..37055392c 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_caching_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_caching_test.dart @@ -30,7 +30,7 @@ void main() async { logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -44,9 +44,9 @@ void main() async { ); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); } @@ -57,7 +57,7 @@ void main() async { logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -80,9 +80,9 @@ void main() async { ); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); } }); @@ -107,7 +107,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -128,7 +128,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -171,7 +171,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -199,7 +199,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -239,7 +239,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -271,7 +271,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart index 198029f80..17476eac1 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_cycle_test.dart @@ -27,7 +27,7 @@ void main() async { createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, linkingEnabled: false, - supportedAssetTypes: [], + buildAssetTypes: [], buildValidator: (config, output) async => [], ); final fullLog = logMessages.join('\n'); @@ -47,7 +47,7 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [], + buildAssetTypes: [], configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: (_) async => [], diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_failure_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_failure_test.dart index 7b9566828..26059a5a1 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_failure_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_failure_test.dart @@ -28,7 +28,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -39,9 +39,9 @@ void main() async { symbols: ['add']); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); } @@ -56,7 +56,7 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -84,7 +84,7 @@ void main() async { packageUri, logger, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -95,9 +95,9 @@ void main() async { symbols: ['add']); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); } }); @@ -120,7 +120,7 @@ void main() async { logger, capturedLogs: logMessages, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_non_root_package_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_non_root_package_test.dart index 825bbe66a..29381b67c 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_non_root_package_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_non_root_package_test.dart @@ -30,7 +30,7 @@ void main() async { dartExecutable, capturedLogs: logMessages, runPackageName: 'some_dev_dep', - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateDataAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -47,7 +47,7 @@ void main() async { dartExecutable, capturedLogs: logMessages, runPackageName: 'native_add', - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateDataAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -55,9 +55,9 @@ void main() async { expect(result.encodedAssets, isNotEmpty); expect( result.dependencies, - [ + contains( packageUri.resolve('src/native_add.c'), - ], + ), ); expect( logMessages.join('\n'), diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_reusability_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_reusability_test.dart index 2f8d34b45..193784b08 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_reusability_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_reusability_test.dart @@ -38,7 +38,7 @@ void main() async { targetOS: Target.current.os, workingDirectory: packageUri, linkingEnabled: false, - supportedAssetTypes: [], + buildAssetTypes: [], buildValidator: (config, output) async => [], ); await buildRunner.buildDryRun( @@ -46,7 +46,7 @@ void main() async { targetOS: Target.current.os, workingDirectory: packageUri, linkingEnabled: false, - supportedAssetTypes: [], + buildAssetTypes: [], buildValidator: (config, output) async => [], ); await buildRunner.build( @@ -55,7 +55,7 @@ void main() async { buildMode: BuildMode.release, workingDirectory: packageUri, linkingEnabled: false, - supportedAssetTypes: [], + buildAssetTypes: [], configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: (_) async => [], @@ -66,7 +66,7 @@ void main() async { targetOS: OS.current, workingDirectory: packageUri, linkingEnabled: false, - supportedAssetTypes: [], + buildAssetTypes: [], configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: (_) async => [], diff --git a/pkgs/native_assets_builder/test/build_runner/build_runner_test.dart b/pkgs/native_assets_builder/test/build_runner/build_runner_test.dart index 239542042..70df079d1 100644 --- a/pkgs/native_assets_builder/test/build_runner/build_runner_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/build_runner_test.dart @@ -33,7 +33,7 @@ void main() async { dartExecutable, capturedLogs: logMessages, configValidator: validateCodeAssetBuildConfig, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, ))!; @@ -59,7 +59,7 @@ void main() async { dartExecutable, capturedLogs: logMessages, packageLayout: packageLayout, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/concurrency_shared_test_helper.dart b/pkgs/native_assets_builder/test/build_runner/concurrency_shared_test_helper.dart index 7b9e5d5cf..afb2c0fb8 100644 --- a/pkgs/native_assets_builder/test/build_runner/concurrency_shared_test_helper.dart +++ b/pkgs/native_assets_builder/test/build_runner/concurrency_shared_test_helper.dart @@ -25,7 +25,7 @@ void main(List args) async { targetOS: target.os, workingDirectory: packageUri, linkingEnabled: false, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetBuildConfig, buildValidator: (config, output) async => await validateDataAssetBuildOutput(config, output), diff --git a/pkgs/native_assets_builder/test/build_runner/concurrency_test_helper.dart b/pkgs/native_assets_builder/test/build_runner/concurrency_test_helper.dart index 6d3bf6a85..870edec6d 100644 --- a/pkgs/native_assets_builder/test/build_runner/concurrency_test_helper.dart +++ b/pkgs/native_assets_builder/test/build_runner/concurrency_test_helper.dart @@ -36,7 +36,7 @@ void main(List args) async { targetOS: OS.current, workingDirectory: packageUri, linkingEnabled: false, - supportedAssetTypes: [CodeAsset.type, DataAsset.type], + buildAssetTypes: [CodeAsset.type, DataAsset.type], configValidator: (config) async => [ ...await validateDataAssetBuildConfig(config), ...await validateCodeAssetBuildConfig(config), diff --git a/pkgs/native_assets_builder/test/build_runner/conflicting_dylib_test.dart b/pkgs/native_assets_builder/test/build_runner/conflicting_dylib_test.dart index ee0f53b55..2aee76303 100644 --- a/pkgs/native_assets_builder/test/build_runner/conflicting_dylib_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/conflicting_dylib_test.dart @@ -27,7 +27,7 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -58,7 +58,7 @@ void main() async { logger, linkingEnabled: true, dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -69,7 +69,7 @@ void main() async { logger, dartExecutable, buildResult: buildResult, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetLinkConfig, linkValidator: validateCodeAssetLinkOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/fail_on_os_sdk_version_test.dart b/pkgs/native_assets_builder/test/build_runner/fail_on_os_sdk_version_test.dart index f56edf833..072ae2f4d 100644 --- a/pkgs/native_assets_builder/test/build_runner/fail_on_os_sdk_version_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/fail_on_os_sdk_version_test.dart @@ -73,7 +73,7 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type, DataAsset.type], + buildAssetTypes: [CodeAsset.type, DataAsset.type], buildConfigValidator: (config) async => [ ...await validateDataAssetBuildConfig(config), ...await validateCodeAssetBuildConfig(config), diff --git a/pkgs/native_assets_builder/test/build_runner/helpers.dart b/pkgs/native_assets_builder/test/build_runner/helpers.dart index 61f6fa343..f252da7d4 100644 --- a/pkgs/native_assets_builder/test/build_runner/helpers.dart +++ b/pkgs/native_assets_builder/test/build_runner/helpers.dart @@ -46,7 +46,7 @@ Future build( int? targetAndroidNdkApi, Target? target, bool linkingEnabled = false, - required List supportedAssetTypes, + required List buildAssetTypes, }) async { final targetOS = target?.os ?? OS.current; return await runWithLog(capturedLogs, () async { @@ -56,7 +56,7 @@ Future build( ).build( configCreator: () { final configBuilder = BuildConfigBuilder(); - if (supportedAssetTypes.contains(CodeAsset.type)) { + if (buildAssetTypes.contains(CodeAsset.type)) { configBuilder.setupCodeConfig( targetArchitecture: target?.architecture ?? Architecture.current, linkModePreference: linkModePreference, @@ -77,7 +77,7 @@ Future build( packageLayout: packageLayout, runPackageName: runPackageName, linkingEnabled: linkingEnabled, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, buildValidator: buildValidator, applicationAssetValidator: applicationAssetValidator, ); @@ -112,7 +112,7 @@ Future link( int? targetMacOSVersion, int? targetAndroidNdkApi, Target? target, - required List supportedAssetTypes, + required List buildAssetTypes, }) async { final targetOS = target?.os ?? OS.current; return await runWithLog(capturedLogs, () async { @@ -122,7 +122,7 @@ Future link( ).link( configCreator: () { final configBuilder = LinkConfigBuilder(); - if (supportedAssetTypes.contains(CodeAsset.type)) { + if (buildAssetTypes.contains(CodeAsset.type)) { configBuilder.setupCodeConfig( targetArchitecture: target?.architecture ?? Architecture.current, linkModePreference: linkModePreference, @@ -143,7 +143,7 @@ Future link( packageLayout: packageLayout, buildResult: buildResult, resourceIdentifiers: resourceIdentifiers, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, linkValidator: linkValidator, applicationAssetValidator: applicationAssetValidator, ); @@ -176,7 +176,7 @@ Future<(BuildResult?, LinkResult?)> buildAndLink( int? targetAndroidNdkApi, Target? target, Uri? resourceIdentifiers, - required List supportedAssetTypes, + required List buildAssetTypes, }) async => await runWithLog(capturedLogs, () async { final buildRunner = NativeAssetsBuildRunner( @@ -201,7 +201,7 @@ Future<(BuildResult?, LinkResult?)> buildAndLink( packageLayout: packageLayout, runPackageName: runPackageName, linkingEnabled: true, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, buildValidator: buildValidator, applicationAssetValidator: applicationAssetValidator, ); @@ -234,7 +234,7 @@ Future<(BuildResult?, LinkResult?)> buildAndLink( packageLayout: packageLayout, buildResult: buildResult, resourceIdentifiers: resourceIdentifiers, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, linkValidator: linkValidator, applicationAssetValidator: applicationAssetValidator, ); @@ -275,7 +275,7 @@ Future buildDryRun( List? capturedLogs, PackageLayout? packageLayout, required bool linkingEnabled, - required List supportedAssetTypes, + required List buildAssetTypes, }) async => runWithLog(capturedLogs, () async { final result = await NativeAssetsBuildRunner( @@ -291,7 +291,7 @@ Future buildDryRun( workingDirectory: packageUri, packageLayout: packageLayout, linkingEnabled: linkingEnabled, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, buildValidator: buildValidator, ); return result; diff --git a/pkgs/native_assets_builder/test/build_runner/link_caching_test.dart b/pkgs/native_assets_builder/test/build_runner/link_caching_test.dart index ded8c8a2a..e83275b9b 100644 --- a/pkgs/native_assets_builder/test/build_runner/link_caching_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/link_caching_test.dart @@ -34,7 +34,7 @@ void main() async { logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], capturedLogs: logMessages, configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, @@ -49,7 +49,7 @@ void main() async { logger, dartExecutable, buildResult: buildResult, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], capturedLogs: logMessages, configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, diff --git a/pkgs/native_assets_builder/test/build_runner/link_test.dart b/pkgs/native_assets_builder/test/build_runner/link_test.dart index 87967cb49..1ec0046b5 100644 --- a/pkgs/native_assets_builder/test/build_runner/link_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/link_test.dart @@ -31,7 +31,7 @@ void main() async { logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], @@ -43,7 +43,7 @@ void main() async { logger, dartExecutable, buildResult: buildResult, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], @@ -55,7 +55,7 @@ void main() async { logger, dartExecutable, linkingEnabled: false, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], @@ -101,7 +101,7 @@ void main() async { logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], @@ -119,7 +119,7 @@ void main() async { logger, dartExecutable, buildResult: buildResult, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], @@ -148,7 +148,7 @@ void main() async { logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], @@ -163,7 +163,7 @@ void main() async { dartExecutable, buildResult: buildResult, capturedLogs: logMessages, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], @@ -203,7 +203,7 @@ void main() async { logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -218,7 +218,7 @@ void main() async { dartExecutable, buildResult: buildResult, capturedLogs: logMessages, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetLinkConfig, linkValidator: validateCodeAssetLinkOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/metadata_test.dart b/pkgs/native_assets_builder/test/build_runner/metadata_test.dart index 17aa2e5d0..274b88c9c 100644 --- a/pkgs/native_assets_builder/test/build_runner/metadata_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/metadata_test.dart @@ -31,7 +31,7 @@ void main() async { logger, dartExecutable, capturedLogs: logMessages, - supportedAssetTypes: ['foo'], + buildAssetTypes: ['foo'], configValidator: (config) async => [], buildValidator: (config, output) async => [], applicationAssetValidator: (_) async => [], diff --git a/pkgs/native_assets_builder/test/build_runner/packaging_preference_test.dart b/pkgs/native_assets_builder/test/build_runner/packaging_preference_test.dart index 140d7954f..92e60dc01 100644 --- a/pkgs/native_assets_builder/test/build_runner/packaging_preference_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/packaging_preference_test.dart @@ -26,7 +26,7 @@ void main() async { logger, dartExecutable, linkModePreference: LinkModePreference.dynamic, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -37,7 +37,7 @@ void main() async { logger, dartExecutable, linkModePreference: LinkModePreference.preferDynamic, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -48,7 +48,7 @@ void main() async { logger, dartExecutable, linkModePreference: LinkModePreference.static, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, @@ -59,7 +59,7 @@ void main() async { logger, dartExecutable, linkModePreference: LinkModePreference.preferStatic, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/build_runner/parse_dep_file_test.dart b/pkgs/native_assets_builder/test/build_runner/parse_dep_file_test.dart new file mode 100644 index 000000000..02897123e --- /dev/null +++ b/pkgs/native_assets_builder/test/build_runner/parse_dep_file_test.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2023, 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. + +import 'package:native_assets_builder/src/build_runner/build_runner.dart'; +import 'package:test/test.dart'; + +void main() { + test('parseDepFileInputs', () { + expect( + parseDepFileInputs( + r'C:\\Program\ Files\\foo.dill: C:\\Program\ Files\\foo.dart C:\\Program\ Files\\bar.dart', + ), + [ + r'C:\Program Files\foo.dart', + r'C:\Program Files\bar.dart', + ], + ); + }); +} diff --git a/pkgs/native_assets_builder/test/build_runner/resources_test.dart b/pkgs/native_assets_builder/test/build_runner/resources_test.dart index 936c3522c..4d5a87207 100644 --- a/pkgs/native_assets_builder/test/build_runner/resources_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/resources_test.dart @@ -34,7 +34,7 @@ void main() async { logger, dartExecutable, linkingEnabled: true, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetBuildConfig, buildValidator: validateDataAssetBuildOutput, applicationAssetValidator: (_) async => [], @@ -53,7 +53,7 @@ void main() async { dartExecutable, buildResult: buildResult, resourceIdentifiers: resourcesUri, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], configValidator: validateDataAssetLinkConfig, linkValidator: validateDataAssetLinkOutput, applicationAssetValidator: (_) async => [], diff --git a/pkgs/native_assets_builder/test/build_runner/wrong_linker_test.dart b/pkgs/native_assets_builder/test/build_runner/wrong_linker_test.dart index e004fe581..4a1c58d25 100644 --- a/pkgs/native_assets_builder/test/build_runner/wrong_linker_test.dart +++ b/pkgs/native_assets_builder/test/build_runner/wrong_linker_test.dart @@ -27,7 +27,7 @@ void main() async { packageUri, createCapturingLogger(logMessages, level: Level.SEVERE), dartExecutable, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], configValidator: validateCodeAssetBuildConfig, buildValidator: validateCodeAssetBuildOutput, applicationAssetValidator: validateCodeAssetInApplication, diff --git a/pkgs/native_assets_builder/test/test_data/native_dynamic_linking_test.dart b/pkgs/native_assets_builder/test/test_data/native_dynamic_linking_test.dart index 5865d93fb..c105e4552 100644 --- a/pkgs/native_assets_builder/test/test_data/native_dynamic_linking_test.dart +++ b/pkgs/native_assets_builder/test/test_data/native_dynamic_linking_test.dart @@ -37,7 +37,7 @@ void main() async { packageName: name, packageRoot: testPackageUri, targetOS: OS.current, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], buildMode: dryRun ? null : BuildMode.debug) ..setupBuildConfig(dryRun: dryRun, linkingEnabled: false) ..setupBuildRunConfig( diff --git a/pkgs/native_assets_builder/test/test_data/transformer_test.dart b/pkgs/native_assets_builder/test/test_data/transformer_test.dart index acd50699b..67c89eaa1 100644 --- a/pkgs/native_assets_builder/test/test_data/transformer_test.dart +++ b/pkgs/native_assets_builder/test/test_data/transformer_test.dart @@ -50,7 +50,7 @@ void main() async { packageName: packageName, packageRoot: packageUri, targetOS: OS.current, - supportedAssetTypes: [DataAsset.type], + buildAssetTypes: [DataAsset.type], buildMode: BuildMode.debug) ..setupBuildConfig(dryRun: false, linkingEnabled: false) ..setupBuildRunConfig( diff --git a/pkgs/native_assets_builder/test_data/wrong_build_output_3/hook/build.dart b/pkgs/native_assets_builder/test_data/wrong_build_output_3/hook/build.dart index 58666acf2..b53f9c872 100644 --- a/pkgs/native_assets_builder/test_data/wrong_build_output_3/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/wrong_build_output_3/hook/build.dart @@ -22,5 +22,5 @@ const _rightContents = '''{ "encodedAssets": [], "dependencies": [], "metadata": {}, - "version": "1.5.0" + "version": "1.6.0" }'''; diff --git a/pkgs/native_assets_cli/example/build/local_asset/test/build_test.dart b/pkgs/native_assets_cli/example/build/local_asset/test/build_test.dart index a178ff606..8f2ea6180 100644 --- a/pkgs/native_assets_cli/example/build/local_asset/test/build_test.dart +++ b/pkgs/native_assets_cli/example/build/local_asset/test/build_test.dart @@ -18,6 +18,6 @@ void main() async { 'package:local_asset/asset.txt', ); }, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], ); } diff --git a/pkgs/native_assets_cli/lib/src/code_assets/testing.dart b/pkgs/native_assets_cli/lib/src/code_assets/testing.dart index 21f2ad672..7bb8ef9f9 100644 --- a/pkgs/native_assets_cli/lib/src/code_assets/testing.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/testing.dart @@ -25,7 +25,7 @@ Future testCodeBuildHook({ int? targetAndroidNdkApi, CCompilerConfig? cCompiler, LinkModePreference? linkModePreference, - required List supportedAssetTypes, + required List buildAssetTypes, bool? linkingEnabled, }) async { await testBuildHook( @@ -48,7 +48,7 @@ Future testCodeBuildHook({ }, buildMode: buildMode, targetOS: targetOS, - supportedAssetTypes: supportedAssetTypes, + buildAssetTypes: buildAssetTypes, linkingEnabled: linkingEnabled, ); } diff --git a/pkgs/native_assets_cli/lib/src/config.dart b/pkgs/native_assets_cli/lib/src/config.dart index 40da1c770..093a7dcc5 100644 --- a/pkgs/native_assets_cli/lib/src/config.dart +++ b/pkgs/native_assets_cli/lib/src/config.dart @@ -73,12 +73,12 @@ sealed class HookConfig { final BuildMode? _buildMode; /// The asset types that the invoker of this hook supports. - final List supportedAssetTypes; + final List buildAssetTypes; HookConfig(this.json) : version = switch (Version.parse(json.string(_versionKey))) { final Version version => (version.major != latestVersion.major || - version < latestVersion) + version < latestParsableVersion) ? throw FormatException( 'Only compatible versions with $latestVersion are supported ' '(was: $version).') @@ -89,8 +89,9 @@ sealed class HookConfig { packageRoot = json.path(_packageRootConfigKey), packageName = json.string(_packageNameConfigKey), targetOS = OS.fromString(json.string(_targetOSConfigKey)), - supportedAssetTypes = - json.optionalStringList(_supportedAssetTypesKey) ?? const [], + buildAssetTypes = json.optionalStringList(_buildAssetTypesKey) ?? + json.optionalStringList(_supportedAssetTypesKey) ?? + const [], _buildMode = switch (json.optionalString(_buildModeConfigKey)) { String value => BuildMode.fromString(value), null => null, @@ -116,13 +117,14 @@ sealed class HookConfigBuilder { required Uri packageRoot, required String packageName, required OS targetOS, - required List supportedAssetTypes, + required List buildAssetTypes, required BuildMode? buildMode, }) { json[_packageNameConfigKey] = packageName; json[_packageRootConfigKey] = packageRoot.toFilePath(); json[_targetOSConfigKey] = targetOS.toString(); - json[_supportedAssetTypesKey] = supportedAssetTypes; + json[_buildAssetTypesKey] = buildAssetTypes; + json[_supportedAssetTypesKey] = buildAssetTypes; if (buildMode != null) { json[_buildModeConfigKey] = buildMode.toString(); } @@ -164,6 +166,7 @@ const _outDirSharedConfigKey = 'out_dir_shared'; const _packageNameConfigKey = 'package_name'; const _packageRootConfigKey = 'package_root'; const _supportedAssetTypesKey = 'supported_asset_types'; +const _buildAssetTypesKey = 'build_asset_types'; final class BuildConfig extends HookConfig { // TODO(dcharkes): Remove after 3.7.0 stable is released and bump the SDK @@ -301,7 +304,7 @@ sealed class HookOutput { String toString() => const JsonEncoder.withIndent(' ').convert(json); /// The version of [HookOutput]. - static final Version latestVersion = Version(1, 5, 0); + static final Version latestVersion = Version(1, 6, 0); } List _parseDependencies(List? list) { @@ -558,4 +561,7 @@ extension EncodedAssetLinkOutputBuilder on LinkOutputBuilder { } // The latest supported config version. -final latestVersion = Version(1, 5, 0); +final latestVersion = Version(1, 6, 0); + +// The parser can deal with configs down to this version. +final latestParsableVersion = Version(1, 5, 0); diff --git a/pkgs/native_assets_cli/lib/src/model/build_config_CHANGELOG.md b/pkgs/native_assets_cli/lib/src/model/build_config_CHANGELOG.md index f3126361e..c89032d80 100644 --- a/pkgs/native_assets_cli/lib/src/model/build_config_CHANGELOG.md +++ b/pkgs/native_assets_cli/lib/src/model/build_config_CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.6.0 +- `BuildConfig.supportedAssetTypes` renamed to `BuildConfig.buildAssetTypes`. + Compatibility with older SDKs: Look for the old key. Compatibility with older + hooks: Also provide the old hook in the config. - `BuildConfig.outputDirectoryShared` for sharing between hook invocations. Compatibility with older SDKs: Create a sibling dir next to the output directory. This does not facilitate caching, but should not break the hook. diff --git a/pkgs/native_assets_cli/lib/src/validation.dart b/pkgs/native_assets_cli/lib/src/validation.dart index 66b314434..c20edd3fd 100644 --- a/pkgs/native_assets_cli/lib/src/validation.dart +++ b/pkgs/native_assets_cli/lib/src/validation.dart @@ -72,12 +72,12 @@ List _validateOutputAssetTypes( Iterable assets, ) { final errors = []; - final supportedAssetTypes = config.supportedAssetTypes; + final buildAssetTypes = config.buildAssetTypes; for (final asset in assets) { - if (!supportedAssetTypes.contains(asset.type)) { + if (!buildAssetTypes.contains(asset.type)) { final error = 'Asset with type "${asset.type}" is not a supported asset type ' - '(${supportedAssetTypes.join(' ')} are supported)'; + '(${buildAssetTypes.join(' ')} are supported)'; errors.add(error); } } diff --git a/pkgs/native_assets_cli/lib/test.dart b/pkgs/native_assets_cli/lib/test.dart index 26c0ab27b..a9e4c289a 100644 --- a/pkgs/native_assets_cli/lib/test.dart +++ b/pkgs/native_assets_cli/lib/test.dart @@ -24,7 +24,7 @@ Future testBuildHook({ check, BuildMode? buildMode, OS? targetOS, - List? supportedAssetTypes, + List? buildAssetTypes, bool? linkingEnabled, }) async { test( @@ -43,7 +43,7 @@ Future testBuildHook({ packageRoot: Directory.current.uri, packageName: _readPackageNameFromPubspec(), targetOS: targetOS ?? OS.current, - supportedAssetTypes: supportedAssetTypes ?? [], + buildAssetTypes: buildAssetTypes ?? [], buildMode: buildMode ?? BuildMode.release, ) ..setupBuildConfig( diff --git a/pkgs/native_assets_cli/test/api/build_test.dart b/pkgs/native_assets_cli/test/api/build_test.dart index 0504151f4..f43c44e32 100644 --- a/pkgs/native_assets_cli/test/api/build_test.dart +++ b/pkgs/native_assets_cli/test/api/build_test.dart @@ -35,7 +35,7 @@ void main() async { packageRoot: tempUri, packageName: packageName, targetOS: OS.iOS, - supportedAssetTypes: ['foo'], + buildAssetTypes: ['foo'], buildMode: BuildMode.release, ) ..setupBuildConfig( diff --git a/pkgs/native_assets_cli/test/build_config_test.dart b/pkgs/native_assets_cli/test/build_config_test.dart index 6c4b334df..4479eb1d1 100644 --- a/pkgs/native_assets_cli/test/build_config_test.dart +++ b/pkgs/native_assets_cli/test/build_config_test.dart @@ -42,7 +42,7 @@ void main() async { packageRoot: packageRootUri, targetOS: OS.android, buildMode: BuildMode.release, - supportedAssetTypes: ['my-asset-type'], + buildAssetTypes: ['my-asset-type'], ) ..setupBuildConfig( linkingEnabled: false, @@ -56,16 +56,8 @@ void main() async { final config = BuildConfig(configBuilder.json); final expectedConfigJson = { + 'build_asset_types': ['my-asset-type'], 'build_mode': 'release', - 'supported_asset_types': ['my-asset-type'], - 'dry_run': false, - 'linking_enabled': false, - 'out_dir': outDirUri.toFilePath(), - 'out_dir_shared': outputDirectoryShared.toFilePath(), - 'package_name': packageName, - 'package_root': packageRootUri.toFilePath(), - 'target_os': 'android', - 'version': latestVersion.toString(), 'dependency_metadata': { 'bar': { 'key': 'value', @@ -75,6 +67,15 @@ void main() async { 'key': 321, }, }, + 'dry_run': false, + 'linking_enabled': false, + 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'out_dir': outDirUri.toFilePath(), + 'package_name': packageName, + 'package_root': packageRootUri.toFilePath(), + 'supported_asset_types': ['my-asset-type'], + 'target_os': 'android', + 'version': latestVersion.toString(), }; expect(config.json, expectedConfigJson); @@ -87,7 +88,7 @@ void main() async { expect(config.packageRoot, packageRootUri); expect(config.targetOS, OS.android); expect(config.buildMode, BuildMode.release); - expect(config.supportedAssetTypes, ['my-asset-type']); + expect(config.buildAssetTypes, ['my-asset-type']); expect(config.linkingEnabled, false); expect(config.dryRun, false); @@ -101,7 +102,7 @@ void main() async { packageRoot: packageRootUri, targetOS: OS.android, buildMode: null, // not available in dry run - supportedAssetTypes: ['my-asset-type'], + buildAssetTypes: ['my-asset-type'], ) ..setupBuildConfig( linkingEnabled: true, @@ -114,15 +115,16 @@ void main() async { final config = BuildConfig(configBuilder.json); final expectedConfigJson = { + 'build_asset_types': ['my-asset-type'], + 'dependency_metadata': {}, 'dry_run': true, - 'supported_asset_types': ['my-asset-type'], 'linking_enabled': true, - 'out_dir': outDirUri.toFilePath(), 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'out_dir': outDirUri.toFilePath(), 'package_name': packageName, 'package_root': packageRootUri.toFilePath(), + 'supported_asset_types': ['my-asset-type'], 'target_os': 'android', - 'dependency_metadata': {}, 'version': latestVersion.toString(), }; @@ -135,7 +137,7 @@ void main() async { expect(config.packageName, packageName); expect(config.packageRoot, packageRootUri); expect(config.targetOS, OS.android); - expect(config.supportedAssetTypes, ['my-asset-type']); + expect(config.buildAssetTypes, ['my-asset-type']); expect(() => config.buildMode, throwsStateError); expect(config.linkingEnabled, true); @@ -155,7 +157,7 @@ void main() async { 'target_os': 'linux', 'version': version, 'package_name': packageName, - 'supported_asset_types': ['my-asset-type'], + 'build_asset_types': ['my-asset-type'], 'dry_run': true, 'linking_enabled': false, }; @@ -189,7 +191,7 @@ void main() async { 'package_root': packageRootUri.toFilePath(), 'target_os': 'android', 'linking_enabled': true, - 'supported_asset_types': ['my-asset-type'], + 'build_asset_types': ['my-asset-type'], }), throwsA(predicate( (e) => @@ -209,7 +211,7 @@ void main() async { 'target_os': 'android', 'linking_enabled': true, 'build_mode': BuildMode.release.name, - 'supported_asset_types': ['my-asset-type'], + 'build_asset_types': ['my-asset-type'], 'dependency_metadata': { 'bar': {'key': 'value'}, 'foo': [], diff --git a/pkgs/native_assets_cli/test/build_output_test.dart b/pkgs/native_assets_cli/test/build_output_test.dart index d58f1c920..5c7e78e4f 100644 --- a/pkgs/native_assets_cli/test/build_output_test.dart +++ b/pkgs/native_assets_cli/test/build_output_test.dart @@ -49,7 +49,7 @@ void main() { // The JSON format of the build output. { - 'version': '1.5.0', + 'version': '1.6.0', 'dependencies': ['path0', 'path1', 'path2'], 'metadata': { 'meta-a': 'meta-b', diff --git a/pkgs/native_assets_cli/test/checksum_test.dart b/pkgs/native_assets_cli/test/checksum_test.dart index 915950fb4..92740e812 100644 --- a/pkgs/native_assets_cli/test/checksum_test.dart +++ b/pkgs/native_assets_cli/test/checksum_test.dart @@ -24,7 +24,7 @@ void main() { packageRoot: Uri.file('foo'), packageName: packageName, targetOS: os, - supportedAssetTypes: [assetType], + buildAssetTypes: [assetType], buildMode: buildMode, ) ..setupBuildConfig(dryRun: dryRun, linkingEnabled: linking); @@ -44,76 +44,75 @@ void main() { // If format or algorithm for checksumming changes we'd like to know (by // needing to update this list). final expectedChecksums = [ - '05cdbdf4976a68c33e75e6b57781c5f5', - 'c36ad7dc2f0846ed134029edaeb59195', - '7f90e825f08edafe99ac7314d02f46e0', - '82279ed0fb55f7e02b8e6cf857b5a7b9', - '8aa77a554828663ccfdb30d026caf729', - '6a69060c347c20000354bb9e7cca21f5', - 'c0a1cd20d08aa29044af633dec235b36', - '72a098e698316a60e6ca2b67c4de82b1', - '16dc68a85ea9cab4a9d35c77f9d8bc6c', - 'fbb47d28d4db2082f331a6710ae293f6', - 'c557d0bffbf479b85861a648ceda8912', - '7c23bce4887d70915a5d5824142cb75f', - '88d164985687d11445a1bba4c83b299e', - 'e6b3d1a31ea2ea2c37babbf8a52393de', - 'dfe63dab862fa7789f3bf4ad882c87c7', - 'b146d5dfbcb2bfdd295cdd548832d717', - '4267a4d5f5b7e1ae3278e590cab52e48', - '461e627475397d461da3c985e17466ba', - '2e5d01733c132b2801e3068bf008e023', - 'aee031592879b62e8512cc73a064c883', - '439222774886f776f2da9a5c0051310f', - 'a59d7e43b0a9562518863d6379fddd16', - '90a0e05df0f56c8d33b3bdbe7ff785b3', - 'e00db5df53778da8aaecace162d20325', - 'b4f8ef47ab0a43f0760c68d66297f1a8', - '17c758237c24c96e1d92a4681ba2b889', - 'dd6ee4832b2c11d31a2488f671d13e9a', - '7ac636c075bcc1423e80c635fed6de6c', - '427db33751df11daa8dc9809614b66e6', - 'c8d5918f01d365e0d6c2a1d610a47d1d', - '534fce1b658242d7942f3eb6e4ca987d', - '3dcea3a8a52eebea225eacd44ee370f1', - '55fe838d0d2a01e288b3faed2adc7a04', - '80727044903ebea814198f4001fdebf0', - '6198b46894c081193b9209f9ddb66b3d', - '856c0ffe90c97d9629e847ba1b3bbb67', - '3e3d7e551f1392f53d73fd3362693184', - '5244e64af596a46940892b28739737e2', - '8a875dc22c02d815e16f50386d03195d', - '50464749a3288f2d655ccef290835776', - '1982534a5ba2f13f8ed5b4ba38386d8c', - '012e03aad8221afab6200718f7e68fa6', - '9ddaa64eadc3b21ba48d77062a12bee7', - 'f2b802ce9d7c055f721e017db5582312', - 'abc578f0fe5c4a4c43b185a7940d0dd7', - '771cd5ab05e5838cccf4a75cc224f506', - 'd41f53ff6aca0cdd74bbea8b0c26b83e', - '24c8e4535afc18981f7470cbd05a5787', - 'fddca58e36cc89868114bb399bc6cec2', - 'fec6330fac0d3d9316f2f580602fc06a', - '092c7130962283f35d5de02604cc3852', - '130517517742ea571ab39d69f56c87a0', - 'e17135e1be677fb428a761b6c3b5f421', - '510c5b24f5bbd414917c96444ff41df3', - '75993da8d1508dc1e556096da0a7c00f', - 'aad9665f7c2a8e28e99c92a90d0f2168', - 'bab93955a78ab99e6157b1568e4b03d1', - 'f2ad0bb263fd38d9fba3ca9ed5c7c66b', - '7743132a908a48c183a75d8c25635de6', - '3b326f5a0ef295d3109bcf95a63b446e', - 'e0775404b93fadf74f5bce5410854346', - 'd1fd0e95194d8d4bc513666e2067548c', - '0541de11331a9ca647f7cbde69c1abf4', - 'c8c85515946c890e3056f379ca757cfe', + '10d9fce0028fdbb72b5994307ebf227c', + '4116af41354c68fd64b58cb6a308ebbb', + '157fda96bdf938d4fe055180bf4dbabc', + 'c5507af2f5f7e8601710c5c2fffb6188', + '2ab19c5f0f4c8f6c17826f6fabca2e6e', + 'c7c3e28d58191051c70c2748aa1377ef', + 'f81cf883235927d5cca9d510c2446a3a', + '8396b8b2541fe6ee9f39ece6aede06b6', + '9e092722bb54a9bdc6434119786a538c', + 'd2d421c2c497ff6a16bbd43f4ba27152', + '6c45154e7e0be87367fd000a9386aa2a', + '4b1257c34a3de0ce91171eadb84be35f', + '7a9a8d4a6e226dbd08e3c591e379d967', + '996f318e4d30a472358d7f21eb14585b', + '7adf24fb2f2cac19d41f439fed3fa5d8', + '99574fa166e54a5c740d0e85f46bc5af', + '2c592c067f97ed13d900bc2bb8c16f86', + 'e5b8f39328001ed0417e8cd70aad4fa8', + '923b4534ee62e50b596e04aaf1392901', + '4df91b08cd288e9a5069a5fe55c64395', + 'dde8372e52f886b8293f6b691a7b76f1', + 'bfeb49adc617a567671c78936130af4c', + 'de7b54bfd2d9ab26796951592967dca2', + 'f3e73bb91a351c1743e81cd32babf90c', + 'ac98097f3d916d7bde50d9c67b2a8d9e', + 'c87086e206e304191a13baed3f29da9e', + 'c85ced6ed90adc35f0dd03b27486d66e', + 'aed9f8805210068380e2556b1bab0a99', + 'e4314b23825c872590bbb384c1072cb8', + '3f9b69de7a31c609a4b6ec125adcaca5', + '0102baa7f1f5071aefa90a18179d0d7d', + '40f84eefd62ff9062b78b655ad3ee6b1', + '723e2805985a094838464d4ab4e0af7d', + 'f5ca710868b73059ce61ded27bd0faac', + '1b0e1ad58ff192d204ca9750505b2d55', + 'a2def75febdaa8a332fc588ee3ef8014', + '59a936e9e646387fcf322a794b753b54', + '8f5945499965afcb5d6eebf30bbacb77', + '4ed56caadaf9079c96dcec668624bf2a', + '0f2a4864df014a824034f9e29ed48ee8', + '0aed524d105e71a3bfd432ade52ed132', + '6ba03bd61a4d8979fcd64e5b6ae245b6', + 'cd70cfa54dad2b6859d5c1d23b83b074', + '2aa7bf1eda6a6fb1bf3edaadcbb9a804', + 'b6fd8e4dc466f8aa1b758134d454b191', + '22c71b4626f3f59463e1276afccfd2fb', + '70ff946f65f2d46be9b323d45e4edf0e', + '7862c709b255bde8debb5ee06ddbcd74', + 'b948929ac5fd276c69ab9f76e5b280f0', + 'aa479a711b010893b3bfb46d68028ed7', + '74c9bf5365c62bd9655f7b773b5e5113', + 'bc6224160b985a2c338f414899eed664', + '78ec380b3257d8b4ca35006e922978bd', + 'c0656028d1e11a2b6cd972464e23cd30', + '11b75baa322bd7cb1362852fc4238a0e', + '6eff070403ac6171ff42fdfbdc1a36ea', + '9d026a26c3788e9d2606ee0c5e0e0e10', + '2dcc623fce0dfc380761b9e2f396d955', + '9ce27557bb269768d25b5f1bd8ffdfa4', + 'e9b1c4c9511c02c64c2112dc16924598', + 'b38af392d228d193ba3d3943d7bb189a', + 'ab5753aa337cf91a224fe89e53173324', + 'a99ffcf470d3b570fed923bbf7257d37', + '630d35827f0193efbb1b439d792ebe23', ]; + printOnFailure('final expectedChecksums = ['); + printOnFailure(checksums.map((e) => " '$e',").join('\n')); + printOnFailure('];'); for (var i = 0; i < checksums.length; ++i) { - if (checksums[i] != expectedChecksums[i]) { - print('Expected ${expectedChecksums[i]} but was ${checksums[i]}'); - print('Config:\n${configs[i]}'); - } expect(checksums[i], expectedChecksums[i]); } }); diff --git a/pkgs/native_assets_cli/test/code_assets/config_test.dart b/pkgs/native_assets_cli/test/code_assets/config_test.dart index 35618b1f9..cb63f5916 100644 --- a/pkgs/native_assets_cli/test/code_assets/config_test.dart +++ b/pkgs/native_assets_cli/test/code_assets/config_test.dart @@ -46,7 +46,7 @@ void main() async { void expectCorrectCodeConfigDryRun( Map json, CodeConfig codeConfig) { { - 'supported_asset_types': [CodeAsset.type], + 'build_asset_types': [CodeAsset.type], 'link_mode_preference': 'prefer-static', }.forEach((k, v) { expect(json[k], v); @@ -63,7 +63,7 @@ void main() async { void expectCorrectCodeConfig( Map json, CodeConfig codeConfig) { { - 'supported_asset_types': [CodeAsset.type], + 'build_asset_types': [CodeAsset.type], 'link_mode_preference': 'prefer-static', 'target_android_ndk_api': 30, 'target_architecture': 'arm64', @@ -93,7 +93,7 @@ void main() async { packageRoot: packageRootUri, targetOS: OS.android, buildMode: null, // not available in dry run - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], ) ..setupBuildConfig( linkingEnabled: true, @@ -119,7 +119,7 @@ void main() async { packageRoot: packageRootUri, targetOS: OS.android, buildMode: BuildMode.release, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], ) ..setupBuildConfig( linkingEnabled: false, @@ -152,7 +152,7 @@ void main() async { packageRoot: packageRootUri, targetOS: OS.android, buildMode: BuildMode.release, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], ) ..setupLinkConfig(assets: assets) ..setupLinkRunConfig( @@ -190,7 +190,7 @@ void main() async { 'target_android_ndk_api': 30, 'target_architecture': 'invalid_architecture', 'target_os': 'android', - 'supported_asset_types': ['my-asset-type'], + 'build_asset_types': ['my-asset-type'], 'version': latestVersion.toString(), }; expect( @@ -201,7 +201,7 @@ void main() async { test('LinkConfig.codeConfig: invalid architecture', () { final config = { - 'supported_asset_types': [CodeAsset.type], + 'build_asset_types': [CodeAsset.type], 'build_mode': 'release', 'dry_run': false, 'link_mode_preference': 'prefer-static', diff --git a/pkgs/native_assets_cli/test/code_assets/validation_test.dart b/pkgs/native_assets_cli/test/code_assets/validation_test.dart index f2ad1c173..7bcbe225a 100644 --- a/pkgs/native_assets_cli/test/code_assets/validation_test.dart +++ b/pkgs/native_assets_cli/test/code_assets/validation_test.dart @@ -36,7 +36,7 @@ void main() { packageRoot: tempUri, targetOS: os, buildMode: BuildMode.release, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], ) ..setupBuildConfig( linkingEnabled: false, diff --git a/pkgs/native_assets_cli/test/data_assets/validation_test.dart b/pkgs/native_assets_cli/test/data_assets/validation_test.dart index c3f5fcd01..45712ddf1 100644 --- a/pkgs/native_assets_cli/test/data_assets/validation_test.dart +++ b/pkgs/native_assets_cli/test/data_assets/validation_test.dart @@ -36,7 +36,7 @@ void main() { packageRoot: tempUri, targetOS: OS.iOS, buildMode: BuildMode.release, - supportedAssetTypes: [DataAsset.type]) + buildAssetTypes: [DataAsset.type]) ..setupBuildConfig( linkingEnabled: false, dryRun: false, diff --git a/pkgs/native_assets_cli/test/example/local_asset_test.dart b/pkgs/native_assets_cli/test/example/local_asset_test.dart index 591d6a3e3..96207c559 100644 --- a/pkgs/native_assets_cli/test/example/local_asset_test.dart +++ b/pkgs/native_assets_cli/test/example/local_asset_test.dart @@ -45,7 +45,7 @@ void main() async { packageRoot: testPackageUri, packageName: name, targetOS: OS.current, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], buildMode: dryRun ? null : BuildMode.debug) ..setupBuildRunConfig( outputDirectory: outputDirectory, diff --git a/pkgs/native_assets_cli/test/example/native_add_library_test.dart b/pkgs/native_assets_cli/test/example/native_add_library_test.dart index 3e85e84db..c2df4cea6 100644 --- a/pkgs/native_assets_cli/test/example/native_add_library_test.dart +++ b/pkgs/native_assets_cli/test/example/native_add_library_test.dart @@ -45,7 +45,7 @@ void main() async { packageRoot: testPackageUri, packageName: name, targetOS: OS.current, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], buildMode: dryRun ? null : BuildMode.debug) ..setupBuildRunConfig( outputDirectory: outputDirectory, diff --git a/pkgs/native_assets_cli/test/example/native_dynamic_linking_test.dart b/pkgs/native_assets_cli/test/example/native_dynamic_linking_test.dart index a20306a4f..a721b058f 100644 --- a/pkgs/native_assets_cli/test/example/native_dynamic_linking_test.dart +++ b/pkgs/native_assets_cli/test/example/native_dynamic_linking_test.dart @@ -54,7 +54,7 @@ void main() async { packageRoot: testPackageUri, packageName: name, targetOS: OS.current, - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], buildMode: dryRun ? null : BuildMode.debug) ..setupBuildRunConfig( outputDirectory: outputDirectory, diff --git a/pkgs/native_assets_cli/test/link_config_test.dart b/pkgs/native_assets_cli/test/link_config_test.dart index 16d394d32..7ce676bc0 100644 --- a/pkgs/native_assets_cli/test/link_config_test.dart +++ b/pkgs/native_assets_cli/test/link_config_test.dart @@ -35,7 +35,7 @@ void main() async { packageRoot: packageRootUri, targetOS: OS.android, buildMode: BuildMode.release, - supportedAssetTypes: ['asset-type-1', 'asset-type-2'], + buildAssetTypes: ['asset-type-1', 'asset-type-2'], ) ..setupLinkConfig(assets: assets) ..setupLinkRunConfig( @@ -46,15 +46,16 @@ void main() async { final config = LinkConfig(configBuilder.json); final expectedConfigJson = { + 'assets': [for (final asset in assets) asset.toJson()], + 'build_asset_types': ['asset-type-1', 'asset-type-2'], 'build_mode': 'release', - 'supported_asset_types': ['asset-type-1', 'asset-type-2'], - 'out_dir': outDirUri.toFilePath(), 'out_dir_shared': outputDirectoryShared.toFilePath(), + 'out_dir': outDirUri.toFilePath(), 'package_name': packageName, 'package_root': packageRootUri.toFilePath(), + 'supported_asset_types': ['asset-type-1', 'asset-type-2'], 'target_os': 'android', 'version': latestVersion.toString(), - 'assets': [for (final asset in assets) asset.toJson()], }; expect(config.json, expectedConfigJson); expect(json.decode(config.toString()), expectedConfigJson); @@ -66,7 +67,7 @@ void main() async { expect(config.packageRoot, packageRootUri); expect(config.targetOS, OS.android); expect(config.buildMode, BuildMode.release); - expect(config.supportedAssetTypes, ['asset-type-1', 'asset-type-2']); + expect(config.buildAssetTypes, ['asset-type-1', 'asset-type-2']); expect(config.encodedAssets, assets); }); @@ -82,7 +83,7 @@ void main() async { 'target_os': 'linux', 'version': version, 'package_name': packageName, - 'supported_asset_types': ['my-asset-type'], + 'build_asset_types': ['my-asset-type'], 'dry_run': true, }; expect( @@ -108,7 +109,7 @@ void main() async { expect( () => LinkConfig({ 'version': latestVersion.toString(), - 'supported_asset_types': ['my-asset-type'], + 'build_asset_types': ['my-asset-type'], 'package_name': packageName, 'package_root': packageRootUri.toFilePath(), 'target_os': 'android', @@ -125,7 +126,7 @@ void main() async { expect( () => LinkConfig({ 'version': latestVersion.toString(), - 'supported_asset_types': ['my-asset-type'], + 'build_asset_types': ['my-asset-type'], 'out_dir': outDirUri.toFilePath(), 'out_dir_shared': outputDirectoryShared.toFilePath(), 'package_name': packageName, diff --git a/pkgs/native_assets_cli/test/link_output_test.dart b/pkgs/native_assets_cli/test/link_output_test.dart index adb5e80a3..5d3a7d74d 100644 --- a/pkgs/native_assets_cli/test/link_output_test.dart +++ b/pkgs/native_assets_cli/test/link_output_test.dart @@ -35,7 +35,7 @@ void main() { // The JSON format of the link output. { - 'version': '1.5.0', + 'version': '1.6.0', 'dependencies': ['path0', 'path1', 'path2'], 'assets': [ {'a-0': 'v-0', 'type': 'my-asset-type'}, diff --git a/pkgs/native_assets_cli/test/validation_test.dart b/pkgs/native_assets_cli/test/validation_test.dart index aa291d020..a64e2f635 100644 --- a/pkgs/native_assets_cli/test/validation_test.dart +++ b/pkgs/native_assets_cli/test/validation_test.dart @@ -36,7 +36,7 @@ void main() { packageRoot: tempUri, targetOS: OS.iOS, buildMode: BuildMode.release, - supportedAssetTypes: ['my-asset-type'], + buildAssetTypes: ['my-asset-type'], ) ..setupBuildConfig( linkingEnabled: false, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_build_failure_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_build_failure_test.dart index 778471a6e..f9648e9f4 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_build_failure_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_build_failure_test.dart @@ -31,7 +31,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_android_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_android_test.dart index f785bbfbc..a2c64cbda 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_android_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_android_test.dart @@ -146,7 +146,7 @@ Future buildLib( await Directory.fromUri(tempUriShared).create(); final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.android, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_ios_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_ios_test.dart index ad765d690..7456f37d2 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_ios_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_ios_test.dart @@ -72,7 +72,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.iOS, @@ -230,7 +230,7 @@ Future buildLib( final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.iOS, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_linux_host_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_linux_host_test.dart index 5e2e4a74a..7b58957eb 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_linux_host_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_linux_host_test.dart @@ -44,7 +44,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.linux, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart index a698efb0d..5e89ca115 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart @@ -59,7 +59,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.macOS, @@ -160,7 +160,7 @@ Future buildLib( final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.macOS, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart index 6058db4e5..b256b9c5a 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_windows_host_test.dart @@ -63,7 +63,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.windows, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart index 1b5630650..3906383e7 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart @@ -45,7 +45,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, @@ -127,7 +127,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, @@ -228,7 +228,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, @@ -295,7 +295,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, @@ -351,7 +351,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, @@ -419,7 +419,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, @@ -492,7 +492,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, @@ -573,7 +573,7 @@ Future testDefines({ final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, diff --git a/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart b/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart index bac97bd79..1ee88a7ac 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart @@ -43,7 +43,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: 'dummy', packageRoot: tempUri, targetOS: OS.current, @@ -83,7 +83,7 @@ void main() { final tempUri2 = await tempDirForTest(); final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: 'dummy', packageRoot: tempUri, targetOS: OS.windows, diff --git a/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart b/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart index c6ebc852e..0027cbd93 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart @@ -37,7 +37,7 @@ void main() { final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: OS.current, diff --git a/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart b/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart index c9eb1ee86..a01c949b8 100644 --- a/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart +++ b/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart @@ -27,7 +27,7 @@ Future buildTestArchive( final buildConfigBuilder = BuildConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: name, packageRoot: tempUri, targetOS: os, diff --git a/pkgs/native_toolchain_c/test/clinker/objects_test.dart b/pkgs/native_toolchain_c/test/clinker/objects_test.dart index ff98f7009..b4f17841f 100644 --- a/pkgs/native_toolchain_c/test/clinker/objects_test.dart +++ b/pkgs/native_toolchain_c/test/clinker/objects_test.dart @@ -33,7 +33,7 @@ Future main() async { final linkConfigBuilder = LinkConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: 'testpackage', packageRoot: tempUri, targetOS: os, diff --git a/pkgs/native_toolchain_c/test/clinker/throws_test.dart b/pkgs/native_toolchain_c/test/clinker/throws_test.dart index e6aa79d0f..7370cbe91 100644 --- a/pkgs/native_toolchain_c/test/clinker/throws_test.dart +++ b/pkgs/native_toolchain_c/test/clinker/throws_test.dart @@ -24,7 +24,7 @@ Future main() async { final linkConfigBuilder = LinkConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: 'testpackage', packageRoot: tempUri, targetOS: os, diff --git a/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart b/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart index 945940166..7862b4ff1 100644 --- a/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart +++ b/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart @@ -63,7 +63,7 @@ Future runTests(List architectures) async { final linkConfigBuilder = LinkConfigBuilder() ..setupHookConfig( - supportedAssetTypes: [CodeAsset.type], + buildAssetTypes: [CodeAsset.type], packageName: 'testpackage', packageRoot: tempUri, targetOS: os,