-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:awslabs/smithy-kotlin into feat-kmp…
…-targets
- Loading branch information
Showing
62 changed files
with
954 additions
and
260 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"id": "666fa825-d13b-458c-af63-354434bfc2ed", | ||
"type": "feature", | ||
"description": "Publish a BOM and a Version Catalog" | ||
} |
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,5 @@ | ||
{ | ||
"id": "6de10487-c3a0-4c63-929a-ba11a415ea8f", | ||
"type": "feature", | ||
"description": "Detect and automatically correct clock skew to prevent signing errors" | ||
} |
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,5 @@ | ||
{ | ||
"id": "b31b8667-e931-49cf-8897-4e2ded2b7f14", | ||
"type": "misc", | ||
"description": "Expose immutable `SpanContext` on `TraceSpan`" | ||
} |
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,5 @@ | ||
{ | ||
"id": "c063605b-4702-4d8a-a841-2e0b7aa78e78", | ||
"type": "misc", | ||
"description": "**BREAKING**: Remove `smithy.client.request.size`, `smithy.client.response.size`, `smithy.client.retries` metrics. Rename all `smithy.client.*` metrics to `smithy.client.call.*`." | ||
} |
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,85 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import aws.sdk.kotlin.gradle.dsl.configurePublishing | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataTarget | ||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget | ||
import java.util.* | ||
|
||
plugins { | ||
`maven-publish` | ||
`java-platform` | ||
`version-catalog` | ||
} | ||
|
||
val sdkVersion: String by project | ||
|
||
group = "aws.smithy.kotlin" | ||
version = sdkVersion | ||
|
||
val evaluateAfter = listOf(":runtime") | ||
evaluateAfter.forEach { evaluationDependsOn(it) } | ||
|
||
fun createBomConstraintsAndVersionCatalog() { | ||
val bomConstraints: DependencyConstraintHandler = dependencies.constraints | ||
val catalogExt = catalog | ||
|
||
project(":runtime").subprojects { | ||
val subproject = this | ||
val hasMavenPublish = subproject.plugins.hasPlugin("maven-publish") | ||
if (!hasMavenPublish) { | ||
logger.info("skipping bom and version-catalog entry for ${subproject.name}") | ||
return@subprojects | ||
} | ||
subproject.plugins.withType<KotlinMultiplatformPluginWrapper> { | ||
subproject.extensions.getByType<KotlinMultiplatformExtension>().targets.all { | ||
val target = this | ||
val gavCoordinates = gav(target) | ||
bomConstraints.api(gavCoordinates) | ||
catalogExt.versionCatalog { | ||
val alias = artifactId(target) | ||
library(alias, gavCoordinates) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun Project.artifactId(target: KotlinTarget): String = when (target) { | ||
is KotlinMetadataTarget -> name | ||
is KotlinJsTarget -> "$name-js" | ||
else -> "$name-${target.targetName.toLowerCase(Locale.ROOT)}" | ||
} | ||
|
||
/** | ||
* Returns a string like "aws.sdk.kotlin:s3-linuxx64:1.0.2" for this target. | ||
*/ | ||
fun Project.gav(target: KotlinTarget): String { | ||
val artifactId = artifactId(target) | ||
return "$group:$artifactId:$version" | ||
} | ||
|
||
fun DependencyConstraintHandler.api(constraintNotation: Any) = | ||
add("api", constraintNotation) | ||
|
||
createBomConstraintsAndVersionCatalog() | ||
|
||
configurePublishing("smithy-kotlin") | ||
|
||
publishing { | ||
publications { | ||
create("bom", MavenPublication::class) { | ||
artifactId = "bom" | ||
from(project.components.getByName("javaPlatform")) | ||
} | ||
|
||
create<MavenPublication>("versionCatalog") { | ||
artifactId = "version-catalog" | ||
from(components["versionCatalog"]) | ||
} | ||
} | ||
} |
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
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
41 changes: 41 additions & 0 deletions
41
...ability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/SpanContext.kt
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,41 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package aws.smithy.kotlin.runtime.telemetry.trace | ||
|
||
/** | ||
* The immutable state that must be serialized and propagated as part of a distributed trace context. | ||
*/ | ||
public interface SpanContext { | ||
public companion object { | ||
public val Invalid: SpanContext = InvalidSpanContext | ||
} | ||
|
||
/** | ||
* The unique trace identifier this span belongs to | ||
*/ | ||
public val traceId: String | ||
|
||
/** | ||
* The unique span identifier | ||
*/ | ||
public val spanId: String | ||
|
||
/** | ||
* True if the [SpanContext] was propagated from a remote parent | ||
*/ | ||
public val isRemote: Boolean | ||
|
||
/** | ||
* True if the [SpanContext] has a non-zero [traceId] and [spanId] | ||
*/ | ||
public val isValid: Boolean | ||
} | ||
|
||
private object InvalidSpanContext : SpanContext { | ||
override val traceId: String = "00000000000000000000000000000000" | ||
override val spanId: String = "0000000000000000" | ||
override val isRemote: Boolean = false | ||
override val isValid: Boolean = false | ||
} |
Oops, something went wrong.