generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 31
misc: Set up Kotlin/Native build #1174
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
Merged
Parent:
kn: merge to main
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
5dc2a7c
Latest
lauzadis 6115504
Depend on -kn plugin
lauzadis 4e6cc64
Move `jvm` files to `jvmAndNative` where appropriate
lauzadis 83087c5
Remove commented block
lauzadis a5b1be0
ktlint
lauzadis cbdfb3f
ktlint
lauzadis 1e09b66
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-r…
lauzadis f3a1ec6
Revert to non-SNAPSHOT version
lauzadis 29e00d0
Re-enable warnings as errors
lauzadis 8c3d77a
Remove K/N targets setup from build script
lauzadis 81e8f3b
Replace `all-platforms` `test jvmTest` with `allTests`
lauzadis 5e03508
Ignore *.cinteropLibraries.json
lauzadis 256fef5
WarningsAsErrors
lauzadis a2ad3ef
WarningsAsErrors
lauzadis bc6b343
WarningsAsErrors
lauzadis a5fa0da
Create a setup-build script to checkout aws-crt-kotlin as a sibling d…
lauzadis f71be44
Fix path
lauzadis 0e17527
Depend on 0.4.15-kn
lauzadis fb048b3
CI
lauzadis 1c10cc7
downstream ..
lauzadis f6eb3c0
CI
lauzadis cd4b31d
Make it a path
lauzadis 3512d81
Add debugging steps
lauzadis eae7a9c
More debug
lauzadis 8efb8e8
More debug
lauzadis bccbbac
More debug
lauzadis bab02b1
Fixed, remove debug
lauzadis 15488ac
Add an `else` println
lauzadis 96cfd7d
add with path `smithy-kotlin` to all checkouts
lauzadis 713222d
Also update setup-build location
lauzadis fae778c
`working-directory: ./smithy-kotlin`
lauzadis cc273a2
Disable KMP builds on JVM suite
lauzadis 161b57a
Fix JVM build
lauzadis 5d8a1f5
Fix aws-signing-crt
lauzadis 42b0453
Test macos suite
lauzadis 2e9fe71
Disable KMP for `protocol-tests` and `downstream`
lauzadis 8651038
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-r…
lauzadis 7cd3ed9
Add linux platform
lauzadis 0fbb759
Add windows platform
lauzadis 72cf8ad
Remove apiCheck
lauzadis f67dda7
Revert to windows-2022
lauzadis 69d57ee
working-directory
lauzadis dea452e
CI
lauzadis 628ff9e
jvmTest -> jvmAndNativeTest
lauzadis 734c830
Remove OCI_EXE
lauzadis 57d0b70
Change CI names
lauzadis dacca68
Remove `allTests`
lauzadis f8135f6
Remove quotes on Windows
lauzadis 9795627
Move ktor test suite to `jvmAndNative`
lauzadis 779173b
Fix erroneous diff
lauzadis 6f0dd35
Revert "Remove quotes on Windows"
lauzadis 19fd715
Support local.properties `compositeProjects`
lauzadis fa0b7c0
Cache K/N toolchain
lauzadis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,39 @@ | ||
| name: Setup Build | ||
| description: > | ||
| Checkout repositories and build dependencies | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Checkout tools | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'aws-kotlin-repo-tools' | ||
| repository: 'awslabs/aws-kotlin-repo-tools' | ||
| sparse-checkout: | | ||
| .github | ||
|
|
||
| - name: Checkout aws-crt-kotlin | ||
| uses: ./aws-kotlin-repo-tools/.github/actions/checkout-head | ||
| with: | ||
| # checkout aws-crt-kotlin as a sibling which will automatically make it an included build | ||
| path: 'aws-crt-kotlin' | ||
| repository: 'awslabs/aws-crt-kotlin' | ||
|
|
||
| # Cache the Kotlin/Native toolchain based on the input Kotlin version from version catalog | ||
| # see https://kotlinlang.org/docs/native-improving-compilation-time.html | ||
| - name: Cache Kotlin Native toolchain | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.konan | ||
| key: ${{ runner.os }}-konan-${{ hashFiles('gradle/libs.versions.toml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-konan- | ||
|
|
||
| - name: Configure JDK | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| distribution: 'corretto' | ||
| java-version: 17 | ||
| cache: 'gradle' |
This file contains hidden or 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,192 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| # Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed | ||
| concurrency: | ||
| group: ci-pr-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| RUN: ${{ github.run_id }}-${{ github.run_number }} | ||
| GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dkotlin.incremental=false" | ||
|
|
||
| jobs: | ||
| jvm: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # we build with a specific JDK version but source/target compatibility should ensure the jar is usable by | ||
| # the target versions we want to support | ||
| java-version: | ||
| - 8 | ||
| - 11 | ||
| - 17 | ||
| - 21 | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'smithy-kotlin' | ||
|
|
||
| - name: Setup build | ||
| uses: ./smithy-kotlin/.github/actions/setup-build | ||
|
|
||
| - name: Build and Test on JVM | ||
| working-directory: ./smithy-kotlin | ||
| shell: bash | ||
| run: | | ||
| ./gradlew -Paws.kotlin.native=false -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace | ||
|
|
||
| # macos-14 build and test for targets: jvm, macoArm64, iosSimulatorArm64, watchosSimulatorArm65, tvosSimulatorArm64 | ||
| # macos-13 build and test for targets: jvm, macoX64, iosX64, tvosX64, watchosX64 | ||
| macos: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [macos-14, macos-13] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'smithy-kotlin' | ||
|
|
||
| - name: Setup build | ||
| uses: ./smithy-kotlin/.github/actions/setup-build | ||
|
|
||
| - name: Build and Test on Apple platforms | ||
| working-directory: ./smithy-kotlin | ||
| shell: bash | ||
| run: | | ||
| # FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532 | ||
| # echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties | ||
| ./gradlew apiCheck | ||
| ./gradlew -Paws.sdk.kotlin.crt.disableCrossCompile=true build | ||
|
|
||
| - name: Save Test Reports | ||
| if: failure() | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: test-reports-${{ matrix.os }} | ||
| path: '**/build/reports' | ||
|
|
||
| # build and test for targets: jvm, linuxX64 | ||
| # cross compile for: linuxX64, linuxArm64 | ||
| # TODO - add mingw as cross compile target | ||
| linux: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'smithy-kotlin' | ||
|
|
||
| - name: Setup build | ||
| uses: ./smithy-kotlin/.github/actions/setup-build | ||
|
|
||
| - name: Configure CRT Docker Images | ||
| run: | | ||
| ./aws-crt-kotlin/docker-images/build-all.sh | ||
|
|
||
| - name: Build and Test on Linux with Cross-Compile | ||
| working-directory: ./smithy-kotlin | ||
| shell: bash | ||
| run: | | ||
| # FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532 | ||
| # echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties | ||
| ./gradlew apiCheck | ||
| ./gradlew build | ||
|
|
||
| - name: Save Test Reports | ||
| if: failure() | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: test-reports-${{ matrix.os }} | ||
| path: '**/build/reports' | ||
|
|
||
| # windows JVM | ||
| windows: | ||
| runs-on: windows-2022 | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'smithy-kotlin' | ||
|
|
||
| - name: Setup build | ||
| uses: ./smithy-kotlin/.github/actions/setup-build | ||
|
|
||
| - name: Build and Test on Windows JVM | ||
| working-directory: ./smithy-kotlin | ||
| run: | | ||
| ./gradlew apiCheck | ||
| ./gradlew -P"aws.sdk.kotlin.crt.disableCrossCompile"=true build | ||
|
|
||
| - name: Save Test Reports | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-reports-windows | ||
| path: '**/build/reports' | ||
|
|
||
| protocol-tests: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'smithy-kotlin' | ||
|
|
||
| - name: Setup build | ||
| uses: ./smithy-kotlin/.github/actions/setup-build | ||
|
|
||
| - name: Test | ||
| working-directory: ./smithy-kotlin | ||
| shell: bash | ||
| run: | | ||
| ./gradlew -Paws.kotlin.native=false publishToMavenLocal | ||
| ./gradlew -Paws.kotlin.native=false testAllProtocols | ||
|
|
||
| downstream: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: 'smithy-kotlin' | ||
|
|
||
| - name: Setup build | ||
| uses: ./smithy-kotlin/.github/actions/setup-build | ||
|
|
||
| - name: Checkout aws-sdk-kotlin | ||
| uses: ./aws-kotlin-repo-tools/.github/actions/checkout-head | ||
| with: | ||
| # smithy-kotlin is checked out as a sibling dir which will automatically make it an included build | ||
| path: 'aws-sdk-kotlin' | ||
| repository: 'awslabs/aws-sdk-kotlin' | ||
|
|
||
| - name: Build and Test aws-sdk-kotlin downstream | ||
| working-directory: ./smithy-kotlin | ||
| run: | | ||
| # TODO - JVM only | ||
| cd $GITHUB_WORKSPACE/smithy-kotlin | ||
| ./gradlew --parallel -Paws.kotlin.native=false publishToMavenLocal | ||
| SMITHY_KOTLIN_RUNTIME_VERSION=$(grep sdkVersion= gradle.properties | cut -d = -f 2) | ||
| SMITHY_KOTLIN_CODEGEN_VERSION=$(grep codegenVersion= gradle.properties | cut -d = -f 2) | ||
| cd $GITHUB_WORKSPACE/aws-sdk-kotlin | ||
| # replace smithy-kotlin-runtime-version and smithy-kotlin-codegen-version to be | ||
| # whatever we are testing such that the protocol test projects don't fail with a | ||
| # version that doesn't exist locally or in maven central. Otherwise the generated | ||
| # protocol test projects will use whatever the SDK thinks the version of | ||
| # smithy-kotlin should be | ||
| sed -i "s/smithy-kotlin-runtime-version = .*$/smithy-kotlin-runtime-version = \"$SMITHY_KOTLIN_RUNTIME_VERSION\"/" gradle/libs.versions.toml | ||
| sed -i "s/smithy-kotlin-codegen-version = .*$/smithy-kotlin-codegen-version = \"$SMITHY_KOTLIN_CODEGEN_VERSION\"/" gradle/libs.versions.toml | ||
| ./gradlew --parallel -Paws.kotlin.native=false publishToMavenLocal | ||
| ./gradlew -Paws.kotlin.native=false test jvmTest | ||
| ./gradlew -Paws.kotlin.native=false testAllProtocols |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -47,3 +47,5 @@ gradle-app.setting | |
|
|
||
| # MacOS | ||
| .DS_Store | ||
|
|
||
| *.cinteropLibraries.json | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Does this mean we have to maintain parallel releases of the repo tools until we're ready to fully GA Kotlin/Native support? What's unsafe/unready about the K/N support in repo tools now that prevents it from being merged to main and used for all smithy-kotlin branches including main?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main difference so far is all the targets which get enabled: aws/aws-kotlin-repo-tools@main...kn-main
I think we might be able to move this to main and drop the parallel versioning strategy.
This parallel release strategy is something that's been planned from the beginning. I can't say for sure but there may be more changes forthcoming which will require us to have this split.