fix relative paths and snapshot logic in tool (#33283)
This commit is contained in:
@@ -68,9 +68,8 @@ dev_dependencies:
|
||||
yaml: 2.1.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
|
||||
builders:
|
||||
# Note: path is relative from generated directory
|
||||
simple_codegen:
|
||||
path: ../../../simple_codegen
|
||||
path: ../simple_codegen
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -83,7 +83,20 @@ class BuildRunner extends CodeGenerator {
|
||||
if (builders != null) {
|
||||
for (String name in builders.keys) {
|
||||
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');
|
||||
@@ -149,7 +162,13 @@ class BuildRunner extends CodeGenerator {
|
||||
'--skip-build-script-check',
|
||||
'--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 {
|
||||
status.stop();
|
||||
}
|
||||
@@ -198,10 +217,15 @@ List<int> _produceScriptId(YamlMap builders) {
|
||||
if (builders == null || builders.isEmpty) {
|
||||
return md5.convert(platform.version.codeUnits).bytes;
|
||||
}
|
||||
final List<String> orderedBuilders = builders.keys
|
||||
final List<String> orderedBuilderNames = builders.keys
|
||||
.cast<String>()
|
||||
.toList()..sort();
|
||||
return md5.convert(orderedBuilders
|
||||
.followedBy(<String>[platform.version])
|
||||
.join('').codeUnits).bytes;
|
||||
final List<String> orderedBuilderValues = builders.values
|
||||
.map((dynamic value) => value.toString())
|
||||
.toList()..sort();
|
||||
return md5.convert(<String>[
|
||||
...orderedBuilderNames,
|
||||
...orderedBuilderValues,
|
||||
platform.version,
|
||||
].join('').codeUnits).bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user