gecko-dev/config
Nick Alexander d825eb0d47 Bug 1439742 - Allow {AB_CD} and {AB_rCD} in LOCALIZED_GENERATED_FILES. r=ted.mielczarek
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
2018-02-21 17:12:17 -08:00
..
Moz
external Bug 1430761: Update tzdata in ICU data files to 2018c. r=Waldo 2018-02-01 05:36:03 -08:00
faster Bug 1256604 - Remove toolkit/content/Makefile.in and move setting CXXFLAGS for buildconfig.html to moz.build r=mshal 2017-11-09 10:45:00 -08:00
makefiles Merge inbound to mozilla-central. a=merge 2018-02-27 11:58:55 +02:00
tests Bug 1339178 - Use pytest to run python-tests, r=davehunt 2017-08-29 14:50:33 -04:00
AB_rCD.mk Bug 1439742 - Pre: Lift AB_rCD to ambient Make environment. r=ted.mielczarek 2018-02-20 12:28:21 -08:00
Makefile.in Bug 1407432 - Move system wrapper generation to moz.build; r=froydnj 2017-11-08 19:58:56 -05:00
MozZipFile.py
android-common.mk
autoconf-js.mk.in
autoconf.mk.in
baseconfig.mk Bug 445128 - Stop putting the version number in the target directory for make install. r=nalexander 2017-12-31 17:18:52 +09:00
check_js_msg_encoding.py Bug 1393242 - Use hglib for get_files_in_working_directory(); r=mshal 2017-08-23 15:21:16 -07:00
check_js_opcode.py Bug 1343417 - Verify bytecode documentation in js/src/vm/Opcodes.h in make check. r=nbp 2017-04-03 10:14:38 +09:00
check_macroassembler_style.py Bug 1434430 - [flake8] Fix blank 'except' statements r=rwood 2018-01-31 14:32:08 -05:00
check_source_count.py
check_spidermonkey_style.py Bug 1439936 - Change check_spidermonkey_style.py to support sorting "util/Windows.h". r=sfink. 2018-02-16 21:41:35 -06:00
check_vanilla_allocations.py Bug 1432298 - Make sm-fuzzing build ready for libfuzzer. r=sfink 2018-01-22 21:23:47 +01:00
config.mk Bug 1439742 - Allow {AB_CD} and {AB_rCD} in LOCALIZED_GENERATED_FILES. r=ted.mielczarek 2018-02-21 17:12:17 -08:00
createprecomplete.py
emptyvars-js.mk.in
emptyvars.mk.in
expandlibs.py
expandlibs_config.py Bug 1353541 Fix rustc in MinGW build r=froydnj,ted 2017-04-26 12:08:59 -05:00
expandlibs_exec.py Bug 1417958 - Normalize lib paths to appease VS2017's incremental linking. r=nalexander 2017-11-17 09:15:00 -05:00
expandlibs_gen.py
find_OOM_errors.py
gcc-stl-wrapper.template.h Bug 1423512 - Remove infallible allocator exception for xpcom glue code. r=erahm 2017-12-06 09:56:02 +09:00
gcc_hidden.h
install.bat
make-stl-wrappers.py Backed out 6 changesets (bug 1407432) on (wild) suspicion of causing failures in browser_sanitize-timespans.js, somehow 2017-11-09 22:07:46 -08:00
make-system-wrappers.py Bug 1407432 - Move system wrapper generation to moz.build; r=froydnj 2017-11-08 19:58:56 -05:00
milestone.txt Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release 2018-01-22 11:19:18 +00:00
moz.build Bug 1412906 - Remove config/makefiles/test/ r=nalexander DONTBUILD 2018-02-26 15:29:59 -05:00
mozunit.py Bug 1438253 - Add Python 3 support to mozunit. r=gps 2018-02-14 18:50:52 +00:00
msvc-stl-wrapper.template.h Bug 1423512 - Remove infallible allocator exception for xpcom glue code. r=erahm 2017-12-06 09:56:02 +09:00
nsinstall.c
nsinstall.py
pathsub.c Bug 1422852 - remove D_INO setting from configure; r=chmanchester 2017-12-04 08:18:00 -05:00
pathsub.h
printconfigsetting.py
printprereleasesuffix.py
pythonpath.py
rebuild_check.py
recurse.mk Bug 1378592 - Remove MOZ_REPLACE_MALLOC_LINKAGE. r=froydnj 2017-07-06 10:26:04 +09:00
rules.mk Bug 1440433 - Part 2: Remove ANDROID_APK_{NAME,PACKAGE}. r=jchen 2018-02-22 13:36:49 -08:00
static-checking-config.mk Bug 1403346 - Implement clang-plugin cxxflags in moz.build. r=glandium 2017-10-25 15:12:10 -07:00
stl-headers.mozbuild Backed out 6 changesets (bug 1407432) on (wild) suspicion of causing failures in browser_sanitize-timespans.js, somehow 2017-11-09 22:07:46 -08:00
system-headers.mozbuild Bug 1428182 - 6b. Support unified headers in Breakpad code; r=ted 2018-01-30 14:08:23 -05:00
version.mk Bug 1427365 - Support spaces in the Windows version resource product name/description. r=gps 2018-01-04 13:50:56 -08:00
version_win.pl