[iOS/macOS] compile data sets into Assets Before the change, defining .dataset in bundle_data's sources produced steps to copy the contents of .dataset into a bundle. Now .dataset becomes a part of Assets.car on build assets step. Bug: none Change-Id: Icd8becf17527fcd11a8ad5135fd5fb8437003152 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/6880 Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/src/gn/bundle_data.cc b/src/gn/bundle_data.cc index cd68efe..a72612d 100644 --- a/src/gn/bundle_data.cc +++ b/src/gn/bundle_data.cc
@@ -30,6 +30,8 @@ // .*\.xcassets/[^/]*\.appiconset/[^/]* // .*\.xcassets/[^/]*\.imageset/[^/]* // .*\.xcassets/[^/]*\.launchimage/[^/]* + // .*\.xcassets/[^/]*\.colorset/[^/]* + // .*\.xcassets/[^/]*\.dataset/[^/]* bool is_file_from_asset_catalog = false; std::string_view dir = FindDirNoTrailingSeparator(source); if (base::EndsWith(source, "/Contents.json", base::CompareCase::SENSITIVE) && @@ -39,7 +41,8 @@ base::EndsWith(dir, ".imageset", base::CompareCase::SENSITIVE) || base::EndsWith(dir, ".launchimage", base::CompareCase::SENSITIVE) || - base::EndsWith(dir, ".colorset", base::CompareCase::SENSITIVE)) { + base::EndsWith(dir, ".colorset", base::CompareCase::SENSITIVE) || + base::EndsWith(dir, ".dataset", base::CompareCase::SENSITIVE)) { dir = FindDirNoTrailingSeparator(dir); is_file_from_asset_catalog = base::EndsWith(dir, ".xcassets", base::CompareCase::SENSITIVE);
diff --git a/src/gn/ninja_create_bundle_target_writer_unittest.cc b/src/gn/ninja_create_bundle_target_writer_unittest.cc index dc72b32..9a966d9 100644 --- a/src/gn/ninja_create_bundle_target_writer_unittest.cc +++ b/src/gn/ninja_create_bundle_target_writer_unittest.cc
@@ -195,6 +195,10 @@ SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@2x.png")); bundle_data.sources().push_back( SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@3x.png")); + bundle_data.sources().push_back( + SourceFile("//foo/Foo.xcassets/foo.dataset/Contents.json")); + bundle_data.sources().push_back( + SourceFile("//foo/Foo.xcassets/foo.dataset/FooScript.js")); bundle_data.action_values().outputs() = SubstitutionList::MakeForTest( "{{bundle_resources_dir}}/{{source_file_part}}"); bundle_data.SetToolchain(setup.toolchain()); @@ -301,6 +305,10 @@ SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@2x.png")); bundle_data2.sources().push_back( SourceFile("//foo/Foo.xcassets/foo.imageset/FooIcon-29@3x.png")); + bundle_data2.sources().push_back( + SourceFile("//foo/Foo.xcassets/foo.dataset/Contents.json")); + bundle_data2.sources().push_back( + SourceFile("//foo/Foo.xcassets/foo.dataset/FooScript.js")); bundle_data2.action_values().outputs() = SubstitutionList::MakeForTest( "{{bundle_resources_dir}}/{{source_file_part}}"); bundle_data2.SetToolchain(setup.toolchain()); @@ -319,6 +327,10 @@ SourceFile("//quz/Quz.xcassets/quz.imageset/QuzIcon-29@2x.png")); bundle_data3.sources().push_back( SourceFile("//quz/Quz.xcassets/quz.imageset/QuzIcon-29@3x.png")); + bundle_data3.sources().push_back( + SourceFile("//quz/Quz.xcassets/quz.dataset/Contents.json")); + bundle_data3.sources().push_back( + SourceFile("//quz/Quz.xcassets/quz.dataset/QuzScript.js")); bundle_data3.action_values().outputs() = SubstitutionList::MakeForTest( "{{bundle_resources_dir}}/{{source_file_part}}"); bundle_data3.SetToolchain(setup.toolchain());