From 00aae9e073b652a2f2a8f0ca3197a23a10b4b996 Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Tue, 10 Dec 2024 21:44:18 +0100 Subject: [PATCH] [native_assets_cli] Move `BuildMode` to [native_toolchain_c] (#1800) The first in a series of refactorings to address: * https://github.com/dart-lang/native/issues/1738 We align `BuildMode` with `OptimizationLevel`, it's configured by the hook author in the build hook. Likely, every package should ship with max optimization level and build mode set to release. Only while developing a package (when it is the root package or path-depsed in) would the build mode be set to debug. This will require a manual roll into dartdev and flutter tools due to the removal of `BuildMode` from the `native_assets_builder` API. The native assets builder will still emit the field in the JSON, until we can bump the `native_assets_cli` SDK constraint to 3.7 stable. Then only people with older versions of the `native_assets_cli` package but a newer SDK break. --- .../lib/src/build_runner/build_runner.dart | 4 - .../build_runner_reusability_test.dart | 2 - .../concurrency_shared_test_helper.dart | 1 - .../build_runner/concurrency_test_helper.dart | 1 - .../test/build_runner/helpers.dart | 4 - .../native_dynamic_linking_test.dart | 15 +- .../test/test_data/transformer_test.dart | 15 +- .../native_dynamic_linking/hook/build.dart | 3 + pkgs/native_assets_cli/CHANGELOG.md | 4 + pkgs/native_assets_cli/lib/code_assets.dart | 1 - .../lib/native_assets_cli.dart | 1 - .../lib/src/code_assets/testing.dart | 2 - pkgs/native_assets_cli/lib/src/config.dart | 34 ++--- .../lib/src/model/build_config_CHANGELOG.md | 5 + pkgs/native_assets_cli/lib/test.dart | 2 - .../test/api/build_test.dart | 1 - .../test/build_config_test.dart | 5 - .../native_assets_cli/test/checksum_test.dart | 130 +++++++----------- .../test/code_assets/config_test.dart | 5 - .../test/code_assets/validation_test.dart | 1 - .../test/data_assets/validation_test.dart | 1 - .../test/example/local_asset_test.dart | 10 +- .../test/example/native_add_library_test.dart | 10 +- .../example/native_dynamic_linking_test.dart | 1 - .../test/link_config_test.dart | 3 - .../test/validation_test.dart | 1 - .../lib/native_toolchain_c.dart | 1 + .../lib/src/cbuilder}/build_mode.dart | 0 .../lib/src/cbuilder/cbuilder.dart | 10 +- .../cbuilder/cbuilder_build_failure_test.dart | 2 +- .../cbuilder/cbuilder_cross_android_test.dart | 2 +- .../cbuilder/cbuilder_cross_ios_test.dart | 4 +- .../cbuilder_cross_linux_host_test.dart | 2 +- .../cbuilder_cross_macos_host_test.dart | 4 +- .../cbuilder_cross_windows_host_test.dart | 2 +- .../test/cbuilder/cbuilder_test.dart | 18 +-- .../test/cbuilder/compiler_resolver_test.dart | 2 - .../test/cbuilder/objective_c_test.dart | 2 +- .../test/clinker/build_testfiles.dart | 2 +- .../test/clinker/objects_test.dart | 1 - .../test/clinker/throws_test.dart | 1 - .../test/clinker/treeshake_helper.dart | 2 - 42 files changed, 122 insertions(+), 195 deletions(-) rename pkgs/{native_assets_cli/lib/src => native_toolchain_c/lib/src/cbuilder}/build_mode.dart (100%) 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 3fccab6c1..b3a20931f 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 @@ -93,7 +93,6 @@ class NativeAssetsBuildRunner { required BuildValidator buildValidator, required ApplicationAssetValidator applicationAssetValidator, required OS targetOS, - required BuildMode buildMode, required Uri workingDirectory, PackageLayout? packageLayout, String? runPackageName, @@ -124,7 +123,6 @@ class NativeAssetsBuildRunner { ..setupHookConfig( targetOS: targetOS, buildAssetTypes: buildAssetTypes, - buildMode: buildMode, packageName: package.name, packageRoot: packageLayout.packageRoot(package.name), ) @@ -200,7 +198,6 @@ class NativeAssetsBuildRunner { required LinkConfigValidator configValidator, required LinkValidator linkValidator, required OS targetOS, - required BuildMode buildMode, required Uri workingDirectory, required ApplicationAssetValidator applicationAssetValidator, PackageLayout? packageLayout, @@ -225,7 +222,6 @@ class NativeAssetsBuildRunner { ..setupHookConfig( targetOS: targetOS, buildAssetTypes: buildAssetTypes, - buildMode: buildMode, packageName: package.name, packageRoot: packageLayout.packageRoot(package.name), ); 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 548276f29..d279a12ae 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 @@ -36,7 +36,6 @@ void main() async { await buildRunner.build( configCreator: configCreator, targetOS: OS.current, - buildMode: BuildMode.release, workingDirectory: packageUri, linkingEnabled: false, buildAssetTypes: [], @@ -46,7 +45,6 @@ void main() async { ); await buildRunner.build( configCreator: configCreator, - buildMode: BuildMode.release, targetOS: OS.current, workingDirectory: packageUri, linkingEnabled: false, 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 afb2c0fb8..e741bfa13 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 @@ -21,7 +21,6 @@ void main(List args) async { dartExecutable: dartExecutable, ).build( configCreator: BuildConfigBuilder.new, - buildMode: BuildMode.release, targetOS: target.os, workingDirectory: packageUri, linkingEnabled: false, 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 870edec6d..9a680232b 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 @@ -32,7 +32,6 @@ void main(List args) async { cCompilerConfig: dartCICompilerConfig, targetMacOSVersion: OS.current == OS.macOS ? defaultMacOSVersion : null, ), - buildMode: BuildMode.release, targetOS: OS.current, workingDirectory: packageUri, linkingEnabled: false, diff --git a/pkgs/native_assets_builder/test/build_runner/helpers.dart b/pkgs/native_assets_builder/test/build_runner/helpers.dart index 56a54c445..275ec9c9a 100644 --- a/pkgs/native_assets_builder/test/build_runner/helpers.dart +++ b/pkgs/native_assets_builder/test/build_runner/helpers.dart @@ -71,7 +71,6 @@ Future build( return configBuilder; }, configValidator: configValidator, - buildMode: BuildMode.release, targetOS: targetOS, workingDirectory: packageUri, packageLayout: packageLayout, @@ -137,7 +136,6 @@ Future link( return configBuilder; }, configValidator: configValidator, - buildMode: BuildMode.release, targetOS: target?.os ?? OS.current, workingDirectory: packageUri, packageLayout: packageLayout, @@ -195,7 +193,6 @@ Future<(BuildResult?, LinkResult?)> buildAndLink( targetAndroidNdkApi: targetAndroidNdkApi, ), configValidator: buildConfigValidator, - buildMode: BuildMode.release, targetOS: target?.os ?? OS.current, workingDirectory: packageUri, packageLayout: packageLayout, @@ -228,7 +225,6 @@ Future<(BuildResult?, LinkResult?)> buildAndLink( targetAndroidNdkApi: targetAndroidNdkApi, ), configValidator: linkConfigValidator, - buildMode: BuildMode.release, targetOS: target?.os ?? OS.current, workingDirectory: packageUri, packageLayout: packageLayout, 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 eacf9e375..a2b167d12 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 @@ -32,15 +32,16 @@ void main() async { final configBuilder = BuildConfigBuilder() ..setupHookConfig( - packageName: name, - packageRoot: testPackageUri, - targetOS: OS.current, - buildAssetTypes: [CodeAsset.type], - buildMode: BuildMode.debug) + packageName: name, + packageRoot: testPackageUri, + targetOS: OS.current, + buildAssetTypes: [CodeAsset.type], + ) ..setupBuildConfig(dryRun: false, linkingEnabled: false) ..setupBuildRunConfig( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared) + outputDirectory: outputDirectory, + outputDirectoryShared: outputDirectoryShared, + ) ..setupCodeConfig( targetArchitecture: Architecture.current, linkModePreference: LinkModePreference.dynamic, 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 67c89eaa1..c965e136d 100644 --- a/pkgs/native_assets_builder/test/test_data/transformer_test.dart +++ b/pkgs/native_assets_builder/test/test_data/transformer_test.dart @@ -47,15 +47,16 @@ void main() async { Future runBuild(Architecture architecture) async { final configBuilder = BuildConfigBuilder() ..setupHookConfig( - packageName: packageName, - packageRoot: packageUri, - targetOS: OS.current, - buildAssetTypes: [DataAsset.type], - buildMode: BuildMode.debug) + packageName: packageName, + packageRoot: packageUri, + targetOS: OS.current, + buildAssetTypes: [DataAsset.type], + ) ..setupBuildConfig(dryRun: false, linkingEnabled: false) ..setupBuildRunConfig( - outputDirectory: outputDirectory, - outputDirectoryShared: outputDirectoryShared) + outputDirectory: outputDirectory, + outputDirectoryShared: outputDirectoryShared, + ) ..setupCodeConfig( targetArchitecture: architecture, linkModePreference: LinkModePreference.dynamic, diff --git a/pkgs/native_assets_builder/test_data/native_dynamic_linking/hook/build.dart b/pkgs/native_assets_builder/test_data/native_dynamic_linking/hook/build.dart index 0713eab62..ee718dfcb 100644 --- a/pkgs/native_assets_builder/test_data/native_dynamic_linking/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/native_dynamic_linking/hook/build.dart @@ -19,6 +19,7 @@ void main(List args) async { sources: [ 'src/debug.c', ], + buildMode: BuildMode.debug, ), CBuilder.library( name: 'math', @@ -27,6 +28,7 @@ void main(List args) async { 'src/math.c', ], libraries: ['debug'], + buildMode: BuildMode.debug, ), CBuilder.library( name: 'add', @@ -35,6 +37,7 @@ void main(List args) async { 'src/add.c', ], libraries: ['math'], + buildMode: BuildMode.debug, ) ]; diff --git a/pkgs/native_assets_cli/CHANGELOG.md b/pkgs/native_assets_cli/CHANGELOG.md index 3b7baec21..03e05bb5f 100644 --- a/pkgs/native_assets_cli/CHANGELOG.md +++ b/pkgs/native_assets_cli/CHANGELOG.md @@ -5,6 +5,10 @@ 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. +- **Breaking change** Move `BuildMode` to `package:native_toolchain_c`. This way + it can be controlled in the build hook together with the `OptimizationLevel`. + Most likely, every package should ship with `release`. `BuildMode.debug` + should only be used while developing the package locally. - Update pubspec.yaml of examples to use 0.9.0 of `package:native_assets_cli`. - Consolidate [CodeAsset] specific things into `lib/src/code_assets/*` diff --git a/pkgs/native_assets_cli/lib/code_assets.dart b/pkgs/native_assets_cli/lib/code_assets.dart index c6637cecf..0e84016a7 100644 --- a/pkgs/native_assets_cli/lib/code_assets.dart +++ b/pkgs/native_assets_cli/lib/code_assets.dart @@ -10,7 +10,6 @@ export 'native_assets_cli.dart' EncodedAsset, EncodedAssetBuildOutputBuilder, EncodedAssetLinkOutputBuilder; -export 'src/build_mode.dart' show BuildMode; export 'src/code_assets/architecture.dart' show Architecture; export 'src/code_assets/c_compiler_config.dart' show CCompilerConfig; export 'src/code_assets/code_asset.dart' show CodeAsset, OSLibraryNaming; diff --git a/pkgs/native_assets_cli/lib/native_assets_cli.dart b/pkgs/native_assets_cli/lib/native_assets_cli.dart index f1ef16f3d..a484fe804 100644 --- a/pkgs/native_assets_cli/lib/native_assets_cli.dart +++ b/pkgs/native_assets_cli/lib/native_assets_cli.dart @@ -10,7 +10,6 @@ export 'src/api/build.dart' show build; export 'src/api/builder.dart' show Builder; export 'src/api/link.dart' show link; export 'src/api/linker.dart' show Linker; -export 'src/build_mode.dart' show BuildMode; export 'src/config.dart' show BuildConfig, 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 7bb8ef9f9..01a8a8c2d 100644 --- a/pkgs/native_assets_cli/lib/src/code_assets/testing.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/testing.dart @@ -16,7 +16,6 @@ Future testCodeBuildHook({ // ignore: inference_failure_on_function_return_type required Function(List arguments) mainMethod, required FutureOr Function(BuildConfig, BuildOutput) check, - BuildMode? buildMode, Architecture? targetArchitecture, OS? targetOS, IOSSdk? targetIOSSdk, @@ -46,7 +45,6 @@ Future testCodeBuildHook({ expect(await validateCodeAssetBuildOutput(config, output), isEmpty); await check(config, output); }, - buildMode: buildMode, targetOS: targetOS, 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 093a7dcc5..27d66de18 100644 --- a/pkgs/native_assets_cli/lib/src/config.dart +++ b/pkgs/native_assets_cli/lib/src/config.dart @@ -9,7 +9,6 @@ import 'package:crypto/crypto.dart' show sha256; import 'package:pub_semver/pub_semver.dart'; import 'api/deprecation_messages.dart'; -import 'build_mode.dart'; import 'code_assets/architecture.dart'; import 'encoded_asset.dart'; import 'json_utils.dart'; @@ -65,13 +64,6 @@ sealed class HookConfig { /// The operating system being compiled for. final OS targetOS; - /// The [BuildMode] that the code should be compiled in. - /// - /// Currently [BuildMode.debug] and [BuildMode.release] are the only modes. - /// - /// Not available during a dry run. - final BuildMode? _buildMode; - /// The asset types that the invoker of this hook supports. final List buildAssetTypes; @@ -91,18 +83,7 @@ sealed class HookConfig { targetOS = OS.fromString(json.string(_targetOSConfigKey)), buildAssetTypes = json.optionalStringList(_buildAssetTypesKey) ?? json.optionalStringList(_supportedAssetTypesKey) ?? - const [], - _buildMode = switch (json.optionalString(_buildModeConfigKey)) { - String value => BuildMode.fromString(value), - null => null, - }; - - BuildMode get buildMode { - if (_buildMode == null) { - throw StateError('Build mode should not be accessed in dry-run mode.'); - } - return _buildMode; - } + const []; @override String toString() => const JsonEncoder.withIndent(' ').convert(json); @@ -118,16 +99,12 @@ sealed class HookConfigBuilder { required String packageName, required OS targetOS, required List buildAssetTypes, - required BuildMode? buildMode, }) { json[_packageNameConfigKey] = packageName; json[_packageRootConfigKey] = packageRoot.toFilePath(); json[_targetOSConfigKey] = targetOS.toString(); json[_buildAssetTypesKey] = buildAssetTypes; json[_supportedAssetTypesKey] = buildAssetTypes; - if (buildMode != null) { - json[_buildModeConfigKey] = buildMode.toString(); - } } /// Constructs a checksum for a [BuildConfig]. @@ -159,7 +136,8 @@ sealed class HookConfigBuilder { } const _targetOSConfigKey = 'target_os'; -const _buildModeConfigKey = 'build_mode'; +// TODO: Bump min-SDK constraint to 3.7 and remove once stable. +const _buildModeConfigKeyDeprecated = 'build_mode'; const _metadataConfigKey = 'metadata'; const _outDirConfigKey = 'out_dir'; const _outDirSharedConfigKey = 'out_dir_shared'; @@ -207,6 +185,10 @@ final class BuildConfigBuilder extends HookConfigBuilder { json[_dependencyMetadataKey] = { for (final key in metadata.keys) key: metadata[key]!.toJson(), }; + // TODO: Bump min-SDK constraint to 3.7 and remove once stable. + if (!dryRun) { + json[_buildModeConfigKeyDeprecated] = 'release'; + } } void setupBuildRunConfig({ @@ -237,6 +219,8 @@ final class LinkConfigBuilder extends HookConfigBuilder { required List assets, }) { json[_assetsKey] = [for (final asset in assets) asset.toJson()]; + // TODO: Bump min-SDK constraint to 3.7 and remove once stable. + json[_buildModeConfigKeyDeprecated] = 'release'; } void setupLinkRunConfig({ 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 c89032d80..77c5947e0 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 @@ -7,6 +7,11 @@ Compatibility with older SDKs: Create a sibling dir next to the output directory. This does not facilitate caching, but should not break the hook. Compatibility with older hooks: These will not read this field. +- `BuildConfig.buildMode` is removed. Instead it is specified by hook writers + in the `CBuilder` constructors. + Compatibility with older SDKs: The new hooks will not read the field. + Compatibility with older hooks: The field is now always passed as 'release' + until we can bump the SDK constraint in `package:native_assets_cli`. ## 1.5.0 diff --git a/pkgs/native_assets_cli/lib/test.dart b/pkgs/native_assets_cli/lib/test.dart index a9e4c289a..3f23d35bc 100644 --- a/pkgs/native_assets_cli/lib/test.dart +++ b/pkgs/native_assets_cli/lib/test.dart @@ -22,7 +22,6 @@ Future testBuildHook({ required FutureOr Function(List arguments) mainMethod, required FutureOr Function(BuildConfig config, BuildOutput output) check, - BuildMode? buildMode, OS? targetOS, List? buildAssetTypes, bool? linkingEnabled, @@ -44,7 +43,6 @@ Future testBuildHook({ packageName: _readPackageNameFromPubspec(), targetOS: targetOS ?? OS.current, buildAssetTypes: buildAssetTypes ?? [], - buildMode: buildMode ?? BuildMode.release, ) ..setupBuildConfig( dryRun: false, diff --git a/pkgs/native_assets_cli/test/api/build_test.dart b/pkgs/native_assets_cli/test/api/build_test.dart index f43c44e32..b10d9adb1 100644 --- a/pkgs/native_assets_cli/test/api/build_test.dart +++ b/pkgs/native_assets_cli/test/api/build_test.dart @@ -36,7 +36,6 @@ void main() async { packageName: packageName, targetOS: OS.iOS, buildAssetTypes: ['foo'], - buildMode: BuildMode.release, ) ..setupBuildConfig( dryRun: false, diff --git a/pkgs/native_assets_cli/test/build_config_test.dart b/pkgs/native_assets_cli/test/build_config_test.dart index 4479eb1d1..61fdf685a 100644 --- a/pkgs/native_assets_cli/test/build_config_test.dart +++ b/pkgs/native_assets_cli/test/build_config_test.dart @@ -41,7 +41,6 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetOS: OS.android, - buildMode: BuildMode.release, buildAssetTypes: ['my-asset-type'], ) ..setupBuildConfig( @@ -87,7 +86,6 @@ void main() async { expect(config.packageName, packageName); expect(config.packageRoot, packageRootUri); expect(config.targetOS, OS.android); - expect(config.buildMode, BuildMode.release); expect(config.buildAssetTypes, ['my-asset-type']); expect(config.linkingEnabled, false); @@ -101,7 +99,6 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetOS: OS.android, - buildMode: null, // not available in dry run buildAssetTypes: ['my-asset-type'], ) ..setupBuildConfig( @@ -138,7 +135,6 @@ void main() async { expect(config.packageRoot, packageRootUri); expect(config.targetOS, OS.android); expect(config.buildAssetTypes, ['my-asset-type']); - expect(() => config.buildMode, throwsStateError); expect(config.linkingEnabled, true); expect(config.dryRun, true); @@ -210,7 +206,6 @@ void main() async { 'package_root': packageRootUri.toFilePath(), 'target_os': 'android', 'linking_enabled': true, - 'build_mode': BuildMode.release.name, 'build_asset_types': ['my-asset-type'], 'dependency_metadata': { 'bar': {'key': 'value'}, diff --git a/pkgs/native_assets_cli/test/checksum_test.dart b/pkgs/native_assets_cli/test/checksum_test.dart index 92740e812..aee34b710 100644 --- a/pkgs/native_assets_cli/test/checksum_test.dart +++ b/pkgs/native_assets_cli/test/checksum_test.dart @@ -14,24 +14,21 @@ void main() { final configs = []; final checksums = []; for (final os in [OS.linux, OS.macOS]) { - for (final buildMode in [BuildMode.release, BuildMode.debug]) { - for (final packageName in ['foo', 'bar']) { - for (final assetType in [CodeAsset.type, DataAsset.type]) { - for (final dryRun in [true, false]) { - for (final linking in [true, false]) { - final builder = BuildConfigBuilder() - ..setupHookConfig( - packageRoot: Uri.file('foo'), - packageName: packageName, - targetOS: os, - buildAssetTypes: [assetType], - buildMode: buildMode, - ) - ..setupBuildConfig(dryRun: dryRun, linkingEnabled: linking); - configs.add( - const JsonEncoder.withIndent(' ').convert(builder.json)); - checksums.add(builder.computeChecksum()); - } + for (final packageName in ['foo', 'bar']) { + for (final assetType in [CodeAsset.type, DataAsset.type]) { + for (final dryRun in [true, false]) { + for (final linking in [true, false]) { + final builder = BuildConfigBuilder() + ..setupHookConfig( + packageRoot: Uri.file('foo'), + packageName: packageName, + targetOS: os, + buildAssetTypes: [assetType], + ) + ..setupBuildConfig(dryRun: dryRun, linkingEnabled: linking); + configs + .add(const JsonEncoder.withIndent(' ').convert(builder.json)); + checksums.add(builder.computeChecksum()); } } } @@ -43,71 +40,40 @@ void main() { // If format or algorithm for checksumming changes we'd like to know (by // needing to update this list). + final expectedChecksums = [ - '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', + '4cfa5fbd14f8d73d04014ee5b453b000', + '365e989ba01bac43d654981fec67205d', + '2191c07f18b5ef13999eb6f8356ae02e', + '257890f33b84d191746a378fb0db4eba', + 'c22d663cde074a6722c2d5253b8e0619', + 'f520e2f4fd0f2fd76da0c6c18db9559b', + '7cc71dd803c24a424db70444002df999', + 'a5774f32e91551e8dfdcc3f63e45f3ed', + '0f361f3a5072f66f68eb4d7a7e4b92d6', + '5cc8e330ea24c647a1dbf2d82497c73c', + '97b5dbdf7a76cf5839de3bd0cac63b6d', + 'ccc846104ddc0dbd700190638b756435', + '0fca1f77969d6e24602cf44c28695c2b', + '683be025644ff73c5eba9d1f99f9808c', + '7a6982964efcf50507669706e31bdab5', + 'd2b17c98c64e750d8bd2ed5beb907401', + 'de3ac273831822414783f0d72acf9d82', + '09c17c21bd277ea2709c35205a2fdfa6', + 'f07b3399888444bc2b7fa837c0c1dddb', + '6e92bc3271d65229793d8bd1ed4e00be', + 'd353ae01cf04e201180edf8c5e4dac37', + '25044b641a83b33860cf8f79154652bb', + 'afc5e24300cf70245146148111b8a746', + '8023595c2343952c02e2aa47f6ee809f', + '226d39440aa5380bbcf71fb9a804a4b0', + '26cab023910889c0c96cbba2bb04ad97', + '32bea1c49326ae259fe97a6fc7b1e08d', + 'a0cccc3aa7069efc86a84b0299dba682', + '28280ef1dfe5e5922eb97577e8a85c40', + '69595125d5987c952355903deaa87684', + 'b5328455769192919339d0e6158d728d', + 'ed827ce888b9929ba83e04af8d5b7a37', ]; printOnFailure('final expectedChecksums = ['); printOnFailure(checksums.map((e) => " '$e',").join('\n')); 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 cb63f5916..b205e5b40 100644 --- a/pkgs/native_assets_cli/test/code_assets/config_test.dart +++ b/pkgs/native_assets_cli/test/code_assets/config_test.dart @@ -92,7 +92,6 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetOS: OS.android, - buildMode: null, // not available in dry run buildAssetTypes: [CodeAsset.type], ) ..setupBuildConfig( @@ -118,7 +117,6 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetOS: OS.android, - buildMode: BuildMode.release, buildAssetTypes: [CodeAsset.type], ) ..setupBuildConfig( @@ -151,7 +149,6 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetOS: OS.android, - buildMode: BuildMode.release, buildAssetTypes: [CodeAsset.type], ) ..setupLinkConfig(assets: assets) @@ -179,7 +176,6 @@ void main() async { test('BuildConfig.codeConfig: invalid architecture', () { final config = { - 'build_mode': 'release', 'dry_run': false, 'linking_enabled': false, 'link_mode_preference': 'prefer-static', @@ -202,7 +198,6 @@ void main() async { test('LinkConfig.codeConfig: invalid architecture', () { final config = { 'build_asset_types': [CodeAsset.type], - 'build_mode': 'release', 'dry_run': false, 'link_mode_preference': 'prefer-static', 'out_dir': outDirUri.toFilePath(), 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 7bcbe225a..4365f1712 100644 --- a/pkgs/native_assets_cli/test/code_assets/validation_test.dart +++ b/pkgs/native_assets_cli/test/code_assets/validation_test.dart @@ -35,7 +35,6 @@ void main() { packageName: packageName, packageRoot: tempUri, targetOS: os, - buildMode: BuildMode.release, buildAssetTypes: [CodeAsset.type], ) ..setupBuildConfig( 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 45712ddf1..422b2e6c9 100644 --- a/pkgs/native_assets_cli/test/data_assets/validation_test.dart +++ b/pkgs/native_assets_cli/test/data_assets/validation_test.dart @@ -35,7 +35,6 @@ void main() { packageName: packageName, packageRoot: tempUri, targetOS: OS.iOS, - buildMode: BuildMode.release, buildAssetTypes: [DataAsset.type]) ..setupBuildConfig( linkingEnabled: 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 96207c559..5c9de1312 100644 --- a/pkgs/native_assets_cli/test/example/local_asset_test.dart +++ b/pkgs/native_assets_cli/test/example/local_asset_test.dart @@ -42,11 +42,11 @@ void main() async { final configBuilder = BuildConfigBuilder() ..setupHookConfig( - packageRoot: testPackageUri, - packageName: name, - targetOS: OS.current, - buildAssetTypes: [CodeAsset.type], - buildMode: dryRun ? null : BuildMode.debug) + packageRoot: testPackageUri, + packageName: name, + targetOS: OS.current, + buildAssetTypes: [CodeAsset.type], + ) ..setupBuildRunConfig( outputDirectory: outputDirectory, outputDirectoryShared: outputDirectoryShared) 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 c2df4cea6..3d9c9b14c 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 @@ -42,11 +42,11 @@ void main() async { final configBuilder = BuildConfigBuilder() ..setupHookConfig( - packageRoot: testPackageUri, - packageName: name, - targetOS: OS.current, - buildAssetTypes: [CodeAsset.type], - buildMode: dryRun ? null : BuildMode.debug) + packageRoot: testPackageUri, + packageName: name, + targetOS: OS.current, + buildAssetTypes: [CodeAsset.type], + ) ..setupBuildRunConfig( outputDirectory: outputDirectory, outputDirectoryShared: outputDirectoryShared) 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 b70e28274..64b3f50de 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 @@ -50,7 +50,6 @@ void main() async { packageName: name, targetOS: OS.current, 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 7ce676bc0..dc87cc772 100644 --- a/pkgs/native_assets_cli/test/link_config_test.dart +++ b/pkgs/native_assets_cli/test/link_config_test.dart @@ -34,7 +34,6 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetOS: OS.android, - buildMode: BuildMode.release, buildAssetTypes: ['asset-type-1', 'asset-type-2'], ) ..setupLinkConfig(assets: assets) @@ -66,7 +65,6 @@ void main() async { expect(config.packageName, packageName); expect(config.packageRoot, packageRootUri); expect(config.targetOS, OS.android); - expect(config.buildMode, BuildMode.release); expect(config.buildAssetTypes, ['asset-type-1', 'asset-type-2']); expect(config.encodedAssets, assets); }); @@ -132,7 +130,6 @@ void main() async { 'package_name': packageName, 'package_root': packageRootUri.toFilePath(), 'target_os': 'android', - 'build_mode': BuildMode.release.name, 'assets': 'astring', }), throwsA(predicate( diff --git a/pkgs/native_assets_cli/test/validation_test.dart b/pkgs/native_assets_cli/test/validation_test.dart index a64e2f635..8a45a1b96 100644 --- a/pkgs/native_assets_cli/test/validation_test.dart +++ b/pkgs/native_assets_cli/test/validation_test.dart @@ -35,7 +35,6 @@ void main() { packageName: packageName, packageRoot: tempUri, targetOS: OS.iOS, - buildMode: BuildMode.release, buildAssetTypes: ['my-asset-type'], ) ..setupBuildConfig( diff --git a/pkgs/native_toolchain_c/lib/native_toolchain_c.dart b/pkgs/native_toolchain_c/lib/native_toolchain_c.dart index 2d4580f1d..4efdfa5fd 100644 --- a/pkgs/native_toolchain_c/lib/native_toolchain_c.dart +++ b/pkgs/native_toolchain_c/lib/native_toolchain_c.dart @@ -5,6 +5,7 @@ /// A library to invoke the native C compiler installed on the host machine. library; +export 'src/cbuilder/build_mode.dart'; export 'src/cbuilder/cbuilder.dart' show CBuilder; export 'src/cbuilder/clinker.dart' show CLinker; export 'src/cbuilder/language.dart' show Language; diff --git a/pkgs/native_assets_cli/lib/src/build_mode.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/build_mode.dart similarity index 100% rename from pkgs/native_assets_cli/lib/src/build_mode.dart rename to pkgs/native_toolchain_c/lib/src/cbuilder/build_mode.dart diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart index 8e99e7ebc..9fda6b34f 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart @@ -8,6 +8,7 @@ import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; import 'package:native_assets_cli/code_assets_builder.dart'; +import 'build_mode.dart'; import 'ctool.dart'; import 'language.dart'; import 'linkmode.dart'; @@ -47,6 +48,8 @@ class CBuilder extends CTool implements Builder { /// Defaults to `true`. final bool ndebugDefine; + final BuildMode buildMode; + CBuilder.library({ required super.name, super.assetName, @@ -71,6 +74,7 @@ class CBuilder extends CTool implements Builder { super.cppLinkStdLib, super.linkModePreference, super.optimizationLevel = OptimizationLevel.o3, + this.buildMode = BuildMode.release, }) : super(type: OutputType.library); CBuilder.executable({ @@ -94,6 +98,7 @@ class CBuilder extends CTool implements Builder { super.language = Language.c, super.cppLinkStdLib, super.optimizationLevel = OptimizationLevel.o3, + this.buildMode = BuildMode.release, }) : super( type: OutputType.executable, assetName: null, @@ -164,9 +169,8 @@ class CBuilder extends CTool implements Builder { flags: flags, defines: { ...defines, - if (buildModeDefine) config.buildMode.name.toUpperCase(): null, - if (ndebugDefine && config.buildMode != BuildMode.debug) - 'NDEBUG': null, + if (buildModeDefine) buildMode.name.toUpperCase(): null, + if (ndebugDefine && buildMode != BuildMode.debug) 'NDEBUG': null, }, pic: pic, std: std, 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 f9648e9f4..164dde262 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 @@ -35,7 +35,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -58,6 +57,7 @@ void main() { sources: [addCUri.toFilePath()], name: name, assetName: name, + buildMode: BuildMode.release, ); expect( () => cbuilder.run( 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 a2c64cbda..6b3002c75 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 @@ -150,7 +150,6 @@ Future buildLib( packageName: name, packageRoot: tempUri, targetOS: OS.android, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -177,6 +176,7 @@ Future buildLib( assetName: name, sources: [addCUri.toFilePath()], flags: flags, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, 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 7456f37d2..29e78e72f 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 @@ -76,7 +76,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.iOS, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -105,6 +104,7 @@ void main() { installName: installName, language: language, optimizationLevel: optimizationLevel, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -234,7 +234,6 @@ Future buildLib( packageName: name, packageRoot: tempUri, targetOS: OS.iOS, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -261,6 +260,7 @@ Future buildLib( name: name, assetName: name, sources: [addCUri.toFilePath()], + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, 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 7b58957eb..c39d398d0 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 @@ -48,7 +48,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.linux, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -74,6 +73,7 @@ void main() { assetName: name, sources: [addCUri.toFilePath()], optimizationLevel: optimizationLevel, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, 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 5e89ca115..129c8bec3 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 @@ -63,7 +63,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.macOS, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -89,6 +88,7 @@ void main() { sources: [sourceUri.toFilePath()], language: language, optimizationLevel: optimizationLevel, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -164,7 +164,6 @@ Future buildLib( packageName: name, packageRoot: tempUri, targetOS: OS.macOS, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -190,6 +189,7 @@ Future buildLib( name: name, assetName: name, sources: [addCUri.toFilePath()], + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, 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 b256b9c5a..6c9532653 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 @@ -67,7 +67,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.windows, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -93,6 +92,7 @@ void main() { assetName: name, sources: [addCUri.toFilePath()], optimizationLevel: optimizationLevel, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart index d076c7fd9..4b0a30793 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart @@ -49,7 +49,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: buildMode, ) ..setupBuildConfig( linkingEnabled: false, @@ -73,6 +72,7 @@ void main() { name: name, sources: [helloWorldCUri.toFilePath()], pie: pic, + buildMode: buildMode, ); await cbuilder.run( config: buildConfig, @@ -131,7 +131,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -154,6 +153,7 @@ void main() { name: name, assetName: name, pic: pic, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -232,7 +232,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -260,6 +259,7 @@ void main() { name: name, sources: [definesCUri.toFilePath()], flags: [flag], + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -299,7 +299,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -323,6 +322,7 @@ void main() { assetName: name, includes: [includeDirectoryUri.toFilePath()], sources: [includesCUri.toFilePath()], + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -355,7 +355,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -384,6 +383,7 @@ void main() { name: name, assetName: name, std: std, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -423,7 +423,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -453,6 +452,7 @@ void main() { name: name, sources: [helloWorldCppUri.toFilePath()], language: Language.cpp, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, @@ -496,7 +496,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -520,6 +519,7 @@ void main() { sources: [helloWorldCppUri.toFilePath()], language: Language.cpp, cppLinkStdLib: 'stdc++', + buildMode: BuildMode.release, ); if (buildConfig.targetOS == OS.windows) { @@ -580,7 +580,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -604,6 +603,7 @@ void main() { assetName: 'debug', includes: [dynamicallyLinkedSrcUri.toFilePath()], sources: [debugCUri.toFilePath()], + buildMode: BuildMode.release, ); await debugBuilder.run( @@ -681,7 +681,6 @@ Future testDefines({ packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: buildMode, ) ..setupBuildConfig( linkingEnabled: false, @@ -709,6 +708,7 @@ Future testDefines({ }, buildModeDefine: buildModeDefine, ndebugDefine: ndebugDefine, + buildMode: buildMode, ); await cbuilder.run( config: buildConfig, 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 1ee88a7ac..b4c1ddf01 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart @@ -47,7 +47,6 @@ void main() { packageName: 'dummy', packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -87,7 +86,6 @@ void main() { packageName: 'dummy', packageRoot: tempUri, targetOS: OS.windows, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, 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 0027cbd93..23f8fe9ca 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/objective_c_test.dart @@ -41,7 +41,6 @@ void main() { packageName: name, packageRoot: tempUri, targetOS: OS.current, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -65,6 +64,7 @@ void main() { assetName: name, sources: [addMUri.toFilePath()], language: Language.objectiveC, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart b/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart index a01c949b8..fe183eb09 100644 --- a/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart +++ b/pkgs/native_toolchain_c/test/clinker/build_testfiles.dart @@ -31,7 +31,6 @@ Future buildTestArchive( packageName: name, packageRoot: tempUri, targetOS: os, - buildMode: BuildMode.release, ) ..setupBuildConfig( linkingEnabled: false, @@ -55,6 +54,7 @@ Future buildTestArchive( assetName: '', sources: [test1Uri.toFilePath(), test2Uri.toFilePath()], linkModePreference: LinkModePreference.static, + buildMode: BuildMode.release, ); await cbuilder.run( config: buildConfig, diff --git a/pkgs/native_toolchain_c/test/clinker/objects_test.dart b/pkgs/native_toolchain_c/test/clinker/objects_test.dart index b4f17841f..d080e984a 100644 --- a/pkgs/native_toolchain_c/test/clinker/objects_test.dart +++ b/pkgs/native_toolchain_c/test/clinker/objects_test.dart @@ -37,7 +37,6 @@ Future main() async { packageName: 'testpackage', packageRoot: tempUri, targetOS: os, - buildMode: BuildMode.debug, ) ..setupLinkConfig( assets: [], diff --git a/pkgs/native_toolchain_c/test/clinker/throws_test.dart b/pkgs/native_toolchain_c/test/clinker/throws_test.dart index 7370cbe91..149f09001 100644 --- a/pkgs/native_toolchain_c/test/clinker/throws_test.dart +++ b/pkgs/native_toolchain_c/test/clinker/throws_test.dart @@ -28,7 +28,6 @@ Future main() async { packageName: 'testpackage', packageRoot: tempUri, targetOS: os, - buildMode: BuildMode.debug, ) ..setupLinkConfig( assets: [], diff --git a/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart b/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart index 7862b4ff1..322d9ba04 100644 --- a/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart +++ b/pkgs/native_toolchain_c/test/clinker/treeshake_helper.dart @@ -67,8 +67,6 @@ Future runTests(List architectures) async { packageName: 'testpackage', packageRoot: tempUri, targetOS: os, - buildMode: BuildMode.release, - //outputDirectoryShared: tempUri2, ) ..setupLinkConfig( assets: [],