Skip to content

Multiple improvements to watching with --build option #27062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
59060a1
Remove unnecessary projectReferences from ExpandResult and referenceS…
sheetalkamat Sep 6, 2018
50bcfb6
Try the ParsedCommandLine from cache instead of re-reading contents o…
sheetalkamat Sep 7, 2018
521edc1
Refactoring to handle case sensitivity of the host when caching
sheetalkamat Sep 7, 2018
82041eb
Add partial reload support also watch wild cards correctly.
sheetalkamat Sep 7, 2018
228858f
Inline builder context instead of it being outside for easier access …
sheetalkamat Sep 10, 2018
6c57ebd
Update watches to wild card directories, input files, config files wh…
sheetalkamat Sep 10, 2018
ec38ca4
Merge branch 'master' into tsbuildWatchImprovements
sheetalkamat Sep 11, 2018
a172751
Always resolve the config file to ResolvedConfigFile if its json, oth…
sheetalkamat Sep 11, 2018
324073a
Remove dead code and rearrange code to handle resolveProjectNames alw…
sheetalkamat Sep 11, 2018
ec6c9ea
Start shaping SolutionBuilder API
sheetalkamat Sep 11, 2018
5029a61
Cache global dependency graph and invalidate it only if doing full re…
sheetalkamat Sep 11, 2018
c8cdb81
Always create dependency graph and build order
sheetalkamat Sep 11, 2018
42479ca
Maintain project references more clearly
sheetalkamat Sep 11, 2018
8a7550f
Deadcode removal
sheetalkamat Sep 11, 2018
bdf1c78
Report file not found error about the project and watch config file e…
sheetalkamat Sep 11, 2018
5553f36
Instead of queueing build for downstream projects right when invalida…
sheetalkamat Sep 12, 2018
ef2024a
Handle circular project references
sheetalkamat Sep 12, 2018
0319f10
Test case to verify the non local change doesnt build referencing pro…
sheetalkamat Sep 12, 2018
5696384
Handle prepend output to be emitted in downstream project even if dec…
sheetalkamat Sep 12, 2018
b8f33f6
Report all project errors on incremental compile
sheetalkamat Sep 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,8 @@ namespace ts {
const options = extend(existingOptions, parsedConfig.options || {});
options.configFilePath = configFileName && normalizeSlashes(configFileName);
setConfigFileInOptions(options, sourceFile);
const { fileNames, wildcardDirectories, spec, projectReferences } = getFileNames();
let projectReferences: ProjectReference[] | undefined;
const { fileNames, wildcardDirectories, spec } = getFileNames();
return {
options,
fileNames,
Expand Down Expand Up @@ -1904,21 +1905,19 @@ namespace ts {

if (hasProperty(raw, "references") && !isNullOrUndefined(raw.references)) {
if (isArray(raw.references)) {
const references: ProjectReference[] = [];
for (const ref of raw.references) {
if (typeof ref.path !== "string") {
createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string");
}
else {
references.push({
(projectReferences || (projectReferences = [])).push({
path: getNormalizedAbsolutePath(ref.path, basePath),
originalPath: ref.path,
prepend: ref.prepend,
circular: ref.circular
});
}
}
result.projectReferences = references;
}
else {
createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "references", "Array");
Expand Down Expand Up @@ -2407,7 +2406,7 @@ namespace ts {
// new entries in these paths.
const wildcardDirectories = getWildcardDirectories(validatedIncludeSpecs, validatedExcludeSpecs, basePath, host.useCaseSensitiveFileNames);

const spec: ConfigFileSpecs = { filesSpecs, referencesSpecs: undefined, includeSpecs, excludeSpecs, validatedIncludeSpecs, validatedExcludeSpecs, wildcardDirectories };
const spec: ConfigFileSpecs = { filesSpecs, includeSpecs, excludeSpecs, validatedIncludeSpecs, validatedExcludeSpecs, wildcardDirectories };
return getFileNamesFromConfigSpecs(spec, basePath, options, host, extraFileExtensions);
}

Expand Down Expand Up @@ -2478,16 +2477,9 @@ namespace ts {

const literalFiles = arrayFrom(literalFileMap.values());
const wildcardFiles = arrayFrom(wildcardFileMap.values());
const projectReferences = spec.referencesSpecs && spec.referencesSpecs.map((r): ProjectReference => {
return {
...r,
path: getNormalizedAbsolutePath(r.path, basePath)
};
});

return {
fileNames: literalFiles.concat(wildcardFiles),
projectReferences,
wildcardDirectories,
spec
};
Expand Down
4 changes: 0 additions & 4 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3838,10 +3838,6 @@
"category": "Error",
"code": 6370
},
"Skipping clean because not all projects could be located": {
"category": "Error",
"code": 6371
},

"The expected type comes from property '{0}' which is declared here on type '{1}'": {
"category": "Message",
Expand Down
13 changes: 4 additions & 9 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,7 @@ namespace ts {

function parseProjectReferenceConfigFile(ref: ProjectReference): { commandLine: ParsedCommandLine, sourceFile: SourceFile } | undefined {
// The actual filename (i.e. add "/tsconfig.json" if necessary)
const refPath = resolveProjectReferencePath(host, ref);
const refPath = resolveProjectReferencePath(ref);
// An absolute path pointing to the containing directory of the config file
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), host.getCurrentDirectory());
const sourceFile = host.getSourceFile(refPath, ScriptTarget.JSON) as JsonSourceFile | undefined;
Expand Down Expand Up @@ -2820,18 +2820,13 @@ namespace ts {
};
}

export interface ResolveProjectReferencePathHost {
fileExists(fileName: string): boolean;
}
/**
* Returns the target config filename of a project reference.
* Note: The file might not exist.
*/
export function resolveProjectReferencePath(host: ResolveProjectReferencePathHost, ref: ProjectReference): ResolvedConfigFileName {
if (!host.fileExists(ref.path)) {
return combinePaths(ref.path, "tsconfig.json") as ResolvedConfigFileName;
}
return ref.path as ResolvedConfigFileName;
// TODO: Does this need to be exposed
export function resolveProjectReferencePath(ref: ProjectReference): ResolvedConfigFileName {
return resolveConfigFileProjectName(ref.path);
}

/* @internal */
Expand Down
Loading