-
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.
Add support for 'any resource' codegen (#1336)
Part of pulumi/pulumi#6346. Depends on commit in pulumi/pulumi#15793.
- Loading branch information
Showing
99 changed files
with
9,298 additions
and
356 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
test description |
152 changes: 152 additions & 0 deletions
152
pkg/codegen/testing/test/testdata/kubernetes20/java/build.gradle
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,152 @@ | ||
// *** WARNING: this file was generated by pulumi-java-gen *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
plugins { | ||
id("signing") | ||
id("java-library") | ||
id("maven-publish") | ||
} | ||
|
||
group = "com.pulumi" | ||
|
||
def resolvedVersion = System.getenv("PACKAGE_VERSION") ?: | ||
(project.version == "unspecified" | ||
? "0.0.1" | ||
: project.version) | ||
|
||
def signingKey = System.getenv("SIGNING_KEY") | ||
def signingPassword = System.getenv("SIGNING_PASSWORD") | ||
def publishRepoURL = System.getenv("PUBLISH_REPO_URL") | ||
def publishRepoUsername = System.getenv("PUBLISH_REPO_USERNAME") | ||
def publishRepoPassword = System.getenv("PUBLISH_REPO_PASSWORD") | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(11) | ||
} | ||
} | ||
|
||
compileJava { | ||
options.fork = true | ||
options.forkOptions.jvmArgs.addAll(["-Xmx16g"]) | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
maven { // The google mirror is less flaky than mavenCentral() | ||
url("https://maven-central.storage-download.googleapis.com/maven2/") | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("com.google.code.findbugs:jsr305:3.0.2") | ||
implementation("com.google.code.gson:gson:2.8.9") | ||
implementation("com.pulumi:pulumi:0.0.1") | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
from sourceSets.main.allJava | ||
archiveClassifier.set('sources') | ||
} | ||
|
||
task javadocJar(type: Jar) { | ||
from javadoc | ||
archiveClassifier.set('javadoc') | ||
zip64 = true | ||
} | ||
|
||
def genPulumiResources = tasks.register('genPulumiResources') { | ||
doLast { | ||
def resourcesDir = sourceSets.main.output.resourcesDir | ||
def subDir = project.name.replace(".", "/") | ||
def outDir = file("$resourcesDir/$subDir") | ||
outDir.mkdirs() | ||
new File(outDir, "version.txt").text = resolvedVersion | ||
def info = new Object() | ||
info.metaClass.resource = true | ||
info.metaClass.name = "kubernetes" | ||
info.metaClass.version = resolvedVersion | ||
def infoJson = new groovy.json.JsonBuilder(info).toPrettyString() | ||
new File(outDir, "plugin.json").text = infoJson | ||
} | ||
} | ||
|
||
jar.configure { | ||
dependsOn genPulumiResources | ||
} | ||
|
||
publishing { | ||
publications { | ||
mainPublication(MavenPublication) { | ||
groupId = "com.pulumi" | ||
artifactId = "kubernetes" | ||
version = resolvedVersion | ||
from components.java | ||
artifact sourcesJar | ||
artifact javadocJar | ||
|
||
pom { | ||
inceptionYear = "2022" | ||
name = "pulumi-kubernetes" | ||
packaging = "jar" | ||
description = "test description" | ||
|
||
url = "https://github.com/pulumi/pulumi-java" | ||
|
||
scm { | ||
connection = "git@github.com/pulumi/pulumi-java.git" | ||
developerConnection = "git@github.com/pulumi/pulumi-java.git" | ||
url = "https://github.com/pulumi/pulumi-java" | ||
} | ||
|
||
licenses { | ||
license { | ||
name = "The Apache License, Version 2.0" | ||
url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = "pulumi" | ||
name = "Pulumi" | ||
email = "support@pulumi.com" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (publishRepoURL) { | ||
repositories { | ||
maven { | ||
name = "PublishRepo" | ||
url = publishRepoURL | ||
credentials { | ||
username = publishRepoUsername | ||
password = publishRepoPassword | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
javadoc { | ||
if (JavaVersion.current().isJava9Compatible()) { | ||
options.addBooleanOption('html5', true) | ||
} | ||
options.jFlags("-Xmx8g", "-Xms512m") | ||
} | ||
|
||
jar { | ||
zip64 = true | ||
} | ||
|
||
if (signingKey) { | ||
signing { | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign publishing.publications.mainPublication | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
pkg/codegen/testing/test/testdata/kubernetes20/java/codegen-manifest.json
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,30 @@ | ||
{ | ||
"emittedFiles": [ | ||
"README.md", | ||
"build.gradle", | ||
"settings.gradle", | ||
"src/main/java/com/pulumi/kubernetes/Config.java", | ||
"src/main/java/com/pulumi/kubernetes/Provider.java", | ||
"src/main/java/com/pulumi/kubernetes/ProviderArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/Utilities.java", | ||
"src/main/java/com/pulumi/kubernetes/core_v1/ConfigMap.java", | ||
"src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapList.java", | ||
"src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapListArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/core_v1/inputs/ConfigMapArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/core_v1/outputs/ConfigMap.java", | ||
"src/main/java/com/pulumi/kubernetes/helm/sh_v3/Release.java", | ||
"src/main/java/com/pulumi/kubernetes/helm/sh_v3/ReleaseArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/inputs/KubeClientSettingsArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ListMetaArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ManagedFieldsEntryArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ObjectMetaArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/meta_v1/inputs/OwnerReferenceArgs.java", | ||
"src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ListMeta.java", | ||
"src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ManagedFieldsEntry.java", | ||
"src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ObjectMeta.java", | ||
"src/main/java/com/pulumi/kubernetes/meta_v1/outputs/OwnerReference.java", | ||
"src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroup.java", | ||
"src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java" | ||
] | ||
} |
14 changes: 14 additions & 0 deletions
14
pkg/codegen/testing/test/testdata/kubernetes20/java/settings.gradle
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,14 @@ | ||
// *** WARNING: this file was generated by pulumi-java-gen. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
pluginManagement { | ||
repositories { | ||
maven { // The google mirror is less flaky than mavenCentral() | ||
url("https://maven-central.storage-download.googleapis.com/maven2/") | ||
} | ||
gradlePluginPortal() | ||
} | ||
} | ||
|
||
rootProject.name = "com.pulumi.kubernetes" | ||
include("lib") |
32 changes: 32 additions & 0 deletions
32
...n/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Config.java
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,32 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
package com.pulumi.kubernetes; | ||
|
||
import com.pulumi.core.internal.Codegen; | ||
import java.lang.String; | ||
import java.util.Optional; | ||
|
||
public final class Config { | ||
|
||
private static final com.pulumi.Config config = com.pulumi.Config.of("kubernetes"); | ||
/** | ||
* The contents of a kubeconfig file or the path to a kubeconfig file. If this is set, this config will be used instead of $KUBECONFIG. | ||
* | ||
*/ | ||
public Optional<String> kubeconfig() { | ||
return Codegen.stringProp("kubeconfig").config(config).get(); | ||
} | ||
/** | ||
* If present, the default namespace to use. This flag is ignored for cluster-scoped resources. | ||
* | ||
* A namespace can be specified in multiple places, and the precedence is as follows: | ||
* 1. `.metadata.namespace` set on the resource. | ||
* 2. This `namespace` parameter. | ||
* 3. `namespace` set for the active context in the kubeconfig. | ||
* | ||
*/ | ||
public Optional<String> namespace() { | ||
return Codegen.stringProp("namespace").config(config).get(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Provider.java
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,51 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
package com.pulumi.kubernetes; | ||
|
||
import com.pulumi.core.Output; | ||
import com.pulumi.core.annotations.ResourceType; | ||
import com.pulumi.core.internal.Codegen; | ||
import com.pulumi.kubernetes.ProviderArgs; | ||
import com.pulumi.kubernetes.Utilities; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* The provider type for the kubernetes package. | ||
* | ||
*/ | ||
@ResourceType(type="pulumi:providers:kubernetes") | ||
public class Provider extends com.pulumi.resources.ProviderResource { | ||
/** | ||
* | ||
* @param name The _unique_ name of the resulting resource. | ||
*/ | ||
public Provider(String name) { | ||
this(name, ProviderArgs.Empty); | ||
} | ||
/** | ||
* | ||
* @param name The _unique_ name of the resulting resource. | ||
* @param args The arguments to use to populate this resource's properties. | ||
*/ | ||
public Provider(String name, @Nullable ProviderArgs args) { | ||
this(name, args, null); | ||
} | ||
/** | ||
* | ||
* @param name The _unique_ name of the resulting resource. | ||
* @param args The arguments to use to populate this resource's properties. | ||
* @param options A bag of options that control this resource's behavior. | ||
*/ | ||
public Provider(String name, @Nullable ProviderArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { | ||
super("kubernetes", name, args == null ? ProviderArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); | ||
} | ||
|
||
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) { | ||
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() | ||
.version(Utilities.getVersion()) | ||
.build(); | ||
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); | ||
} | ||
|
||
} |
Oops, something went wrong.