Skip to content

Commit f829901

Browse files
authored
[RustPlanner] use InstallStage (#151)
## Summary We can use the InstallStage as intended: leverage Docker layers to ensure incremental builds are faster, when no crates (rust dependencies) change. ## How was it tested? in `testdata/rust/rust-stable`: ``` > devbox build > docker run devbox # printed the version number used. ```
1 parent 494a276 commit f829901

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

planner/languages/rust/rust_planner.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ func (p *Planner) getPlan(srcDir string) (*plansdk.Plan, error) {
6363
// 2. https://stackoverflow.com/a/56166959
6464
DevPackages: []string{rustPkgDev, "gcc"},
6565
RuntimePackages: []string{"glibc"},
66+
InstallStage: &plansdk.Stage{
67+
InputFiles: []string{"."},
68+
Command: "cargo fetch",
69+
},
6670
BuildStage: &plansdk.Stage{
6771
InputFiles: []string{"."},
68-
Command: "cargo build --release",
72+
Command: "cargo build --release --offline",
6973
},
7074
StartStage: &plansdk.Stage{
7175
InputFiles: []string{fmt.Sprintf("target/release/%s", manifest.PackageField.Name)},

testdata/rust/rust-1.62.0/plan.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
"glibc"
1212
],
1313
"install_stage": {
14-
"command": ""
14+
"command": "cargo fetch",
15+
"input_files": [
16+
"."
17+
]
1518
},
1619
"build_stage": {
17-
"command": "cargo build --release",
20+
"command": "cargo build --release --offline",
1821
"input_files": [
1922
"."
2023
]

testdata/rust/rust-stable-hello-world/plan.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
"glibc"
1111
],
1212
"install_stage": {
13-
"command": ""
13+
"command": "cargo fetch",
14+
"input_files": [
15+
"."
16+
]
1417
},
1518
"build_stage": {
16-
"command": "cargo build --release",
19+
"command": "cargo build --release --offline",
1720
"input_files": [
1821
"."
1922
]

testdata/rust/rust-stable/plan.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
"glibc"
1212
],
1313
"install_stage": {
14-
"command": ""
14+
"command": "cargo fetch",
15+
"input_files": [
16+
"."
17+
]
1518
},
1619
"build_stage": {
17-
"command": "cargo build --release",
20+
"command": "cargo build --release --offline",
1821
"input_files": [
1922
"."
2023
]

0 commit comments

Comments
 (0)