diff --git a/pkgs/code_assets/doc/schema/hook/shared_definitions.schema.json b/pkgs/code_assets/doc/schema/hook/shared_definitions.schema.json index 032ada0fc..27645f201 100644 --- a/pkgs/code_assets/doc/schema/hook/shared_definitions.schema.json +++ b/pkgs/code_assets/doc/schema/hook/shared_definitions.schema.json @@ -1,21 +1,10 @@ { "$schema": "https://json-schema.org/draft-07/schema#", - "title": "package:code_assets party:sdk shared definitions", + "title": "package:code_assets party:hook shared definitions", "definitions": { "BuildInput": {}, "BuildOutput": {}, - "HookInput": { - "properties": { - "config": { - "properties": { - "code": { - "$comment": "Future SDKs will no longer provide 'code', 'extensions.code_config' instead.", - "deprecated": true - } - } - } - } - }, + "HookInput": {}, "HookOutput": {}, "LinkInput": {}, "LinkOutput": {} diff --git a/pkgs/code_assets/doc/schema/sdk/shared_definitions.schema.json b/pkgs/code_assets/doc/schema/sdk/shared_definitions.schema.json index 229524230..b367a6fd6 100644 --- a/pkgs/code_assets/doc/schema/sdk/shared_definitions.schema.json +++ b/pkgs/code_assets/doc/schema/sdk/shared_definitions.schema.json @@ -4,17 +4,7 @@ "definitions": { "BuildInput": {}, "BuildOutput": {}, - "HookInput": { - "properties": { - "config": { - "properties": { - "code": { - "$comment": "Old hooks still read 'code' so provide both 'code' and 'extensions.code_config'." - } - } - } - } - }, + "HookInput": {}, "HookOutput": {}, "LinkInput": {}, "LinkOutput": {} diff --git a/pkgs/code_assets/doc/schema/shared/shared_definitions.schema.json b/pkgs/code_assets/doc/schema/shared/shared_definitions.schema.json index 53e6fe91e..d493682ae 100644 --- a/pkgs/code_assets/doc/schema/shared/shared_definitions.schema.json +++ b/pkgs/code_assets/doc/schema/shared/shared_definitions.schema.json @@ -212,9 +212,6 @@ "Config": { "type": "object", "properties": { - "code": { - "$ref": "#/definitions/CodeConfig" - }, "extensions": { "$ref": "#/definitions/ConfigExtensions" } diff --git a/pkgs/code_assets/test/data/build_input_android.json b/pkgs/code_assets/test/data/build_input_android.json index 1e611c63a..6bf81193e 100644 --- a/pkgs/code_assets/test/data/build_input_android.json +++ b/pkgs/code_assets/test/data/build_input_android.json @@ -4,19 +4,6 @@ "build_asset_types": [ "code_assets/code" ], - "code": { - "android": { - "target_ndk_api": 21 - }, - "c_compiler": { - "ar": "/Users/dacoharkes/Library/Android/sdk/ndk/28.0.12674087/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar", - "cc": "/Users/dacoharkes/Library/Android/sdk/ndk/28.0.12674087/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang", - "ld": "/Users/dacoharkes/Library/Android/sdk/ndk/28.0.12674087/toolchains/llvm/prebuilt/darwin-x86_64/bin/ld.lld" - }, - "link_mode_preference": "dynamic", - "target_architecture": "arm", - "target_os": "android" - }, "extensions": { "code_assets": { "android": { diff --git a/pkgs/code_assets/test/data/build_input_ios.json b/pkgs/code_assets/test/data/build_input_ios.json index fbcce63e4..2267ce1a0 100644 --- a/pkgs/code_assets/test/data/build_input_ios.json +++ b/pkgs/code_assets/test/data/build_input_ios.json @@ -4,20 +4,6 @@ "build_asset_types": [ "code_assets/code" ], - "code": { - "c_compiler": { - "ar": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar", - "cc": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", - "ld": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" - }, - "ios": { - "target_sdk": "iphonesimulator", - "target_version": 12 - }, - "link_mode_preference": "dynamic", - "target_architecture": "arm64", - "target_os": "ios" - }, "extensions": { "code_assets": { "c_compiler": { diff --git a/pkgs/code_assets/test/data/build_input_linux.json b/pkgs/code_assets/test/data/build_input_linux.json index e5485c562..3a0fd4d2f 100644 --- a/pkgs/code_assets/test/data/build_input_linux.json +++ b/pkgs/code_assets/test/data/build_input_linux.json @@ -4,16 +4,6 @@ "build_asset_types": [ "code_assets/code" ], - "code": { - "c_compiler": { - "ar": "/usr/lib/llvm-16/bin/llvm-ar", - "cc": "/usr/lib/llvm-16/bin/clang", - "ld": "/usr/lib/llvm-16/bin/ld.lld" - }, - "link_mode_preference": "dynamic", - "target_architecture": "x64", - "target_os": "linux" - }, "extensions": { "code_assets": { "c_compiler": { diff --git a/pkgs/code_assets/test/data/build_input_macos.json b/pkgs/code_assets/test/data/build_input_macos.json index 0f579d771..035c25980 100644 --- a/pkgs/code_assets/test/data/build_input_macos.json +++ b/pkgs/code_assets/test/data/build_input_macos.json @@ -18,19 +18,6 @@ "build_asset_types": [ "code_assets/code" ], - "code": { - "c_compiler": { - "ar": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar", - "cc": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", - "ld": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" - }, - "link_mode_preference": "dynamic", - "macos": { - "target_version": 13 - }, - "target_architecture": "arm64", - "target_os": "macos" - }, "extensions": { "code_assets": { "c_compiler": { diff --git a/pkgs/code_assets/test/data/build_input_windows.json b/pkgs/code_assets/test/data/build_input_windows.json index da8448b82..6bb6eab5f 100644 --- a/pkgs/code_assets/test/data/build_input_windows.json +++ b/pkgs/code_assets/test/data/build_input_windows.json @@ -4,24 +4,6 @@ "build_asset_types": [ "code_assets/code" ], - "code": { - "c_compiler": { - "ar": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\bin\\Hostx64\\x64\\lib.exe", - "cc": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\bin\\Hostx64\\x64\\cl.exe", - "env_script": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat", - "env_script_arguments": [], - "ld": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\bin\\Hostx64\\x64\\link.exe", - "windows": { - "developer_command_prompt": { - "arguments": [], - "script": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" - } - } - }, - "link_mode_preference": "dynamic", - "target_architecture": "x64", - "target_os": "windows" - }, "extensions": { "code_assets": { "c_compiler": { diff --git a/pkgs/code_assets/test/data/link_input_macos.json b/pkgs/code_assets/test/data/link_input_macos.json index 3d60159f6..a0c5c6567 100644 --- a/pkgs/code_assets/test/data/link_input_macos.json +++ b/pkgs/code_assets/test/data/link_input_macos.json @@ -26,19 +26,6 @@ "build_asset_types": [ "code_assets/code" ], - "code": { - "c_compiler": { - "ar": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar", - "cc": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", - "ld": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" - }, - "link_mode_preference": "dynamic", - "macos": { - "target_version": 13 - }, - "target_architecture": "arm64", - "target_os": "macos" - }, "extensions": { "code_assets": { "c_compiler": { diff --git a/pkgs/code_assets/test/schema/schema_test.dart b/pkgs/code_assets/test/schema/schema_test.dart index f51633498..84351f36d 100644 --- a/pkgs/code_assets/test/schema/schema_test.dart +++ b/pkgs/code_assets/test/schema/schema_test.dart @@ -63,6 +63,8 @@ void main() { Uri packageUri = findPackageRoot('code_assets'); +const _codeConfigPath = ['config', 'extensions', 'code_assets']; + FieldsFunction _codeFields(AllTestData allTestData) { final dataUri = packageUri.resolve('test/data/build_output_macos.json'); final assets = @@ -96,27 +98,23 @@ FieldsFunction _codeFields(AllTestData allTestData) { ]; return <(List, void Function(ValidationResults result))>[ - for (final codeConfigPath in [ - ['config', 'code'], - ['config', 'extensions', 'code_assets'], - ]) - if (inputOrOutput == InputOrOutput.input) ...[ - ([...codeConfigPath, 'c_compiler'], expectOptionalFieldMissing), - ([...codeConfigPath, 'c_compiler', 'ar'], expectRequiredFieldMissing), - ([...codeConfigPath, 'c_compiler', 'cc'], expectRequiredFieldMissing), - ([...codeConfigPath, 'c_compiler', 'ld'], expectRequiredFieldMissing), - ([...codeConfigPath, 'macos'], expectRequiredFieldMissing), - ( - [...codeConfigPath, 'macos', 'target_version'], - expectRequiredFieldMissing, - ), - if (hook == Hook.link) ...[ - for (final (field, expect) in codeAssetFields) ...[ - (['assets', 0, 'encoding', ...field], expect), - (['assets', 1, 'encoding', ...field], expect), - ], + if (inputOrOutput == InputOrOutput.input) ...[ + ([..._codeConfigPath, 'c_compiler'], expectOptionalFieldMissing), + ([..._codeConfigPath, 'c_compiler', 'ar'], expectRequiredFieldMissing), + ([..._codeConfigPath, 'c_compiler', 'cc'], expectRequiredFieldMissing), + ([..._codeConfigPath, 'c_compiler', 'ld'], expectRequiredFieldMissing), + ([..._codeConfigPath, 'macos'], expectRequiredFieldMissing), + ( + [..._codeConfigPath, 'macos', 'target_version'], + expectRequiredFieldMissing, + ), + if (hook == Hook.link) ...[ + for (final (field, expect) in codeAssetFields) ...[ + (['assets', 0, 'encoding', ...field], expect), + (['assets', 1, 'encoding', ...field], expect), ], ], + ], if (inputOrOutput == InputOrOutput.output) ...[ for (final (field, expect) in codeAssetFields) (['assets', 0, 'encoding', ...field], expect), @@ -154,55 +152,45 @@ _codeFieldsWindows({ required Hook hook, required Party party, }) => <(List, void Function(ValidationResults result))>[ - if (inputOrOutput == InputOrOutput.input && hook == Hook.build) - for (final codeConfigPath in [ - ['config', 'code'], - ['config', 'extensions', 'code_assets'], - ]) ...[ - ( - [...codeConfigPath, 'c_compiler', 'env_script'], - expectOptionalFieldMissing, - ), - ( - [...codeConfigPath, 'c_compiler', 'env_script_arguments'], - expectOptionalFieldMissing, - ), - ( - [...codeConfigPath, 'c_compiler', 'windows'], - expectRequiredFieldMissing, - ), - ( - [ - ...codeConfigPath, - 'c_compiler', - 'windows', - 'developer_command_prompt', - ], - expectOptionalFieldMissing, - ), - ( - [ - 'config', - 'code', - 'c_compiler', - 'windows', - 'developer_command_prompt', - 'script', - ], - expectRequiredFieldMissing, - ), - ( - [ - 'config', - 'code', - 'c_compiler', - 'windows', - 'developer_command_prompt', - 'arguments', - ], - expectRequiredFieldMissing, - ), - ], + if (inputOrOutput == InputOrOutput.input && hook == Hook.build) ...[ + ( + [..._codeConfigPath, 'c_compiler', 'env_script'], + expectOptionalFieldMissing, + ), + ( + [..._codeConfigPath, 'c_compiler', 'env_script_arguments'], + expectOptionalFieldMissing, + ), + ([..._codeConfigPath, 'c_compiler', 'windows'], expectRequiredFieldMissing), + ( + [..._codeConfigPath, 'c_compiler', 'windows', 'developer_command_prompt'], + expectOptionalFieldMissing, + ), + ( + [ + 'config', + 'extensions', + 'code_assets', + 'c_compiler', + 'windows', + 'developer_command_prompt', + 'script', + ], + expectRequiredFieldMissing, + ), + ( + [ + 'config', + 'extensions', + 'code_assets', + 'c_compiler', + 'windows', + 'developer_command_prompt', + 'arguments', + ], + expectRequiredFieldMissing, + ), + ], ]; List<(List, void Function(ValidationResults result))> _codeFieldsIOS({ @@ -210,18 +198,11 @@ List<(List, void Function(ValidationResults result))> _codeFieldsIOS({ required Hook hook, required Party party, }) => <(List, void Function(ValidationResults result))>[ - if (inputOrOutput == InputOrOutput.input && hook == Hook.build) - for (final codeConfigPath in [ - ['config', 'code'], - ['config', 'extensions', 'code_assets'], - ]) ...[ - ([...codeConfigPath, 'ios'], expectRequiredFieldMissing), - ([...codeConfigPath, 'ios', 'target_sdk'], expectRequiredFieldMissing), - ( - [...codeConfigPath, 'ios', 'target_version'], - expectRequiredFieldMissing, - ), - ], + if (inputOrOutput == InputOrOutput.input && hook == Hook.build) ...[ + ([..._codeConfigPath, 'ios'], expectRequiredFieldMissing), + ([..._codeConfigPath, 'ios', 'target_sdk'], expectRequiredFieldMissing), + ([..._codeConfigPath, 'ios', 'target_version'], expectRequiredFieldMissing), + ], ]; List<(List, void Function(ValidationResults result))> @@ -230,15 +211,11 @@ _codeFieldsAndroid({ required Hook hook, required Party party, }) => <(List, void Function(ValidationResults result))>[ - if (inputOrOutput == InputOrOutput.input && hook == Hook.build) - for (final codeConfigPath in [ - ['config', 'code'], - ['config', 'extensions', 'code_assets'], - ]) ...[ - ([...codeConfigPath, 'android'], expectRequiredFieldMissing), - ( - [...codeConfigPath, 'android', 'target_ndk_api'], - expectRequiredFieldMissing, - ), - ], + if (inputOrOutput == InputOrOutput.input && hook == Hook.build) ...[ + ([..._codeConfigPath, 'android'], expectRequiredFieldMissing), + ( + [..._codeConfigPath, 'android', 'target_ndk_api'], + expectRequiredFieldMissing, + ), + ], ]; diff --git a/pkgs/native_assets_cli/lib/src/code_assets/config.dart b/pkgs/native_assets_cli/lib/src/code_assets/config.dart index d8dd65544..0be6eb276 100644 --- a/pkgs/native_assets_cli/lib/src/code_assets/config.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/config.dart @@ -41,9 +41,10 @@ class CodeConfig { final syntax.CodeConfig _syntax; CodeConfig._fromJson(Map json, List path) - : _syntax = - syntax.Config.fromJson(json, path: path).extensions?.codeAssets ?? - syntax.Config.fromJson(json, path: path).code!; + : _syntax = syntax.Config.fromJson( + json, + path: path, + ).extensions!.codeAssets!; /// The architecture the code code asset should be built for. /// @@ -207,7 +208,6 @@ extension CodeAssetBuildInputBuilder on HookConfigBuilder { baseHookConfig.extensions ??= hook_syntax.JsonObject.fromJson({}); final hookConfig = syntax.Config.fromJson(baseHookConfig.json); hookConfig.extensions!.codeAssets = codeConfig; - hookConfig.code = codeConfig; // old location } } diff --git a/pkgs/native_assets_cli/lib/src/code_assets/syntax.g.dart b/pkgs/native_assets_cli/lib/src/code_assets/syntax.g.dart index a0693b0d3..674fb6900 100644 --- a/pkgs/native_assets_cli/lib/src/code_assets/syntax.g.dart +++ b/pkgs/native_assets_cli/lib/src/code_assets/syntax.g.dart @@ -388,32 +388,11 @@ class CodeConfig extends JsonObject { class Config extends JsonObject { Config.fromJson(super.json, {super.path = const []}) : super.fromJson(); - Config({required CodeConfig? code, required ConfigExtensions? extensions}) - : super() { - this.code = code; + Config({required ConfigExtensions? extensions}) : super() { this.extensions = extensions; json.sortOnKey(); } - CodeConfig? get code { - final jsonValue = _reader.optionalMap('code'); - if (jsonValue == null) return null; - return CodeConfig.fromJson(jsonValue, path: [...path, 'code']); - } - - set code(CodeConfig? value) { - json.setOrRemove('code', value?.json); - json.sortOnKey(); - } - - List _validateCode() { - final mapErrors = _reader.validate?>('code'); - if (mapErrors.isNotEmpty) { - return mapErrors; - } - return code?.validate() ?? []; - } - ConfigExtensions? get extensions { final jsonValue = _reader.optionalMap('extensions'); if (jsonValue == null) return null; @@ -434,11 +413,7 @@ class Config extends JsonObject { } @override - List validate() => [ - ...super.validate(), - ..._validateCode(), - ..._validateExtensions(), - ]; + List validate() => [...super.validate(), ..._validateExtensions()]; @override String toString() => 'Config($json)'; diff --git a/pkgs/native_assets_cli/test/checksum_test.dart b/pkgs/native_assets_cli/test/checksum_test.dart index 7c10b4f18..bb4eeb146 100644 --- a/pkgs/native_assets_cli/test/checksum_test.dart +++ b/pkgs/native_assets_cli/test/checksum_test.dart @@ -93,68 +93,68 @@ void main() { // needing to update this list). final expectedChecksums = [ - 'bd9690f00c931db8c6c30808a8f1cde9', - '0b8ee01ab5670140b009588e3f083ff4', - 'e694c17d347cdb155a31857f770b5c92', - 'ab4bd1af9b3d1b688903b37c77bd8020', - '9ce75907a01f3e0580e697619ead5e92', - 'c61b2dca0e198fc2c989541300b81f88', - 'ba62e22d54212a304c317caad42ec845', - '65da7b33bab3187145d00c9728386346', - '6fe78cf88ec338f52a11adc70fb5a1dd', - '38a3455207083f317402e18d743b66d6', - 'ac6ee76ec70e91990e231e6deca22e2c', - '5852caaef24a1dbd09369d9610efb1f6', - '933ccde655cd848665a364a73bfc41bf', - '7b9b1acdfa7b534ac195475d666dcae4', - '77985d7269baa0ceeea5ce4c8f78132e', - '007f3c94a5f46e5d2193b4609e933aa8', - '02e0846c1d8cab3d3f3d153d9eb3abe6', - 'd985d4f76ffabf8cb50799c5c7047907', - '8287982d50fc9d24a5a8b9caa92f53fa', - '3e980a7cd3824cb931f0cec4eaaba852', + '61ab5ef403d9f006b6b5574a50e50daf', + 'e3a77db8c85c6b3549c8421e59e38e95', + 'e7a12aac9e17ddbb64887cd6cd9232d2', + 'cf1dd12731866d00afbbcdfe70e61589', + 'ad93ea8c702c5f11c92c52191883099c', + '38c7c121e0c15cf54c984824e5051f4c', + 'c08bfcfb8272762b33a98f79bf350724', + 'e1270f247e192dc50b652621ae2e5a93', + 'e78c9baa330705077190565d8a847fb1', + '9ad4121bade1db392de9ce083c13fc8f', + 'e5e00070ef4bc56a7ce3069424df4120', + '838b8de06f73db3cea251697402babb0', + '589ee41a4f1fdaaa428406cada32c4e3', + '4746317758d511ffd2f47c44ea1e9ff8', + '61773dc007d379d913773be8dab6d027', + 'cbdc799766b327b719acda0c8fa362df', + '81ab30daef84759670866735ab9bdafe', + 'c3b5b08d9dfd763eefe1548fe1cebd15', + '817d7a4498017835e17ed855fdcc810e', + '43bf049e1e796472d5bf91b225026cda', 'edeadb00c19dd64b77617ae191e4bedd', - 'e2f57dd491415fcb126d0fcf5fbd6ad8', - 'dc000b9f8f74ed89e1920c6f4e73ec71', - 'f8cb300fa892d0a89feecd99767e62c8', - '8125df1da5b7240f8fffe55703991bda', - 'fab51a95bbdbddb969a205bda986a1c2', - '3cf31b6b812e40808012798a06415006', - '318994fa4438ee9a696c2f0d44990fb0', - 'df86f6cd9139ba8cbe886e136a835aa2', - '9614324bd0b7dcf10d3519ede425e08c', - '1a88b01b071f4548fb144a1de7af7930', - '04c76dc39e3d239c98c95f523dcf73d5', - '90d99a26b43030659c414ccec228e50c', - '73d045b89a97df12b569b1f4eb3de901', - '08068f90a5027536da383c8cd69b5413', - '13048fabeabaa3f594e0f84f74026c55', - '42df0997fffca20e1ea235cfb8f26b33', - 'a031105b078e5c529cc0f006cb32d082', - '384a96ffe009db50c6519c0c3fbde186', - '7146608d686db3ea662e903a1b658d71', - 'ecfc19b70841c37f974892bd9dd5cf6c', + 'c31e4bfcd55d57f37ca1e1ec96ffe592', + 'ab4f63c8d2bb35fa00568e682b800843', + '2ef2c44c9571c14aeccae1d99f32a1b4', + '553911c58185ec4bc0a91d38066f04b8', + 'bab035bb051f235c39b78e5607a8a01c', + 'c011395901dd42b098f486d2ff06a4dd', + 'e9f7fadde6dab0e7cc4ac0c7fb1a628c', + 'ebba044d322c1ceb81cf4e1e7c0e120e', + '0b282c055b7817b099f84613af0c5c8a', + '9a8e06eedabd3c6001aa114064390ce9', + '75515f1094704fa6cfd486e506d2af18', + 'c86127d13e36019097d0707baf98e8f7', + '4667534582f16a6551428fd045b3ac27', + 'f94ee3512b58bcc7f55e5f518d9441ce', + '799b09a9cb7041165adc850c3bc34607', + '1c2bddd1f0a1e8b889ca5b46817694f0', + 'af00c3aa5215cab39e58a696b886dc37', + 'c1505e20a93de1ab1143a79e965cd245', + '31f2609c732d83722c420f8fb8465830', + '7cd688235b6d1d8edb2f81fecb0a8da4', '81bac5e642e7b84dbd5fb1f71b07962d', - '0b5834235f76d74e1c0e421f931b56e5', - 'f54129ea72f73738bba7db94f23ebbfd', - 'f751ee056930928dc9ef116eaf764861', - 'f0db90d146cbbc5204da7505b556ae30', - '06145a287b8f59f8f760dff4a4a82c21', - '18024b2d4c64ec81dcf26c5a50e1972b', - '32cc339e14ca1e925457ed62566a2395', - '311294eb2f68ab507ab6fce91f94eff3', - 'acf7450a5b53664262c780d5b044ecf3', - 'a84c9207e3ab011ce8e63190baca72b2', - '2554f04bd60ca06a3ca4ca1ddc93c63e', - 'a2f4c2deb7e7ae4fb4b79d6a75688347', - '78e667bd827f2c786980750d4cbcadb9', - 'b28d2f17304340966622c8cc49d5d2c0', - 'f7e4053963dbe6c4ad71b7da33ada6e1', - 'd8b00533f06e9d2771afc21ab9313ec8', - 'e971ff2017f15f77f6aeaa4723a13ad1', - 'e5f886c5816fa705903d2ff8080d9f86', - '1398000924687b7bd167d9e4584961a8', - '79672bd8fc07a6fc328cb3eca8ddc737', + '1a78f75ee147bbb5edf68b2e56e78a22', + '9d6adcd09c95cc55d80f6cac5cc93590', + '55fc558767c6e43269dc3de4556562ab', + '9edb0db4a6b1e629f8fa949e42dc35e1', + 'd30575bba443794ee26b362fcd177406', + '29d89c1c649dd8e60d2d4be8c8f87fae', + 'a304174ba2dcf0146bdd5b311bea9479', + '7e55d4def09b16926719d5c3267ca6b8', + '89bed1462b388cfed8e20a9f5d2cbb97', + '3d6cb538997816a0c051748607352a79', + 'f33556a6cbc01e6e1390fdcb9f3aa82c', + '20cf1a9119f96e519419e1b83633e289', + '6b965e47445f5ff5549ff87b5b5d73c7', + '64fffab256c810f794441a0f207d1691', + 'b4c4b511d1744f61eb95758e3a54386d', + '20a0433b2ea9181634efa432d671a77e', + '517b3c6690c52e6c2f905c22a6aa0096', + 'ebc520c76af5f114423363be7b025586', + '7769c411f18744248a58b52d63ace420', + '1baf5b978ec51f44383c407d31dc5ebf', '9fe464ec313e3465c9e43e12ec4fa5df', ]; printOnFailure('final expectedChecksums = ['); diff --git a/pkgs/native_assets_cli/test/code_assets/config_test.dart b/pkgs/native_assets_cli/test/code_assets/config_test.dart index d8c651fe2..0e8263ad4 100644 --- a/pkgs/native_assets_cli/test/code_assets/config_test.dart +++ b/pkgs/native_assets_cli/test/code_assets/config_test.dart @@ -87,7 +87,6 @@ void main() async { }, ], 'config': { - 'code': codeConfig, 'build_asset_types': ['code_assets/code'], 'extensions': {'code_assets': codeConfig}, if (hookType == 'build') 'linking_enabled': false, @@ -224,7 +223,8 @@ void main() async { final input = inputJson(); traverseJson>(input, [ 'config', - 'code', + 'extensions', + 'code_assets', ])['target_architecture'] = 'invalid_architecture'; expect( () => BuildInput(input).config.code.targetArchitecture, @@ -234,8 +234,11 @@ void main() async { test('LinkInput.config.code: invalid os', () { final input = inputJson(hookType: 'link'); - traverseJson>(input, ['config', 'code'])['target_os'] = - 'invalid_os'; + traverseJson>(input, [ + 'config', + 'extensions', + 'code_assets', + ])['target_os'] = 'invalid_os'; expect(() => LinkInput(input).config.code.targetOS, throwsFormatException); }); @@ -260,23 +263,6 @@ void main() async { ), ), ); - - traverseJson>(input, ['config']).remove('extensions'); - traverseJson>(input, ['config', 'code'])['target_os'] = - 123; - expect( - () => LinkInput(input).config.code.targetOS, - throwsA( - predicate( - (e) => - e is FormatException && - e.message.contains( - "Unexpected value '123' (int) for 'config.code.target_os'. " - 'Expected a String.', - ), - ), - ), - ); }); test('LinkInput.config.code.link_mode_preference missing', () { @@ -299,25 +285,8 @@ void main() async { ), ), ); - - traverseJson>(input, ['config']).remove('extensions'); - traverseJson>(input, [ - 'config', - 'code', - ]).remove('link_mode_preference'); - expect( - () => LinkInput(input).config.code.linkModePreference, - throwsA( - predicate( - (e) => - e is FormatException && - e.message.contains( - "No value was provided for 'config.code.link_mode_preference'.", - ), - ), - ), - ); }); + test('LinkInput.assets.0.link_mode missing', () { final input = inputJson(hookType: 'link'); traverseJson>(input, [ diff --git a/pkgs/native_assets_cli/test/code_assets/validation_test.dart b/pkgs/native_assets_cli/test/code_assets/validation_test.dart index e05151594..7ee22dcfb 100644 --- a/pkgs/native_assets_cli/test/code_assets/validation_test.dart +++ b/pkgs/native_assets_cli/test/code_assets/validation_test.dart @@ -196,7 +196,8 @@ void main() { ); traverseJson>(builder.json, [ 'config', - 'code', + 'extensions', + 'code_assets', 'ios', ]).remove(propertyKey); final errors = await validateCodeAssetBuildInput( @@ -207,7 +208,7 @@ void main() { contains( contains( 'No value was provided for ' - '\'config.code.ios.$propertyKey\'.', + '\'config.extensions.code_assets.ios.$propertyKey\'.', ), ), ); @@ -226,14 +227,16 @@ void main() { ); traverseJson>(builder.json, [ 'config', - 'code', + 'extensions', + 'code_assets', 'android', ]).remove('target_ndk_api'); expect( await validateCodeAssetBuildInput(BuildInput(builder.json)), contains( contains( - 'No value was provided for \'config.code.android.target_ndk_api\'.' + 'No value was provided for ' + '\'config.extensions.code_assets.android.target_ndk_api\'.' ' Expected a int.', ), ), @@ -253,14 +256,16 @@ void main() { traverseJson>(builder.json, [ 'config', - 'code', + 'extensions', + 'code_assets', 'macos', ]).remove('target_version'); expect( await validateCodeAssetBuildInput(BuildInput(builder.json)), contains( contains( - 'No value was provided for \'config.code.macos.target_version\'.' + 'No value was provided for ' + '\'config.extensions.code_assets.macos.target_version\'.' ' Expected a int.', ), ), @@ -268,11 +273,17 @@ void main() { traverseJson>(builder.json, [ 'config', - 'code', + 'extensions', + 'code_assets', ]).remove('macos'); expect( await validateCodeAssetBuildInput(BuildInput(builder.json)), - contains(contains('No value was provided for \'config.code.macos\'.')), + contains( + contains( + 'No value was provided for ' + '\'config.extensions.code_assets.macos\'.', + ), + ), ); }); @@ -317,7 +328,8 @@ void main() { // If developer command prompt is present, it must contain the script. traverseJson>(builder.json, [ 'config', - 'code', + 'extensions', + 'code_assets', 'c_compiler', 'windows', 'developer_command_prompt', @@ -327,7 +339,8 @@ void main() { contains( contains( 'No value was provided for ' - "'config.code.c_compiler.windows.developer_command_prompt.script'.", + "'config.extensions.code_assets.c_compiler." + "windows.developer_command_prompt.script'.", ), ), ); @@ -339,7 +352,8 @@ void main() { // the Windows config. traverseJson>(builder.json, [ 'config', - 'code', + 'extensions', + 'code_assets', 'c_compiler', ]).remove('windows'); expect( @@ -347,7 +361,7 @@ void main() { contains( contains( 'No value was provided for ' - "'config.code.c_compiler.windows'.", + "'config.extensions.code_assets.c_compiler.windows'.", ), ), );