Skip to content

Commit 156b56b

Browse files
authored
Merge pull request ActiveState#3651 from ActiveState/mitchell/dx-3224
Recognize build expressions that use `Any()` for a version requirement.
2 parents 5b0c39c + 77b420e commit 156b56b

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

pkg/buildscript/marshal.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const (
2222
ltFuncName = "Lt"
2323
lteFuncName = "Lte"
2424
andFuncName = "And"
25+
anyFuncName = "Any"
2526
)
2627

2728
// Marshal returns this structure in AScript, suitable for writing to disk.

pkg/buildscript/marshal_buildexpression.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ func marshalReq(fn *funcCall) ([]byte, error) {
153153
return errs.Wrap(err, "Could not marshal additional requirement")
154154
}
155155
}
156+
case anyFuncName:
157+
// We can ignore the `version = Any()` argument; omitting it is an equivalent statement.
158+
// As mentioned in this function's comment, once buildexpressions support requirements as
159+
// functions, we won't need to do any of this anymore.
156160
default:
157161
return errs.New("Unknown version comparator: %s", name)
158162
}

test/integration/buildscript_int_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,30 @@ main = wheel
159159
suite.Contains(files, "sample_activestate-1.0.0.dist-info/WHEEL")
160160
}
161161

162+
func (suite *BuildScriptIntegrationTestSuite) TestBuildScriptRequirementVersionAny() {
163+
suite.OnlyRunForTags(tagsuite.BuildScripts)
164+
ts := e2e.New(suite.T(), false)
165+
defer ts.Close()
166+
167+
cp := ts.Spawn("config", "set", constants.AsyncRuntimeConfig, "true")
168+
cp.ExpectExitCode(0)
169+
170+
// Enable as part of DX-3230.
171+
//cp = ts.Spawn("config", "set", constants.OptinBuildscriptsConfig, "true")
172+
//cp.ExpectExitCode(0)
173+
174+
// This project's build expression has a requirement whose version is the "Any()" function.
175+
// Make sure we can successfully checkout and modify this project.
176+
// Previously, no version would be given for such a requirement.
177+
cp = ts.Spawn("checkout", "ActiveState/python3-MacOS#b6aac9cf-a758-42d6-9574-78ec513ad8e9", ".")
178+
cp.Expect("Checked out project")
179+
cp.ExpectExitCode(0)
180+
181+
cp = ts.Spawn("install", "dotenv")
182+
cp.Expect("Added: language/python/dotenv@Auto")
183+
cp.ExpectExitCode(0)
184+
}
185+
162186
func TestBuildScriptIntegrationTestSuite(t *testing.T) {
163187
suite.Run(t, new(BuildScriptIntegrationTestSuite))
164188
}

0 commit comments

Comments
 (0)