Skip to content

Commit 1fd4226

Browse files
authored
Handle Gradle system properties with spaces (jfrog#2357)
1 parent 0553c3a commit 1fd4226

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

buildtools/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ func GradleCmd(c *cli.Context) (err error) {
473473
return err
474474
}
475475
printDeploymentView := log.IsStdErrTerminal()
476-
gradleCmd := gradle.NewGradleCommand().SetConfiguration(buildConfiguration).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(configFilePath).SetThreads(threads).SetDetailedSummary(detailedSummary || printDeploymentView).SetXrayScan(xrayScan).SetScanOutputFormat(scanOutputFormat)
476+
gradleCmd := gradle.NewGradleCommand().SetConfiguration(buildConfiguration).SetTasks(filteredGradleArgs).SetConfigPath(configFilePath).SetThreads(threads).SetDetailedSummary(detailedSummary || printDeploymentView).SetXrayScan(xrayScan).SetScanOutputFormat(scanOutputFormat)
477477
err = commands.Exec(gradleCmd)
478478
result := gradleCmd.Result()
479479
defer cliutils.CleanupResult(result, &err)

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ require (
130130
gopkg.in/yaml.v3 v3.0.1 // indirect
131131
)
132132

133-
// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231130093251-25c79868c10c
133+
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20231220111402-c8c1e14358a8
134134

135-
// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20231218161600-36dbad03f5c2
135+
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20231220105505-e62769dde9da
136136

137-
// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.3.2-0.20231130091721-6d742be8bc7a
137+
replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231220102935-c8776c613ad8
138138

139-
// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20231126134442-14887b84b87a
139+
// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.3.2-0.20231130091721-6d742be8bc7a

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,16 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl
130130
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
131131
github.com/jedib0t/go-pretty/v6 v6.4.0 h1:YlI/2zYDrweA4MThiYMKtGRfT+2qZOO65ulej8GTcVI=
132132
github.com/jedib0t/go-pretty/v6 v6.4.0/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI=
133-
github.com/jfrog/build-info-go v1.9.17 h1:sUA6V3P8i+awYlK7dkwm4l6IuLE2W964F5Pb18x95HA=
134-
github.com/jfrog/build-info-go v1.9.17/go.mod h1:/5VZXH2Ud0IK3cOFwPykjwPOaEcHhzzbjnRiou+YKpM=
133+
github.com/jfrog/build-info-go v1.8.9-0.20231220102935-c8776c613ad8 h1:eAMet7vShbCBSL4QCia/F7pvtPHUGPqVqpvv3Y0cOkw=
134+
github.com/jfrog/build-info-go v1.8.9-0.20231220102935-c8776c613ad8/go.mod h1:/5VZXH2Ud0IK3cOFwPykjwPOaEcHhzzbjnRiou+YKpM=
135135
github.com/jfrog/gofrog v1.3.2 h1:TktKP+PdZdxjkYZxWWIq4DkTGSYtr9Slsy+egZpEhUY=
136136
github.com/jfrog/gofrog v1.3.2/go.mod h1:AQo5Fq0G9nDEF6icH7MYQK0iohR4HuEAXl8jaxRuT6Q=
137137
github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY=
138138
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
139-
github.com/jfrog/jfrog-cli-core/v2 v2.47.6 h1:k8elejLkXA+4SCExynlMElYDFtMUb0TSWc7CFkpFVMc=
140-
github.com/jfrog/jfrog-cli-core/v2 v2.47.6/go.mod h1:p/hr1BkO3BVSVOMkAL599FAQaBK7O+HPHHvcdwm+jKs=
141-
github.com/jfrog/jfrog-client-go v1.35.2 h1:JtGqf7KK+wcx/Pf5b0MUrkvMc+tCtIi0cB5TxFjQxnk=
142-
github.com/jfrog/jfrog-client-go v1.35.2/go.mod h1:p80RAyfQQ78M2r5LUw1uUTA8yxTmTNoPy7eJ4IzOge0=
139+
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20231220111402-c8c1e14358a8 h1:pcF3UC/sST+jGtsio3UdK0+1bOOGRIZr0hc2owWhfJ0=
140+
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20231220111402-c8c1e14358a8/go.mod h1:5fV8ru7uMkW+V6xvWdUhAQC3dBHL2IrFZgC9crEZIus=
141+
github.com/jfrog/jfrog-client-go v1.28.1-0.20231220105505-e62769dde9da h1:t56rae4Ut2XDvubtxTbrjUk4neWvu+KcwlDlJ5BYBMc=
142+
github.com/jfrog/jfrog-client-go v1.28.1-0.20231220105505-e62769dde9da/go.mod h1:0NN5REuCDly9u0FtZxmb1wcOBr1cVR/gPazyZSO8Zs0=
143143
github.com/jszwec/csvutil v1.8.0 h1:G7vS2LGdpZZDH1HmHeNbxOaJ/ZnJlpwGFvOkTkJzzNk=
144144
github.com/jszwec/csvutil v1.8.0/go.mod h1:/E4ONrmGkwmWsk9ae9jpXnv9QT8pLHEPcCirMFhxG9I=
145145
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=

gradle_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestGradleBuildConditionalUpload(t *testing.T) {
4545
oldHomeDir := changeWD(t, filepath.Dir(buildGradlePath))
4646
defer clientTestUtils.ChangeDirAndAssert(t, oldHomeDir)
4747
execFunc := func() error {
48-
return runJfrogCliWithoutAssertion("gradle", "clean artifactoryPublish", "-b"+buildGradlePath, "--scan")
48+
return runJfrogCliWithoutAssertion("gradle", "clean", "artifactoryPublish", "-b"+buildGradlePath, "--scan")
4949
}
5050
testConditionalUpload(t, execFunc, searchSpec, tests.GetGradleDeployedArtifacts()...)
5151
cleanGradleTest(t)
@@ -61,7 +61,7 @@ func TestGradleWithDeploymentView(t *testing.T) {
6161
defer clientTestUtils.ChangeDirAndAssert(t, oldHomeDir)
6262
assertPrintedDeploymentViewFunc, cleanupFunc := initDeploymentViewTest(t)
6363
defer cleanupFunc()
64-
assert.NoError(t, runJfrogCliWithoutAssertion("gradle", "clean artifactoryPublish", "-b"+buildGradlePath))
64+
assert.NoError(t, runJfrogCliWithoutAssertion("gradle", "clean", "artifactoryPublish", "-b"+buildGradlePath))
6565
assertPrintedDeploymentViewFunc()
6666
cleanGradleTest(t)
6767
}
@@ -76,7 +76,7 @@ func TestGradleBuildWithServerID(t *testing.T) {
7676
buildNumber := "1"
7777
// Windows compatibility
7878
buildGradlePath = strings.ReplaceAll(buildGradlePath, `\`, "/")
79-
runJfrogCli(t, "gradle", "clean artifactoryPublish", "-b"+buildGradlePath, "--build-name="+tests.GradleBuildName, "--build-number="+buildNumber)
79+
runJfrogCli(t, "gradle", "clean", "artifactoryPublish", "-b"+buildGradlePath, "--build-name="+tests.GradleBuildName, "--build-number="+buildNumber)
8080
clientTestUtils.ChangeDirAndAssert(t, oldHomeDir)
8181
// Validate
8282
searchSpec, err := tests.CreateSpec(tests.SearchAllGradle)
@@ -111,8 +111,8 @@ func TestGradleBuildWithServerIDAndDetailedSummary(t *testing.T) {
111111
buildGradlePath = strings.ReplaceAll(buildGradlePath, `\`, "/")
112112

113113
// Test gradle with detailed summary without buildinfo props.
114-
filteredGradleArgs := []string{"clean artifactoryPublish", "-b" + buildGradlePath}
115-
gradleCmd := gradle.NewGradleCommand().SetConfiguration(new(utils.BuildConfiguration)).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true)
114+
filteredGradleArgs := []string{"clean", "artifactoryPublish", "-b" + buildGradlePath}
115+
gradleCmd := gradle.NewGradleCommand().SetConfiguration(new(utils.BuildConfiguration)).SetTasks(filteredGradleArgs).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true)
116116
assert.NoError(t, commands.Exec(gradleCmd))
117117
// Validate sha256
118118
assert.NotNil(t, gradleCmd.Result())
@@ -121,7 +121,7 @@ func TestGradleBuildWithServerIDAndDetailedSummary(t *testing.T) {
121121
}
122122

123123
// Test gradle with detailed summary + buildinfo.
124-
gradleCmd = gradle.NewGradleCommand().SetConfiguration(utils.NewBuildConfiguration(tests.GradleBuildName, buildNumber, "", "")).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true)
124+
gradleCmd = gradle.NewGradleCommand().SetConfiguration(utils.NewBuildConfiguration(tests.GradleBuildName, buildNumber, "", "")).SetTasks(filteredGradleArgs).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true)
125125
assert.NoError(t, commands.Exec(gradleCmd))
126126
// Validate sha256
127127
tests.VerifySha256DetailedSummaryFromResult(t, gradleCmd.Result())
@@ -160,7 +160,7 @@ func TestGradleBuildWithServerIDWithUsesPlugin(t *testing.T) {
160160
oldHomeDir := changeWD(t, filepath.Dir(buildGradlePath))
161161
buildName := tests.GradleBuildName
162162
buildNumber := "1"
163-
runJfrogCli(t, "gradle", "clean artifactoryPublish -b "+buildGradlePath, "--build-name="+buildName, "--build-number="+buildNumber)
163+
runJfrogCli(t, "gradle", "clean", "artifactoryPublish", "-b"+buildGradlePath, "--build-name="+buildName, "--build-number="+buildNumber)
164164
changeWD(t, oldHomeDir)
165165
// Validate
166166
searchSpec, err := tests.CreateSpec(tests.SearchAllGradle)

0 commit comments

Comments
 (0)