-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Delete --project from all vcpkg-artifacts commands and use ex…
…isting vcpkg switches to control where the manifest is located instead. (#731)" (#750) This reverts commit 8dc83cc.
- Loading branch information
1 parent
c91aa61
commit 3247920
Showing
16 changed files
with
125 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { resolve } from 'path'; | ||
import { ProjectManifest } from '../../artifacts/artifact'; | ||
import { configurationName } from '../../constants'; | ||
import { FileType } from '../../fs/filesystem'; | ||
import { i } from '../../i18n'; | ||
import { session } from '../../main'; | ||
import { Uri } from '../../util/uri'; | ||
import { projectFile } from '../format'; | ||
import { debug, error } from '../styling'; | ||
import { Switch } from '../switch'; | ||
|
||
interface ResolvedProjectUri { | ||
filename: string; | ||
uri: Uri; | ||
} | ||
|
||
export class Project extends Switch { | ||
switch = 'project'; | ||
get help() { | ||
return [ | ||
i`override the path to the project folder` | ||
]; | ||
} | ||
|
||
async resolveProjectUri() : Promise<ResolvedProjectUri | undefined> { | ||
const v = this.value; | ||
if (v) { | ||
const uri = session.fileSystem.file(resolve(v)); | ||
const stat = await uri.stat(); | ||
|
||
if (stat.type & FileType.File) { | ||
return {'filename': v, uri: uri}; | ||
} | ||
if (stat.type & FileType.Directory) { | ||
const project = uri.join(configurationName); | ||
if (await project.exists()) { | ||
return {'filename': project.fsPath, uri: project}; | ||
} | ||
} | ||
|
||
error(i`Unable to find project environment ${projectFile(uri)}`); | ||
return undefined; | ||
} | ||
|
||
const sessionProject = await session.findProjectProfile(); | ||
if (sessionProject) { | ||
return {'filename': sessionProject.fsPath, 'uri': sessionProject}; | ||
} | ||
|
||
return undefined; | ||
} | ||
|
||
get resolvedValue(): Promise<Uri | undefined> { | ||
return this.resolveProjectUri().then(v => v?.uri); | ||
} | ||
|
||
get manifest(): Promise<ProjectManifest | undefined> { | ||
return this.resolveProjectUri().then(async (resolved) => { | ||
if (!resolved) { | ||
debug('No project manifest'); | ||
return undefined; | ||
} | ||
|
||
debug(`Loading project manifest ${resolved.filename} `); | ||
return await new ProjectManifest(session, await session.openManifest(resolved.filename, resolved.uri)); | ||
}); | ||
} | ||
} |
Oops, something went wrong.