Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
5fc1b55
kn: configure targets (#53)
lauzadis Oct 29, 2024
2293711
misc: enable using `kn-main` in CI (#55)
lauzadis Nov 7, 2024
2ba27e5
kn: enable checking out submodules recursively (#56)
lauzadis Nov 18, 2024
0cb72d8
kn: add `submodules` to inputs (#57)
lauzadis Nov 18, 2024
492ec38
Fix step description
lauzadis Nov 18, 2024
c6fdc8e
Merge branch 'main' of github.com:awslabs/aws-kotlin-repo-tools into …
lauzadis Dec 12, 2024
26013a8
Add `disableCrossCompileTargets` util function
lauzadis Dec 13, 2024
4395e9d
Merge branch 'main' of github.com:awslabs/aws-kotlin-repo-tools into …
lauzadis Jan 21, 2025
f712e53
kn: commonize iOS simulator configuration (#63)
lauzadis Jan 31, 2025
ab34ff6
Check error code 405 in boot tasks
lauzadis Feb 3, 2025
7a07412
kn: Create iOS simulator boot and shutdown tasks in root project (#64)
lauzadis Feb 4, 2025
586ce30
misc: merge from main
aws-sdk-kotlin-ci Mar 11, 2025
02d4a9f
misc: merge from main
aws-sdk-kotlin-ci Mar 11, 2025
f08d5ad
misc: merge from main
aws-sdk-kotlin-ci Mar 18, 2025
791c4d6
misc: merge from main
aws-sdk-kotlin-ci Mar 18, 2025
40954d0
Remove K/N targets from `ALLOWED_PUBLICATIONS`
lauzadis Mar 18, 2025
07c11e4
Revert back to 1.1.+
lauzadis Mar 18, 2025
a0e3e17
misc: prepare to merge `kn-main` back into `main` (#78)
lauzadis Mar 18, 2025
9df2b1a
Only use kn-main if the ref has a `kn-` prefix
lauzadis Mar 18, 2025
7b5ba87
Merge branch 'kn-main-merge' into kn-main
lauzadis Mar 18, 2025
11393d3
Revert Publish.kt changes
lauzadis Mar 18, 2025
c3de4a3
Update ALLOWED_PUBLICATIONS
lauzadis Mar 28, 2025
f73bca0
misc: merge from main
aws-sdk-kotlin-ci Apr 1, 2025
e32ec2a
misc: merge from main
aws-sdk-kotlin-ci Apr 2, 2025
75a3cfc
misc: merge from main
aws-sdk-kotlin-ci Apr 11, 2025
e8b7535
misc: merge from main
aws-sdk-kotlin-ci Apr 11, 2025
ae892e4
misc: merge from main
aws-sdk-kotlin-ci Apr 11, 2025
dcef6f5
misc: merge from main
aws-sdk-kotlin-ci Apr 16, 2025
b16bda7
misc: merge from main
aws-sdk-kotlin-ci Apr 24, 2025
480579d
misc: merge from main
aws-sdk-kotlin-ci May 14, 2025
03eebb0
misc: merge from main
aws-sdk-kotlin-ci Jun 4, 2025
8843582
feat: Kotlin/Native Windows compilation (#91)
ianbotsf Jun 17, 2025
02eb75b
misc: merge from main
aws-sdk-kotlin-ci Jun 24, 2025
4485be4
misc: merge from main
aws-sdk-kotlin-ci Jun 25, 2025
10d7f50
misc: merge from main
aws-sdk-kotlin-ci Jun 26, 2025
5b29488
misc: merge from main
aws-sdk-kotlin-ci Jun 27, 2025
eb6f209
misc: merge from main
aws-sdk-kotlin-ci Jun 27, 2025
d26088a
misc: merge from main
aws-sdk-kotlin-ci Jun 27, 2025
d65e3bb
misc: merge from main
aws-sdk-kotlin-ci Jun 27, 2025
8b604db
misc: merge from main
aws-sdk-kotlin-ci Jun 27, 2025
3833134
misc: merge from main
aws-sdk-kotlin-ci Jul 1, 2025
f7c8029
misc: merge from main
aws-sdk-kotlin-ci Jul 3, 2025
8c13663
misc: merge from main
aws-sdk-kotlin-ci Jul 3, 2025
887125a
misc: merge from main
aws-sdk-kotlin-ci Jul 18, 2025
f60872e
misc: merge from main
aws-sdk-kotlin-ci Jul 22, 2025
5dea066
misc: merge from main
aws-sdk-kotlin-ci Jul 28, 2025
edb046b
misc: merge from main
aws-sdk-kotlin-ci Jul 30, 2025
f865fd9
misc: merge from main
aws-sdk-kotlin-ci Jul 31, 2025
3dfab79
Change simulator device to "iPhone 16"
lauzadis Aug 6, 2025
dcba387
kn: merge from main, add mingwX64 as an allowed publication (#110)
lauzadis Aug 6, 2025
1255831
Merge branch 'main' of github.com:awslabs/aws-kotlin-repo-tools into …
lauzadis Aug 11, 2025
c5d09db
kn: prepare for merge to main (#112)
lauzadis Aug 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/actions/checkout-head/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ inputs:
commands. The post-job step removes the PAT.
default: ${{ github.token }}
required: false
submodules:
description: >
Whether to checkout submodules. `true` to checkout submodules or `recursive` to recursively checkout submodules
default: 'false'
required: 'false'

runs:
using: composite
Expand All @@ -44,7 +49,9 @@ runs:
echo "ref=$ref" >> "$GITHUB_OUTPUT"
else
baseref="main"
if [ -n "$GITHUB_BASE_REF" ]; then
if [[ "$ref" == kn-* ]] && git ls-remote --exit-code --heads "https://github.com/$REPOSITORY.git" "kn-main"; then
baseref="kn-main"
elif [ -n "$GITHUB_BASE_REF" ]; then
echo "attempting GH base ref: $GITHUB_BASE_REF"
if git ls-remote --exit-code --heads "https://github.com/$REPOSITORY.git" "$GITHUB_BASE_REF"; then
baseref="$GITHUB_BASE_REF"
Expand All @@ -60,4 +67,5 @@ runs:
path: ${{ inputs.path }}
repository: ${{ inputs.repository }}
ref: ${{ steps.repo.outputs.ref }}
token: ${{ inputs.token }}
token: ${{ inputs.token }}
submodules: ${{ inputs.submodules }}
3 changes: 2 additions & 1 deletion build-plugins/build-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ dependencies {
compileOnly(gradleApi())
implementation(libs.aws.sdk.s3)
implementation(libs.aws.sdk.cloudwatch)
testImplementation(libs.junit.jupiter)
testImplementation(kotlin("test"))
testImplementation(libs.kotlinx.coroutines.test)
}

gradlePlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ private object EnvironmentVariables {
const val GPG_SECRET_KEY = "JRELEASER_GPG_SECRET_KEY"
}

private val ALLOWED_PUBLICATION_NAMES = setOf(
internal val ALLOWED_PUBLICATION_NAMES = setOf(
"common",
"jvm",
"metadata",
"kotlinMultiplatform",
"metadata",
"bom",
"versionCatalog",
"android", // aws-crt-kotlin
"codegen",
"codegen-testutils",

Expand All @@ -57,6 +56,22 @@ private val ALLOWED_PUBLICATION_NAMES = setOf(
"dynamodb-mapper-schema-generatorPluginMarkerMaven",
)

internal val KOTLIN_NATIVE_PUBLICATION_NAMES = setOf(
"iosArm64",
"iosX64",
"linuxArm64",
"linuxX64",
"macosArm64",
"macosX64",
"mingwX64",
)

// TODO Refactor to support project names _or_ publication group names.
// aws-crt-kotlin is not published with a group name, so we need to check project names instead.
private val KOTLIN_NATIVE_PROJECT_NAMES = setOf(
"aws-crt-kotlin",
)

/**
* Mark this project as excluded from publishing
*/
Expand Down Expand Up @@ -360,7 +375,7 @@ fun Project.configureJReleaser() {
}
}

private fun isAvailableForPublication(project: Project, publication: MavenPublication): Boolean {
internal fun isAvailableForPublication(project: Project, publication: MavenPublication): Boolean {
var shouldPublish = true

// Check SKIP_PUBLISH_PROP
Expand All @@ -371,7 +386,12 @@ private fun isAvailableForPublication(project: Project, publication: MavenPublic
shouldPublish = shouldPublish && (publishGroupName == null || publication.groupId.startsWith(publishGroupName))

// Validate publication name is allowed to be published
shouldPublish = shouldPublish && ALLOWED_PUBLICATION_NAMES.any { publication.name.equals(it, ignoreCase = true) }
shouldPublish = shouldPublish &&
(
ALLOWED_PUBLICATION_NAMES.any { publication.name.equals(it, ignoreCase = true) } ||
// standard publication
(KOTLIN_NATIVE_PUBLICATION_NAMES.any { publication.name.equals(it, ignoreCase = true) } && KOTLIN_NATIVE_PROJECT_NAMES.any { project.name.equals(it, ignoreCase = true) }) // Kotlin/Native publication
)

return shouldPublish
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.sdk.kotlin.gradle.dsl

import kotlinx.coroutines.test.runTest
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.testfixtures.ProjectBuilder
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class PublishTest {
@Test
fun `aws-crt-kotlin can publish Kotlin Native artifacts`() = runTest {
val project = ProjectBuilder.builder().withName("aws-crt-kotlin").build()
project.group = "aws.sdk.kotlin.crt"
project.version = "1.2.3"

project.configurePublishing("aws-crt-kotlin")

val publishing = project.extensions.getByType(PublishingExtension::class.java)
publishing.publications {
ALLOWED_PUBLICATION_NAMES.forEach {
val jvmRuntimePublication = create(it, MavenPublication::class.java).apply {
groupId = "aws.sdk.kotlin.crt"
version = "1.2.3"
artifactId = "aws-crt-kotlin"
}
assertTrue(isAvailableForPublication(project, jvmRuntimePublication))
}

KOTLIN_NATIVE_PUBLICATION_NAMES.forEach {
val nativeRuntimePublication = create(it, MavenPublication::class.java).apply {
groupId = "aws.sdk.kotlin.crt"
version = "1.2.3"
artifactId = "aws-crt-kotlin"
}
assertTrue(isAvailableForPublication(project, nativeRuntimePublication))
}
}
}

@Test
fun `aws-sdk-kotlin cannot publish Kotlin Native artifacts`() = runTest {
val project = ProjectBuilder.builder().withName("aws-sdk-kotlin").build()
project.group = "aws.sdk.kotlin"
project.version = "1.2.3"

project.configurePublishing("aws-sdk-kotlin")

val publishing = project.extensions.getByType(PublishingExtension::class.java)
publishing.publications {
ALLOWED_PUBLICATION_NAMES.forEach {
val jvmRuntimePublication = create(it, MavenPublication::class.java).apply {
groupId = "aws.sdk.kotlin"
version = "1.2.3"
artifactId = "aws-runtime"
}
assertTrue(isAvailableForPublication(project, jvmRuntimePublication))
}

KOTLIN_NATIVE_PUBLICATION_NAMES.forEach {
val nativeRuntimePublication = create(it, MavenPublication::class.java).apply {
groupId = "aws.sdk.kotlin"
version = "1.2.3"
artifactId = "aws-runtime"
}
assertFalse(isAvailableForPublication(project, nativeRuntimePublication))
}
}
}

@Test
fun `smithy-kotlin cannot publish Kotlin Native artifacts`() = runTest {
val project = ProjectBuilder.builder().withName("aws-smithy-kotlin").build()
project.group = "aws.smithy.kotlin"
project.version = "1.2.3"

project.configurePublishing("smithy-kotlin", "smithy-lang")

val publishing = project.extensions.getByType(PublishingExtension::class.java)
publishing.publications {
ALLOWED_PUBLICATION_NAMES.forEach {
val jvmRuntimePublication = create(it, MavenPublication::class.java).apply {
groupId = "aws.smithy.kotlin"
version = "1.2.3"
artifactId = "runtime"
}
assertTrue(isAvailableForPublication(project, jvmRuntimePublication))
}

KOTLIN_NATIVE_PUBLICATION_NAMES.forEach {
val nativeRuntimePublication = create(it, MavenPublication::class.java).apply {
groupId = "aws.smithy.kotlin"
version = "1.2.3"
artifactId = "runtime"
}
assertFalse(isAvailableForPublication(project, nativeRuntimePublication))
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.sdk.kotlin.gradle.kmp

import org.gradle.api.Project
import org.gradle.api.tasks.Exec
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest
import org.jetbrains.kotlin.konan.target.HostManager

private val DEFAULT_SIMULATOR_DEVICE_NAME = "iPhone 16"

/**
* Disables standalone mode in simulator tests since it causes issues with TLS.
* This means we need to manage the simulator state ourselves (booting, shutting down).
* https://youtrack.jetbrains.com/issue/KT-38317
*/
public fun Project.configureIosSimulatorTasks() {
if (!HostManager.hostIsMac) return

val simulatorDeviceName = project.findProperty("iosSimulatorDevice") as? String ?: DEFAULT_SIMULATOR_DEVICE_NAME
val xcrun = "/usr/bin/xcrun"

val bootTask = rootProject.tasks.maybeCreate("bootIosSimulatorDevice", Exec::class.java).apply {
isIgnoreExitValue = true
commandLine(xcrun, "simctl", "boot", simulatorDeviceName)

doLast {
val result = executionResult.get()
val code = result.exitValue
if (code != 148 && code != 149) { // ignore "simulator already running" errors
result.assertNormalExitValue()
}
}
}

val shutdownTask = rootProject.tasks.maybeCreate("shutdownIosSimulatorDevice", Exec::class.java).apply {
isIgnoreExitValue = true
commandLine(xcrun, "simctl", "shutdown", simulatorDeviceName)

doLast {
val result = executionResult.get()
val code = result.exitValue
if (code != 148 && code != 149) { // ignore "simulator already shutdown" errors
result.assertNormalExitValue()
}
}
}

allprojects {
val simulatorTasks = tasks.withType<KotlinNativeSimulatorTest>()
simulatorTasks.configureEach {
dependsOn(bootTask)
standalone.set(false)
device.set(simulatorDeviceName)
}
shutdownTask.mustRunAfter(simulatorTasks)
}
}
Loading
Loading