[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

@@ -17,13 +17,15 @@ void main() {
testWithoutContext('generateLocalizations forwards arguments correctly', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Logger logger = BufferLogger.test();
final String projectDir = fileSystem.path.join('path', 'to', 'flutter_project');
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
FakeCommand(
command: <String>[
'dart',
'--disable-dart-dev',
'dev/tools/localization/bin/gen_l10n.dart',
'--gen-inputs-and-outputs-list=/',
'--project-dir=$projectDir',
'--arb-dir=arb',
'--template-arb-file=example.arb',
'--output-localization-file=bar',
@@ -36,7 +38,11 @@ void main() {
],
),
]);
final Directory arbDirectory = fileSystem.directory('arb')
final Directory flutterProjectDirectory = fileSystem
.directory(fileSystem.path.join('path', 'to', 'flutter_project'))
..createSync(recursive: true);
final Directory arbDirectory = flutterProjectDirectory
.childDirectory('arb')
..createSync();
arbDirectory.childFile('foo.arb').createSync();
arbDirectory.childFile('bar.arb').createSync();
@@ -57,7 +63,7 @@ void main() {
logger: logger,
fileSystem: fileSystem,
processManager: processManager,
projectDir: fileSystem.currentDirectory,
projectDir: flutterProjectDirectory,
dartBinaryPath: 'dart',
flutterRoot: '',
dependenciesDir: fileSystem.currentDirectory,

View File

@@ -1189,6 +1189,7 @@ void main() {
'--disable-dart-dev',
globals.fs.path.join(Cache.flutterRoot, 'dev', 'tools', 'localization', 'bin', 'gen_l10n.dart'),
'--gen-inputs-and-outputs-list=${dependencies.absolute.path}',
'--project-dir=${globals.fs.currentDirectory.path}',
],
onRun: () {
dependencies
@@ -1218,6 +1219,7 @@ void main() {
'--disable-dart-dev',
globals.fs.path.join(Cache.flutterRoot, 'dev', 'tools', 'localization', 'bin', 'gen_l10n.dart'),
'--gen-inputs-and-outputs-list=${dependencies.absolute.path}',
'--project-dir=${globals.fs.currentDirectory.path}',
],
exitCode: 1,
stderr: 'stderr'