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

Allow specifying a source directory in configuration #22

Closed
wants to merge 3 commits into from
Closed
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
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
"default": "builddir",
"description": "Specify in which folder Meson build configure and build the project."
},
"mesonbuild.sourceFolder": {
"type": "string",
"default": "",
"description": "Specify in which folder (relative to the workspace root) the meson.build file is located."
},
"mesonbuild.configureOptions": {
"type": "array",
"default": [
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function activate(ctx: vscode.ExtensionContext): void {
ctx.subscriptions.push(
vscode.commands.registerCommand("mesonbuild.configure", async () => {
await runMesonConfigure(
root,
workspaceRelative(extensionConfiguration("sourceFolder")),
workspaceRelative(extensionConfiguration("buildFolder"))
);
explorer.refresh();
Expand Down
4 changes: 2 additions & 2 deletions src/meson/runners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function runMesonConfigure(source: string, build: string) {
async progress => {
progress.report({
message: `Checking if Meson is configured in ${relative(
source,
vscode.workspace.rootPath,
build
)}...`
});
Expand All @@ -39,7 +39,7 @@ export async function runMesonConfigure(source: string, build: string) {
await exec("ninja reconfigure", { cwd: build });
} else {
progress.report({
message: `Configuring Meson into ${relative(source, build)}...`
message: `Configuring Meson into ${relative(vscode.workspace.rootPath, build)}...`
});
const configureOpts = extensionConfiguration("configureOptions").join(
" "
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export interface ExtensionConfiguration {
configureOnOpen: boolean;
configureOptions: string[];
buildFolder: string;
sourceFolder: string;
}
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ export function workspaceRelative(filepath: string) {

export async function getTargetName(t: Target) {
const buildDir = workspaceRelative(extensionConfiguration("buildFolder"));
const sourceDir = workspaceRelative(extensionConfiguration("sourceFolder"));
const buildOptions = await getMesonBuildOptions(buildDir);
const layoutOption = buildOptions.filter(o => o.name === "layout")[0];
if (layoutOption.value === "mirror")
return path.join(
path.relative(vscode.workspace.rootPath, path.dirname(t.defined_in)),
path.relative(sourceDir, path.dirname(t.defined_in)),
t.name
);
else return `meson-out/${t.name}`;
Expand Down