From 2ade85bc5ed9c122283debaf402650add56640cb Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Tue, 15 Oct 2024 14:34:12 +0200 Subject: [PATCH] More test updates regarding `targetMacOSVersion must be set iff targetOS==MacOS` requirement --- .../build_runner/concurrency_test_helper.dart | 1 + .../test/build_runner/helpers.dart | 56 +++++++++++-------- 2 files changed, 34 insertions(+), 23 deletions(-) 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 163a2f40c..bebf171a7 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 @@ -30,6 +30,7 @@ void main(List args) async { targetArchitecture: Architecture.current, linkModePreference: LinkModePreference.dynamic, cCompilerConfig: dartCICompilerConfig, + targetMacOSVersion: OS.current == OS.macOS ? defaultMacOSVersion : null, ), buildMode: BuildMode.release, targetOS: OS.current, diff --git a/pkgs/native_assets_builder/test/build_runner/helpers.dart b/pkgs/native_assets_builder/test/build_runner/helpers.dart index e8b13f574..c80f3f798 100644 --- a/pkgs/native_assets_builder/test/build_runner/helpers.dart +++ b/pkgs/native_assets_builder/test/build_runner/helpers.dart @@ -55,17 +55,22 @@ Future build( logger: logger, dartExecutable: dartExecutable, ).build( - configCreator: () => BuildConfigBuilder() - ..setupCodeConfig( - targetArchitecture: target?.architecture ?? Architecture.current, - linkModePreference: linkModePreference, - cCompilerConfig: cCompilerConfig ?? dartCICompilerConfig, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion ?? - (targetOS == OS.macOS ? _defaultMacOSVersion : null), - targetAndroidNdkApi: targetAndroidNdkApi, - ), + configCreator: () { + final configBuilder = BuildConfigBuilder(); + if (supportedAssetTypes.contains(CodeAsset.type)) { + configBuilder.setupCodeConfig( + targetArchitecture: target?.architecture ?? Architecture.current, + linkModePreference: linkModePreference, + cCompilerConfig: cCompilerConfig ?? dartCICompilerConfig, + targetIOSSdk: targetIOSSdk, + targetIOSVersion: targetIOSVersion, + targetMacOSVersion: targetMacOSVersion ?? + (targetOS == OS.macOS ? defaultMacOSVersion : null), + targetAndroidNdkApi: targetAndroidNdkApi, + ); + } + return configBuilder; + }, configValidator: configValidator, buildMode: BuildMode.release, targetOS: targetOS, @@ -118,17 +123,22 @@ Future link( logger: logger, dartExecutable: dartExecutable, ).link( - configCreator: () => LinkConfigBuilder() - ..setupCodeConfig( - targetArchitecture: target?.architecture ?? Architecture.current, - linkModePreference: linkModePreference, - cCompilerConfig: cCompilerConfig ?? dartCICompilerConfig, - targetIOSSdk: targetIOSSdk, - targetIOSVersion: targetIOSVersion, - targetMacOSVersion: targetMacOSVersion ?? - (targetOS == OS.macOS ? _defaultMacOSVersion : null), - targetAndroidNdkApi: targetAndroidNdkApi, - ), + configCreator: () { + final configBuilder = LinkConfigBuilder(); + if (supportedAssetTypes.contains(CodeAsset.type)) { + configBuilder.setupCodeConfig( + targetArchitecture: target?.architecture ?? Architecture.current, + linkModePreference: linkModePreference, + cCompilerConfig: cCompilerConfig ?? dartCICompilerConfig, + targetIOSSdk: targetIOSSdk, + targetIOSVersion: targetIOSVersion, + targetMacOSVersion: targetMacOSVersion ?? + (targetOS == OS.macOS ? defaultMacOSVersion : null), + targetAndroidNdkApi: targetAndroidNdkApi, + ); + } + return configBuilder; + }, configValidator: configValidator, buildMode: BuildMode.release, targetOS: target?.os ?? OS.current, @@ -350,4 +360,4 @@ final CCompilerConfig? dartCICompilerConfig = (() { return null; })(); -int _defaultMacOSVersion = 13; +int defaultMacOSVersion = 13;