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

fix: Start config.toml lookup in tauri dir, not workspace root #779

Merged
merged 7 commits into from
Apr 29, 2024
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
5 changes: 5 additions & 0 deletions .changes/targetdir-lookup-workspace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
action: patch
---

Fixed an issue that caused `tauri-action` to not detect `build.target` in `.cargo/config.toml` if the app was part of a cargo workspace.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ export async function buildProject(
.toLowerCase();
}

const cratePath = getWorkspaceDir(app.tauriPath) ?? app.tauriPath;
const workspacePath = getWorkspaceDir(app.tauriPath) ?? app.tauriPath;

const artifactsPath = join(
getTargetDir(cratePath, !!targetPath),
getTargetDir(workspacePath, info.tauriPath, !!targetPath),
targetPath ?? '',
profile ? profile : debug ? 'debug' : 'release',
);
Expand Down
10 changes: 7 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,16 @@ export function getWorkspaceDir(dir: string): string | null {
return null;
}

export function getTargetDir(crateDir: string, targetArgSet: boolean): string {
export function getTargetDir(
workspacePath: string,
tauriPath: string,
targetArgSet: boolean,
): string {
// The default path if no configs are set.
const def = join(crateDir, 'target');
const def = join(workspacePath, 'target');

// This will hold the path of current iteration
let dir = crateDir;
let dir = tauriPath;

// hold on to target-dir cargo config while we search for build.target
let targetDir;
Expand Down
Loading