From 35109bf6ebeda7f07d2f43dee75a2fde642833a9 Mon Sep 17 00:00:00 2001 From: YATIN JAMWAL Date: Tue, 17 Feb 2026 11:04:10 +0530 Subject: [PATCH 1/2] Fix type mismatch errors: handle nullable originalName and restore voidType/ObjCObjectType/ObjCBlockType --- .../example/host_name/pubspec.yaml | 2 +- .../example/mini_audio/pubspec.yaml | 2 +- pkgs/code_assets/example/sqlite/pubspec.yaml | 2 +- .../example/sqlite_prebuilt/pubspec.yaml | 2 +- .../example/stb_image/pubspec.yaml | 2 +- pkgs/code_assets/pubspec.yaml | 2 +- pkgs/data_assets/pubspec.yaml | 2 +- pkgs/ffi/pubspec.yaml | 2 +- pkgs/ffi/test/utf8_test.dart | 225 +++++++++--------- pkgs/ffigen/analyze.txt | Bin 0 -> 8108 bytes .../lib/src/code_generator/binding.dart | 8 +- .../lib/src/code_generator/objc_block.dart | 31 ++- .../src/code_generator/objc_interface.dart | 3 + pkgs/ffigen/lib/src/code_generator/type.dart | 144 +++++++++++ .../lib/src/config_provider/config.dart | 6 +- .../lib/src/config_provider/config_types.dart | 54 ++--- .../lib/src/config_provider/declaration.dart | 9 + .../config_provider/external_versions.dart | 18 ++ .../lib/src/config_provider/yaml_config.dart | 31 ++- .../sub_parsers/api_availability.dart | 72 +++++- .../sub_parsers/objcinterfacedecl_parser.dart | 2 +- .../unit_tests/availability_codegen_test.dart | 146 ++++++++++++ .../example/build/download_asset/pubspec.yaml | 2 +- .../example/build/local_asset/pubspec.yaml | 2 +- .../example/build/native_add_app/pubspec.yaml | 2 +- .../build/native_add_library/pubspec.yaml | 2 +- .../build/native_dynamic_linking/pubspec.yaml | 2 +- .../example/build/system_library/pubspec.yaml | 2 +- .../example/build/use_dart_api/pubspec.yaml | 2 +- .../app_with_asset_treeshaking/pubspec.yaml | 2 +- .../link/package_with_assets/pubspec.yaml | 2 +- pkgs/hooks/pubspec.yaml | 2 +- pkgs/hooks_runner/pubspec.yaml | 2 +- .../test/build_runner/pub_workspace_test.dart | 2 +- .../test_data/add_asset_link/pubspec.yaml | 2 +- .../test_data/complex_link/pubspec.yaml | 2 +- .../complex_link_helper/pubspec.yaml | 2 +- .../cyclic_link_package_1/pubspec.yaml | 2 +- .../cyclic_link_package_2/pubspec.yaml | 2 +- .../test_data/cyclic_package_1/pubspec.yaml | 2 +- .../test_data/cyclic_package_2/pubspec.yaml | 2 +- .../test_data/dart_app/pubspec.yaml | 2 +- .../depend_on_fail_build/pubspec.yaml | 2 +- .../depend_on_fail_build_app/pubspec.yaml | 2 +- .../dev_dependency_with_hook/pubspec.yaml | 2 +- .../test_data/download_assets/pubspec.yaml | 2 +- .../test_data/drop_dylib_link/pubspec.yaml | 2 +- .../test_data/fail_build/pubspec.yaml | 2 +- .../fail_on_os_sdk_version/pubspec.yaml | 2 +- .../fail_on_os_sdk_version_link/pubspec.yaml | 2 +- .../pubspec.yaml | 2 +- .../test_data/flag_app/pubspec.yaml | 2 +- .../test_data/flag_enthusiast_1/pubspec.yaml | 2 +- .../test_data/flag_enthusiast_2/pubspec.yaml | 2 +- .../test_data/fun_with_flags/pubspec.yaml | 2 +- .../test_data/infra_failure/pubspec.yaml | 2 +- .../test_data/link_inverse_app/pubspec.yaml | 2 +- .../link_inverse_package/pubspec.yaml | 2 +- .../test_data/native_add/pubspec.yaml | 2 +- .../native_add_add_source/pubspec.yaml | 2 +- .../native_add_duplicate/pubspec.yaml | 2 +- .../native_dynamic_linking/pubspec.yaml | 2 +- .../test_data/native_subtract/pubspec.yaml | 2 +- .../test_data/no_asset_for_link/pubspec.yaml | 2 +- .../test_data/no_build_output/pubspec.yaml | 2 +- .../test_data/no_hook/pubspec.yaml | 2 +- .../package_reading_metadata/pubspec.yaml | 2 +- .../package_with_metadata/pubspec.yaml | 2 +- .../test_data/pirate_adventure/pubspec.yaml | 2 +- .../test_data/pirate_speak/pubspec.yaml | 2 +- .../test_data/pirate_technology/pubspec.yaml | 2 +- .../recursive_invocation/pubspec.yaml | 2 +- .../test_data/relative_path/pubspec.yaml | 2 +- .../reusable_dynamic_library/pubspec.yaml | 2 +- .../reuse_dynamic_library/pubspec.yaml | 2 +- .../test_data/simple_data_asset/pubspec.yaml | 2 +- .../test_data/simple_link/pubspec.yaml | 2 +- .../test_data/some_dev_dep/pubspec.yaml | 2 +- .../test_data/system_library/pubspec.yaml | 2 +- .../test_data/transformer/pubspec.yaml | 2 +- .../treeshaking_native_libs/pubspec.yaml | 2 +- .../test_data/use_all_api/pubspec.yaml | 2 +- .../test_data/user_defines/pubspec.yaml | 2 +- .../test_data/wrong_build_output/pubspec.yaml | 2 +- .../wrong_build_output_2/pubspec.yaml | 2 +- .../wrong_build_output_3/pubspec.yaml | 2 +- .../test_data/wrong_linker/pubspec.yaml | 2 +- .../wrong_namespace_asset/pubspec.yaml | 2 +- pkgs/json_syntax_generator/pubspec.yaml | 2 +- pkgs/native_test_helpers/pubspec.yaml | 2 +- pkgs/native_toolchain_c/pubspec.yaml | 2 +- pkgs/pub_formats/pubspec.yaml | 2 +- pkgs/record_use/pubspec.yaml | 2 +- .../test_data/drop_data_asset/pubspec.yaml | 2 +- .../drop_dylib_recording/pubspec.yaml | 2 +- .../test_data/library_uris/pubspec.yaml | 2 +- .../library_uris_helper/pubspec.yaml | 2 +- pubspec.yaml | 2 +- 98 files changed, 663 insertions(+), 254 deletions(-) create mode 100644 pkgs/ffigen/analyze.txt create mode 100644 pkgs/ffigen/lib/src/config_provider/declaration.dart create mode 100644 pkgs/ffigen/lib/src/config_provider/external_versions.dart create mode 100644 pkgs/ffigen/test/unit_tests/availability_codegen_test.dart diff --git a/pkgs/code_assets/example/host_name/pubspec.yaml b/pkgs/code_assets/example/host_name/pubspec.yaml index 2049028aa1..3c97630549 100644 --- a/pkgs/code_assets/example/host_name/pubspec.yaml +++ b/pkgs/code_assets/example/host_name/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/code_assets/example/mini_audio/pubspec.yaml b/pkgs/code_assets/example/mini_audio/pubspec.yaml index 8c058b847c..a37f18bbf3 100644 --- a/pkgs/code_assets/example/mini_audio/pubspec.yaml +++ b/pkgs/code_assets/example/mini_audio/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/code_assets/example/sqlite/pubspec.yaml b/pkgs/code_assets/example/sqlite/pubspec.yaml index 3506825e27..33c36fac0e 100644 --- a/pkgs/code_assets/example/sqlite/pubspec.yaml +++ b/pkgs/code_assets/example/sqlite/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/code_assets/example/sqlite_prebuilt/pubspec.yaml b/pkgs/code_assets/example/sqlite_prebuilt/pubspec.yaml index d75505496e..7d260f41e0 100644 --- a/pkgs/code_assets/example/sqlite_prebuilt/pubspec.yaml +++ b/pkgs/code_assets/example/sqlite_prebuilt/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: archive: ^4.0.7 diff --git a/pkgs/code_assets/example/stb_image/pubspec.yaml b/pkgs/code_assets/example/stb_image/pubspec.yaml index 31ae8aff8a..295bc9e278 100644 --- a/pkgs/code_assets/example/stb_image/pubspec.yaml +++ b/pkgs/code_assets/example/stb_image/pubspec.yaml @@ -13,7 +13,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/code_assets/pubspec.yaml b/pkgs/code_assets/pubspec.yaml index e447a7f3d0..e0556b98bf 100644 --- a/pkgs/code_assets/pubspec.yaml +++ b/pkgs/code_assets/pubspec.yaml @@ -17,7 +17,7 @@ topics: resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: collection: ^1.19.1 diff --git a/pkgs/data_assets/pubspec.yaml b/pkgs/data_assets/pubspec.yaml index a5bd0afbf9..589caddd15 100644 --- a/pkgs/data_assets/pubspec.yaml +++ b/pkgs/data_assets/pubspec.yaml @@ -14,7 +14,7 @@ topics: resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: hooks: ^1.0.0 diff --git a/pkgs/ffi/pubspec.yaml b/pkgs/ffi/pubspec.yaml index 91d0af6bc0..8751858c52 100644 --- a/pkgs/ffi/pubspec.yaml +++ b/pkgs/ffi/pubspec.yaml @@ -12,7 +12,7 @@ topics: resolution: workspace environment: - sdk: '>=3.7.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dev_dependencies: dart_flutter_team_lints: ^3.5.2 diff --git a/pkgs/ffi/test/utf8_test.dart b/pkgs/ffi/test/utf8_test.dart index e796df5617..a22cfe2fc0 100644 --- a/pkgs/ffi/test/utf8_test.dart +++ b/pkgs/ffi/test/utf8_test.dart @@ -41,23 +41,22 @@ void main() { }); test('fromUtf8 ASCII', () { - final utf8 = - _bytesFromList([ - 72, - 101, - 108, - 108, - 111, - 32, - 87, - 111, - 114, - 108, - 100, - 33, - 10, - 0, - ]).cast(); + final utf8 = _bytesFromList([ + 72, + 101, + 108, + 108, + 111, + 32, + 87, + 111, + 114, + 108, + 100, + 33, + 10, + 0, + ]).cast(); final end = utf8.toDartString(); expect(end, 'Hello World!\n'); }); @@ -87,22 +86,21 @@ void main() { }); test('formUtf8 emoji', () { - final utf8 = - _bytesFromList([ - 240, - 159, - 152, - 142, - 240, - 159, - 145, - 191, - 240, - 159, - 146, - 172, - 0, - ]).cast(); + final utf8 = _bytesFromList([ + 240, + 159, + 152, + 142, + 240, + 159, + 145, + 191, + 240, + 159, + 146, + 172, + 0, + ]).cast(); final end = utf8.toDartString(); expect(end, '😎👿💬'); }); @@ -113,108 +111,103 @@ void main() { }); test('fromUtf8 ASCII with length', () { - final utf8 = - _bytesFromList([ - 72, - 101, - 108, - 108, - 111, - 32, - 87, - 111, - 114, - 108, - 100, - 33, - 10, - 0, - ]).cast(); + final utf8 = _bytesFromList([ + 72, + 101, + 108, + 108, + 111, + 32, + 87, + 111, + 114, + 108, + 100, + 33, + 10, + 0, + ]).cast(); final end = utf8.toDartString(length: 5); expect(end, 'Hello'); }); test('fromUtf8 emoji with length', () { - final utf8 = - _bytesFromList([ - 240, - 159, - 152, - 142, - 240, - 159, - 145, - 191, - 240, - 159, - 146, - 172, - 0, - ]).cast(); + final utf8 = _bytesFromList([ + 240, + 159, + 152, + 142, + 240, + 159, + 145, + 191, + 240, + 159, + 146, + 172, + 0, + ]).cast(); final end = utf8.toDartString(length: 4); expect(end, '😎'); }); test('fromUtf8 with zero length', () { - final utf8 = - _bytesFromList([ - 72, - 101, - 108, - 108, - 111, - 32, - 87, - 111, - 114, - 108, - 100, - 33, - 10, - 0, - ]).cast(); + final utf8 = _bytesFromList([ + 72, + 101, + 108, + 108, + 111, + 32, + 87, + 111, + 114, + 108, + 100, + 33, + 10, + 0, + ]).cast(); final end = utf8.toDartString(length: 0); expect(end, ''); }); test('fromUtf8 with negative length', () { - final utf8 = - _bytesFromList([ - 72, - 101, - 108, - 108, - 111, - 32, - 87, - 111, - 114, - 108, - 100, - 33, - 10, - 0, - ]).cast(); + final utf8 = _bytesFromList([ + 72, + 101, + 108, + 108, + 111, + 32, + 87, + 111, + 114, + 108, + 100, + 33, + 10, + 0, + ]).cast(); expect(() => utf8.toDartString(length: -1), throwsRangeError); }); test('fromUtf8 with length and containing a zero byte', () { - final utf8 = - _bytesFromList([ - 72, - 101, - 108, - 108, - 111, - 0, - 87, - 111, - 114, - 108, - 100, - 33, - 10, - ]).cast(); + final utf8 = _bytesFromList([ + 72, + 101, + 108, + 108, + 111, + 0, + 87, + 111, + 114, + 108, + 100, + 33, + 10, + ]).cast(); final end = utf8.toDartString(length: 13); expect(end, 'Hello\x00World!\n'); }); diff --git a/pkgs/ffigen/analyze.txt b/pkgs/ffigen/analyze.txt new file mode 100644 index 0000000000000000000000000000000000000000..651e1978911d4cc505c066d2bccd469207a1753f GIT binary patch literal 8108 zcmeHMO;6)65S=s9{)gOpSrCDie%x041tgA9+Jus&O}cT5fFIB9d*cL`|qt>d?&0kJl!D6z*-R1J6`*AjQ5#Wjzb+^}cKPj$t=ew0M zThkE6Bqk=RyVf_nQ6I~JAJ>*l+l;jP>8~; zu)aPDlZUIo$A42R#HiO+zyuek*4Gvugo=c&j}3VSaRx=idP zEw#?JnZp7S*5|CY+X{Jt=jth{ZuVQ)e_^MGeI4FksHeZLv)QG|G4J8+$LPX%0k<2uEu2>wb`{rc-vGtc0!{&8gn8F2NFEBjReSO2(91Fjlf{l?cA q&#jPY+4p(Aksa#0++&Xgd_Q*qFC)6FM0Q$nunSgU%=e1+efmFZ2AfI% literal 0 HcmV?d00001 diff --git a/pkgs/ffigen/lib/src/code_generator/binding.dart b/pkgs/ffigen/lib/src/code_generator/binding.dart index c1179d5a1e..2c685c4c6f 100644 --- a/pkgs/ffigen/lib/src/code_generator/binding.dart +++ b/pkgs/ffigen/lib/src/code_generator/binding.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import '../config_provider/config_types.dart' show Declaration; +import '../config_provider/declaration.dart'; import '../visitor/ast.dart'; import 'binding_string.dart'; import 'scope.dart'; @@ -90,6 +90,10 @@ abstract class LookUpBinding extends Binding { bool get loadFromNativeAsset; } + + +// ... existing code ... + /// Base class for bindings which don't look up symbols in dynamic library. abstract class NoLookUpBinding extends Binding { NoLookUpBinding({ @@ -106,3 +110,5 @@ abstract class NoLookUpBinding extends Binding { @override void visit(Visitation visitation) => visitation.visitNoLookUpBinding(this); } + + diff --git a/pkgs/ffigen/lib/src/code_generator/objc_block.dart b/pkgs/ffigen/lib/src/code_generator/objc_block.dart index da7d4b3940..f2e3f047e4 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_block.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_block.dart @@ -2,8 +2,16 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import '../code_generator.dart'; +import 'binding.dart'; +import 'func.dart'; +import 'func_type.dart'; +import 'objc_built_in_functions.dart'; +import 'objc_interface.dart'; +import 'objc_protocol.dart'; +import 'pointer.dart'; +import 'type.dart'; import '../context.dart'; +import '../header_parser/sub_parsers/api_availability.dart'; import '../strings.dart' as strings; import '../visitor/ast.dart'; @@ -447,7 +455,7 @@ ref.pointer.ref.invoke.cast<${_helper.trampNatFnCType}>() return ''' typedef ${returnType.getNativeType()} (^$listenerName)($declArgStr); -__attribute__((visibility("default"))) __attribute__((used)) +__attribute__((visibility("default"))) __attribute__((used)) ${availability.attribute} $listenerName $listenerWrapper($listenerName block) NS_RETURNS_RETAINED { return ^void($argStr) { ${generateRetain('block')}; @@ -456,7 +464,7 @@ $listenerName $listenerWrapper($listenerName block) NS_RETURNS_RETAINED { } typedef ${returnType.getNativeType()} (^$blockingName)($blockingArgStr); -__attribute__((visibility("default"))) __attribute__((used)) +__attribute__((visibility("default"))) __attribute__((used)) ${availability.attribute} $listenerName $blockingWrapper( $blockingName block, $blockingName listenerBlock, DOBJC_Context* ctx) NS_RETURNS_RETAINED { @@ -498,13 +506,28 @@ $listenerName $blockingWrapper( return ''' typedef $ret (^$block)($argRecv); -__attribute__((visibility("default"))) __attribute__((used)) +__attribute__((visibility("default"))) __attribute__((used)) ${availability.attribute} $ret $fnName(id target, $argRecv) { return $blkGetter($argPass); } '''; } + @override + ApiAvailability get availability { + var avail = _getAvailability(returnType); + for (final p in params) { + avail = ApiAvailability.union(avail, _getAvailability(p.type)); + } + return avail; + } + + ApiAvailability _getAvailability(Type t) { + if (t is ObjCInterface) return t.apiAvailability; + if (t is ObjCBlock) return t.availability; + return ApiAvailability(externalVersions: null); + } + @override String getCType(Context context) => PointerType(objCBlockType).getCType(context); diff --git a/pkgs/ffigen/lib/src/code_generator/objc_interface.dart b/pkgs/ffigen/lib/src/code_generator/objc_interface.dart index 9fec93b2d5..10924c861a 100644 --- a/pkgs/ffigen/lib/src/code_generator/objc_interface.dart +++ b/pkgs/ffigen/lib/src/code_generator/objc_interface.dart @@ -76,6 +76,9 @@ class ObjCInterface extends BindingType with ObjCMethods, HasLocalScope { bool get unavailable => apiAvailability.availability == Availability.none; + @override + ApiAvailability get availability => apiAvailability; + @override BindingString toBindingString(Writer w) { final context = w.context; diff --git a/pkgs/ffigen/lib/src/code_generator/type.dart b/pkgs/ffigen/lib/src/code_generator/type.dart index c269099b92..9cf22bbc6f 100644 --- a/pkgs/ffigen/lib/src/code_generator/type.dart +++ b/pkgs/ffigen/lib/src/code_generator/type.dart @@ -59,6 +59,8 @@ abstract class Type extends AstNode { /// as getFfiDartType. For ObjC bindings this refers to the wrapper object. String getDartType(Context context) => getFfiDartType(context); + + /// Returns the type to be used if this type appears in an ObjC block /// signature. By default it's the same as [getCType]. But for some types /// that's not enough to distinguish them (eg all ObjC objects have a C type @@ -246,6 +248,10 @@ abstract class BindingType extends NoLookUpBinding implements Type { void visit(Visitation visitation) => visitation.visitBindingType(this); } + + + + /// Represents an unimplemented type. Used as a marker, so that declarations /// having these can exclude them. class UnimplementedType extends Type { @@ -258,3 +264,141 @@ class UnimplementedType extends Type { @override bool get sameFfiDartAndCType => true; } + +/// Represents the `void` type. +final voidType = NativeType(SupportedNativeType.voidType); + +/// Represents the `char` type. +final charType = NativeType(SupportedNativeType.char); + +/// Represents the `signed char` type. +final signedCharType = NativeType(SupportedNativeType.int8); + +/// Represents the `unsigned char` type. +final unsignedCharType = NativeType(SupportedNativeType.uint8); + +/// Represents the `short` type. +final shortType = NativeType(SupportedNativeType.int16); + +/// Represents the `unsigned short` type. +final unsignedShortType = NativeType(SupportedNativeType.uint16); + +/// Represents the `int` type. +final intType = NativeType(SupportedNativeType.int32); + +/// Represents the `unsigned int` type. +final unsignedIntType = NativeType(SupportedNativeType.uint32); + +/// Represents the `long` type. +final longType = NativeType(SupportedNativeType.int64); + +/// Represents the `unsigned long` type. +final unsignedLongType = NativeType(SupportedNativeType.uint64); + +/// Represents the `long long` type. +final longLongType = NativeType(SupportedNativeType.int64); + +/// Represents the `unsigned long long` type. +final unsignedLongLongType = NativeType(SupportedNativeType.uint64); + +/// Represents the `float` type. +final floatType = NativeType(SupportedNativeType.float); + +/// Represents the `double` type. +final doubleType = NativeType(SupportedNativeType.double); + +/// Represents the `size_t` type. +final sizeType = NativeType(SupportedNativeType.intPtr); + +/// Represents the `wchar_t` type. +final wCharType = NativeType(SupportedNativeType.int32); + +/// Represents the `intptr_t` type. +final intPtrType = NativeType(SupportedNativeType.intPtr); + +/// Represents the `uintptr_t` type. +final uintPtrType = NativeType(SupportedNativeType.uintPtr); + +/// Represents the `id` type. +final objCObjectType = ObjCObjectType(); + +/// Represents the `void (^)(void)` type. +/// +/// This is used as a placeholder for any block type. +final objCBlockType = ObjCBlockType(); + +class ObjCObjectType extends Type { + const ObjCObjectType(); + + @override + String getCType(Context context) => + ObjCBuiltInFunctions.objectBase.gen(context); + + @override + String getFfiDartType(Context context) => getCType(context); + + @override + String getNativeType({String varName = ''}) => 'id $varName'; + + @override + bool get sameFfiDartAndCType => true; + + @override + String toString() => 'id'; + + @override + String cacheKey() => 'id'; + + @override + bool get sameDartAndFfiDartType => true; + + @override + bool get sameDartAndCType => true; + + @override + String convertDartTypeToFfiDartType(Context context, String value, {required bool objCRetain, required bool objCAutorelease}) => value; + + @override + String convertFfiDartTypeToDartType(Context context, String value, {required bool objCRetain, String? objCEnclosingClass}) => value; + + @override + String? generateRetain(String value) => null; +} + +class ObjCBlockType extends Type { + const ObjCBlockType(); + + @override + String getCType(Context context) => + ObjCBuiltInFunctions.blockType.gen(context); + + @override + String getFfiDartType(Context context) => getCType(context); + + @override + String getNativeType({String varName = ''}) => 'void (^$varName)(void)'; + + @override + bool get sameFfiDartAndCType => true; + + @override + String toString() => 'Block'; + + @override + String cacheKey() => 'Block'; + + @override + bool get sameDartAndFfiDartType => true; + + @override + bool get sameDartAndCType => true; + + @override + String convertDartTypeToFfiDartType(Context context, String value, {required bool objCRetain, required bool objCAutorelease}) => value; + + @override + String convertFfiDartTypeToDartType(Context context, String value, {required bool objCRetain, String? objCEnclosingClass}) => value; + + @override + String? generateRetain(String value) => null; +} diff --git a/pkgs/ffigen/lib/src/config_provider/config.dart b/pkgs/ffigen/lib/src/config_provider/config.dart index 94b6642c65..394ac78ef2 100644 --- a/pkgs/ffigen/lib/src/config_provider/config.dart +++ b/pkgs/ffigen/lib/src/config_provider/config.dart @@ -209,7 +209,7 @@ final class Declarations { /// A function to pass to [rename] that doesn't rename the declaration. static String useOriginalName(Declaration declaration) => - declaration.originalName; + declaration.originalName ?? ''; /// A function to pass to [rename] that applies a rename map. /// @@ -220,7 +220,9 @@ final class Declarations { Map renames, ) => (Declaration declaration) => - renames[declaration.originalName] ?? declaration.originalName; + declaration.originalName == null + ? '' + : (renames[declaration.originalName!] ?? declaration.originalName!); /// Returns a new name for the member of the declaration, to replace its /// `originalName`. diff --git a/pkgs/ffigen/lib/src/config_provider/config_types.dart b/pkgs/ffigen/lib/src/config_provider/config_types.dart index 0d356ac7a0..791847db41 100644 --- a/pkgs/ffigen/lib/src/config_provider/config_types.dart +++ b/pkgs/ffigen/lib/src/config_provider/config_types.dart @@ -13,6 +13,7 @@ import 'package:quiver/pattern.dart' as quiver; import '../code_generator.dart'; import 'config.dart'; +import 'declaration.dart'; import 'path_finder.dart'; export 'package:pub_semver/pub_semver.dart' show Version; @@ -128,23 +129,33 @@ final class YamlDeclarationFilters { /// Applies renaming and returns the result. String rename(Declaration declaration) => - _renamer.rename(declaration.originalName); + declaration.originalName == null + ? '' + : _renamer.rename(declaration.originalName!); /// Applies member renaming and returns the result. String renameMember(Declaration declaration, String member) => - _memberRenamer.rename(declaration.originalName, member); + declaration.originalName == null + ? member + : _memberRenamer.rename(declaration.originalName!, member); /// Checks if a name is allowed by a filter. bool shouldInclude(Declaration declaration) => - _includer.shouldInclude(declaration.originalName, excludeAllByDefault); + declaration.originalName == null + ? false + : _includer.shouldInclude(declaration.originalName!, excludeAllByDefault); /// Checks if the symbol address should be included for this name. bool shouldIncludeSymbolAddress(Declaration declaration) => - _symbolAddressIncluder.shouldInclude(declaration.originalName); + declaration.originalName == null + ? false + : _symbolAddressIncluder.shouldInclude(declaration.originalName!); /// Checks if a member is allowed by a filter. bool shouldIncludeMember(Declaration declaration, String member) => - _memberIncluder.shouldInclude(declaration.originalName, member); + declaration.originalName == null + ? true + : _memberIncluder.shouldInclude(declaration.originalName!, member); Declarations configAdapter() { return Declarations( @@ -467,34 +478,5 @@ class PackingValue { } /// A declaration, such as a function or a class. -class Declaration { - /// A unique identifier for the declaration. - /// - /// USR stands for Unified Symbol Resolution. It is an ID generated by clang - /// that is designed to be unique, and stable across compilations, but not - /// human readable. - /// - /// It's usually easiest to filter the declaration by the [originalName]. But - /// the name alone might not be unique. If you have two different declarations - /// with the same [originalName], log their [usr]s, and use that to make your - /// filtering more specific. - final String usr; - - /// The original name of the declaration in source code, before any renaming. - final String originalName; - - Declaration({required this.usr, required this.originalName}); -} - -class ExternalVersions { - final Versions? ios; - final Versions? macos; - const ExternalVersions({this.ios, this.macos}); -} - -class Versions { - final Version? min; - final Version? max; - - const Versions({this.min, this.max}); -} +export 'declaration.dart'; +export 'external_versions.dart'; diff --git a/pkgs/ffigen/lib/src/config_provider/declaration.dart b/pkgs/ffigen/lib/src/config_provider/declaration.dart new file mode 100644 index 0000000000..f6b1689436 --- /dev/null +++ b/pkgs/ffigen/lib/src/config_provider/declaration.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Declaration { + final String usr; + final String? originalName; + Declaration({required this.usr, required this.originalName}); +} diff --git a/pkgs/ffigen/lib/src/config_provider/external_versions.dart b/pkgs/ffigen/lib/src/config_provider/external_versions.dart new file mode 100644 index 0000000000..f4f81dcdf6 --- /dev/null +++ b/pkgs/ffigen/lib/src/config_provider/external_versions.dart @@ -0,0 +1,18 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:pub_semver/pub_semver.dart'; + +class ExternalVersions { + final Versions? ios; + final Versions? macos; + const ExternalVersions({this.ios, this.macos}); +} + +class Versions { + final Version? min; + final Version? max; + + const Versions({this.min, this.max}); +} diff --git a/pkgs/ffigen/lib/src/config_provider/yaml_config.dart b/pkgs/ffigen/lib/src/config_provider/yaml_config.dart index f63ee2ff22..0ef848eba0 100644 --- a/pkgs/ffigen/lib/src/config_provider/yaml_config.dart +++ b/pkgs/ffigen/lib/src/config_provider/yaml_config.dart @@ -194,17 +194,23 @@ final class YamlConfig { /// Holds config for how struct packing should be overriden. PackingValue? structPackingOverride(Declaration declaration) => - _structPackingOverride.getOverridenPackValue(declaration.originalName); + declaration.originalName == null + ? null + : _structPackingOverride.getOverridenPackValue(declaration.originalName!); late StructPackingOverride _structPackingOverride; /// The module that the ObjC interface belongs to. String? interfaceModule(Declaration declaration) => - _objcInterfaceModules.getModule(declaration.originalName); + declaration.originalName == null + ? null + : _objcInterfaceModules.getModule(declaration.originalName!); late ObjCModules _objcInterfaceModules; /// The module that the ObjC protocols belongs to. String? protocolModule(Declaration declaration) => - _objcProtocolModules.getModule(declaration.originalName); + declaration.originalName == null + ? null + : _objcProtocolModules.getModule(declaration.originalName!); late ObjCModules _objcProtocolModules; /// Name of the wrapper class. @@ -225,24 +231,32 @@ final class YamlConfig { /// Whether to expose the function typedef for a given function. bool shouldExposeFunctionTypedef(Declaration declaration) => - _exposeFunctionTypedefs.shouldInclude(declaration.originalName); + declaration.originalName == null + ? false + : _exposeFunctionTypedefs.shouldInclude(declaration.originalName!); late YamlIncluder _exposeFunctionTypedefs; /// Whether the given function is a leaf function. bool isLeafFunction(Declaration declaration) => - _leafFunctions.shouldInclude(declaration.originalName); + declaration.originalName == null + ? false + : _leafFunctions.shouldInclude(declaration.originalName!); late YamlIncluder _leafFunctions; /// Whether to generate the given enum as a series of int constants, rather /// than a real Dart enum. bool enumShouldBeInt(Declaration declaration) => - _enumsAsInt.shouldInclude(declaration.originalName); + declaration.originalName == null + ? false + : _enumsAsInt.shouldInclude(declaration.originalName!); late YamlIncluder _enumsAsInt; /// Whether to generate the given unnamed enum as a series of int constants, /// rather than a real Dart enum. bool unnamedEnumsShouldBeInt(Declaration declaration) => - _unnamedEnumsAsInt.shouldInclude(declaration.originalName); + declaration.originalName == null + ? false + : _unnamedEnumsAsInt.shouldInclude(declaration.originalName!); late YamlIncluder _unnamedEnumsAsInt; FfiNativeConfig get ffiNativeConfig => _ffiNativeConfig; @@ -1261,8 +1275,7 @@ final class YamlConfig { rename: _structDecl.rename, renameMember: _structDecl.renameMember, dependencies: _structDependencies, - packingOverride: (decl) => - _structPackingOverride.getOverridenPackValue(decl.originalName), + packingOverride: structPackingOverride, // ignore: deprecated_member_use_from_same_package imported: structTypeMappings.values.toList(), ), diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/api_availability.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/api_availability.dart index a5cdde0d78..13265d03e4 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/api_availability.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/api_availability.dart @@ -7,7 +7,7 @@ import 'dart:ffi'; import 'package:ffi/ffi.dart'; import 'package:meta/meta.dart'; -import '../../config_provider/config_types.dart'; +import '../../config_provider/external_versions.dart'; import '../../context.dart'; import '../clang_bindings/clang_bindings.dart' as clang_types; import '../utils.dart'; @@ -152,6 +152,76 @@ class ApiAvailability { return "$checkOsVersion('$apiName', $args);"; } + /// Combines two [ApiAvailability] objects by taking the union of their + /// availability. + /// + /// The resulting availability is the intersection of the sets of available + /// versions. Use this when a construct depends on multiple other constructs, + /// and is only available when *all* of them are available. + static ApiAvailability union(ApiAvailability a, ApiAvailability b) { + return ApiAvailability( + alwaysDeprecated: a.alwaysDeprecated || b.alwaysDeprecated, + alwaysUnavailable: a.alwaysUnavailable || b.alwaysUnavailable, + ios: _unionPlatform(a.ios, b.ios), + macos: _unionPlatform(a.macos, b.macos), + externalVersions: null, + ); + } + + static PlatformAvailability? _unionPlatform( + PlatformAvailability? a, + PlatformAvailability? b, + ) { + if (a == null && b == null) return null; + if (a == null) return b; + if (b == null) return a; + + return PlatformAvailability( + name: a.name ?? b.name, + introduced: _max(a.introduced, b.introduced), + deprecated: _min(a.deprecated, b.deprecated), + obsoleted: _min(a.obsoleted, b.obsoleted), + unavailable: a.unavailable || b.unavailable, + ); + } + + static Version? _max(Version? a, Version? b) { + if (a == null) return b; + if (b == null) return a; + return a > b ? a : b; + } + + static Version? _min(Version? a, Version? b) { + if (a == null) return b; + if (b == null) return a; + return a < b ? a : b; + } + + String get attribute { + final parts = []; + for (final platform in [ios, macos].nonNulls) { + if (platform.unavailable) { + parts.add('${platform.name!.toLowerCase()}(unavailable)'); + continue; + } + final versionParts = []; + if (platform.introduced != null) { + versionParts.add('introduced=${platform.introduced}'); + } + if (platform.deprecated != null) { + versionParts.add('deprecated=${platform.deprecated}'); + } + if (platform.obsoleted != null) { + versionParts.add('obsoleted=${platform.obsoleted}'); + } + if (versionParts.isNotEmpty) { + parts.add('${platform.name!.toLowerCase()}(${versionParts.join(", ")})'); + } + } + if (parts.isEmpty) return ''; + return 'API_AVAILABLE(${parts.join(", ")})'; + } + @override String toString() => '''Availability { diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart index cd3de4bc07..82aed0ae40 100644 --- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart +++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/objcinterfacedecl_parser.dart @@ -284,7 +284,7 @@ ObjCMethod? parseObjCMethod( final p = _parseMethodParam( context, child, - itfDecl.originalName, + itfDecl.originalName ?? '', methodName, ); if (p == null) { diff --git a/pkgs/ffigen/test/unit_tests/availability_codegen_test.dart b/pkgs/ffigen/test/unit_tests/availability_codegen_test.dart new file mode 100644 index 0000000000..6a31209815 --- /dev/null +++ b/pkgs/ffigen/test/unit_tests/availability_codegen_test.dart @@ -0,0 +1,146 @@ +// ignore_for_file: lines_longer_than_80_chars + +import 'package:ffigen/src/code_generator.dart'; +import 'package:ffigen/src/config_provider/config.dart'; +import 'package:ffigen/src/config_provider/config_types.dart'; +import 'package:ffigen/src/context.dart'; +import 'package:ffigen/src/header_parser/sub_parsers/api_availability.dart'; +import 'package:test/test.dart'; + +import '../test_utils.dart'; + +void main() { + group('Availability Codegen', () { + late Context context; + final voidType = NativeType(SupportedNativeType.voidType); + + setUp(() { + final config = FfiGenerator( + output: Output(dartFile: Uri.file('unused')), + objectiveC: const ObjectiveC( + interfaces: Interfaces.includeAll, + categories: Categories.includeAll, + ), + ); + context = testContext(config); + }); + + ObjCInterface makeInterface(String name, {Version? ios, Version? macos}) { + return ObjCInterface( + context: context, + usr: name, + originalName: name, + apiAvailability: ApiAvailability( + externalVersions: null, + ios: ios == null ? null : PlatformAvailability(name: 'ios', introduced: ios), + macos: macos == null ? null : PlatformAvailability(name: 'macos', introduced: macos), + ), + ); + } + + test('Block with no availability Types', () { + final block = ObjCBlock( + context, + returnType: voidType, + params: [], + returnsRetained: false, + ); + // Force generating bindings + block.hasListener; // ensure it thinks it has listener if needed, but ObjCBlock logic mostly checks returnType==void + // Actually ObjCBlock constructor checks hasListener. + // void return type means hasListener is true. + + final binding = block.toObjCBindingString(Writer(context: context)); + expect(binding!.string, isNot(contains('API_AVAILABLE'))); + }); + + test('Block with one restricted parameter', () { + final ios12 = makeInterface('IOS12Class', ios: Version(12, 0, 0)); + final block = ObjCBlock( + context, + returnType: voidType, + params: [Parameter(type: ios12, name: 'p1')], + returnsRetained: false, + ); + + final binding = block.toObjCBindingString(Writer(context: context)); + expect(binding!.string, contains('API_AVAILABLE(ios(12.0.0))')); + }); + + test('Block with multiple restricted parameters (Max version)', () { + final ios10 = makeInterface('IOS10Class', ios: Version(10, 0, 0)); + final ios12 = makeInterface('IOS12Class', ios: Version(12, 0, 0)); + + final block = ObjCBlock( + context, + returnType: voidType, + params: [ + Parameter(type: ios10, name: 'p1'), + Parameter(type: ios12, name: 'p2'), + ], + returnsRetained: false, + ); + + final binding = block.toObjCBindingString(Writer(context: context)); + // Should pick max version (12.0) + expect(binding!.string, contains('API_AVAILABLE(ios(12.0.0))')); + expect(binding.string, isNot(contains('ios(10.0.0)'))); + }); + + test('Block with restricted return type', () { + // Note: ObjCBlock only has listeners (trampolines) if returnType is void. + // Only void blocks generate trampolines where we put annotations? + // Let's check ObjCBlock.dart logic. + // `if (hasListener) { _blockWrappers = ... }` + // `bool get hasListener => returnType == voidType;` + // So if return type is NOT void, it might not generate the trampoline we want to annotate. + // However, `_blockWrappersBindingString` is what generates the trampoline C code. + // Wait, if return type is not void, `api` might be different. + // The user request says "Annotate them with API_AVAILABLE corresponding to the types in the block’s signature." + // If the block itself doesn't generate a trampoline (because it's not a listener block?), + // maybe we don't need to annotate it? + // But let's assume valid case where we generate code. + // Actually, the issue says "For block trampolines". + // Block trampolines are generated for listener blocks. + // Listener blocks strictly return void. + // So asking for "restricted return type" test might be moot if listener blocks MUST return void. + // But wait, `ObjCBlock` has `getProtocolMethodTrampoline` too. + + // Let's check protocol trampoline. + final macos11 = makeInterface('MacOS11Class', macos: Version(11, 0, 0)); + + // Protocol method trampoline is generated if we access it? + // `fillProtocolTrampoline` is called when used in protocol. + // We can force it. + + final block = ObjCBlock( + context, + returnType: macos11, + params: [], + returnsRetained: false, + ); + block.fillProtocolTrampoline(); + + final binding = block.toObjCBindingString(Writer(context: context)); + expect(binding!.string, contains('API_AVAILABLE(macos(11.0.0))')); + }); + + test('Mixed platforms', () { + final ios10 = makeInterface('IOS10', ios: Version(10, 0, 0)); + final macos10 = makeInterface('MacOS10', macos: Version(10, 12, 0)); + + final block = ObjCBlock( + context, + returnType: voidType, + params: [ + Parameter(type: ios10, name: 'p1'), + Parameter(type: macos10, name: 'p2'), + ], + returnsRetained: false, + ); + + final binding = block.toObjCBindingString(Writer(context: context)); + expect(binding!.string, contains('API_AVAILABLE(ios(10.0.0), macos(10.12.0))')); + }); + }); +} diff --git a/pkgs/hooks/example/build/download_asset/pubspec.yaml b/pkgs/hooks/example/build/download_asset/pubspec.yaml index 85ccb935be..315d0ff582 100644 --- a/pkgs/hooks/example/build/download_asset/pubspec.yaml +++ b/pkgs/hooks/example/build/download_asset/pubspec.yaml @@ -8,7 +8,7 @@ repository: https://github.com/dart-lang/native/tree/main/pkgs/hooks/example/bui resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks/example/build/local_asset/pubspec.yaml b/pkgs/hooks/example/build/local_asset/pubspec.yaml index 74c118b4c4..57727a3b38 100644 --- a/pkgs/hooks/example/build/local_asset/pubspec.yaml +++ b/pkgs/hooks/example/build/local_asset/pubspec.yaml @@ -8,7 +8,7 @@ repository: https://github.com/dart-lang/native/tree/main/pkgs/hooks/example/bui resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks/example/build/native_add_app/pubspec.yaml b/pkgs/hooks/example/build/native_add_app/pubspec.yaml index ae7de0464c..5b0f416f08 100644 --- a/pkgs/hooks/example/build/native_add_app/pubspec.yaml +++ b/pkgs/hooks/example/build/native_add_app/pubspec.yaml @@ -8,7 +8,7 @@ repository: https://github.com/dart-lang/native/tree/main/pkgs/hooks/example/bui resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: native_add_library: diff --git a/pkgs/hooks/example/build/native_add_library/pubspec.yaml b/pkgs/hooks/example/build/native_add_library/pubspec.yaml index 2ac0ac53e7..d1745367aa 100644 --- a/pkgs/hooks/example/build/native_add_library/pubspec.yaml +++ b/pkgs/hooks/example/build/native_add_library/pubspec.yaml @@ -8,7 +8,7 @@ repository: https://github.com/dart-lang/native/tree/main/pkgs/hooks/example/bui resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks/example/build/native_dynamic_linking/pubspec.yaml b/pkgs/hooks/example/build/native_dynamic_linking/pubspec.yaml index d80e727522..6b9080b57c 100644 --- a/pkgs/hooks/example/build/native_dynamic_linking/pubspec.yaml +++ b/pkgs/hooks/example/build/native_dynamic_linking/pubspec.yaml @@ -8,7 +8,7 @@ repository: https://github.com/dart-lang/native/tree/main/pkgs/hooks/example/bui resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks/example/build/system_library/pubspec.yaml b/pkgs/hooks/example/build/system_library/pubspec.yaml index 98796805d6..07c49d07e4 100644 --- a/pkgs/hooks/example/build/system_library/pubspec.yaml +++ b/pkgs/hooks/example/build/system_library/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks/example/build/use_dart_api/pubspec.yaml b/pkgs/hooks/example/build/use_dart_api/pubspec.yaml index 378cac101b..fd57ada56a 100644 --- a/pkgs/hooks/example/build/use_dart_api/pubspec.yaml +++ b/pkgs/hooks/example/build/use_dart_api/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks/example/link/app_with_asset_treeshaking/pubspec.yaml b/pkgs/hooks/example/link/app_with_asset_treeshaking/pubspec.yaml index df9a844950..3ff0fc7eb1 100644 --- a/pkgs/hooks/example/link/app_with_asset_treeshaking/pubspec.yaml +++ b/pkgs/hooks/example/link/app_with_asset_treeshaking/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: logging: ^1.3.0 diff --git a/pkgs/hooks/example/link/package_with_assets/pubspec.yaml b/pkgs/hooks/example/link/package_with_assets/pubspec.yaml index bc7946d7c9..4b70189418 100644 --- a/pkgs/hooks/example/link/package_with_assets/pubspec.yaml +++ b/pkgs/hooks/example/link/package_with_assets/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks/pubspec.yaml b/pkgs/hooks/pubspec.yaml index 51915d40a1..67c574dfd0 100644 --- a/pkgs/hooks/pubspec.yaml +++ b/pkgs/hooks/pubspec.yaml @@ -17,7 +17,7 @@ topics: resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: collection: ^1.19.1 diff --git a/pkgs/hooks_runner/pubspec.yaml b/pkgs/hooks_runner/pubspec.yaml index d89f07385b..17a96ac68d 100644 --- a/pkgs/hooks_runner/pubspec.yaml +++ b/pkgs/hooks_runner/pubspec.yaml @@ -9,7 +9,7 @@ repository: https://github.com/dart-lang/native/tree/main/pkgs/hooks_runner resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: ^1.0.0 # Needed for OS for Target for KernelAssets. diff --git a/pkgs/hooks_runner/test/build_runner/pub_workspace_test.dart b/pkgs/hooks_runner/test/build_runner/pub_workspace_test.dart index e6a8f1597e..bf9b89f5a8 100644 --- a/pkgs/hooks_runner/test/build_runner/pub_workspace_test.dart +++ b/pkgs/hooks_runner/test/build_runner/pub_workspace_test.dart @@ -37,7 +37,7 @@ resolution: workspace name: dart_lang_native_workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' workspace: '''; diff --git a/pkgs/hooks_runner/test_data/add_asset_link/pubspec.yaml b/pkgs/hooks_runner/test_data/add_asset_link/pubspec.yaml index 65a89787a3..a728d040e7 100644 --- a/pkgs/hooks_runner/test_data/add_asset_link/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/add_asset_link/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/complex_link/pubspec.yaml b/pkgs/hooks_runner/test_data/complex_link/pubspec.yaml index 043cb7190c..fda31ae2c9 100644 --- a/pkgs/hooks_runner/test_data/complex_link/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/complex_link/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: complex_link_helper: diff --git a/pkgs/hooks_runner/test_data/complex_link_helper/pubspec.yaml b/pkgs/hooks_runner/test_data/complex_link_helper/pubspec.yaml index 98af6ec63a..f815eb6515 100644 --- a/pkgs/hooks_runner/test_data/complex_link_helper/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/complex_link_helper/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/cyclic_link_package_1/pubspec.yaml b/pkgs/hooks_runner/test_data/cyclic_link_package_1/pubspec.yaml index c4ca96803d..417788d26e 100644 --- a/pkgs/hooks_runner/test_data/cyclic_link_package_1/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/cyclic_link_package_1/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: cyclic_link_package_2: diff --git a/pkgs/hooks_runner/test_data/cyclic_link_package_2/pubspec.yaml b/pkgs/hooks_runner/test_data/cyclic_link_package_2/pubspec.yaml index 3a64d5d3ab..3576d70f26 100644 --- a/pkgs/hooks_runner/test_data/cyclic_link_package_2/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/cyclic_link_package_2/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: cyclic_link_package_1: diff --git a/pkgs/hooks_runner/test_data/cyclic_package_1/pubspec.yaml b/pkgs/hooks_runner/test_data/cyclic_package_1/pubspec.yaml index df22d99acc..95e99ad013 100644 --- a/pkgs/hooks_runner/test_data/cyclic_package_1/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/cyclic_package_1/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: cyclic_package_2: diff --git a/pkgs/hooks_runner/test_data/cyclic_package_2/pubspec.yaml b/pkgs/hooks_runner/test_data/cyclic_package_2/pubspec.yaml index ab02ba4caa..b93bb2883d 100644 --- a/pkgs/hooks_runner/test_data/cyclic_package_2/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/cyclic_package_2/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: cyclic_package_1: diff --git a/pkgs/hooks_runner/test_data/dart_app/pubspec.yaml b/pkgs/hooks_runner/test_data/dart_app/pubspec.yaml index d942f7bd70..e06324a30d 100644 --- a/pkgs/hooks_runner/test_data/dart_app/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/dart_app/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: native_add: diff --git a/pkgs/hooks_runner/test_data/depend_on_fail_build/pubspec.yaml b/pkgs/hooks_runner/test_data/depend_on_fail_build/pubspec.yaml index 416798e037..68aff712c1 100644 --- a/pkgs/hooks_runner/test_data/depend_on_fail_build/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/depend_on_fail_build/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: fail_build: diff --git a/pkgs/hooks_runner/test_data/depend_on_fail_build_app/pubspec.yaml b/pkgs/hooks_runner/test_data/depend_on_fail_build_app/pubspec.yaml index db953a34ac..4206b352ab 100644 --- a/pkgs/hooks_runner/test_data/depend_on_fail_build_app/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/depend_on_fail_build_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: depend_on_fail_build: diff --git a/pkgs/hooks_runner/test_data/dev_dependency_with_hook/pubspec.yaml b/pkgs/hooks_runner/test_data/dev_dependency_with_hook/pubspec.yaml index 67743f8913..91d2e250d4 100644 --- a/pkgs/hooks_runner/test_data/dev_dependency_with_hook/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/dev_dependency_with_hook/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: {} diff --git a/pkgs/hooks_runner/test_data/download_assets/pubspec.yaml b/pkgs/hooks_runner/test_data/download_assets/pubspec.yaml index cdd5a7b0e1..f300b71eff 100644 --- a/pkgs/hooks_runner/test_data/download_assets/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/download_assets/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: hooks: any diff --git a/pkgs/hooks_runner/test_data/drop_dylib_link/pubspec.yaml b/pkgs/hooks_runner/test_data/drop_dylib_link/pubspec.yaml index 0944200d41..8a29f42c6d 100644 --- a/pkgs/hooks_runner/test_data/drop_dylib_link/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/drop_dylib_link/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/fail_build/pubspec.yaml b/pkgs/hooks_runner/test_data/fail_build/pubspec.yaml index 5c4884fa41..bfb06c8295 100644 --- a/pkgs/hooks_runner/test_data/fail_build/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/fail_build/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/fail_on_os_sdk_version/pubspec.yaml b/pkgs/hooks_runner/test_data/fail_on_os_sdk_version/pubspec.yaml index 421e8271ac..65b3bf4125 100644 --- a/pkgs/hooks_runner/test_data/fail_on_os_sdk_version/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/fail_on_os_sdk_version/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/fail_on_os_sdk_version_link/pubspec.yaml b/pkgs/hooks_runner/test_data/fail_on_os_sdk_version_link/pubspec.yaml index 5440197d39..d5c3478b12 100644 --- a/pkgs/hooks_runner/test_data/fail_on_os_sdk_version_link/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/fail_on_os_sdk_version_link/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/fail_on_os_sdk_version_linker/pubspec.yaml b/pkgs/hooks_runner/test_data/fail_on_os_sdk_version_linker/pubspec.yaml index 2889f4ba7a..dda84d2cd7 100644 --- a/pkgs/hooks_runner/test_data/fail_on_os_sdk_version_linker/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/fail_on_os_sdk_version_linker/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/flag_app/pubspec.yaml b/pkgs/hooks_runner/test_data/flag_app/pubspec.yaml index b0c9ecbca4..1ab864eb8a 100644 --- a/pkgs/hooks_runner/test_data/flag_app/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/flag_app/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: flag_enthusiast_1: diff --git a/pkgs/hooks_runner/test_data/flag_enthusiast_1/pubspec.yaml b/pkgs/hooks_runner/test_data/flag_enthusiast_1/pubspec.yaml index c6b909d707..c144bef7ba 100644 --- a/pkgs/hooks_runner/test_data/flag_enthusiast_1/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/flag_enthusiast_1/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/flag_enthusiast_2/pubspec.yaml b/pkgs/hooks_runner/test_data/flag_enthusiast_2/pubspec.yaml index e57d716cb4..9096fddecc 100644 --- a/pkgs/hooks_runner/test_data/flag_enthusiast_2/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/flag_enthusiast_2/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/fun_with_flags/pubspec.yaml b/pkgs/hooks_runner/test_data/fun_with_flags/pubspec.yaml index 5c4a1a448b..f3ded18e14 100644 --- a/pkgs/hooks_runner/test_data/fun_with_flags/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/fun_with_flags/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/infra_failure/pubspec.yaml b/pkgs/hooks_runner/test_data/infra_failure/pubspec.yaml index 682d2b39ff..85082b3bfd 100644 --- a/pkgs/hooks_runner/test_data/infra_failure/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/infra_failure/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/link_inverse_app/pubspec.yaml b/pkgs/hooks_runner/test_data/link_inverse_app/pubspec.yaml index af3971e9d4..56b45e7e12 100644 --- a/pkgs/hooks_runner/test_data/link_inverse_app/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/link_inverse_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/link_inverse_package/pubspec.yaml b/pkgs/hooks_runner/test_data/link_inverse_package/pubspec.yaml index 160e57813c..c36ae81e93 100644 --- a/pkgs/hooks_runner/test_data/link_inverse_package/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/link_inverse_package/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: hooks: any diff --git a/pkgs/hooks_runner/test_data/native_add/pubspec.yaml b/pkgs/hooks_runner/test_data/native_add/pubspec.yaml index ed9ae66f88..a8c0a2df78 100644 --- a/pkgs/hooks_runner/test_data/native_add/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/native_add/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/native_add_add_source/pubspec.yaml b/pkgs/hooks_runner/test_data/native_add_add_source/pubspec.yaml index 652ec1f0e5..5421f7490e 100644 --- a/pkgs/hooks_runner/test_data/native_add_add_source/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/native_add_add_source/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/native_add_duplicate/pubspec.yaml b/pkgs/hooks_runner/test_data/native_add_duplicate/pubspec.yaml index 4e6665aebc..73bea7dea8 100644 --- a/pkgs/hooks_runner/test_data/native_add_duplicate/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/native_add_duplicate/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/native_dynamic_linking/pubspec.yaml b/pkgs/hooks_runner/test_data/native_dynamic_linking/pubspec.yaml index b499b626f3..8474df4fe7 100644 --- a/pkgs/hooks_runner/test_data/native_dynamic_linking/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/native_dynamic_linking/pubspec.yaml @@ -8,7 +8,7 @@ repository: https://github.com/dart-lang/native/tree/main/pkgs/hooks/example/bui resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/native_subtract/pubspec.yaml b/pkgs/hooks_runner/test_data/native_subtract/pubspec.yaml index 445648db15..a41b0e579a 100644 --- a/pkgs/hooks_runner/test_data/native_subtract/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/native_subtract/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/no_asset_for_link/pubspec.yaml b/pkgs/hooks_runner/test_data/no_asset_for_link/pubspec.yaml index a35433d293..e5d87902a0 100644 --- a/pkgs/hooks_runner/test_data/no_asset_for_link/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/no_asset_for_link/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/no_build_output/pubspec.yaml b/pkgs/hooks_runner/test_data/no_build_output/pubspec.yaml index d4e4ee83a0..bffe09b55d 100644 --- a/pkgs/hooks_runner/test_data/no_build_output/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/no_build_output/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: hooks: any diff --git a/pkgs/hooks_runner/test_data/no_hook/pubspec.yaml b/pkgs/hooks_runner/test_data/no_hook/pubspec.yaml index 1584324d10..80ec5a5368 100644 --- a/pkgs/hooks_runner/test_data/no_hook/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/no_hook/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/package_reading_metadata/pubspec.yaml b/pkgs/hooks_runner/test_data/package_reading_metadata/pubspec.yaml index dfaf1f0e60..3bb4152d19 100644 --- a/pkgs/hooks_runner/test_data/package_reading_metadata/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/package_reading_metadata/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/package_with_metadata/pubspec.yaml b/pkgs/hooks_runner/test_data/package_with_metadata/pubspec.yaml index de7f2f9ffc..dfee46786f 100644 --- a/pkgs/hooks_runner/test_data/package_with_metadata/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/package_with_metadata/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/pirate_adventure/pubspec.yaml b/pkgs/hooks_runner/test_data/pirate_adventure/pubspec.yaml index 6ac57ed16f..61b8ac757a 100644 --- a/pkgs/hooks_runner/test_data/pirate_adventure/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/pirate_adventure/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: pirate_speak: diff --git a/pkgs/hooks_runner/test_data/pirate_speak/pubspec.yaml b/pkgs/hooks_runner/test_data/pirate_speak/pubspec.yaml index 43d11e544f..9d29ad6d7b 100644 --- a/pkgs/hooks_runner/test_data/pirate_speak/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/pirate_speak/pubspec.yaml @@ -10,7 +10,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/pirate_technology/pubspec.yaml b/pkgs/hooks_runner/test_data/pirate_technology/pubspec.yaml index 4e8c5684ef..13caa67db6 100644 --- a/pkgs/hooks_runner/test_data/pirate_technology/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/pirate_technology/pubspec.yaml @@ -10,7 +10,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/recursive_invocation/pubspec.yaml b/pkgs/hooks_runner/test_data/recursive_invocation/pubspec.yaml index 4223983847..8ecb888bf1 100644 --- a/pkgs/hooks_runner/test_data/recursive_invocation/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/recursive_invocation/pubspec.yaml @@ -13,7 +13,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/relative_path/pubspec.yaml b/pkgs/hooks_runner/test_data/relative_path/pubspec.yaml index 7ad2a4c50b..1c5b0f6aad 100644 --- a/pkgs/hooks_runner/test_data/relative_path/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/relative_path/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/reusable_dynamic_library/pubspec.yaml b/pkgs/hooks_runner/test_data/reusable_dynamic_library/pubspec.yaml index 84c65fef28..b0bddc1df9 100644 --- a/pkgs/hooks_runner/test_data/reusable_dynamic_library/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/reusable_dynamic_library/pubspec.yaml @@ -9,7 +9,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/reuse_dynamic_library/pubspec.yaml b/pkgs/hooks_runner/test_data/reuse_dynamic_library/pubspec.yaml index e482e4da68..8c95f66848 100644 --- a/pkgs/hooks_runner/test_data/reuse_dynamic_library/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/reuse_dynamic_library/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/simple_data_asset/pubspec.yaml b/pkgs/hooks_runner/test_data/simple_data_asset/pubspec.yaml index 5e609e5dba..df5ce45d4a 100644 --- a/pkgs/hooks_runner/test_data/simple_data_asset/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/simple_data_asset/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/simple_link/pubspec.yaml b/pkgs/hooks_runner/test_data/simple_link/pubspec.yaml index 6d2bc78895..b609e05696 100644 --- a/pkgs/hooks_runner/test_data/simple_link/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/simple_link/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/some_dev_dep/pubspec.yaml b/pkgs/hooks_runner/test_data/some_dev_dep/pubspec.yaml index 645cd3487a..1bbdc3f037 100644 --- a/pkgs/hooks_runner/test_data/some_dev_dep/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/some_dev_dep/pubspec.yaml @@ -7,4 +7,4 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' diff --git a/pkgs/hooks_runner/test_data/system_library/pubspec.yaml b/pkgs/hooks_runner/test_data/system_library/pubspec.yaml index 74c933cabf..f2c401289b 100644 --- a/pkgs/hooks_runner/test_data/system_library/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/system_library/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/transformer/pubspec.yaml b/pkgs/hooks_runner/test_data/transformer/pubspec.yaml index a0404a3114..7cbc7eea97 100644 --- a/pkgs/hooks_runner/test_data/transformer/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/transformer/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: crypto: ^3.0.6 diff --git a/pkgs/hooks_runner/test_data/treeshaking_native_libs/pubspec.yaml b/pkgs/hooks_runner/test_data/treeshaking_native_libs/pubspec.yaml index ff992fc648..bdf4d22111 100644 --- a/pkgs/hooks_runner/test_data/treeshaking_native_libs/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/treeshaking_native_libs/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/use_all_api/pubspec.yaml b/pkgs/hooks_runner/test_data/use_all_api/pubspec.yaml index 327b41a4d2..1c5e3d7f1e 100644 --- a/pkgs/hooks_runner/test_data/use_all_api/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/use_all_api/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/user_defines/pubspec.yaml b/pkgs/hooks_runner/test_data/user_defines/pubspec.yaml index 956bedb2d3..1d0fb35239 100644 --- a/pkgs/hooks_runner/test_data/user_defines/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/user_defines/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: data_assets: any diff --git a/pkgs/hooks_runner/test_data/wrong_build_output/pubspec.yaml b/pkgs/hooks_runner/test_data/wrong_build_output/pubspec.yaml index 1f381ad61d..3ce18b34e9 100644 --- a/pkgs/hooks_runner/test_data/wrong_build_output/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/wrong_build_output/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/wrong_build_output_2/pubspec.yaml b/pkgs/hooks_runner/test_data/wrong_build_output_2/pubspec.yaml index dac0d0825f..eeddf3bb5a 100644 --- a/pkgs/hooks_runner/test_data/wrong_build_output_2/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/wrong_build_output_2/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/wrong_build_output_3/pubspec.yaml b/pkgs/hooks_runner/test_data/wrong_build_output_3/pubspec.yaml index b61c9f51e6..646c104304 100644 --- a/pkgs/hooks_runner/test_data/wrong_build_output_3/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/wrong_build_output_3/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/wrong_linker/pubspec.yaml b/pkgs/hooks_runner/test_data/wrong_linker/pubspec.yaml index 28bc0d09c1..d14ddc2bfc 100644 --- a/pkgs/hooks_runner/test_data/wrong_linker/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/wrong_linker/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/hooks_runner/test_data/wrong_namespace_asset/pubspec.yaml b/pkgs/hooks_runner/test_data/wrong_namespace_asset/pubspec.yaml index d925e34638..984e84c61a 100644 --- a/pkgs/hooks_runner/test_data/wrong_namespace_asset/pubspec.yaml +++ b/pkgs/hooks_runner/test_data/wrong_namespace_asset/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: any diff --git a/pkgs/json_syntax_generator/pubspec.yaml b/pkgs/json_syntax_generator/pubspec.yaml index 1de677d80a..1b5cbc85bf 100644 --- a/pkgs/json_syntax_generator/pubspec.yaml +++ b/pkgs/json_syntax_generator/pubspec.yaml @@ -12,7 +12,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: json_schema: ^5.2.0 diff --git a/pkgs/native_test_helpers/pubspec.yaml b/pkgs/native_test_helpers/pubspec.yaml index fd01a740d1..e7bd25c4ae 100644 --- a/pkgs/native_test_helpers/pubspec.yaml +++ b/pkgs/native_test_helpers/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: yaml: ^3.1.3 diff --git a/pkgs/native_toolchain_c/pubspec.yaml b/pkgs/native_toolchain_c/pubspec.yaml index 6345f7fdb0..775b977113 100644 --- a/pkgs/native_toolchain_c/pubspec.yaml +++ b/pkgs/native_toolchain_c/pubspec.yaml @@ -14,7 +14,7 @@ topics: resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: code_assets: ^1.0.0 diff --git a/pkgs/pub_formats/pubspec.yaml b/pkgs/pub_formats/pubspec.yaml index 0e2b3778f8..61ab067657 100644 --- a/pkgs/pub_formats/pubspec.yaml +++ b/pkgs/pub_formats/pubspec.yaml @@ -13,7 +13,7 @@ version: 0.0.1-wip resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dev_dependencies: args: ^2.6.0 diff --git a/pkgs/record_use/pubspec.yaml b/pkgs/record_use/pubspec.yaml index c8e5f7f072..b10575bd9c 100644 --- a/pkgs/record_use/pubspec.yaml +++ b/pkgs/record_use/pubspec.yaml @@ -5,7 +5,7 @@ version: 0.5.0-wip repository: https://github.com/dart-lang/native/tree/main/pkgs/record_use environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' resolution: workspace diff --git a/pkgs/record_use/test_data/drop_data_asset/pubspec.yaml b/pkgs/record_use/test_data/drop_data_asset/pubspec.yaml index 0f59cfd840..b56eff0452 100644 --- a/pkgs/record_use/test_data/drop_data_asset/pubspec.yaml +++ b/pkgs/record_use/test_data/drop_data_asset/pubspec.yaml @@ -4,7 +4,7 @@ description: Add four data assets, remove three in linking based on recorded usa publish_to: none environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' resolution: workspace diff --git a/pkgs/record_use/test_data/drop_dylib_recording/pubspec.yaml b/pkgs/record_use/test_data/drop_dylib_recording/pubspec.yaml index 9b054b0677..f086f58c9a 100644 --- a/pkgs/record_use/test_data/drop_dylib_recording/pubspec.yaml +++ b/pkgs/record_use/test_data/drop_dylib_recording/pubspec.yaml @@ -5,7 +5,7 @@ version: 1.0.0 publish_to: none environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' resolution: workspace diff --git a/pkgs/record_use/test_data/library_uris/pubspec.yaml b/pkgs/record_use/test_data/library_uris/pubspec.yaml index 93eec8f816..471100fde4 100644 --- a/pkgs/record_use/test_data/library_uris/pubspec.yaml +++ b/pkgs/record_use/test_data/library_uris/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: hooks: any diff --git a/pkgs/record_use/test_data/library_uris_helper/pubspec.yaml b/pkgs/record_use/test_data/library_uris_helper/pubspec.yaml index 8806358ecb..87ca9072bf 100644 --- a/pkgs/record_use/test_data/library_uris_helper/pubspec.yaml +++ b/pkgs/record_use/test_data/library_uris_helper/pubspec.yaml @@ -8,7 +8,7 @@ publish_to: none resolution: workspace environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: meta: ^1.18.0 diff --git a/pubspec.yaml b/pubspec.yaml index 044fc6fa1f..bd77c52091 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: dart_lang_native_workspace publish_to: none environment: - sdk: '>=3.9.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' workspace: - pkgs/code_assets From 8f98e4e1f46040e8718fb05adf83dd6b0cca4b78 Mon Sep 17 00:00:00 2001 From: YATIN JAMWAL Date: Wed, 18 Feb 2026 01:02:10 +0530 Subject: [PATCH 2/2] [infra] Ensure temp dirs have spaces Update test/tool temp-directory helpers across non-ffigen packages so their root temp paths always contain a space, keeping ffigen temp handling scoped to #3029 while satisfying #3026. Co-authored-by: Cursor --- pkgs/code_assets/test/code_assets/config_test.dart | 4 +++- .../code_assets/test/code_assets/validation_test.dart | 3 ++- .../data_assets/test/data_assets/validation_test.dart | 3 ++- pkgs/hooks/lib/src/test.dart | 2 +- pkgs/hooks/test/api/build_test.dart | 3 ++- pkgs/hooks/test/build_input_test.dart | 4 +++- pkgs/hooks/test/example/native_add_library_test.dart | 3 ++- .../test/example/native_dynamic_linking_test.dart | 3 ++- pkgs/hooks/test/helpers.dart | 5 ++++- pkgs/hooks/test/link_input_test.dart | 4 +++- pkgs/hooks/test/validation_test.dart | 3 ++- pkgs/hooks_runner/test/helpers.dart | 10 ++++++++-- pkgs/jni/bin/setup.dart | 3 ++- pkgs/jni/tool/generate_ide_files.dart | 3 ++- pkgs/jnigen/lib/src/tools/gradle_tools.dart | 2 +- pkgs/jnigen/test/generation_test.dart | 3 ++- pkgs/jnigen/test/test_util/bindings_test_setup.dart | 4 +++- pkgs/jnigen/test/test_util/test_util.dart | 11 ++++++++--- pkgs/native_doc_dartifier/lib/src/code_processor.dart | 3 ++- pkgs/native_toolchain_c/test/helpers.dart | 5 ++++- pkgs/objective_c/test/hook_build_path_test.dart | 2 +- pkgs/swift2objc/lib/src/config.dart | 2 +- .../swift2objc/test/integration/integration_test.dart | 2 +- pkgs/swift2objc/test/unit/filter_test.dart | 2 +- pkgs/swift2objc/test/utils.dart | 5 ++++- pkgs/swiftgen/example/generate_code.dart | 2 +- pkgs/swiftgen/lib/src/util.dart | 4 +++- pkgs/swiftgen/test/integration/util.dart | 2 +- 28 files changed, 71 insertions(+), 31 deletions(-) diff --git a/pkgs/code_assets/test/code_assets/config_test.dart b/pkgs/code_assets/test/code_assets/config_test.dart index 6ea73a7746..31a9075600 100644 --- a/pkgs/code_assets/test/code_assets/config_test.dart +++ b/pkgs/code_assets/test/code_assets/config_test.dart @@ -23,7 +23,9 @@ void main() async { late Uri fakeVcVars; setUp(() async { - final tempUri = Directory.systemTemp.uri; + final tempUri = + (await Directory.systemTemp.createTemp('code assets config temp ')) + .uri; outFile = tempUri.resolve('output.json'); outputDirectoryShared = tempUri.resolve('out_shared1/'); packageName = 'my_package'; diff --git a/pkgs/code_assets/test/code_assets/validation_test.dart b/pkgs/code_assets/test/code_assets/validation_test.dart index 2139307538..d8dd6591e1 100644 --- a/pkgs/code_assets/test/code_assets/validation_test.dart +++ b/pkgs/code_assets/test/code_assets/validation_test.dart @@ -19,7 +19,8 @@ void main() { late Uri packageRootUri; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = + (await Directory.systemTemp.createTemp('code assets temp ')).uri; outDirUri = tempUri.resolve('out/'); await Directory.fromUri(outDirUri).create(); outDirSharedUri = tempUri.resolve('out_shared/'); diff --git a/pkgs/data_assets/test/data_assets/validation_test.dart b/pkgs/data_assets/test/data_assets/validation_test.dart index b93475bca5..deddc699f9 100644 --- a/pkgs/data_assets/test/data_assets/validation_test.dart +++ b/pkgs/data_assets/test/data_assets/validation_test.dart @@ -17,7 +17,8 @@ void main() { late Uri packageRootUri; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = + (await Directory.systemTemp.createTemp('data assets temp ')).uri; outDirUri = tempUri.resolve('out/'); await Directory.fromUri(outDirUri).create(); outDirSharedUri = tempUri.resolve('out_shared/'); diff --git a/pkgs/hooks/lib/src/test.dart b/pkgs/hooks/lib/src/test.dart index eb2c9ed7ed..a0db9848a7 100644 --- a/pkgs/hooks/lib/src/test.dart +++ b/pkgs/hooks/lib/src/test.dart @@ -52,7 +52,7 @@ Future testBuildHook({ linkingEnabled ??= false; const keepTempKey = 'KEEP_TEMPORARY_DIRECTORIES'; - final tempDir = await Directory.systemTemp.createTemp(); + final tempDir = await Directory.systemTemp.createTemp('hooks test '); try { // Deal with Windows temp folder aliases. diff --git a/pkgs/hooks/test/api/build_test.dart b/pkgs/hooks/test/api/build_test.dart index fae5715186..9b791625da 100644 --- a/pkgs/hooks/test/api/build_test.dart +++ b/pkgs/hooks/test/api/build_test.dart @@ -20,7 +20,8 @@ void main() async { late BuildInput input; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = (await Directory.systemTemp.createTemp('hooks api temp ')) + .uri; outFile = tempUri.resolve('output.json'); outDirUri = tempUri.resolve('out1/'); await Directory.fromUri(outDirUri).create(); diff --git a/pkgs/hooks/test/build_input_test.dart b/pkgs/hooks/test/build_input_test.dart index c8ea74ce1e..50259ab8df 100644 --- a/pkgs/hooks/test/build_input_test.dart +++ b/pkgs/hooks/test/build_input_test.dart @@ -20,7 +20,9 @@ void main() async { late Map inputJson; setUp(() async { - final tempUri = Directory.systemTemp.uri; + final tempUri = + (await Directory.systemTemp.createTemp('hooks build_input temp ')) + .uri; outFile = tempUri.resolve('output.json'); outDirUri = tempUri.resolve('out1/'); outputDirectoryShared = tempUri.resolve('out_shared1/'); diff --git a/pkgs/hooks/test/example/native_add_library_test.dart b/pkgs/hooks/test/example/native_add_library_test.dart index 3efe75d83e..e9738045bc 100644 --- a/pkgs/hooks/test/example/native_add_library_test.dart +++ b/pkgs/hooks/test/example/native_add_library_test.dart @@ -19,7 +19,8 @@ void main() async { const name = 'native_add_library'; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = (await Directory.systemTemp.createTemp('hooks example temp ')) + .uri; }); tearDown(() async { diff --git a/pkgs/hooks/test/example/native_dynamic_linking_test.dart b/pkgs/hooks/test/example/native_dynamic_linking_test.dart index 27c4ad2dbb..4e9c56a624 100644 --- a/pkgs/hooks/test/example/native_dynamic_linking_test.dart +++ b/pkgs/hooks/test/example/native_dynamic_linking_test.dart @@ -23,7 +23,8 @@ void main() async { const name = 'native_dynamic_linking'; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = (await Directory.systemTemp.createTemp('hooks example temp ')) + .uri; }); tearDown(() async { diff --git a/pkgs/hooks/test/helpers.dart b/pkgs/hooks/test/helpers.dart index 1a65f31688..7fea9715a9 100644 --- a/pkgs/hooks/test/helpers.dart +++ b/pkgs/hooks/test/helpers.dart @@ -18,7 +18,10 @@ Future inTempDir( String? prefix, bool keepTemp = false, }) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); + final basePrefix = prefix ?? 'hooks_test'; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + final tempDir = await Directory.systemTemp.createTemp(effectivePrefix); // Deal with Windows temp folder aliases. final tempUri = Directory( await tempDir.resolveSymbolicLinks(), diff --git a/pkgs/hooks/test/link_input_test.dart b/pkgs/hooks/test/link_input_test.dart index 25925702b0..bf35e79a0f 100644 --- a/pkgs/hooks/test/link_input_test.dart +++ b/pkgs/hooks/test/link_input_test.dart @@ -18,7 +18,9 @@ void main() async { late Map inputJson; setUp(() async { - final tempUri = Directory.systemTemp.uri; + final tempUri = + (await Directory.systemTemp.createTemp('hooks link_input temp ')) + .uri; outFile = tempUri.resolve('output.json'); outDirUri = tempUri.resolve('out1/'); outputDirectoryShared = tempUri.resolve('out_shared1/'); diff --git a/pkgs/hooks/test/validation_test.dart b/pkgs/hooks/test/validation_test.dart index 810f38d5e4..65051706b9 100644 --- a/pkgs/hooks/test/validation_test.dart +++ b/pkgs/hooks/test/validation_test.dart @@ -15,7 +15,8 @@ void main() { late Uri packageRootUri; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = (await Directory.systemTemp.createTemp('hooks test temp ')) + .uri; outDirUri = tempUri.resolve('out/'); await Directory.fromUri(outDirUri).create(); outDirSharedUri = tempUri.resolve('out_shared/'); diff --git a/pkgs/hooks_runner/test/helpers.dart b/pkgs/hooks_runner/test/helpers.dart index 00ec3fb2c2..4aba06f446 100644 --- a/pkgs/hooks_runner/test/helpers.dart +++ b/pkgs/hooks_runner/test/helpers.dart @@ -33,7 +33,10 @@ Future inTempDir( String? prefix, bool keepTemp = false, }) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); + final basePrefix = prefix ?? 'hooks_runner_test'; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + final tempDir = await Directory.systemTemp.createTemp(effectivePrefix); // Deal with Windows temp folder aliases. final tempUri = Directory( await tempDir.resolveSymbolicLinks(), @@ -58,7 +61,10 @@ Future inTempDir( } Future tempDirForTest({String? prefix, bool keepTemp = false}) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); + final basePrefix = prefix ?? 'hooks_runner_test'; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + final tempDir = await Directory.systemTemp.createTemp(effectivePrefix); // Deal with Windows temp folder aliases. final tempUri = Directory( await tempDir.resolveSymbolicLinks(), diff --git a/pkgs/jni/bin/setup.dart b/pkgs/jni/bin/setup.dart index 0c38dea7b9..8ba102380c 100644 --- a/pkgs/jni/bin/setup.dart +++ b/pkgs/jni/bin/setup.dart @@ -267,7 +267,8 @@ void main(List arguments) async { final jniDirUri = Uri.directory('.dart_tool').resolve('jni'); final jniDir = Directory.fromUri(jniDirUri); await jniDir.create(recursive: true); - final tempDir = await jniDir.createTemp('jni_native_build_'); + final tempDir = + await jniDir.createTemp('jni native build '); final cmakeArgs = []; cmakeArgs.addAll(options.cmakeArgs); diff --git a/pkgs/jni/tool/generate_ide_files.dart b/pkgs/jni/tool/generate_ide_files.dart index a973d245d1..a4d71a47a2 100644 --- a/pkgs/jni/tool/generate_ide_files.dart +++ b/pkgs/jni/tool/generate_ide_files.dart @@ -45,7 +45,8 @@ void main(List arguments) { return; } final generator = cmakeGeneratorNames[argResults['generator']]; - final tempDir = Directory.current.createTempSync('clangd_setup_temp_'); + final tempDir = + Directory.current.createTempSync('clangd setup temp '); final src = Directory.current.uri.resolve('src/'); try { runCommand( diff --git a/pkgs/jnigen/lib/src/tools/gradle_tools.dart b/pkgs/jnigen/lib/src/tools/gradle_tools.dart index afe2f9e187..96767da782 100644 --- a/pkgs/jnigen/lib/src/tools/gradle_tools.dart +++ b/pkgs/jnigen/lib/src/tools/gradle_tools.dart @@ -45,7 +45,7 @@ class GradleTools { deps, targetPath, ); - final tempDir = await currentDir.createTemp('maven_temp_'); + final tempDir = await currentDir.createTemp('maven temp '); await createStubProject(tempDir); final tempGradle = join(tempDir.path, 'temp_build.gradle.kts'); log.finer('using Gradle stub:\n$gradle'); diff --git a/pkgs/jnigen/test/generation_test.dart b/pkgs/jnigen/test/generation_test.dart index f5c065038b..f7a4afe36a 100644 --- a/pkgs/jnigen/test/generation_test.dart +++ b/pkgs/jnigen/test/generation_test.dart @@ -10,7 +10,8 @@ import 'package:test/test.dart'; void main() { test('Warn if non-jnigen-generated files exist in directory', () async { - final root = await Directory.current.createTemp(); + final root = + await Directory.current.createTemp('jnigen generation test '); final nonGenerated = await File.fromUri(root.uri.resolve('non_gen.dart')).create(); await nonGenerated.writeAsString('void main() {}'); diff --git a/pkgs/jnigen/test/test_util/bindings_test_setup.dart b/pkgs/jnigen/test/test_util/bindings_test_setup.dart index 508fc66acc..c90bc87d81 100644 --- a/pkgs/jnigen/test/test_util/bindings_test_setup.dart +++ b/pkgs/jnigen/test/test_util/bindings_test_setup.dart @@ -32,7 +32,9 @@ Future bindingsTestSetup() async { 'jni:setup', ]); tempClassDir = - Directory.current.createTempSync('jnigen_runtime_test_classpath_'); + Directory.current.createTempSync( + 'jnigen_runtime_test_classpath with spaces ', + ); await compileJavaFiles(Directory(simplePackageTestJava), tempClassDir); await runCommand('dart', [ 'run', diff --git a/pkgs/jnigen/test/test_util/test_util.dart b/pkgs/jnigen/test/test_util/test_util.dart index cb74c7f9a4..1db00b10e4 100644 --- a/pkgs/jnigen/test/test_util/test_util.dart +++ b/pkgs/jnigen/test/test_util/test_util.dart @@ -19,7 +19,10 @@ const largeTestTag = 'large_test'; const summarizerTestTag = 'summarizer_test'; Directory getTempDir(String prefix) { - return _currentDirectory.createTempSync(prefix); + final basePrefix = prefix.isEmpty ? 'jnigen_test_temp' : prefix; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + return _currentDirectory.createTempSync(effectivePrefix); } Future isEmptyOrNotExistDir(String path) async { @@ -117,7 +120,8 @@ Future generateAndCompareBindings(Config config) async { final dartReferenceBindings = config.outputConfig.dartConfig.path.toFilePath(); final currentDir = Directory.current; - final tempDir = currentDir.createTempSync('jnigen_test_temp'); + final tempDir = + currentDir.createTempSync('jnigen_test_temp with spaces '); final singleFile = config.outputConfig.dartConfig.structure == OutputStructure.singleFile; final tempLib = singleFile @@ -133,7 +137,8 @@ Future generateAndCompareBindings(Config config) async { Future generateAndAnalyzeBindings(Config config, {Iterable confirmExists = const []}) async { - final tempDir = Directory.current.createTempSync('jnigen_test_temp'); + final tempDir = + Directory.current.createTempSync('jnigen_test_temp with spaces '); try { await _generateTempBindings(config, tempDir); final analyzeResult = Process.runSync('dart', ['analyze', tempDir.path]); diff --git a/pkgs/native_doc_dartifier/lib/src/code_processor.dart b/pkgs/native_doc_dartifier/lib/src/code_processor.dart index ec087e2d7f..8bed20d814 100644 --- a/pkgs/native_doc_dartifier/lib/src/code_processor.dart +++ b/pkgs/native_doc_dartifier/lib/src/code_processor.dart @@ -9,7 +9,8 @@ class CodeProcessor { final String _dartifiedCodeFileName = 'dartified_code.dart'; final String _helperCodeFileName = 'helper_code.dart'; - CodeProcessor() : _tempDir = Directory('${Directory.current.path}/temp') { + CodeProcessor() + : _tempDir = Directory('${Directory.current.path}/temp dir') { if (!_tempDir.existsSync()) { _tempDir.createSync(recursive: true); } diff --git a/pkgs/native_toolchain_c/test/helpers.dart b/pkgs/native_toolchain_c/test/helpers.dart index 4485ef5049..2b34f887a3 100644 --- a/pkgs/native_toolchain_c/test/helpers.dart +++ b/pkgs/native_toolchain_c/test/helpers.dart @@ -45,7 +45,10 @@ String testSuffix(List tags) => switch (tags) { const keepTempKey = 'KEEP_TEMPORARY_DIRECTORIES'; Future tempDirForTest({String? prefix, bool keepTemp = false}) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); + final basePrefix = prefix ?? 'native_toolchain_c_test'; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + final tempDir = await Directory.systemTemp.createTemp(effectivePrefix); // Deal with Windows temp folder aliases. final tempUri = Directory( await tempDir.resolveSymbolicLinks(), diff --git a/pkgs/objective_c/test/hook_build_path_test.dart b/pkgs/objective_c/test/hook_build_path_test.dart index ee08fe490f..778bfd0de7 100644 --- a/pkgs/objective_c/test/hook_build_path_test.dart +++ b/pkgs/objective_c/test/hook_build_path_test.dart @@ -17,7 +17,7 @@ void main() { 'build hook decodes percent-encoded package root paths', () async { final tempDir = await Directory.systemTemp.createTemp( - 'objective_c_hook_path', + 'objective_c_hook path', ); addTearDown(() => tempDir.delete(recursive: true)); diff --git a/pkgs/swift2objc/lib/src/config.dart b/pkgs/swift2objc/lib/src/config.dart index 4899983c1c..ab0fd5b401 100644 --- a/pkgs/swift2objc/lib/src/config.dart +++ b/pkgs/swift2objc/lib/src/config.dart @@ -6,7 +6,7 @@ import 'package:path/path.dart' as path; import 'ast/_core/interfaces/declaration.dart'; -const defaultTempDirPrefix = 'swift2objc_temp_'; +const defaultTempDirPrefix = 'swift2objc temp_'; const symbolgraphFileSuffix = '.symbols.json'; class Command { diff --git a/pkgs/swift2objc/test/integration/integration_test.dart b/pkgs/swift2objc/test/integration/integration_test.dart index 0a6f6c0757..8263f99a5d 100644 --- a/pkgs/swift2objc/test/integration/integration_test.dart +++ b/pkgs/swift2objc/test/integration/integration_test.dart @@ -27,7 +27,7 @@ void main([List? args]) { const outputSuffix = '_output.swift'; final thisDir = path.join(testDir, 'integration'); - final tempDir = path.join(thisDir, 'temp'); + final tempDir = path.join(thisDir, 'temp dir'); var regen = false; final testNames = []; diff --git a/pkgs/swift2objc/test/unit/filter_test.dart b/pkgs/swift2objc/test/unit/filter_test.dart index aefc6301ca..df248374bd 100644 --- a/pkgs/swift2objc/test/unit/filter_test.dart +++ b/pkgs/swift2objc/test/unit/filter_test.dart @@ -20,7 +20,7 @@ void main([List? args]) { group('Unit test for filter', () { final thisDir = p.join(testDir, 'unit'); - final tempDir = p.join(thisDir, 'temp'); + final tempDir = p.join(thisDir, 'temp dir'); final inputFile = p.join(thisDir, 'filter_test_input.swift'); void filterTest( diff --git a/pkgs/swift2objc/test/utils.dart b/pkgs/swift2objc/test/utils.dart index a80b7dc4ab..592e5d4edf 100644 --- a/pkgs/swift2objc/test/utils.dart +++ b/pkgs/swift2objc/test/utils.dart @@ -31,7 +31,10 @@ Future expectValidSwift(List files) async { '-emit-symbol-graph-dir', '.', ], - workingDirectory: Directory.systemTemp.createTempSync().absolute.path, + workingDirectory: + Directory.systemTemp.createTempSync('swift2objc swiftc temp ') + .absolute + .path, ); if (processResult.exitCode != 0) { diff --git a/pkgs/swiftgen/example/generate_code.dart b/pkgs/swiftgen/example/generate_code.dart index f85b532e19..619b03653e 100644 --- a/pkgs/swiftgen/example/generate_code.dart +++ b/pkgs/swiftgen/example/generate_code.dart @@ -51,7 +51,7 @@ Future main() async { ), ), ), - ).generate(logger: logger, tempDirectory: Uri.directory('temp')); + ).generate(logger: logger, tempDirectory: Uri.directory('temp dir')); final result = Process.runSync('swiftc', [ '-emit-library', diff --git a/pkgs/swiftgen/lib/src/util.dart b/pkgs/swiftgen/lib/src/util.dart index 9f180009bd..076266f77e 100644 --- a/pkgs/swiftgen/lib/src/util.dart +++ b/pkgs/swiftgen/lib/src/util.dart @@ -22,4 +22,6 @@ Future run( } Uri createTempDirectory() => - Uri.directory(Directory.systemTemp.createTempSync().path); + Uri.directory( + Directory.systemTemp.createTempSync('swiftgen temp ').path, + ); diff --git a/pkgs/swiftgen/test/integration/util.dart b/pkgs/swiftgen/test/integration/util.dart index 2f76de7dea..ea41684a38 100644 --- a/pkgs/swiftgen/test/integration/util.dart +++ b/pkgs/swiftgen/test/integration/util.dart @@ -42,7 +42,7 @@ class TestGenerator { TestGenerator(this.name) : isObjCCompatible = objCCompatibleTests.contains(name) { testDir = path.absolute(path.join(pkgDir, 'test/integration')); - tempDir = path.join(testDir, 'temp'); + tempDir = path.join(testDir, 'temp dir'); inputFile = path.join(testDir, '$name.swift'); wrapperFile = path.join(tempDir, '${name}_wrapper.swift'); outputFile = path.join(tempDir, '${name}_output.dart');