Skip to content

Commit

Permalink
feat(cli): include cacheStatus for single packages. (vercel#2849)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanhammond authored Nov 30, 2022
1 parent 2ee0b49 commit 6006545
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
4 changes: 4 additions & 0 deletions cli/integration_tests/single_package/dry-run.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Check
{
"task": "build",
"hash": "7bf32e1dedb04a5d",
"cacheState": {
"local": false,
"remote": false
},
"command": "echo 'building' \u003e foo",
"outputs": [
"foo"
Expand Down
8 changes: 8 additions & 0 deletions cli/integration_tests/single_package_deps/dry-run.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Check
{
"task": "build",
"hash": "8fc80cfff3b64237",
"cacheState": {
"local": false,
"remote": false
},
"command": "echo 'building' \u003e foo",
"outputs": [
"foo"
Expand All @@ -47,6 +51,10 @@ Check
{
"task": "test",
"hash": "c71366ccd6a86465",
"cacheState": {
"local": false,
"remote": false
},
"command": "[[ ( -f foo ) \u0026\u0026 $(cat foo) == 'building' ]]",
"outputs": null,
"excludedOutputs": null,
Expand Down
4 changes: 4 additions & 0 deletions cli/integration_tests/single_package_no_config/dry-run.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Check
{
"task": "build",
"hash": "c7223f212c321d3b",
"cacheState": {
"local": false,
"remote": false
},
"command": "echo 'building'",
"outputs": null,
"excludedOutputs": null,
Expand Down
33 changes: 18 additions & 15 deletions cli/internal/run/dry_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,15 @@ type hashedTask struct {
}

type hashedSinglePackageTask struct {
Task string `json:"task"`
Hash string `json:"hash"`
Command string `json:"command"`
Outputs []string `json:"outputs"`
ExcludedOutputs []string `json:"excludedOutputs"`
LogFile string `json:"logFile"`
Dependencies []string `json:"dependencies"`
Dependents []string `json:"dependents"`
Task string `json:"task"`
Hash string `json:"hash"`
CacheState cache.ItemStatus `json:"cacheState"`
Command string `json:"command"`
Outputs []string `json:"outputs"`
ExcludedOutputs []string `json:"excludedOutputs"`
LogFile string `json:"logFile"`
Dependencies []string `json:"dependencies"`
Dependents []string `json:"dependents"`
}

func (ht *hashedTask) toSinglePackageTask() hashedSinglePackageTask {
Expand All @@ -299,12 +300,14 @@ func (ht *hashedTask) toSinglePackageTask() hashedSinglePackageTask {
dependents[i] = util.StripPackageName(dependent)
}
return hashedSinglePackageTask{
Task: util.RootTaskTaskName(ht.TaskID),
Hash: ht.Hash,
Command: ht.Command,
Outputs: ht.Outputs,
LogFile: ht.LogFile,
Dependencies: dependencies,
Dependents: dependents,
Task: util.RootTaskTaskName(ht.TaskID),
Hash: ht.Hash,
CacheState: ht.CacheState,
Command: ht.Command,
Outputs: ht.Outputs,
ExcludedOutputs: ht.ExcludedOutputs,
LogFile: ht.LogFile,
Dependencies: dependencies,
Dependents: dependents,
}
}

0 comments on commit 6006545

Please sign in to comment.