Unverified Commit 75d75bfa authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

fix relative paths and snapshot logic in tool (#33283)

parent 582c5587
...@@ -68,9 +68,8 @@ dev_dependencies: ...@@ -68,9 +68,8 @@ dev_dependencies:
yaml: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" yaml: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
builders: builders:
# Note: path is relative from generated directory
simple_codegen: simple_codegen:
path: ../../../simple_codegen path: ../simple_codegen
flutter: flutter:
uses-material-design: true uses-material-design: true
......
...@@ -83,7 +83,20 @@ class BuildRunner extends CodeGenerator { ...@@ -83,7 +83,20 @@ class BuildRunner extends CodeGenerator {
if (builders != null) { if (builders != null) {
for (String name in builders.keys) { for (String name in builders.keys) {
final Object node = builders[name]; final Object node = builders[name];
stringBuffer.writeln(' $name: $node'); // For relative paths, make sure it is accounted for
// parent directories.
if (node is YamlMap && node['path'] != null) {
final String path = node['path'];
if (fs.path.isRelative(path)) {
final String convertedPath = fs.path.join('..', '..', node['path']);
stringBuffer.writeln(' $name:');
stringBuffer.writeln(' path: $convertedPath');
} else {
stringBuffer.writeln(' $name: $node');
}
} else {
stringBuffer.writeln(' $name: $node');
}
} }
} }
stringBuffer.writeln(' build_runner: ^$kMinimumBuildRunnerVersion'); stringBuffer.writeln(' build_runner: ^$kMinimumBuildRunnerVersion');
...@@ -149,7 +162,13 @@ class BuildRunner extends CodeGenerator { ...@@ -149,7 +162,13 @@ class BuildRunner extends CodeGenerator {
'--skip-build-script-check', '--skip-build-script-check',
'--delete-conflicting-outputs' '--delete-conflicting-outputs'
]; ];
buildDaemonClient = await BuildDaemonClient.connect(flutterProject.directory.path, command, logHandler: (ServerLog log) => printTrace(log.toString())); buildDaemonClient = await BuildDaemonClient.connect(
flutterProject.directory.path,
command,
logHandler: (ServerLog log) {
printTrace(log.toString());
}
);
} finally { } finally {
status.stop(); status.stop();
} }
...@@ -198,10 +217,15 @@ List<int> _produceScriptId(YamlMap builders) { ...@@ -198,10 +217,15 @@ List<int> _produceScriptId(YamlMap builders) {
if (builders == null || builders.isEmpty) { if (builders == null || builders.isEmpty) {
return md5.convert(platform.version.codeUnits).bytes; return md5.convert(platform.version.codeUnits).bytes;
} }
final List<String> orderedBuilders = builders.keys final List<String> orderedBuilderNames = builders.keys
.cast<String>() .cast<String>()
.toList()..sort(); .toList()..sort();
return md5.convert(orderedBuilders final List<String> orderedBuilderValues = builders.values
.followedBy(<String>[platform.version]) .map((dynamic value) => value.toString())
.join('').codeUnits).bytes; .toList()..sort();
return md5.convert(<String>[
...orderedBuilderNames,
...orderedBuilderValues,
platform.version,
].join('').codeUnits).bytes;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment