Skip to content

Commit

Permalink
fix(compiler): generate relative paths only in summary file errors (a…
Browse files Browse the repository at this point in the history
…ngular#26759)

Previously errors in the summary file would include absolute file names.
This is undesirable as the output of a build should not depend on the
current working directory. Doing so causes nondeterminism issues in
builds.

PR Close angular#26759
  • Loading branch information
alxhub authored and sculove committed Nov 2, 2018
1 parent b410a4e commit cfa2379
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/compiler/src/aot/static_symbol_resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ export class StaticSymbolResolver {
// correctly.
const originFilePath = this.resolveModule(origin, filePath);
if (!originFilePath) {
this.reportError(
new Error(`Couldn't resolve original symbol for ${origin} from ${filePath}`));
this.reportError(new Error(
`Couldn't resolve original symbol for ${origin} from ${this.host.getOutputName(filePath)}`));
} else {
this.symbolResourcePaths.set(symbol, originFilePath);
}
Expand Down Expand Up @@ -420,7 +420,8 @@ export class StaticSymbolResolver {
if (!filePath) {
return {
__symbolic: 'error',
message: `Could not resolve ${module} relative to ${sourceSymbol.filePath}.`,
message:
`Could not resolve ${module} relative to ${self.host.getMetadataFor(sourceSymbol.filePath)}.`,
line: map.line,
character: map.character,
fileName: getOriginalName()
Expand Down Expand Up @@ -504,7 +505,7 @@ export class StaticSymbolResolver {
if (moduleMetadata['version'] != SUPPORTED_SCHEMA_VERSION) {
const errorMessage = moduleMetadata['version'] == 2 ?
`Unsupported metadata version ${moduleMetadata['version']} for module ${module}. This module should be compiled with a newer version of ngc` :
`Metadata version mismatch for module ${module}, found version ${moduleMetadata['version']}, expected ${SUPPORTED_SCHEMA_VERSION}`;
`Metadata version mismatch for module ${this.host.getOutputName(module)}, found version ${moduleMetadata['version']}, expected ${SUPPORTED_SCHEMA_VERSION}`;
this.reportError(new Error(errorMessage));
}
this.metadataCache.set(module, moduleMetadata);
Expand All @@ -518,7 +519,7 @@ export class StaticSymbolResolver {
if (!filePath) {
this.reportError(
new Error(`Could not resolve module ${module}${containingFile ? ' relative to ' +
containingFile : ''}`));
this.host.getOutputName(containingFile) : ''}`));
return this.getStaticSymbol(`ERROR:${module}`, symbolName);
}
return this.getStaticSymbol(filePath, symbolName);
Expand Down

0 comments on commit cfa2379

Please sign in to comment.