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

pdc executes from workspace root #36

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions src/core/ConfigurationResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { readSDKPath } from "./readSDKPath";
import { readSDKVersion } from "./readSDKVersion";

export interface Configuration {
workspaceRoot: string;
sdkPath: string;
sdkVersion: string;
sourcePath: string;
Expand Down Expand Up @@ -88,6 +89,7 @@ export class ConfigurationResolver {
const gamePath = productPath + ".pdx";

return {
workspaceRoot,
sdkPath,
sdkVersion,
sourcePath,
Expand Down
2 changes: 2 additions & 0 deletions src/pdc/PDCExecutionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class PDCExecutionFactory implements TaskExecutionFactory {
}

const {
workspaceRoot,
sdkPath: sdkPathConfig,
sourcePath: sourcePathConfig,
gamePath: gamePathConfig,
Expand All @@ -55,6 +56,7 @@ export class PDCExecutionFactory implements TaskExecutionFactory {

const execution = new vscode.CustomExecution(async () => {
const runner = new PDCTaskRunner({
workspaceRoot,
sdkPath,
sourcePath,
gamePath,
Expand Down
4 changes: 3 additions & 1 deletion src/pdc/PDCTaskRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getPDCCommand, GetPDCCommandOptions } from "./getPDCCommand";
* `tasks.json`.
*/
export interface PDCTaskRunnerOptions {
workspaceRoot: string;
sdkPath: string;
sourcePath: string;
gamePath: string;
Expand All @@ -34,6 +35,7 @@ export class PDCTaskRunner implements TaskRunner {
constructor(private options: PDCTaskRunnerOptions) {}

async run(onMessage: OnTaskRunnerMessage): Promise<void> {
const { workspaceRoot } = this.options;
const pdcOptions = this.getPDCOptions();
const pdcCommand = getPDCCommand(pdcOptions);

Expand All @@ -50,7 +52,7 @@ export class PDCTaskRunner implements TaskRunner {

onMessage("Compiling...");
onMessage(`> ${pdcCommand}`);
await exec(pdcCommand);
await exec(pdcCommand, { cwd: workspaceRoot });
}

private getPDCOptions(): GetPDCCommandOptions {
Expand Down