fix(compiler): generate relative paths only in summary file errors (#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 #26759
This commit is contained in:
parent
d50d400231
commit
56f44be0aa
|
@ -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);
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue