From 7ac882f9354d249c77a1b6eb6d7063becdd4f4ad Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Wed, 21 Feb 2024 19:11:24 +0100 Subject: [PATCH] Use Dart casing `targetOs` -> `targetOS` --- .../lib/src/build_runner/build_runner.dart | 14 +++--- .../build_runner_reusability_test.dart | 4 +- .../test/build_runner/helpers.dart | 2 +- .../example/local_asset/build.dart | 2 +- pkgs/native_assets_cli/lib/src/api/build.dart | 2 +- .../lib/src/api/build_config.dart | 14 +++--- .../lib/src/api/ios_sdk.dart | 4 +- .../lib/src/helpers/asset_downloader.dart | 4 +- .../lib/src/model/build_config.dart | 30 ++++++------ .../lib/src/model/c_code_asset.dart | 2 +- .../lib/src/model/ios_sdk.dart | 4 +- .../lib/src/model/target.dart | 2 +- .../test/api/build_config_test.dart | 18 ++++---- .../test/api/build_test.dart | 4 +- .../test/model/build_config_test.dart | 46 +++++++++---------- .../test/model/build_output_test.dart | 2 +- .../test/model/target_test.dart | 6 +-- .../lib/src/cbuilder/cbuilder.dart | 8 ++-- .../lib/src/cbuilder/compiler_resolver.dart | 24 +++++----- .../lib/src/cbuilder/run_cbuilder.dart | 22 ++++----- .../cbuilder/cbuilder_build_failure_test.dart | 2 +- .../cbuilder/cbuilder_cross_android_test.dart | 2 +- .../cbuilder/cbuilder_cross_ios_test.dart | 6 +-- .../cbuilder_cross_linux_host_test.dart | 2 +- .../cbuilder_cross_macos_host_test.dart | 2 +- .../cbuilder_cross_windows_host_test.dart | 2 +- .../test/cbuilder/cbuilder_test.dart | 30 ++++++------ .../test/cbuilder/compiler_resolver_test.dart | 4 +- 28 files changed, 132 insertions(+), 132 deletions(-) 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 c513c14e8..38125d5d2 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 @@ -133,7 +133,7 @@ class NativeAssetsBuildRunner { /// [runPackageName] are built. Future dryRun({ required LinkModePreferenceImpl linkModePreference, - required OSImpl targetOs, + required OSImpl targetOS, required Uri workingDirectory, required bool includeParentEnvironment, PackageLayout? packageLayout, @@ -169,7 +169,7 @@ class NativeAssetsBuildRunner { final config = await _cliConfigDryRun( packageName: package.name, packageRoot: packageLayout.packageRoot(package.name), - targetOs: targetOs, + targetOS: targetOS, linkMode: linkModePreference, buildParentDir: packageLayout.dartToolNativeAssetsBuilder, ); @@ -353,7 +353,7 @@ build_output.yaml contained a format error. final buildDirName = BuildConfigImpl.checksum( packageName: packageName, packageRoot: packageRoot, - targetOs: target.os, + targetOS: target.os, targetArchitecture: target.architecture, buildMode: buildMode, linkModePreference: linkMode, @@ -372,7 +372,7 @@ build_output.yaml contained a format error. outDir: outDirUri, packageName: packageName, packageRoot: packageRoot, - targetOs: target.os, + targetOS: target.os, targetArchitecture: target.architecture, buildMode: buildMode, linkModePreference: linkMode, @@ -386,11 +386,11 @@ build_output.yaml contained a format error. static Future _cliConfigDryRun({ required String packageName, required Uri packageRoot, - required OSImpl targetOs, + required OSImpl targetOS, required LinkModePreferenceImpl linkMode, required Uri buildParentDir, }) async { - final buildDirName = 'dry_run_${targetOs}_$linkMode'; + final buildDirName = 'dry_run_${targetOS}_$linkMode'; final outDirUri = buildParentDir.resolve('$buildDirName/out/'); final outDir = Directory.fromUri(outDirUri); if (!await outDir.exists()) { @@ -400,7 +400,7 @@ build_output.yaml contained a format error. outDir: outDirUri, packageName: packageName, packageRoot: packageRoot, - targetOs: targetOs, + targetOS: targetOS, linkModePreference: linkMode, ); } 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 57a955227..c7e84e926 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 @@ -29,13 +29,13 @@ void main() async { ); await buildRunner.dryRun( - targetOs: Target.current.os, + targetOS: Target.current.os, linkModePreference: LinkModePreferenceImpl.dynamic, workingDirectory: packageUri, includeParentEnvironment: true, ); await buildRunner.dryRun( - targetOs: Target.current.os, + targetOS: Target.current.os, linkModePreference: LinkModePreferenceImpl.dynamic, workingDirectory: packageUri, includeParentEnvironment: true, diff --git a/pkgs/native_assets_builder/test/build_runner/helpers.dart b/pkgs/native_assets_builder/test/build_runner/helpers.dart index 5b4a9254d..e830af761 100644 --- a/pkgs/native_assets_builder/test/build_runner/helpers.dart +++ b/pkgs/native_assets_builder/test/build_runner/helpers.dart @@ -92,7 +92,7 @@ Future dryRun( dartExecutable: dartExecutable, ).dryRun( linkModePreference: linkModePreference, - targetOs: Target.current.os, + targetOS: Target.current.os, workingDirectory: packageUri, includeParentEnvironment: includeParentEnvironment, packageLayout: packageLayout, diff --git a/pkgs/native_assets_cli/example/local_asset/build.dart b/pkgs/native_assets_cli/example/local_asset/build.dart index 014f8c9b0..1af40c190 100644 --- a/pkgs/native_assets_cli/example/local_asset/build.dart +++ b/pkgs/native_assets_cli/example/local_asset/build.dart @@ -36,7 +36,7 @@ void main(List args) async { id: 'library:$packageName/asset.txt', file: assetPath, linkMode: LinkMode.dynamic, - os: config.targetOs, + os: config.targetOS, architecture: config.targetArchitecture, dynamicLoading: BundledDylib(), ), diff --git a/pkgs/native_assets_cli/lib/src/api/build.dart b/pkgs/native_assets_cli/lib/src/api/build.dart index 0379fa92c..febd1ea50 100644 --- a/pkgs/native_assets_cli/lib/src/api/build.dart +++ b/pkgs/native_assets_cli/lib/src/api/build.dart @@ -72,7 +72,7 @@ import 'build_output.dart'; /// id: 'library:$packageName/asset.txt', /// file: assetPath, /// linkMode: LinkMode.dynamic, -/// os: config.targetOs, +/// os: config.targetOS, /// architecture: config.targetArchitecture, /// dynamicLoading: BundledDylib(), /// ), diff --git a/pkgs/native_assets_cli/lib/src/api/build_config.dart b/pkgs/native_assets_cli/lib/src/api/build_config.dart index 770dabb90..b612f6733 100644 --- a/pkgs/native_assets_cli/lib/src/api/build_config.dart +++ b/pkgs/native_assets_cli/lib/src/api/build_config.dart @@ -51,11 +51,11 @@ abstract final class BuildConfig { Architecture? get targetArchitecture; /// The operating system being compiled for. - OS get targetOs; + OS get targetOS; /// When compiling for iOS, whether to target device or simulator. /// - /// Required when [targetOs] equals [OS.iOS]. + /// Required when [targetOS] equals [OS.iOS]. /// /// Not available during a [dryRun]. IOSSdk? get targetIOSSdk; @@ -63,7 +63,7 @@ abstract final class BuildConfig { /// When compiling for Android, the minimum Android SDK API version to that /// the compiled code will be compatible with. /// - /// Required when [targetOs] equals [OS.android]. + /// Required when [targetOS] equals [OS.android]. /// /// Not available during a [dryRun]. /// @@ -149,7 +149,7 @@ abstract final class BuildConfig { required Uri packageRoot, required BuildMode buildMode, required Architecture targetArchitecture, - required OS targetOs, + required OS targetOS, IOSSdk? targetIOSSdk, int? targetAndroidNdkApi, CCompilerConfig? cCompiler, @@ -163,7 +163,7 @@ abstract final class BuildConfig { packageRoot: packageRoot, buildMode: buildMode as BuildModeImpl, targetArchitecture: targetArchitecture as ArchitectureImpl, - targetOs: targetOs as OSImpl, + targetOS: targetOS as OSImpl, targetIOSSdk: targetIOSSdk as IOSSdkImpl?, targetAndroidNdkApi: targetAndroidNdkApi, cCompiler: cCompiler as CCompilerConfigImpl?, @@ -181,7 +181,7 @@ abstract final class BuildConfig { required Uri outDir, required String packageName, required Uri packageRoot, - required OS targetOs, + required OS targetOS, required LinkModePreference linkModePreference, Iterable? supportedAssetTypes, }) => @@ -189,7 +189,7 @@ abstract final class BuildConfig { outDir: outDir, packageName: packageName, packageRoot: packageRoot, - targetOs: targetOs as OSImpl, + targetOS: targetOS as OSImpl, linkModePreference: linkModePreference as LinkModePreferenceImpl, supportedAssetTypes: supportedAssetTypes, ); diff --git a/pkgs/native_assets_cli/lib/src/api/ios_sdk.dart b/pkgs/native_assets_cli/lib/src/api/ios_sdk.dart index 152c82db6..26fc67051 100644 --- a/pkgs/native_assets_cli/lib/src/api/ios_sdk.dart +++ b/pkgs/native_assets_cli/lib/src/api/ios_sdk.dart @@ -12,7 +12,7 @@ abstract final class IOSSdk { /// /// The SDK location can be found on the host machine with /// `xcrun --sdk iphoneos --show-sdk-path`. - static const IOSSdk iPhoneOs = IOSSdkImpl.iPhoneOs; + static const IOSSdk iPhoneOS = IOSSdkImpl.iPhoneOS; /// The iphonesimulator SDK in Xcode. /// @@ -22,7 +22,7 @@ abstract final class IOSSdk { /// All known values for [IOSSdk]. static const values = [ - iPhoneOs, + iPhoneOS, iPhoneSimulator, ]; } diff --git a/pkgs/native_assets_cli/lib/src/helpers/asset_downloader.dart b/pkgs/native_assets_cli/lib/src/helpers/asset_downloader.dart index 6c03f0092..e8d137f85 100644 --- a/pkgs/native_assets_cli/lib/src/helpers/asset_downloader.dart +++ b/pkgs/native_assets_cli/lib/src/helpers/asset_downloader.dart @@ -44,7 +44,7 @@ class AssetDownloader implements Builder { Uri? targetUri; if (!config.dryRun) { final downloadUri2 = downloadUri( - config.targetOs, + config.targetOS, config.targetArchitecture!, ); final fileName = @@ -61,7 +61,7 @@ class AssetDownloader implements Builder { file: targetUri, linkMode: LinkMode.dynamic, dynamicLoading: BundledDylib(), - os: config.targetOs, + os: config.targetOS, architecture: config.targetArchitecture, ), ); diff --git a/pkgs/native_assets_cli/lib/src/model/build_config.dart b/pkgs/native_assets_cli/lib/src/model/build_config.dart index 36195a953..2227b9874 100644 --- a/pkgs/native_assets_cli/lib/src/model/build_config.dart +++ b/pkgs/native_assets_cli/lib/src/model/build_config.dart @@ -22,8 +22,8 @@ final class BuildConfigImpl implements BuildConfig { late final ArchitectureImpl? _targetArchitecture; @override - OSImpl get targetOs => _targetOs; - late final OSImpl _targetOs; + OSImpl get targetOS => _targetOS; + late final OSImpl _targetOS; @override IOSSdkImpl? get targetIOSSdk { @@ -92,7 +92,7 @@ final class BuildConfigImpl implements BuildConfig { required Uri packageRoot, required BuildModeImpl buildMode, required ArchitectureImpl targetArchitecture, - required OSImpl targetOs, + required OSImpl targetOS, IOSSdkImpl? targetIOSSdk, int? targetAndroidNdkApi, CCompilerConfigImpl? cCompiler, @@ -107,7 +107,7 @@ final class BuildConfigImpl implements BuildConfig { .._packageRoot = packageRoot .._buildMode = buildMode .._targetArchitecture = targetArchitecture - .._targetOs = targetOs + .._targetOS = targetOS .._targetIOSSdk = targetIOSSdk .._targetAndroidNdkApi = targetAndroidNdkApi .._cCompiler = cCompiler ?? CCompilerConfigImpl() @@ -125,7 +125,7 @@ final class BuildConfigImpl implements BuildConfig { required Uri outDir, required String packageName, required Uri packageRoot, - required OSImpl targetOs, + required OSImpl targetOS, required LinkModePreferenceImpl linkModePreference, Iterable? supportedAssetTypes, }) { @@ -134,7 +134,7 @@ final class BuildConfigImpl implements BuildConfig { .._outDir = outDir .._packageName = packageName .._packageRoot = packageRoot - .._targetOs = targetOs + .._targetOS = targetOS .._targetArchitecture = null .._linkModePreference = linkModePreference .._cCompiler = CCompilerConfigImpl() @@ -157,7 +157,7 @@ final class BuildConfigImpl implements BuildConfig { required String packageName, required Uri packageRoot, required ArchitectureImpl targetArchitecture, - required OSImpl targetOs, + required OSImpl targetOS, required BuildModeImpl buildMode, IOSSdkImpl? targetIOSSdk, int? targetAndroidNdkApi, @@ -171,7 +171,7 @@ final class BuildConfigImpl implements BuildConfig { version ?? latestVersion, packageName, targetArchitecture.toString(), - targetOs.toString(), + targetOS.toString(), targetIOSSdk.toString(), targetAndroidNdkApi.toString(), buildMode.toString(), @@ -299,7 +299,7 @@ final class BuildConfigImpl implements BuildConfig { } }, (config) { - _targetOs = OSImpl.fromString( + _targetOS = OSImpl.fromString( config.string( OSImpl.configKey, validValues: OSImpl.values.map((e) => '$e'), @@ -317,7 +317,7 @@ final class BuildConfigImpl implements BuildConfig { ...ArchitectureImpl.values else for (final target in Target.values) - if (target.os == _targetOs) target.architecture + if (target.os == _targetOS) target.architecture ]; _targetArchitecture = ArchitectureImpl.fromString( config.string( @@ -331,7 +331,7 @@ final class BuildConfigImpl implements BuildConfig { if (dryRun) { _throwIfNotNullInDryRun(IOSSdkImpl.configKey); } else { - _targetIOSSdk = (osSet && _targetOs == OSImpl.iOS) + _targetIOSSdk = (osSet && _targetOS == OSImpl.iOS) ? IOSSdkImpl.fromString( config.string( IOSSdkImpl.configKey, @@ -345,7 +345,7 @@ final class BuildConfigImpl implements BuildConfig { if (dryRun) { _throwIfNotNullInDryRun(targetAndroidNdkApiConfigKey); } else { - _targetAndroidNdkApi = (osSet && _targetOs == OSImpl.android) + _targetAndroidNdkApi = (osSet && _targetOS == OSImpl.android) ? config.int(targetAndroidNdkApiConfigKey) : null; } @@ -456,7 +456,7 @@ final class BuildConfigImpl implements BuildConfig { outDirConfigKey: _outDir.toFilePath(), packageNameConfigKey: _packageName, packageRootConfigKey: _packageRoot.toFilePath(), - OSImpl.configKey: _targetOs.toString(), + OSImpl.configKey: _targetOS.toString(), LinkModePreferenceImpl.configKey: _linkModePreference.toString(), supportedAssetTypesKey: _supportedAssetTypes, _versionKey: latestVersion.toString(), @@ -490,7 +490,7 @@ final class BuildConfigImpl implements BuildConfig { if (other.packageName != packageName) return false; if (other.packageRoot != packageRoot) return false; if (other.dryRun != dryRun) return false; - if (other.targetOs != targetOs) return false; + if (other.targetOS != targetOS) return false; if (other.linkModePreference != linkModePreference) return false; if (!const DeepCollectionEquality() .equals(other._supportedAssetTypes, _supportedAssetTypes)) return false; @@ -511,7 +511,7 @@ final class BuildConfigImpl implements BuildConfig { outDir, packageName, packageRoot, - targetOs, + targetOS, linkModePreference, dryRun, const DeepCollectionEquality().hash(_supportedAssetTypes), diff --git a/pkgs/native_assets_cli/lib/src/model/c_code_asset.dart b/pkgs/native_assets_cli/lib/src/model/c_code_asset.dart index f89cc2f31..9b0976719 100644 --- a/pkgs/native_assets_cli/lib/src/model/c_code_asset.dart +++ b/pkgs/native_assets_cli/lib/src/model/c_code_asset.dart @@ -240,7 +240,7 @@ final class CCodeAssetImpl implements CCodeAsset, AssetImpl { _idKey: id, _linkModeKey: linkMode.name, _pathKey: dynamicLoading.toYaml(version, file), - _targetKey: Target.fromArchitectureAndOs(architecture!, os).toString(), + _targetKey: Target.fromArchitectureAndOS(architecture!, os).toString(), }..sortOnKey(); } return { diff --git a/pkgs/native_assets_cli/lib/src/model/ios_sdk.dart b/pkgs/native_assets_cli/lib/src/model/ios_sdk.dart index c50388562..9c20c9e12 100644 --- a/pkgs/native_assets_cli/lib/src/model/ios_sdk.dart +++ b/pkgs/native_assets_cli/lib/src/model/ios_sdk.dart @@ -9,11 +9,11 @@ final class IOSSdkImpl implements IOSSdk { const IOSSdkImpl._(this.xcodebuildSdk); - static const iPhoneOs = IOSSdkImpl._('iphoneos'); + static const iPhoneOS = IOSSdkImpl._('iphoneos'); static const iPhoneSimulator = IOSSdkImpl._('iphonesimulator'); static const values = [ - iPhoneOs, + iPhoneOS, iPhoneSimulator, ]; diff --git a/pkgs/native_assets_cli/lib/src/model/target.dart b/pkgs/native_assets_cli/lib/src/model/target.dart index 44c749c0f..18cdc9775 100644 --- a/pkgs/native_assets_cli/lib/src/model/target.dart +++ b/pkgs/native_assets_cli/lib/src/model/target.dart @@ -35,7 +35,7 @@ final class Target implements Comparable { return target; } - factory Target.fromArchitectureAndOs( + factory Target.fromArchitectureAndOS( ArchitectureImpl architecture, OSImpl os, ) { diff --git a/pkgs/native_assets_cli/test/api/build_config_test.dart b/pkgs/native_assets_cli/test/api/build_config_test.dart index 71dc4cc71..0fcddf4fc 100644 --- a/pkgs/native_assets_cli/test/api/build_config_test.dart +++ b/pkgs/native_assets_cli/test/api/build_config_test.dart @@ -52,8 +52,8 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: Architecture.arm64, - targetOs: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOs, + targetOS: OS.iOS, + targetIOSSdk: IOSSdk.iPhoneOS, cCompiler: CCompilerConfig( cc: fakeClang, ld: fakeLd, @@ -69,7 +69,7 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: Architecture.arm64, - targetOs: OS.android, + targetOS: OS.android, targetAndroidNdkApi: 30, buildMode: BuildMode.release, linkModePreference: LinkModePreference.preferStatic, @@ -81,7 +81,7 @@ void main() async { expect(config1.outDir != config2.outDir, true); expect(config1.packageRoot, config2.packageRoot); expect(config1.targetArchitecture == config2.targetArchitecture, true); - expect(config1.targetOs != config2.targetOs, true); + expect(config1.targetOS != config2.targetOS, true); expect(config1.targetIOSSdk != config2.targetIOSSdk, true); expect(config1.cCompiler.cc != config2.cCompiler.cc, true); expect(config1.cCompiler.ld != config2.cCompiler.ld, true); @@ -100,7 +100,7 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetArchitecture: Architecture.arm64, - targetOs: OS.android, + targetOS: OS.android, targetAndroidNdkApi: 30, buildMode: BuildMode.release, linkModePreference: LinkModePreference.preferStatic, @@ -128,7 +128,7 @@ void main() async { outDir: outDirUri, packageName: packageName, packageRoot: packageRootUri, - targetOs: OS.android, + targetOS: OS.android, linkModePreference: LinkModePreference.preferStatic, supportedAssetTypes: [CCodeAsset.type], ); @@ -153,7 +153,7 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: Architecture.arm64, - targetOs: OS.android, + targetOS: OS.android, targetAndroidNdkApi: 30, buildMode: BuildMode.release, linkModePreference: LinkModePreference.preferStatic, @@ -173,7 +173,7 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: Architecture.arm64, - targetOs: OS.android, + targetOS: OS.android, targetAndroidNdkApi: 30, buildMode: BuildMode.release, linkModePreference: LinkModePreference.preferStatic, @@ -200,7 +200,7 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: Architecture.arm64, - targetOs: OS.android, + targetOS: OS.android, targetAndroidNdkApi: 30, buildMode: BuildMode.release, linkModePreference: LinkModePreference.preferStatic, diff --git a/pkgs/native_assets_cli/test/api/build_test.dart b/pkgs/native_assets_cli/test/api/build_test.dart index 448e86169..731ad27ec 100644 --- a/pkgs/native_assets_cli/test/api/build_test.dart +++ b/pkgs/native_assets_cli/test/api/build_test.dart @@ -45,8 +45,8 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: Architecture.arm64, - targetOs: OS.iOS, - targetIOSSdk: IOSSdk.iPhoneOs, + targetOS: OS.iOS, + targetIOSSdk: IOSSdk.iPhoneOS, cCompiler: CCompilerConfig( cc: fakeClang, ld: fakeLd, diff --git a/pkgs/native_assets_cli/test/model/build_config_test.dart b/pkgs/native_assets_cli/test/model/build_config_test.dart index fd47f567d..2ec858527 100644 --- a/pkgs/native_assets_cli/test/model/build_config_test.dart +++ b/pkgs/native_assets_cli/test/model/build_config_test.dart @@ -54,8 +54,8 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.iOS, - targetIOSSdk: IOSSdkImpl.iPhoneOs, + targetOS: OSImpl.iOS, + targetIOSSdk: IOSSdkImpl.iPhoneOS, cCompiler: CCompilerConfigImpl( cc: fakeClang, ld: fakeLd, @@ -70,7 +70,7 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.android, + targetOS: OSImpl.android, targetAndroidNdkApi: 30, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.preferStatic, @@ -81,7 +81,7 @@ void main() async { expect(config1.outDir != config2.outDir, true); expect(config1.packageRoot, config2.packageRoot); expect(config1.targetArchitecture == config2.targetArchitecture, true); - expect(config1.targetOs != config2.targetOs, true); + expect(config1.targetOS != config2.targetOS, true); expect(config1.targetIOSSdk != config2.targetIOSSdk, true); expect(config1.cCompiler.cc != config2.cCompiler.cc, true); expect(config1.cCompiler.ld != config2.cCompiler.ld, true); @@ -99,7 +99,7 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.android, + targetOS: OSImpl.android, targetAndroidNdkApi: 30, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.preferStatic, @@ -127,7 +127,7 @@ void main() async { outDir: outDirUri, packageName: packageName, packageRoot: packageRootUri, - targetOs: OSImpl.android, + targetOS: OSImpl.android, linkModePreference: LinkModePreferenceImpl.preferStatic, ); @@ -151,8 +151,8 @@ void main() async { packageName: packageName, packageRoot: packageRootUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.iOS, - targetIOSSdk: IOSSdkImpl.iPhoneOs, + targetOS: OSImpl.iOS, + targetIOSSdk: IOSSdkImpl.iPhoneOS, cCompiler: CCompilerConfigImpl( cc: fakeClang, ld: fakeLd, @@ -173,7 +173,7 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.android, + targetOS: OSImpl.android, targetAndroidNdkApi: 30, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.preferStatic, @@ -193,7 +193,7 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.android, + targetOS: OSImpl.android, targetAndroidNdkApi: 30, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.preferStatic, @@ -219,8 +219,8 @@ void main() async { packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.iOS, - targetIOSSdk: IOSSdkImpl.iPhoneOs, + targetOS: OSImpl.iOS, + targetIOSSdk: IOSSdkImpl.iPhoneOS, cCompiler: CCompilerConfigImpl( cc: fakeClang, ld: fakeLd, @@ -298,8 +298,8 @@ version: 1.0.0'''; packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.iOS, - targetIOSSdk: IOSSdkImpl.iPhoneOs, + targetOS: OSImpl.iOS, + targetIOSSdk: IOSSdkImpl.iPhoneOS, cCompiler: CCompilerConfigImpl( cc: fakeClang, ld: fakeLd, @@ -418,8 +418,8 @@ version: 1.0.0'''; packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.iOS, - targetIOSSdk: IOSSdkImpl.iPhoneOs, + targetOS: OSImpl.iOS, + targetIOSSdk: IOSSdkImpl.iPhoneOS, cCompiler: CCompilerConfigImpl( cc: fakeClang, ld: fakeLd, @@ -436,7 +436,7 @@ version: 1.0.0'''; packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.android, + targetOS: OSImpl.android, targetAndroidNdkApi: 30, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.preferStatic, @@ -458,7 +458,7 @@ version: 1.0.0'''; packageName: packageName, packageRoot: tempUri, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.android, + targetOS: OSImpl.android, targetAndroidNdkApi: 30, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.preferStatic, @@ -486,7 +486,7 @@ version: 1.0.0'''; packageName: packageName, packageRoot: packageRootUri, targetArchitecture: ArchitectureImpl.x64, - targetOs: OSImpl.windows, + targetOS: OSImpl.windows, cCompiler: CCompilerConfigImpl( cc: fakeCl, envScript: fakeVcVars, @@ -535,7 +535,7 @@ version: 1.0.0'''; packageName: packageName, packageRoot: nativeAddUri, targetArchitecture: ArchitectureImpl.x64, - targetOs: OSImpl.linux, + targetOS: OSImpl.linux, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.dynamic, supportedAssetTypes: [CCodeAsset.type], @@ -549,7 +549,7 @@ version: 1.0.0'''; packageName: packageName, packageRoot: nativeAddUri, targetArchitecture: ArchitectureImpl.x64, - targetOs: OSImpl.linux, + targetOS: OSImpl.linux, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.dynamic, dependencyMetadata: { @@ -564,7 +564,7 @@ version: 1.0.0'''; packageName: packageName, packageRoot: nativeAddUri, targetArchitecture: ArchitectureImpl.x64, - targetOs: OSImpl.linux, + targetOS: OSImpl.linux, buildMode: BuildModeImpl.release, linkModePreference: LinkModePreferenceImpl.dynamic, cCompiler: CCompilerConfigImpl( @@ -657,7 +657,7 @@ version: 1.0.0'''; packageName: packageName, outDir: outDirUri, packageRoot: tempUri, - targetOs: OSImpl.windows, + targetOS: OSImpl.windows, linkModePreference: LinkModePreferenceImpl.dynamic, ); buildConfig.toYamlString(); diff --git a/pkgs/native_assets_cli/test/model/build_output_test.dart b/pkgs/native_assets_cli/test/model/build_output_test.dart index dc60ddcc7..4cc2216a6 100644 --- a/pkgs/native_assets_cli/test/model/build_output_test.dart +++ b/pkgs/native_assets_cli/test/model/build_output_test.dart @@ -174,7 +174,7 @@ version: ${BuildOutputImpl.latestVersion}'''; packageRoot: packageRoot, buildMode: BuildModeImpl.debug, targetArchitecture: ArchitectureImpl.arm64, - targetOs: OSImpl.macOS, + targetOS: OSImpl.macOS, linkModePreference: LinkModePreferenceImpl.dynamic, ); await buildOutput.writeToFile(config: config); diff --git a/pkgs/native_assets_cli/test/model/target_test.dart b/pkgs/native_assets_cli/test/model/target_test.dart index e5ddc01ba..4c56d7402 100644 --- a/pkgs/native_assets_cli/test/model/target_test.dart +++ b/pkgs/native_assets_cli/test/model/target_test.dart @@ -59,13 +59,13 @@ void main() { Target.macOSArm64.supportedTargetTargets(), contains(Target.iOSArm64)); }); - test('Target fromArchitectureAndOs', () async { + test('Target fromArchitectureAndOS', () async { final current = - Target.fromArchitectureAndOs(ArchitectureImpl.current, OSImpl.current); + Target.fromArchitectureAndOS(ArchitectureImpl.current, OSImpl.current); expect(current.toString(), Abi.current().toString()); expect( - () => Target.fromArchitectureAndOs(ArchitectureImpl.arm, OSImpl.windows), + () => Target.fromArchitectureAndOS(ArchitectureImpl.arm, OSImpl.windows), throwsA(predicate( (e) => e is ArgumentError && diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart index 6250ab690..2fcc95b68 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart @@ -44,7 +44,7 @@ class CBuilder implements Builder { /// Name of the library or executable to build. /// - /// The filename will be decided by [BuildConfig.targetOs] and + /// The filename will be decided by [BuildConfig.targetOS] and /// [OS.libraryFileName] or [OS.executableFileName]. /// /// File will be placed in [BuildConfig.outDir]. @@ -201,9 +201,9 @@ class CBuilder implements Builder { await Directory.fromUri(outDir).create(recursive: true); final linkMode = buildConfig.linkModePreference.preferredLinkMode; final libUri = - outDir.resolve(buildConfig.targetOs.libraryFileName(name, linkMode)); + outDir.resolve(buildConfig.targetOS.libraryFileName(name, linkMode)); final exeUri = - outDir.resolve(buildConfig.targetOs.executableFileName(name)); + outDir.resolve(buildConfig.targetOS.executableFileName(name)); final sources = [ for (final source in this.sources) packageRoot.resolveUri(Uri.file(source)), @@ -252,7 +252,7 @@ class CBuilder implements Builder { id: assetId!, file: buildConfig.dryRun ? null : libUri, linkMode: linkMode, - os: buildConfig.targetOs, + os: buildConfig.targetOS, architecture: buildConfig.dryRun ? null : buildConfig.targetArchitecture, dynamicLoading: BundledDylib(), diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/compiler_resolver.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/compiler_resolver.dart index dc5301d62..b721da274 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/compiler_resolver.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/compiler_resolver.dart @@ -47,26 +47,26 @@ class CompilerResolver { return result; } - final targetOs = buildConfig.targetOs; + final targetOS = buildConfig.targetOS; final targetArchitecture = buildConfig.targetArchitecture; final errorMessage = "No tools configured on host '${hostOS}_$hostArchitecture' with target " - "'${targetOs}_$targetArchitecture'."; + "'${targetOS}_$targetArchitecture'."; logger?.severe(errorMessage); throw ToolError(errorMessage); } /// Select the right compiler for cross compiling to the specified target. Tool? _selectCompiler() { - final targetOs = buildConfig.targetOs; + final targetOS = buildConfig.targetOS; final targetArch = buildConfig.targetArchitecture; // TODO(dacoharkes): Support falling back on other tools. if (targetArch == hostArchitecture && - targetOs == hostOS && + targetOS == hostOS && hostOS == OS.linux) return clang; - if (targetOs == OS.macOS || targetOs == OS.iOS) return appleClang; - if (targetOs == OS.android) return androidNdkClang; + if (targetOS == OS.macOS || targetOS == OS.iOS) return appleClang; + if (targetOS == OS.android) return androidNdkClang; if (hostOS == OS.linux) { switch (targetArch) { case Architecture.arm: @@ -131,28 +131,28 @@ class CompilerResolver { return result; } - final targetOs = buildConfig.targetOs; + final targetOS = buildConfig.targetOS; final targetArchitecture = buildConfig.targetArchitecture; final errorMessage = "No tools configured on host '${hostOS}_$hostArchitecture' with target " - "'${targetOs}_$targetArchitecture'."; + "'${targetOS}_$targetArchitecture'."; logger?.severe(errorMessage); throw ToolError(errorMessage); } /// Select the right archiver for cross compiling to the specified target. Tool? _selectArchiver() { - final targetOs = buildConfig.targetOs; + final targetOS = buildConfig.targetOS; final targetArchitecture = buildConfig.targetArchitecture; // TODO(dacoharkes): Support falling back on other tools. if (targetArchitecture == hostArchitecture && - targetOs == hostOS && + targetOS == hostOS && hostOS == OS.linux) { return llvmAr; } - if (targetOs == OS.macOS || targetOs == OS.iOS) return appleAr; - if (targetOs == OS.android) return androidNdkLlvmAr; + if (targetOS == OS.macOS || targetOS == OS.iOS) return appleAr; + if (targetOS == OS.android) return androidNdkLlvmAr; if (hostOS == OS.linux) { switch (targetArchitecture) { case Architecture.arm: diff --git a/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart b/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart index 665079a13..bb231b639 100644 --- a/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart +++ b/pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart @@ -62,7 +62,7 @@ class RunCBuilder { .whereType() .length == 1) { - if (buildConfig.targetOs == OS.windows && cppLinkStdLib != null) { + if (buildConfig.targetOS == OS.windows && cppLinkStdLib != null) { throw ArgumentError.value( cppLinkStdLib, 'cppLinkStdLib', @@ -79,7 +79,7 @@ class RunCBuilder { Future archiver() async => (await _resolver.resolveArchiver()).uri; Future iosSdk(IOSSdk iosSdk, {required Logger? logger}) async { - if (iosSdk == IOSSdk.iPhoneOs) { + if (iosSdk == IOSSdk.iPhoneOS) { return (await iPhoneOSSdk.defaultResolver!.resolve(logger: logger)) .where((i) => i.tool == iPhoneOSSdk) .first @@ -122,7 +122,7 @@ class RunCBuilder { } late final IOSSdk targetIosSdk; - if (buildConfig.targetOs == OS.iOS) { + if (buildConfig.targetOS == OS.iOS) { targetIosSdk = buildConfig.targetIOSSdk!; } @@ -130,7 +130,7 @@ class RunCBuilder { // invoking clang. Mimic that behavior here. // See https://github.com/dart-lang/native/issues/171. late final int targetAndroidNdkApi; - if (buildConfig.targetOs == OS.android) { + if (buildConfig.targetOS == OS.android) { final minimumApi = buildConfig.targetArchitecture == Architecture.riscv64 ? 35 : 21; targetAndroidNdkApi = max(buildConfig.targetAndroidNdkApi!, minimumApi); @@ -141,21 +141,21 @@ class RunCBuilder { await runProcess( executable: compiler.uri, arguments: [ - if (buildConfig.targetOs == OS.android) ...[ + if (buildConfig.targetOS == OS.android) ...[ '--target=' '${androidNdkClangTargetFlags[architecture]!}' '$targetAndroidNdkApi', '--sysroot=${androidSysroot(compiler).toFilePath()}', ], - if (buildConfig.targetOs == OS.macOS) + if (buildConfig.targetOS == OS.macOS) '--target=${appleClangMacosTargetFlags[architecture]!}', - if (buildConfig.targetOs == OS.iOS) + if (buildConfig.targetOS == OS.iOS) '--target=${appleClangIosTargetFlags[architecture]![targetIosSdk]!}', - if (buildConfig.targetOs == OS.iOS) ...[ + if (buildConfig.targetOS == OS.iOS) ...[ '-isysroot', (await iosSdk(targetIosSdk, logger: logger)).toFilePath(), ], - if (buildConfig.targetOs == OS.macOS) ...[ + if (buildConfig.targetOS == OS.macOS) ...[ '-isysroot', (await macosSdk(logger: logger)).toFilePath(), ], @@ -190,7 +190,7 @@ class RunCBuilder { '-x', 'c++', '-l', - cppLinkStdLib ?? defaultCppLinkStdLib[buildConfig.targetOs]! + cppLinkStdLib ?? defaultCppLinkStdLib[buildConfig.targetOS]! ], ...flags, for (final MapEntry(key: name, :value) in defines.entries) @@ -307,7 +307,7 @@ class RunCBuilder { static const appleClangIosTargetFlags = { Architecture.arm64: { - IOSSdk.iPhoneOs: 'arm64-apple-ios', + IOSSdk.iPhoneOS: 'arm64-apple-ios', IOSSdk.iPhoneSimulator: 'arm64-apple-ios-simulator', }, Architecture.x64: { 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 f2a73c4e1..5cf28c543 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 @@ -34,7 +34,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, linkModePreference: LinkModePreference.dynamic, buildMode: BuildMode.release, cCompiler: CCompilerConfig( 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 340d0640e..a20a5090b 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 @@ -129,7 +129,7 @@ Future buildLib( packageName: name, packageRoot: tempUri, targetArchitecture: targetArchitecture, - targetOs: OS.android, + targetOS: OS.android, targetAndroidNdkApi: androidNdkApi, buildMode: BuildMode.release, linkModePreference: linkMode == LinkMode.dynamic 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 6b66ff64f..1cac73a5c 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 @@ -39,7 +39,7 @@ void main() { for (final linkMode in LinkMode.values) { for (final targetIOSSdk in IOSSdk.values) { for (final target in targets) { - if (target == Architecture.x64 && targetIOSSdk == IOSSdk.iPhoneOs) { + if (target == Architecture.x64 && targetIOSSdk == IOSSdk.iPhoneOS) { continue; } @@ -61,7 +61,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: target, - targetOs: OS.iOS, + targetOS: OS.iOS, buildMode: BuildMode.release, linkModePreference: linkMode == LinkMode.dynamic ? LinkModePreference.dynamic @@ -100,7 +100,7 @@ void main() { logger: logger, ); expect(otoolResult.exitCode, 0); - if (targetIOSSdk == IOSSdk.iPhoneOs || target == Architecture.x64) { + if (targetIOSSdk == IOSSdk.iPhoneOS || target == Architecture.x64) { // The x64 simulator behaves as device, presumably because the // devices are never x64. expect(otoolResult.stdout, contains('LC_VERSION_MIN_IPHONEOS')); 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 ea86fff59..593539158 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 @@ -49,7 +49,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: target, - targetOs: OS.linux, + targetOS: OS.linux, buildMode: BuildMode.release, linkModePreference: linkMode == LinkMode.dynamic ? LinkModePreference.dynamic 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 e2a5ec114..cd363b988 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 @@ -47,7 +47,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: target, - targetOs: OS.macOS, + targetOS: OS.macOS, buildMode: BuildMode.release, linkModePreference: linkMode == LinkMode.dynamic ? LinkModePreference.dynamic 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 9bc3ad166..3d1d5a998 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 @@ -58,7 +58,7 @@ void main() { outDir: tempUri, packageName: name, packageRoot: tempUri, - targetOs: OS.windows, + targetOS: OS.windows, targetArchitecture: target, buildMode: BuildMode.release, linkModePreference: linkMode == LinkMode.dynamic diff --git a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart index d9b65ad05..9a96856b8 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart @@ -48,7 +48,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, buildMode: buildMode, // Ignored by executables. linkModePreference: LinkModePreference.dynamic, @@ -87,7 +87,7 @@ void main() { (message) => message.contains(helloWorldCUri.toFilePath()), ); - switch ((buildConfig.targetOs, pic)) { + switch ((buildConfig.targetOS, pic)) { case (OS.windows, _) || (_, null): expect(compilerInvocation, isNot(contains('-fPIC'))); expect(compilerInvocation, isNot(contains('-fPIE'))); @@ -119,7 +119,7 @@ void main() { outDir: tempUri, packageName: name, packageRoot: tempUri, - targetOs: OS.current, + targetOS: OS.current, linkModePreference: LinkModePreference.dynamic, ) : BuildConfig( @@ -127,7 +127,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, buildMode: BuildMode.release, linkModePreference: LinkModePreference.dynamic, cCompiler: CCompilerConfig( @@ -161,7 +161,7 @@ void main() { final compilerInvocation = logMessages.singleWhere( (message) => message.contains(addCUri.toFilePath()), ); - switch ((buildConfig.targetOs, pic)) { + switch ((buildConfig.targetOS, pic)) { case (OS.windows, _) || (_, null): expect(compilerInvocation, isNot(contains('-fPIC'))); expect(compilerInvocation, isNot(contains('-fPIE'))); @@ -219,7 +219,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, buildMode: BuildMode.release, // Ignored by executables. linkModePreference: LinkModePreference.dynamic, @@ -231,7 +231,7 @@ void main() { ); final buildOutput = BuildOutput(); - final flag = switch (buildConfig.targetOs) { + final flag = switch (buildConfig.targetOS) { OS.windows => '/DFOO=USER_FLAG', _ => '-DFOO=USER_FLAG', }; @@ -277,7 +277,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, buildMode: BuildMode.release, linkModePreference: LinkModePreference.dynamic, cCompiler: CCompilerConfig( @@ -322,7 +322,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, buildMode: BuildMode.release, linkModePreference: LinkModePreference.dynamic, cCompiler: CCompilerConfig( @@ -333,7 +333,7 @@ void main() { ); final buildOutput = BuildOutput(); - final stdFlag = switch (buildConfig.targetOs) { + final stdFlag = switch (buildConfig.targetOS) { OS.windows => '/std:$std', _ => '-std=$std', }; @@ -381,7 +381,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, // Ignored by executables. linkModePreference: LinkModePreference.dynamic, cCompiler: CCompilerConfig( @@ -392,7 +392,7 @@ void main() { ); final buildOutput = BuildOutput(); - final defaultStdLibLinkFlag = switch (buildConfig.targetOs) { + final defaultStdLibLinkFlag = switch (buildConfig.targetOS) { OS.windows => null, OS.linux => '-l stdc++', OS.macOS => '-l c++', @@ -445,7 +445,7 @@ void main() { packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, // Ignored by executables. linkModePreference: LinkModePreference.dynamic, cCompiler: CCompilerConfig( @@ -462,7 +462,7 @@ void main() { cppLinkStdLib: 'stdc++', ); - if (buildConfig.targetOs == OS.windows) { + if (buildConfig.targetOS == OS.windows) { await expectLater( () => cbuilder.run( buildConfig: buildConfig, @@ -515,7 +515,7 @@ Future testDefines({ packageName: name, packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, buildMode: buildMode, // Ignored by executables. linkModePreference: LinkModePreference.dynamic, 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 7421248f8..0a256e986 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart @@ -45,7 +45,7 @@ void main() { packageName: 'dummy', packageRoot: tempUri, targetArchitecture: Architecture.current, - targetOs: OS.current, + targetOS: OS.current, buildMode: BuildMode.release, linkModePreference: LinkModePreference.dynamic, cCompiler: CCompilerConfig( @@ -69,7 +69,7 @@ void main() { packageName: 'dummy', packageRoot: tempUri, targetArchitecture: Architecture.arm64, - targetOs: OS.windows, + targetOS: OS.windows, buildMode: BuildMode.release, linkModePreference: LinkModePreference.dynamic, );