Skip to content

Commit

Permalink
fix: Start config.toml lookup in tauri dir, not workspace root (#779)
Browse files Browse the repository at this point in the history
* and the logging begins

* more logging

* start looking for .cargo/config in tauri dir

* remove temp logging

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

* fix changefile
  • Loading branch information
FabianLars authored Apr 29, 2024
1 parent efcf29f commit 6c3f5cf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
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

0 comments on commit 6c3f5cf

Please sign in to comment.