Skip to content

Commit ec848a9

Browse files
JoelRoxellRyan-Gordon
authored andcommitted
feat: support builds from a cargo workspace
1 parent d6f4492 commit ec848a9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class RustPlugin {
4848
dockerImage: DEFAULT_DOCKER_IMAGE,
4949
dockerless: false,
5050
strictMode: true,
51+
inWorkspace: false,
5152
},
5253
(this.serverless.service.custom && this.serverless.service.custom.rust) ||
5354
{},
@@ -168,7 +169,7 @@ class RustPlugin {
168169
const zip = new AdmZip();
169170
zip.addFile(
170171
"bootstrap",
171-
readFileSync(path.join(sourceDir, binary)),
172+
readFileSync(path.join(this.custom.inWorkspace ? '..' : '', sourceDir, binary)),
172173
"",
173174
0o755,
174175
);

tests/unit/index.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ describe("RustPlugin", () => {
4242
dockerTag: "latest",
4343
dockerless: false,
4444
strictMode: true,
45+
inWorkspace: false
4546
});
4647
});
4748

@@ -57,6 +58,7 @@ describe("RustPlugin", () => {
5758
dockerTag: "custom-tag",
5859
dockerless: true,
5960
strictMode: false,
61+
inWorkspace: false
6062
},
6163
},
6264
package: {},
@@ -71,6 +73,7 @@ describe("RustPlugin", () => {
7173
dockerTag: "custom-tag",
7274
dockerless: true,
7375
strictMode: false,
76+
inWorkspace: false
7477
});
7578
});
7679

0 commit comments

Comments
 (0)