[gen_l10n] Absolute project path parameter (#63368)

This commit is contained in:
Shi-Hao Hong
2020-08-13 20:11:05 +08:00
committed by GitHub
parent 0629030a05
commit 0a7c6243fa
6 changed files with 151 additions and 7 deletions

View File

@@ -120,6 +120,14 @@ void main(List<String> arguments) {
'\n\n'
'When null, the JSON file will not be generated.'
);
parser.addOption(
'project-dir',
valueHelp: 'absolute/path/to/flutter/project',
help: 'When specified, the tool uses the path passed into this option '
'as the directory of the root Flutter project.'
'\n\n'
'When null, the relative path to the present working directory will be used.'
);
final argslib.ArgResults results = parser.parse(arguments);
if (results['help'] == true) {
@@ -140,6 +148,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 String projectPathString = results['project-dir'] as String;
const local.LocalFileSystem fs = local.LocalFileSystem();
final LocalizationsGenerator localizationsGenerator = LocalizationsGenerator(fs);
@@ -157,6 +166,7 @@ void main(List<String> arguments) {
headerFile: headerFile,
useDeferredLoading: useDeferredLoading,
inputsAndOutputsListPath: inputsAndOutputsListPath,
projectPathString: projectPathString,
)
..loadResources()
..writeOutputFiles()