зеркало из https://github.com/mozilla/gecko-dev.git
d825eb0d47
There are a lot of choices and moving pieces in this commit. I elected to include the mechanics and the target use case in the same commit so that readers can compare and contrast the implementation and final expression in one review window. - Initially, I wanted to make the {AB_CD} substitutions in LOCALIZED_FILES and not in LOCALIZED_GENERATED_FILES. However, I ran into conceptual blockers doing this. Fundamentally, LOCALIZED_FILES is FINAL_TARGET_FILES, and my use case should _not_ be putting files anywhere near dist/bin. In addition, LOCALIZED_FILES (FINAL_TARGET_FILES) is handled using manifests, which would need to grow locale-aware functionality to handle this. That's not desirable. In addition, if we use manifests, then we lose the powerful locality of |mach build mobile/android{/base}| re-generating changed locale-dependent resources. This is similar to how the build system plumbs dist/idl manifest processing throughout the build: we're repairing local workflows after moving work into a global process. For these reasons, this doesn't support {AB_CD} in LOCALIZED_FILES. - There is even another layer of complexity! There are two axes involved with these files: AB_CD controls localization and the Make target controls destination. For the record, it is: regular builds - AB_CD unset multi-locale builds - AB_CD set single-locale repacks - AB_CD set For the record, the existing logic (before any changes) is: regular builds - Make target is `libs` in mobile/android/base/locales multi-locale builds - Make target is `chrome-%` in mobile/android/base/locales single-locale repacks - Make target is `libs` in mobile/android/base/locales This commit adds targets for both destinations, and uses Make chrome-%:: and libs:: magic to control what is invoked in the various situations. Tricky! - I added MERGE_RELATIVE_FILES in order to be able to follow-up this patch with more patches that will get rid of m/a/base/locales/{moz.build,Makefile.in} altogether, and fold this work into m/a/base. As it stands, we're already reaching from m/a/base/locales all the way out to mobile/locales/.../region.properties, so the existing code doesn't follow the layout expected between mozilla-central and l10n-central/$(AB_CD). But that'll impedance will get worse as we improve the build system dependencies, not better, so we should grow support for localized resources that aren't exactly as expected. - I chose to follow Python's syntax for string substitutions. I would have preferred to mark files that should be localized with a leading '%'... but I took that for filesystem absolute paths in moz.build files already. I also considered @AB_CD@ to echo the preprocessor, but didn't want to open the door to an expecation that _all_ preprocessor DEFINEs will work in the way {AB_CD} does. - The generate_*py script changes required a bit of a hack to "turn off" locale dependent resources. This would have been nicer if we had marked localized resources with '%'... but we didn't. See the --fallback flag. The real reason this is needed is that we're doing work which is more like the work of compare-locales (merging locale-dependent resources) at build-time rather than repack time. I don't know why that's the case -- probably when we (I) implemented it, compare-locales and the whole l10n process was entirely opaque. It's not worth changing it now, so we use this --fallback flag approach. - I didn't get to tup support. This should gently fail without breaking tup builds: any {AB_CD} substitutions just won't be expanded. I haven't a clue how this should work in tup in the future (or, more generally, how to make any sense of repacks without declaring the full set of expected locales at configure time.) - strings.xml can't be a LOCALIZED_PP_FILES, since we need to customize the output location based on AB_rCD, and since we need a little more flexibility than PP_FILES gives for our inputs. MozReview-Commit-ID: MyfIkNSEzt --HG-- rename : python/mozbuild/mozbuild/test/backend/data/localized-generated-files/en-US/localized-input => python/mozbuild/mozbuild/test/backend/data/localized-generated-files-AB_CD/en-US/localized-input rename : python/mozbuild/mozbuild/test/backend/data/localized-generated-files/foo-data => python/mozbuild/mozbuild/test/backend/data/localized-generated-files-AB_CD/foo-data rename : python/mozbuild/mozbuild/test/backend/data/localized-generated-files/generate-foo.py => python/mozbuild/mozbuild/test/backend/data/localized-generated-files-AB_CD/generate-foo.py rename : python/mozbuild/mozbuild/test/backend/data/localized-generated-files/en-US/localized-input => python/mozbuild/mozbuild/test/backend/data/localized-generated-files-AB_CD/inner/locales/en-US/localized-input rename : python/mozbuild/mozbuild/test/backend/data/localized-generated-files/moz.build => python/mozbuild/mozbuild/test/backend/data/localized-generated-files-AB_CD/moz.build rename : python/mozbuild/mozbuild/test/backend/data/localized-generated-files/non-localized-input => python/mozbuild/mozbuild/test/backend/data/localized-generated-files-AB_CD/non-localized-input extra : rebase_source : 816b6f220758f2bb3bdd3ec81a2cb02269c6de5b |
||
---|---|---|
.. | ||
Moz | ||
external | ||
faster | ||
makefiles | ||
tests | ||
AB_rCD.mk | ||
Makefile.in | ||
MozZipFile.py | ||
android-common.mk | ||
autoconf-js.mk.in | ||
autoconf.mk.in | ||
baseconfig.mk | ||
check_js_msg_encoding.py | ||
check_js_opcode.py | ||
check_macroassembler_style.py | ||
check_source_count.py | ||
check_spidermonkey_style.py | ||
check_vanilla_allocations.py | ||
config.mk | ||
createprecomplete.py | ||
emptyvars-js.mk.in | ||
emptyvars.mk.in | ||
expandlibs.py | ||
expandlibs_config.py | ||
expandlibs_exec.py | ||
expandlibs_gen.py | ||
find_OOM_errors.py | ||
gcc-stl-wrapper.template.h | ||
gcc_hidden.h | ||
install.bat | ||
make-stl-wrappers.py | ||
make-system-wrappers.py | ||
milestone.txt | ||
moz.build | ||
mozunit.py | ||
msvc-stl-wrapper.template.h | ||
nsinstall.c | ||
nsinstall.py | ||
pathsub.c | ||
pathsub.h | ||
printconfigsetting.py | ||
printprereleasesuffix.py | ||
pythonpath.py | ||
rebuild_check.py | ||
recurse.mk | ||
rules.mk | ||
static-checking-config.mk | ||
stl-headers.mozbuild | ||
system-headers.mozbuild | ||
version.mk | ||
version_win.pl |