Repository navigation
fix: let ruflet.yaml's display_name win over the app_name ruflet new writes into services.yaml - #112
Merged
Merged
Conversation
`ruflet new` writes `app: app_name:` into services.yaml. The loader merged the two app blocks key by key, so a display_name stated in ruflet.yaml sat next to services.yaml's app_name, and build_client_metadata reads app_name first: the generated name shipped instead of the one the project states. When ruflet.yaml's app states a non-blank display_name or app_name, services.yaml's display_name and app_name no longer fill in. Every other services.yaml app key still fills gaps. When neither file states a package_name, the package keeps being derived from the name the old merge used, so identifiers and binary names do not move. `name:`-only projects are unchanged. Fixes #106
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #106
Problem
ruflet newwritesapp: app_name: <Name>intoservices.yaml. If the project names the app inruflet.yamlwithapp.display_name, that name is ignored.load_ruflet_configmerged the twoappblocks key by key (service_config["app"].merge(declared)), soservices.yaml'sapp_namestayed next toruflet.yaml'sdisplay_name.build_client_metadatareadsapp_namefirst, so the generated name shipped, with no warning.This contradicts the loader's own comment ("fills gaps rather than overriding what the project states"), the README ("what the project states wins", with
app_nameanddisplay_nameas accepted spellings) and the configuration reference, which callsdisplay_namethe user-facing name. The bug is longstanding: gem 0.0.23 behaves the same.What changed
packages/ruflet/lib/ruflet/cli/build/config_loader.rb: the merge moves into a newmerge_declared_app.ruflet.yaml'sappstates a non-blankdisplay_nameorapp_name,services.yaml'sdisplay_nameandapp_nameare dropped before the merge. Every otherservices.yamlapp key still fills gaps as before:package_name,organization,version,description, and so on.package_name, the package (and with it the bundle identifiers, binary names and pubspec name) is derived from the name keys. In that case the loader sets the documented top-level fallbackpackage_nameto the name the old merge derived it from, so the package stays byte-identical. Only the display name changes.display_name:states nothing, soservices.yamlstill fills it, as before.ruflet.yamlwith onlyname:is unchanged.nameis described as the user-facing name in the README but as the package-safe name in the configuration reference, so whether it should also replaceservices.yaml'sapp_nameis left to the owner.contributors/app_identity.rbreads the package's name source through the samepackage_source_namehelper, so the loader and the metadata cannot disagree about precedence. This is a refactor with no behavior change.No app code change, no new config key, no new command or flag.
Behavior changes
This is a clear bug fix (D6). Only one combination of files changes:
ruflet.yamlappstatesdisplay_name(without a non-blankapp_name), andservices.yamlapphas a differentapp_name. That is everyruflet newproject that addsdisplay_name:to itsruflet.yaml.services.yamlapp_nameships as the display name.ruflet.yamldisplay_nameships.It is written to:
android:labelCFBundleDisplayName/CFBundleNameandINFOPLIST_KEY_CFBundleDisplayNamePRODUCT_NAME(the.appbundle name;ruflet run --desktopglobs*.app, so it still finds it)name/short_name,<title>andapple-mobile-web-app-titleFileDescription/ProductNamePackage names, application/bundle identifiers, binary names, the mobile identity checks and everything else are unchanged in every case. These cases are byte-identical to before:
ruflet.yamlusingapp_namename:-onlyservices.yamlapp blockHow verified
packages/ruflet/test/update_command_test.rb):test_ruflet_yaml_display_name_wins_over_the_app_name_ruflet_new_writesuses the realwrite_default_ruflet_config(whatruflet newwrites) plusdisplay_name: Acme Shop. It runssync_client_metadataand checks the label, plists, pbxproj, macOS xcconfig, web manifest and title. The package (shop), application id and version still come fromservices.yaml.test_ruflet_yaml_name_spellings_replace_services_yaml_ones_and_blank_ones_leave_the_gapcoversdisplay_name,app_name, blank and emptydisplay_name, and no name.test_ruflet_yaml_display_name_keeps_the_package_derived_from_services_yaml: nopackage_nameanywhere. The display name changes, the package and bundle ids stayvoice_journal, and the mobileapp.package_nameerror is still reported.test_ruflet_yaml_name_alone_still_lets_services_yaml_app_name_fill: thename:-only case is unchanged.mergefails 3 of the 4 new tests. Thename:-only test passes either way, by design."acme_shop"instead of"voice_journal").build-apk-with-ruflet-yaml-display-namerunsruflet build apkon the generateddefault_appwithruflet.yamlstatingdisplay_name: Acme Shop.Acme Shopin the Android, iOS, macOS, web and Windows outputs, andchange_app_package_name com.example.default_app(unchanged).Default Appeverywhere.ruby test/compat/compat.rb --jobs 4checked 235 goldens with 0 diffs: all 234 existing goldens are byte-identical, plus the new one at the end of the build section.test/compat_goldens_test.rbpasses (243 runs).packages/ruflet/test/*_test.rbfile, one process per file, has 0 failures and 0 errors.ruflet new shopfollowed bysync_client_metadataon the vendored template (test/compat/fixtures/template/ruflet_flutter_template.tar):app.display_namegivesAcme Shopin every file (before:Shop).app.app_namegivesAcme Shop(unchanged).app.namegivesShop(unchanged).Shop(unchanged).The engine and the template are not touched.