OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library fasta.kernel_target; | 5 library fasta.kernel_target; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'dart:io' show File, IOSink; | 9 import 'dart:io' show File, IOSink; |
10 | 10 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } on InputError catch (e) { | 279 } on InputError catch (e) { |
280 return handleInputError(uri, e, isFullProgram: true); | 280 return handleInputError(uri, e, isFullProgram: true); |
281 } catch (e, s) { | 281 } catch (e, s) { |
282 return reportCrash(e, s, loader?.currentUriForCrashReporting); | 282 return reportCrash(e, s, loader?.currentUriForCrashReporting); |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 Future writeDepsFile(Uri output, Uri depsFile, | 286 Future writeDepsFile(Uri output, Uri depsFile, |
287 {Iterable<Uri> extraDependencies}) async { | 287 {Iterable<Uri> extraDependencies}) async { |
288 String toRelativeFilePath(Uri uri) { | 288 String toRelativeFilePath(Uri uri) { |
289 return Uri.parse(relativizeUri(uri)).toFilePath(); | 289 // Ninja expects to find file names relative to the current working |
| 290 // directory. We've tried making them relative to the deps file, but that |
| 291 // doesn't work for downstream projects. Making them absolute also |
| 292 // doesn't work. |
| 293 // |
| 294 // We can test if it works by running ninja twice, for example: |
| 295 // |
| 296 // ninja -C xcodebuild/ReleaseX64 runtime_kernel -d explain |
| 297 // ninja -C xcodebuild/ReleaseX64 runtime_kernel -d explain |
| 298 // |
| 299 // The second time, ninja should say: |
| 300 // |
| 301 // ninja: Entering directory `xcodebuild/ReleaseX64' |
| 302 // ninja: no work to do. |
| 303 // |
| 304 // It's broken if it says something like this: |
| 305 // |
| 306 // ninja explain: expected depfile 'patched_sdk.d' to mention |
| 307 // 'patched_sdk/platform.dill', got |
| 308 // '/.../xcodebuild/ReleaseX64/patched_sdk/platform.dill' |
| 309 return Uri.parse(relativizeUri(uri, base: Uri.base)).toFilePath(); |
290 } | 310 } |
291 | 311 |
292 if (loader.first == null) return null; | 312 if (loader.first == null) return null; |
293 StringBuffer sb = new StringBuffer(); | 313 StringBuffer sb = new StringBuffer(); |
294 sb.write(toRelativeFilePath(output)); | 314 sb.write(toRelativeFilePath(output)); |
295 sb.write(":"); | 315 sb.write(":"); |
296 Set<String> allDependencies = new Set<String>(); | 316 Set<String> allDependencies = new Set<String>(); |
297 allDependencies.addAll(loader.getDependencies().map(toRelativeFilePath)); | 317 allDependencies.addAll(loader.getDependencies().map(toRelativeFilePath)); |
298 if (extraDependencies != null) { | 318 if (extraDependencies != null) { |
299 allDependencies.addAll(extraDependencies.map(toRelativeFilePath)); | 319 allDependencies.addAll(extraDependencies.map(toRelativeFilePath)); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 } | 716 } |
697 for (Constructor constructor in superclass.constructors) { | 717 for (Constructor constructor in superclass.constructors) { |
698 if (constructor.name.name.isEmpty) { | 718 if (constructor.name.name.isEmpty) { |
699 return constructor.function.requiredParameterCount == 0 | 719 return constructor.function.requiredParameterCount == 0 |
700 ? constructor | 720 ? constructor |
701 : null; | 721 : null; |
702 } | 722 } |
703 } | 723 } |
704 return null; | 724 return null; |
705 } | 725 } |
OLD | NEW |