Skip to content
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

Add new compiler option --rootDir #2772

Merged
merged 12 commits into from
Apr 20, 2015
Merged

Add new compiler option --rootDir #2772

merged 12 commits into from
Apr 20, 2015

Conversation

mhegazy
Copy link
Contributor

@mhegazy mhegazy commented Apr 15, 2015

The new option fixes #2644, which is a reactivation of #287, and has been in discussion in #2034.

Background

The current behavior of the compiler when using --outDir is to duplicate the input structure in the output under the value of --outDir. the root of the input is computed as the longest common path of all source (.ts and not .d.ts) files. so an input of FolderA\FolderB\1.ts and FolderA\FolderB\2.ts would result in computing the commonSourceRoot to FolderA\FolderB\. now if a new file FolderA\3.ts is added to the input, the commonSourceRoot will pop out to FolderA\.

This is generally undesirable and can be confusing. it also does not allow for folders that do not contain .ts files to be replicated in the output.

--rootDir flag

The new flag is used to customize the commonSourceRoot instead of automatically calculating it.

The same rules apply, i.e. all source files (.ts) should be under the rootDir, otherwise the output generation may not be correct.

The name rootDir is meant to resemble outDir as both flags go together.

Conflicts:
	tests/baselines/reference/APISample_compile.types
	tests/baselines/reference/APISample_linter.types
	tests/baselines/reference/APISample_transform.types
	tests/baselines/reference/APISample_watcher.types
"category": "Message",
"code": 6058
},
"File '{0}' is not under rootDir '{1}'. RootDir is expected to contain all source files.": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use lowercase 'r' for 'RootDir', use single quotes :

"under 'rootDir' '{1}'. 'rootDir' is expected..."

Conflicts:
	tests/baselines/reference/APISample_compile.types
	tests/baselines/reference/APISample_linter.types
	tests/baselines/reference/APISample_transform.types
	tests/baselines/reference/APISample_watcher.types
return getNormalizedPathFromPathComponents(commonPathComponents);
}

function checkSourceFilesBelongToPath(soruceFiles: SourceFile[], rootDirectory: string): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

soruceFiles -> sourceFiles

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why so soruce?

@DanielRosenwasser
Copy link
Member

👍

@NekR
Copy link

NekR commented Apr 30, 2015

Is this in beta already or will be only in release?

@mhegazy
Copy link
Contributor Author

mhegazy commented Apr 30, 2015

Should be in 1.5-beta

@NekR
Copy link

NekR commented Apr 30, 2015

@mhegazy filed here #2974

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty parent directories are not preserved with --outDir
5 participants