Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: pkg/analysis_server/tool/spec/codegen_tools.dart

Issue 1219493007: Modify analysis server codegen check to tolerate Windows line endings. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/tool/spec/codegen_tools.dart
diff --git a/pkg/analysis_server/tool/spec/codegen_tools.dart b/pkg/analysis_server/tool/spec/codegen_tools.dart
index 84a95ab4e309fca43623336d57f80320dae7d45b..0d7e95fc506136589473344fd4f32a43bb18c4e8 100644
--- a/pkg/analysis_server/tool/spec/codegen_tools.dart
+++ b/pkg/analysis_server/tool/spec/codegen_tools.dart
@@ -286,7 +286,11 @@ class GeneratedDirectory extends GeneratedContent {
String expectedContents = fileContentsComputer();
File outputFile =
new File(joinAll(posix.split(posix.join(outputDirPath, file))));
- if (expectedContents != outputFile.readAsStringSync()) {
+ String actualContents = outputFile.readAsStringSync();
+ // Normalize Windows line endings to Unix line endings so that the
+ // comparison doesn't fail on Windows.
+ actualContents = actualContents.replaceAll('\r\n', '\n');
+ if (expectedContents != actualContents) {
return false;
}
}
@@ -370,7 +374,11 @@ class GeneratedFile extends GeneratedContent {
bool check() {
String expectedContents = computeContents();
try {
- return expectedContents == outputFile.readAsStringSync();
+ String actualContents = outputFile.readAsStringSync();
+ // Normalize Windows line endings to Unix line endings so that the
+ // comparison doesn't fail on Windows.
+ actualContents = actualContents.replaceAll('\r\n', '\n');
+ return expectedContents == actualContents;
} catch (e) {
// There was a problem reading the file (most likely because it didn't
// exist). Treat that the same as if the file doesn't have the expected
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698