-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default to using gradle0nexus in gen-sdk
When using `pulumi-java-gen`, the user can bass a `—build` flag which the following options: * `none`: no gradle file is generated (the default) * `gradle`: a gradle file is generated -> BuildFiles: gradle * `gradle-nexus`: a gradle file using the nexus publishing plugin is generated, using a default version of the plugin -> BuildFiles: gradle, GradleNexusPublishPluginVersion: 2.0.0 * `gradle-nexus:$VER`: a gradle file using the nexus publishing plugin is generated, using the version $VER for the plugin -> BuildFiles: gradle, GradleNexusPublishPluginVersion: $VER Using `gen-sdk`, the options are managed via the schema, `buildFiles` can take the following options: * `gradle-nexus`: the default if the buildFiles is not set, a gradle file using the nexus publishing plugin is generated, implies `gradleNexusPublishPluginVersion: 2.0.0` if `gradleNexusPublishPluginVersionA` is not set. * `gradle`: a gradle file is generated, but without the nexus publishing plugin * `none`: no gradle file is generated Fixes #1593
- Loading branch information
Showing
37 changed files
with
1,499 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,30 @@ import ( | |
"github.com/pulumi/pulumi/pkg/v3/codegen/schema" | ||
) | ||
|
||
func TestNewGradleTemplateContextLegacy(t *testing.T) { | ||
pkg, info := eksExample() | ||
tctx := newGradleTemplateContext(pkg, info, true /*legacyBuildFiles*/) | ||
assert.Equal(t, "0.37.1", tctx.Version) | ||
assert.Equal(t, "com.pulumi", tctx.GroupID) | ||
assert.Equal(t, "eks", tctx.Name) | ||
assert.Equal(t, "https://github.com/pulumi/pulumi-eks", tctx.ProjectURL) | ||
assert.Equal(t, "[email protected]/pulumi/pulumi-eks.git", tctx.ProjectGitURL) | ||
assert.Equal(t, "Pulumi Amazon Web Services (AWS) EKS Components.", tctx.ProjectDescription) | ||
assert.Equal(t, "2022", tctx.ProjectInceptionYear) | ||
assert.Equal(t, "com.pulumi.eks", tctx.RootProjectName) | ||
assert.Equal(t, "pulumi-eks", tctx.ProjectName) | ||
assert.Equal(t, "pulumi", tctx.DeveloperID) | ||
assert.Equal(t, "[email protected]", tctx.DeveloperEmail) | ||
assert.Equal(t, "The Apache License, Version 2.0", tctx.LicenceName) | ||
assert.Equal(t, "http://www.apache.org/licenses/LICENSE-2.0.txt", tctx.LicenceURL) | ||
assert.Equal(t, info.Dependencies, tctx.Dependencies) | ||
assert.Equal(t, "", tctx.GradleNexusPublishPluginVersion) | ||
assert.Equal(t, false, tctx.GradleNexusPublishPluginEnabled) | ||
} | ||
|
||
func TestNewGradleTemplateContext(t *testing.T) { | ||
pkg, info := eksExample() | ||
tctx := newGradleTemplateContext(pkg, info) | ||
tctx := newGradleTemplateContext(pkg, info, false /*legacyBuildFiles*/) | ||
assert.Equal(t, "0.37.1", tctx.Version) | ||
assert.Equal(t, "com.pulumi", tctx.GroupID) | ||
assert.Equal(t, "eks", tctx.Name) | ||
|
@@ -28,12 +49,48 @@ func TestNewGradleTemplateContext(t *testing.T) { | |
assert.Equal(t, "The Apache License, Version 2.0", tctx.LicenceName) | ||
assert.Equal(t, "http://www.apache.org/licenses/LICENSE-2.0.txt", tctx.LicenceURL) | ||
assert.Equal(t, info.Dependencies, tctx.Dependencies) | ||
assert.Equal(t, "2.0.0", tctx.GradleNexusPublishPluginVersion) | ||
assert.Equal(t, true, tctx.GradleNexusPublishPluginEnabled) | ||
} | ||
|
||
func TestNewGradleTemplateContextBuildFiles(t *testing.T) { | ||
pkg, _ := eksExample() | ||
|
||
// Legacy build files: false | ||
|
||
// We default to the behavior of `gradle-nexus`. | ||
info := &PackageInfo{BuildFiles: ""} | ||
tctx := newGradleTemplateContext(pkg, info, false /*legacyBuildFiles*/) | ||
assert.Equal(t, "2.0.0", tctx.GradleNexusPublishPluginVersion) | ||
assert.Equal(t, true, tctx.GradleNexusPublishPluginEnabled) | ||
|
||
info = &PackageInfo{BuildFiles: "gradle-nexus"} | ||
tctx = newGradleTemplateContext(pkg, info, false /*legacyBuildFiles*/) | ||
assert.Equal(t, "2.0.0", tctx.GradleNexusPublishPluginVersion) | ||
assert.Equal(t, true, tctx.GradleNexusPublishPluginEnabled) | ||
|
||
info = &PackageInfo{BuildFiles: "gradle"} | ||
tctx = newGradleTemplateContext(pkg, info, false /*legacyBuildFiles*/) | ||
assert.Equal(t, "", tctx.GradleNexusPublishPluginVersion) | ||
assert.Equal(t, false, tctx.GradleNexusPublishPluginEnabled) | ||
|
||
// Legacy build files: true | ||
|
||
info = &PackageInfo{BuildFiles: "gradle"} | ||
tctx = newGradleTemplateContext(pkg, info, true /*legacyBuildFiles*/) | ||
assert.Equal(t, "", tctx.GradleNexusPublishPluginVersion) | ||
assert.Equal(t, false, tctx.GradleNexusPublishPluginEnabled) | ||
|
||
info = &PackageInfo{BuildFiles: "gradle", GradleNexusPublishPluginVersion: "1.2.3"} | ||
tctx = newGradleTemplateContext(pkg, info, true /*legacyBuildFiles*/) | ||
assert.Equal(t, "1.2.3", tctx.GradleNexusPublishPluginVersion) | ||
assert.Equal(t, true, tctx.GradleNexusPublishPluginEnabled) | ||
} | ||
|
||
func TestGenGradleProject(t *testing.T) { | ||
pkg, info := eksExample() | ||
files := fs{} | ||
err := genGradleProject(pkg, info, files) | ||
err := genGradleProject(pkg, info, files, true /*legacyBuildFiles*/) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
1 change: 1 addition & 0 deletions
1
pkg/codegen/testing/test/testdata/build-files/gradle-nexus/java/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test description |
Oops, something went wrong.