-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(prepare): resolve sources/outputs relative to dir when set
#8472
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ impl GitSubmodulePrepareProvider { | |
| /// Handles INI-style sections and comments. Only extracts `path` values | ||
| /// from `[submodule "..."]` sections. | ||
| fn submodule_paths(&self) -> Vec<PathBuf> { | ||
| let gitmodules = self.base.project_root.join(".gitmodules"); | ||
| let gitmodules = self.base.config_root().join(".gitmodules"); | ||
| let Ok(content) = std::fs::read_to_string(&gitmodules) else { | ||
| return vec![]; | ||
| }; | ||
|
|
@@ -53,7 +53,7 @@ impl GitSubmodulePrepareProvider { | |
| let value = value.trim_start(); | ||
| value | ||
| .strip_prefix('=') | ||
| .map(|value| self.base.project_root.join(value.trim())) | ||
| .map(|value| self.base.config_root().join(value.trim())) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code block in |
||
| } else { | ||
| None | ||
| } | ||
|
|
@@ -68,7 +68,7 @@ impl PrepareProvider for GitSubmodulePrepareProvider { | |
| } | ||
|
|
||
| fn sources(&self) -> Vec<PathBuf> { | ||
| vec![self.base.project_root.join(".gitmodules")] | ||
| vec![self.base.config_root().join(".gitmodules")] | ||
| } | ||
|
|
||
| fn outputs(&self) -> Vec<PathBuf> { | ||
|
|
@@ -89,7 +89,7 @@ impl PrepareProvider for GitSubmodulePrepareProvider { | |
| "--recursive".to_string(), | ||
| ], | ||
| env: self.base.config.env.clone(), | ||
| cwd: Some(self.base.project_root.clone()), | ||
| cwd: Some(self.base.config_root()), | ||
| description: self | ||
| .base | ||
| .config | ||
|
|
@@ -100,7 +100,7 @@ impl PrepareProvider for GitSubmodulePrepareProvider { | |
| } | ||
|
|
||
| fn is_applicable(&self) -> bool { | ||
| let gitmodules = self.base.project_root.join(".gitmodules"); | ||
| let gitmodules = self.base.config_root().join(".gitmodules"); | ||
| gitmodules.exists() && gitmodules.metadata().map(|m| m.len() > 0).unwrap_or(false) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,17 +28,18 @@ impl PrepareProvider for GoPrepareProvider { | |
|
|
||
| fn sources(&self) -> Vec<PathBuf> { | ||
| // go.mod defines dependencies - changes here trigger downloads | ||
| vec![self.base.project_root.join("go.mod")] | ||
| vec![self.base.config_root().join("go.mod")] | ||
| } | ||
|
|
||
| fn outputs(&self) -> Vec<PathBuf> { | ||
| let root = self.base.config_root(); | ||
| // Go downloads modules to GOPATH/pkg/mod, but we can check vendor/ if used | ||
| let vendor = self.base.project_root.join("vendor"); | ||
| let vendor = root.join("vendor"); | ||
| if vendor.exists() { | ||
| vec![vendor] | ||
| } else { | ||
| // go.sum gets updated after go mod download completes | ||
| vec![self.base.project_root.join("go.sum")] | ||
| vec![root.join("go.sum")] | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -48,7 +49,7 @@ impl PrepareProvider for GoPrepareProvider { | |
| } | ||
|
|
||
| // Use `go mod vendor` if vendor/ exists, otherwise `go mod download` | ||
| let vendor = self.base.project_root.join("vendor"); | ||
| let vendor = self.base.config_root().join("vendor"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The path to the |
||
| let (args, desc) = if vendor.exists() { | ||
| ( | ||
| vec!["mod".to_string(), "vendor".to_string()], | ||
|
|
@@ -65,7 +66,7 @@ impl PrepareProvider for GoPrepareProvider { | |
| program: "go".to_string(), | ||
| args, | ||
| env: self.base.config.env.clone(), | ||
| cwd: Some(self.base.project_root.clone()), | ||
| cwd: Some(self.base.config_root()), | ||
| description: self | ||
| .base | ||
| .config | ||
|
|
@@ -77,6 +78,6 @@ impl PrepareProvider for GoPrepareProvider { | |
|
|
||
| fn is_applicable(&self) -> bool { | ||
| // Check for go.mod (the source/lockfile), not go.sum (which may be an output) | ||
| self.base.project_root.join("go.mod").exists() | ||
| self.base.config_root().join("go.mod").exists() | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a minor performance improvement,
base_dircan be initialized outside of the loop since it doesn't change between iterations.