Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: clean up build scripts #119

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ build/
*.iml
.idea/
local.properties
*.klib
*.klib
.kotlin/
dockcross-*
43 changes: 2 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ CRT interfaces are subject to change.
OCI_EXE=docker python3 .github/scripts/run-container-test.py --distro al2 --arch x64 --test-bin-dir ./aws-crt-kotlin/build/bin
```


See the usage/help for different distributions provided: `python3 .github/scripts/run-container.py -h`


### OSX

#### Debugging simulator test issues
Expand Down Expand Up @@ -66,46 +64,9 @@ List simulator runtimes with:
xcrun simctl list devices available
```


See also:

See also:
* https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes
* https://www.iosdev.recipes/simctl/

### Windows


## Elasticurl App

The `elasticurl` project contains an MPP (JVM and Native only) executable that provides a simple testing application for exercising the CRT bindings.

**Native**

```
# replace "PLATFORM" with the target platform you want to run (e.g. macosX64, linuxX64, etc)

./elasticurl/bin/PLATFORM/elasticurlDebugExecutable/elasticurl.kexe [OPTIONS] URL
```


**JVM**
```
java -jar ./elasticurl/libs/elasticurl-jvm.jar [OPTIONS] URL
```

NOTE: You can also use the convenience script `./scripts/elasticurlJvm.sh [OPTIONS] URL`

To enable memory tracing specify the environment variable `CRTDEBUG=trace=N` and provide the CLI option `-v trace`

e.g.
```
CRTDEBUG=trace=2 ./elasticurl/bin/macosX64/elasticurlDebugExecutable/elasticurl.kexe -v trace https://aws.amazon.com
```


**Integration Test**

Run the simple elasticurl integration test script

`./scripts/elasticurl-test.sh`

Not supported yet.
1,000 changes: 0 additions & 1,000 deletions aws-crt-kotlin/api/android/aws-crt-kotlin.api

This file was deleted.

1 change: 0 additions & 1 deletion aws-crt-kotlin/api/aws-crt-kotlin.api
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ public final class aws/sdk/kotlin/crt/http/HttpClientConnectionManagerOptionsBui

public final class aws/sdk/kotlin/crt/http/HttpException : aws/sdk/kotlin/crt/CrtRuntimeException {
public fun <init> (I)V
public fun getErrorCode ()I
}

public final class aws/sdk/kotlin/crt/http/HttpHeader {
Expand Down
1,000 changes: 0 additions & 1,000 deletions aws-crt-kotlin/api/jvm/aws-crt-kotlin.api

This file was deleted.

63 changes: 1 addition & 62 deletions aws-crt-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import aws.sdk.kotlin.gradle.crt.cmakeInstallDir
import aws.sdk.kotlin.gradle.crt.configureCrtCMakeBuild
import aws.sdk.kotlin.gradle.crt.disableCrossCompileTargets
import aws.sdk.kotlin.gradle.dsl.configurePublishing
import aws.sdk.kotlin.gradle.kmp.IDEA_ACTIVE
import aws.sdk.kotlin.gradle.kmp.configureKmpTargets
import aws.sdk.kotlin.gradle.util.typedProp
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
Expand All @@ -23,7 +22,7 @@ plugins {
val sdkVersion: String by project
group = properties["publishGroupName"] ?: error("missing publishGroupName")
version = sdkVersion
description = "Kotlin Multiplatform bindings for AWS SDK Common Runtime"
description = "Kotlin Multiplatform bindings for AWS Common Runtime"

// See: https://kotlinlang.org/docs/reference/opt-in-requirements.html#opting-in-to-using-api
val optinAnnotations = listOf("kotlin.RequiresOptIn", "kotlinx.cinterop.ExperimentalForeignApi")
Expand All @@ -45,42 +44,6 @@ kotlin {
// FIXME - setup docker files and cmake tasks appropriately
// mingwX64()

jvm {
attributes {
attribute<org.gradle.api.attributes.java.TargetJvmEnvironment>(
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
objects.named(TargetJvmEnvironment.STANDARD_JVM),
)
}
}

// KMP doesn't support sharing source sets for multiple JVM targets OR JVM + Android targets.
// We can manually declare a `jvmCommon` target and wire it up. It will compile fine but Intellij does
// not support this and the developer experience is abysmal. Kotlin/Native suffers a similar problem and
// we can use the same solution. Simply, if Intellij is running (i.e. the one invoking this script) then
// assume we are only building for JVM. Otherwise declare the additional JVM target for Android and
// set the sourceSet the same for both but with different runtime dependencies.
// See:
// * https://kotlinlang.org/docs/mpp-share-on-platforms.html#share-code-in-libraries
// * https://kotlinlang.org/docs/mpp-set-up-targets.html#distinguish-several-targets-for-one-platform
if (!IDEA_ACTIVE) {

// NOTE: We don't actually need the Android plugin. All of the Android specifics are handled in aws-crt-java,
// we just need a variant with a different dependency set + some distinguishing attributes.
jvm("android") {
attributes {
attribute(
org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.Companion.attribute,
org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.androidJvm,
)
attribute(
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
objects.named(TargetJvmEnvironment.ANDROID),
)
}
}
}

sourceSets {
val commonMain by getting {
dependencies {
Expand Down Expand Up @@ -110,30 +73,6 @@ kotlin {
implementation(libs.mockserver.netty)
}
}

if (!IDEA_ACTIVE) {
val androidMain by getting {
// re-use the jvm (desktop) sourceSet. We only really care about declaring a variant with a different set
// of runtime dependencies
kotlin.srcDir("jvm/src")
dependsOn(commonMain)
dependencies {
// we need symbols we can resolve during compilation but at runtime (i.e. on device) we depend on the Android dependency
compileOnly(libs.crt.java)
val crtJavaVersion = libs.versions.crt.java.version.get()
implementation("software.amazon.awssdk.crt:aws-crt-android:$crtJavaVersion@aar")

// FIXME - temporary integration with CompletableFuture while we work out a POC on the jvm target
implementation(libs.kotlinx.coroutines.jdk8)
}
}

// disable compilation of android test source set. It is the same as the jvmTest sourceSet/tests. This
// sourceSet only exists to create a new variant that is the same in every way except the runtime
// dependency on aws-crt-android. To test this we would need to run it on device/emulator.
tasks.getByName("androidTest").enabled = false
tasks.getByName("compileTestKotlinAndroid").enabled = false
}
}

sourceSets.all {
Expand Down
8 changes: 2 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ buildscript {
}

plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
alias(libs.plugins.kotlinx.binary.compatibility.validator)
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.aws.kotlin.repo.tools.kmp)
alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics)
Expand Down Expand Up @@ -60,7 +60,7 @@ subprojects {
if (project.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
allprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.allWarningsAsErrors = true
compilerOptions.allWarningsAsErrors = true
}
}
}
Expand All @@ -75,7 +75,3 @@ val lintPaths = listOf(
)

configureLinting(lintPaths)

apiValidation {
ignoredProjects += setOf("elasticurl")
}
67 changes: 0 additions & 67 deletions elasticurl/build.gradle.kts

This file was deleted.

Loading
Loading