[gen_l10n] Synthetic package generation by default (#62395)
* synthetic packages by default in gen_l10n tool * Refactor default path for synthetic package * Remove unused import * Code cleanup * Further improvements to help text * Refactor synthetic package path * Remove newlines * Test cleanup * clean up logic in inputs and outputs list function * Update l10n.yaml usage * only add option if value is non-null * Update stocks app as proof of concept for synthetic package usage * Address nits * print pubspec contents * add print statements * Do not allow null value for useSyntheticPackage * + * + * + * + * Cleanup * Add test * Fix text * Dont parse pubspec directly * Test using context * WIP: generate synthetic packages on pub get -- needs tests * Allow null value * Update null handling * Refactor to properly handle null case * Fix yamlMap condition * Fix yaml node for real * WIP: struggling to write tests * WIP - take absolute path as an option * Add tests * Use environment project directory for synthetic package generation pathway * Fix typo * Improve help text * Update defaults * Remove unauthorized path import * Fix pathing issues at synthetic package generation * Fix typo in test * Use path.join so projectDir matches up based on OS * Fix Windows pathing in test * Remove unnecessary replaceApp code for projectDir.path * Use globals.fs.currentDirectory.path in resident_runner_test.dart * Fix merge conflict * Add test to ensure that synthetic package is generated on pub get * Fix resident_runner_test.dart tests * Fix tests * Use package:file instead of dart:io * WIP - exploration * Remove synthetic package use from stocks example * Update integration test to not use synthetic packages * Remove trailing whitespace * flutter pub get runs synth package generation * Remove more print statements * Add license header * WIP - minimally working pub.get * Use own MockBuildSystem * Modify test and implementation to be a little cleaner * Fix flutter pub get invocation * Use synthetic packages in stocks app * Revert "Use synthetic packages in stocks app" This reverts commit 45bf24903c3d4a2a5fd5481d7d6bc36c4a348703. * Add environment and buildSystem params to flutter test * Address code review feedback * + * Isolate codegen into its own API * Fix imports * Slight refactor * Add one more test for no l10n.yaml file * Remove unneeded mock class and import in pub_get_test.dart * More code review feedback * Remove unnecessary imports * Remove `return await`s that I missed * use arrow functions instead
This commit is contained in:
@@ -27,10 +27,15 @@ void main(List<String> arguments) {
|
||||
);
|
||||
parser.addOption(
|
||||
'output-dir',
|
||||
help: 'The directory where the generated localization classes will be written. '
|
||||
help: 'The directory where the generated localization classes will be written '
|
||||
'if the synthetic-package flag is set to false.'
|
||||
'\n\n'
|
||||
'If output-dir is specified and the synthetic-package flag is enabled, '
|
||||
'this option will be ignored by the tool.'
|
||||
'\n\n'
|
||||
'The app must import the file specified in the \'output-localization-file\' '
|
||||
'option from this directory. If unspecified, this defaults to the same '
|
||||
'directory as the input directory specified in \'arb-dir\'.'
|
||||
'directory as the input directory specified in \'arb-dir\'.',
|
||||
);
|
||||
parser.addOption(
|
||||
'template-arb-file',
|
||||
@@ -120,6 +125,20 @@ void main(List<String> arguments) {
|
||||
'\n\n'
|
||||
'When null, the JSON file will not be generated.'
|
||||
);
|
||||
parser.addFlag(
|
||||
'synthetic-package',
|
||||
defaultsTo: true,
|
||||
help: 'Determines whether or not the generated output files will be '
|
||||
'generated as a synthetic package or at a specified directory in '
|
||||
'the Flutter project.'
|
||||
'\n\n'
|
||||
'This flag is set to true by default.'
|
||||
'\n\n'
|
||||
'When synthetic-package is set to false, it will generate the '
|
||||
'localizations files in the directory specified by arb-dir by default. '
|
||||
'\n\n'
|
||||
'If output-dir is specified, files will be generated there.',
|
||||
);
|
||||
parser.addOption(
|
||||
'project-dir',
|
||||
valueHelp: 'absolute/path/to/flutter/project',
|
||||
@@ -148,6 +167,7 @@ void main(List<String> arguments) {
|
||||
final String headerFile = results['header-file'] as String;
|
||||
final bool useDeferredLoading = results['use-deferred-loading'] as bool;
|
||||
final String inputsAndOutputsListPath = results['gen-inputs-and-outputs-list'] as String;
|
||||
final bool useSyntheticPackage = results['synthetic-package'] as bool;
|
||||
final String projectPathString = results['project-dir'] as String;
|
||||
|
||||
const local.LocalFileSystem fs = local.LocalFileSystem();
|
||||
@@ -166,6 +186,7 @@ void main(List<String> arguments) {
|
||||
headerFile: headerFile,
|
||||
useDeferredLoading: useDeferredLoading,
|
||||
inputsAndOutputsListPath: inputsAndOutputsListPath,
|
||||
useSyntheticPackage: useSyntheticPackage,
|
||||
projectPathString: projectPathString,
|
||||
)
|
||||
..loadResources()
|
||||
|
||||
Reference in New Issue
Block a user