Skip to content

Commit

Permalink
feat: bump to CDK 2.142, qualify Companion object references
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudshiftchris committed May 22, 2024
1 parent e8d3c1e commit 02f9bf5
Show file tree
Hide file tree
Showing 4,888 changed files with 85,986 additions and 46,777 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

# Kotlin 2.0+
.kotlin/

####################
# IntelliJ
Expand Down
13 changes: 0 additions & 13 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins { `kotlin-dsl` }

dependencies {
Expand Down Expand Up @@ -42,16 +39,6 @@ dependencies {
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}

// https://kotlinlang.org/docs/whatsnew19.html#try-the-k2-compiler-in-your-project
if (GradleVersion.current() < GradleVersion.version("8.3")) {
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
languageVersion.set(KotlinVersion.KOTLIN_1_9)
apiVersion.set(KotlinVersion.KOTLIN_1_9)
}
}
}

fun DependencyHandlerScope.plugin(id: String, version: String) = "$id:$id.gradle.plugin:$version"

fun DependencyHandlerScope.plugin(plugin: Provider<PluginDependency>): Provider<String> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private class DelegatedCall(
val listType =
type.typeArguments[1] as ParameterizedTypeName
CallSegment(
"%N$nullable.mapValues{it.value.map(%T::unwrap) }$nullableListSuffix",
"%N$nullable.mapValues{it.value.map(%T.Companion::unwrap) }$nullableListSuffix",
listOf(
name,
listType.typeArguments[0].mapClassName().copy(nullable = false),
Expand All @@ -237,7 +237,7 @@ private class DelegatedCall(
val listType =
type.typeArguments[0] as ParameterizedTypeName
CallSegment(
"%N$nullable.map{ it.map(%T::unwrap) }$nullableListSuffix",
"%N$nullable.map{ it.map(%T.Companion::unwrap) }$nullableListSuffix",
listOf(
name,
listType.typeArguments[0].mapClassName().copy(nullable = false),
Expand All @@ -246,7 +246,7 @@ private class DelegatedCall(
}

type.isListOfCdkObject() -> CallSegment(
"%N$nullable.map(%T::unwrap)$nullableListSuffix",
"%N$nullable.map(%T.Companion::unwrap)$nullableListSuffix",
listOf(
name,
type.typeArguments[0].mapClassName()
Expand Down Expand Up @@ -287,7 +287,7 @@ private class DelegatedCall(
)

type.isCdkClass -> CallSegment(
"%N$nullable.let(%T::unwrap)",
"%N$nullable.let(%T.Companion::unwrap)",
listOf(name, type.mapClassName()),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ tasks.withType<Test>().configureEach {
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions { freeCompilerArgs += listOf("-Xjsr305=strict", "-Xcontext-receivers") }
compilerOptions {}
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
// freeCompilerArgs.add("-Xcontext-receivers")
}
}

dependencies {
Expand Down Expand Up @@ -91,7 +93,7 @@ configurations {
kotlin {
explicitApi()
jvmToolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.AMAZON
}
kotlinDaemonJvmArgs = when {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group = io.cloudshiftdev.kotlin-cdk-wrapper
version = 0.8.0
version = 0.8.1

kotlin.code.style=official

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public open class Annotations(

public companion object {
public fun of(scope: IConstruct): Annotations =
software.amazon.awscdk.Annotations.of(scope.let(IConstruct::unwrap)).let(Annotations::wrap)
software.amazon.awscdk.Annotations.of(scope.let(IConstruct.Companion::unwrap)).let(Annotations::wrap)

internal fun wrap(cdkObject: software.amazon.awscdk.Annotations): Annotations =
Annotations(cdkObject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public open class App(
public constructor() : this(software.amazon.awscdk.App()
)

public constructor(props: AppProps) : this(software.amazon.awscdk.App(props.let(AppProps::unwrap))
public constructor(props: AppProps) :
this(software.amazon.awscdk.App(props.let(AppProps.Companion::unwrap))
)

public constructor(props: AppProps.Builder.() -> Unit) : this(AppProps(props)
Expand Down Expand Up @@ -266,7 +267,7 @@ public open class App(
* App.
*/
override fun defaultStackSynthesizer(defaultStackSynthesizer: IReusableStackSynthesizer) {
cdkBuilder.defaultStackSynthesizer(defaultStackSynthesizer.let(IReusableStackSynthesizer::unwrap))
cdkBuilder.defaultStackSynthesizer(defaultStackSynthesizer.let(IReusableStackSynthesizer.Companion::unwrap))
}

/**
Expand Down Expand Up @@ -295,7 +296,7 @@ public open class App(
* @param policyValidationBeta1 Validation plugins to run after synthesis.
*/
override fun policyValidationBeta1(policyValidationBeta1: List<IPolicyValidationPluginBeta1>) {
cdkBuilder.policyValidationBeta1(policyValidationBeta1.map(IPolicyValidationPluginBeta1::unwrap))
cdkBuilder.policyValidationBeta1(policyValidationBeta1.map(IPolicyValidationPluginBeta1.Companion::unwrap))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public interface AppProps {
* information, see the README of the main CDK package.
*/
override fun defaultStackSynthesizer(defaultStackSynthesizer: IReusableStackSynthesizer) {
cdkBuilder.defaultStackSynthesizer(defaultStackSynthesizer.let(IReusableStackSynthesizer::unwrap))
cdkBuilder.defaultStackSynthesizer(defaultStackSynthesizer.let(IReusableStackSynthesizer.Companion::unwrap))
}

/**
Expand All @@ -281,7 +281,7 @@ public interface AppProps {
* @param policyValidationBeta1 Validation plugins to run after synthesis.
*/
override fun policyValidationBeta1(policyValidationBeta1: List<IPolicyValidationPluginBeta1>) {
cdkBuilder.policyValidationBeta1(policyValidationBeta1.map(IPolicyValidationPluginBeta1::unwrap))
cdkBuilder.policyValidationBeta1(policyValidationBeta1.map(IPolicyValidationPluginBeta1.Companion::unwrap))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ public open class Arn(
software.amazon.awscdk.Arn.extractResourceName(arn, resourceType)

public fun format(components: ArnComponents): String =
software.amazon.awscdk.Arn.format(components.let(ArnComponents::unwrap))
software.amazon.awscdk.Arn.format(components.let(ArnComponents.Companion::unwrap))

@kotlin.Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("83161df07d376e5b5e803618627b191a1ad135e49cc4e2242ec6d546f408d688")
public fun format(components: ArnComponents.Builder.() -> Unit): String =
format(ArnComponents(components))

public fun format(components: ArnComponents, stack: Stack): String =
software.amazon.awscdk.Arn.format(components.let(ArnComponents::unwrap),
stack.let(Stack::unwrap))
software.amazon.awscdk.Arn.format(components.let(ArnComponents.Companion::unwrap),
stack.let(Stack.Companion::unwrap))

public fun split(arn: String, arnFormat: ArnFormat): ArnComponents =
software.amazon.awscdk.Arn.split(arn,
arnFormat.let(ArnFormat::unwrap)).let(ArnComponents::wrap)
arnFormat.let(ArnFormat.Companion::unwrap)).let(ArnComponents::wrap)

internal fun wrap(cdkObject: software.amazon.awscdk.Arn): Arn = Arn(cdkObject)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public interface ArnComponents {
* @param arnFormat The specific ARN format to use for this ARN value.
*/
override fun arnFormat(arnFormat: ArnFormat) {
cdkBuilder.arnFormat(arnFormat.let(ArnFormat::unwrap))
cdkBuilder.arnFormat(arnFormat.let(ArnFormat.Companion::unwrap))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public open class Aspects(
* @param aspect The aspect to add.
*/
public open fun add(aspect: IAspect) {
unwrap(this).add(aspect.let(IAspect::unwrap))
unwrap(this).add(aspect.let(IAspect.Companion::unwrap))
}

/**
Expand All @@ -58,7 +58,7 @@ public open class Aspects(

public companion object {
public fun of(scope: IConstruct): Aspects =
software.amazon.awscdk.Aspects.of(scope.let(IConstruct::unwrap)).let(Aspects::wrap)
software.amazon.awscdk.Aspects.of(scope.let(IConstruct.Companion::unwrap)).let(Aspects::wrap)

internal fun wrap(cdkObject: software.amazon.awscdk.Aspects): Aspects = Aspects(cdkObject)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public open class AssetManifestBuilder(
sourceHash: String,
source: DockerImageSource,
dest: DockerImageDestination,
): DockerImageDestination = unwrap(this).addDockerImageAsset(stack.let(Stack::unwrap), sourceHash,
source.let(DockerImageSource::unwrap),
dest.let(DockerImageDestination::unwrap)).let(DockerImageDestination::wrap)
): DockerImageDestination = unwrap(this).addDockerImageAsset(stack.let(Stack.Companion::unwrap),
sourceHash, source.let(DockerImageSource.Companion::unwrap),
dest.let(DockerImageDestination.Companion::unwrap)).let(DockerImageDestination::wrap)

/**
* Add a docker asset source and destination to the manifest.
Expand Down Expand Up @@ -89,8 +89,9 @@ public open class AssetManifestBuilder(
sourceHash: String,
source: FileSource,
dest: FileDestination,
): FileDestination = unwrap(this).addFileAsset(stack.let(Stack::unwrap), sourceHash,
source.let(FileSource::unwrap), dest.let(FileDestination::unwrap)).let(FileDestination::wrap)
): FileDestination = unwrap(this).addFileAsset(stack.let(Stack.Companion::unwrap), sourceHash,
source.let(FileSource.Companion::unwrap),
dest.let(FileDestination.Companion::unwrap)).let(FileDestination::wrap)

/**
* Add a file asset source and destination to the manifest.
Expand Down Expand Up @@ -124,9 +125,10 @@ public open class AssetManifestBuilder(
stack: Stack,
asset: DockerImageAssetSource,
target: AssetManifestDockerImageDestination,
): DockerImageDestination = unwrap(this).defaultAddDockerImageAsset(stack.let(Stack::unwrap),
asset.let(DockerImageAssetSource::unwrap),
target.let(AssetManifestDockerImageDestination::unwrap)).let(DockerImageDestination::wrap)
): DockerImageDestination =
unwrap(this).defaultAddDockerImageAsset(stack.let(Stack.Companion::unwrap),
asset.let(DockerImageAssetSource.Companion::unwrap),
target.let(AssetManifestDockerImageDestination.Companion::unwrap)).let(DockerImageDestination::wrap)

/**
* Add a docker image asset to the manifest with default settings.
Expand Down Expand Up @@ -160,9 +162,9 @@ public open class AssetManifestBuilder(
stack: Stack,
asset: FileAssetSource,
target: AssetManifestFileDestination,
): FileDestination = unwrap(this).defaultAddFileAsset(stack.let(Stack::unwrap),
asset.let(FileAssetSource::unwrap),
target.let(AssetManifestFileDestination::unwrap)).let(FileDestination::wrap)
): FileDestination = unwrap(this).defaultAddFileAsset(stack.let(Stack.Companion::unwrap),
asset.let(FileAssetSource.Companion::unwrap),
target.let(AssetManifestFileDestination.Companion::unwrap)).let(FileDestination::wrap)

/**
* Add a file asset to the manifest with default settings.
Expand Down Expand Up @@ -194,7 +196,8 @@ public open class AssetManifestBuilder(
* @param dependencies
*/
public open fun emitManifest(stack: Stack, session: ISynthesisSession): String =
unwrap(this).emitManifest(stack.let(Stack::unwrap), session.let(ISynthesisSession::unwrap))
unwrap(this).emitManifest(stack.let(Stack.Companion::unwrap),
session.let(ISynthesisSession.Companion::unwrap))

/**
* Write the manifest to disk, and add it to the synthesis session.
Expand All @@ -211,8 +214,9 @@ public open class AssetManifestBuilder(
stack: Stack,
session: ISynthesisSession,
options: AssetManifestOptions,
): String = unwrap(this).emitManifest(stack.let(Stack::unwrap),
session.let(ISynthesisSession::unwrap), options.let(AssetManifestOptions::unwrap))
): String = unwrap(this).emitManifest(stack.let(Stack.Companion::unwrap),
session.let(ISynthesisSession.Companion::unwrap),
options.let(AssetManifestOptions.Companion::unwrap))

/**
* Write the manifest to disk, and add it to the synthesis session.
Expand Down Expand Up @@ -249,9 +253,9 @@ public open class AssetManifestBuilder(
session: ISynthesisSession,
options: AssetManifestOptions,
dependencies: List<String>,
): String = unwrap(this).emitManifest(stack.let(Stack::unwrap),
session.let(ISynthesisSession::unwrap), options.let(AssetManifestOptions::unwrap),
dependencies)
): String = unwrap(this).emitManifest(stack.let(Stack.Companion::unwrap),
session.let(ISynthesisSession.Companion::unwrap),
options.let(AssetManifestOptions.Companion::unwrap), dependencies)

/**
* Whether there are any assets registered in the manifest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public interface AssetManifestDockerImageDestination {
* @param role Role to use to perform the upload.
*/
override fun role(role: RoleOptions) {
cdkBuilder.role(role.let(RoleOptions::unwrap))
cdkBuilder.role(role.let(RoleOptions.Companion::unwrap))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public interface AssetManifestFileDestination {
* @param role Role to use for uploading.
*/
override fun role(role: RoleOptions) {
cdkBuilder.role(role.let(RoleOptions::unwrap))
cdkBuilder.role(role.let(RoleOptions.Companion::unwrap))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public interface AssetOptions {
* `AssetHashType.CUSTOM`.
*/
override fun assetHashType(assetHashType: AssetHashType) {
cdkBuilder.assetHashType(assetHashType.let(AssetHashType::unwrap))
cdkBuilder.assetHashType(assetHashType.let(AssetHashType.Companion::unwrap))
}

/**
Expand All @@ -182,7 +182,7 @@ public interface AssetOptions {
* final asset.
*/
override fun bundling(bundling: BundlingOptions) {
cdkBuilder.bundling(bundling.let(BundlingOptions::unwrap))
cdkBuilder.bundling(bundling.let(BundlingOptions.Companion::unwrap))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ public open class AssetStaging(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: AssetStagingProps,
) : this(software.amazon.awscdk.AssetStaging(scope.let(CloudshiftdevConstructsConstruct::unwrap),
id, props.let(AssetStagingProps::unwrap))
) :
this(software.amazon.awscdk.AssetStaging(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
id, props.let(AssetStagingProps.Companion::unwrap))
)

public constructor(
Expand Down Expand Up @@ -144,7 +145,7 @@ public open class AssetStaging(
* @param stack
*/
public open fun relativeStagedPath(stack: Stack): String =
unwrap(this).relativeStagedPath(stack.let(Stack::unwrap))
unwrap(this).relativeStagedPath(stack.let(Stack.Companion::unwrap))

/**
* The absolute path of the asset as it was referenced by the user.
Expand Down Expand Up @@ -324,7 +325,7 @@ public open class AssetStaging(
* @param assetHashType Specifies the type of hash to calculate for this asset.
*/
override fun assetHashType(assetHashType: AssetHashType) {
cdkBuilder.assetHashType(assetHashType.let(AssetHashType::unwrap))
cdkBuilder.assetHashType(assetHashType.let(AssetHashType.Companion::unwrap))
}

/**
Expand All @@ -342,7 +343,7 @@ public open class AssetStaging(
* bundling provider.
*/
override fun bundling(bundling: BundlingOptions) {
cdkBuilder.bundling(bundling.let(BundlingOptions::unwrap))
cdkBuilder.bundling(bundling.let(BundlingOptions.Companion::unwrap))
}

/**
Expand Down Expand Up @@ -410,7 +411,7 @@ public open class AssetStaging(
* @param follow A strategy for how to handle symlinks.
*/
override fun follow(follow: SymlinkFollowMode) {
cdkBuilder.follow(follow.let(SymlinkFollowMode::unwrap))
cdkBuilder.follow(follow.let(SymlinkFollowMode.Companion::unwrap))
}

/**
Expand All @@ -421,7 +422,7 @@ public open class AssetStaging(
* @param ignoreMode The ignore behavior to use for `exclude` patterns.
*/
override fun ignoreMode(ignoreMode: IgnoreMode) {
cdkBuilder.ignoreMode(ignoreMode.let(IgnoreMode::unwrap))
cdkBuilder.ignoreMode(ignoreMode.let(IgnoreMode.Companion::unwrap))
}

/**
Expand Down
Loading

0 comments on commit 02f9bf5

Please sign in to comment.