Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
bbc7cf1
chore: bootstrap CRT build for native platforms (#91)
aajtodd Feb 13, 2024
b5c745c
chore: bootsrap kotlin native CI (#92)
aajtodd Feb 16, 2024
700af3d
(kn) feat: initial Allocator, logging, CrtResource implementations (#93)
lauzadis Feb 28, 2024
ef8137a
fix: use same toolchain on arm that k/n does (#95)
aajtodd Mar 5, 2024
9908822
misc: Kotlin/Native IO implementation (#96)
lauzadis Mar 5, 2024
082670c
feat: k/n http bindings (#97)
aajtodd Mar 7, 2024
ee467c8
setup basic logging for native and fix static libs (#98)
aajtodd Mar 13, 2024
4b10e82
fix: iOS simulator TLS negotiation errors (#101)
lauzadis Apr 3, 2024
a79c167
feat: add support for native checksums (#100)
lauzadis Apr 5, 2024
938a6b1
kn: signing (#103)
lauzadis Apr 29, 2024
886798f
Merge branch 'main' of github.com:awslabs/aws-crt-kotlin into kn-main
lauzadis Oct 17, 2024
b9b99f7
Fix merge
lauzadis Oct 18, 2024
69d9c7d
ktlint
lauzadis Oct 22, 2024
d254084
git submodule update
lauzadis Oct 22, 2024
147cd68
Merge branch 'main' of github.com:awslabs/aws-crt-kotlin into kn-main
lauzadis Oct 22, 2024
6eaf028
misc: clean up build scripts (#119)
lauzadis Oct 25, 2024
f059811
kn: lift build logic into aws-kotlin-repo-tools (#120)
lauzadis Nov 6, 2024
375b817
kn: checksum bindings (#121)
lauzadis Dec 9, 2024
ff3a81d
Add WithCrt to MutableBuffer
lauzadis Dec 17, 2024
adb9e36
ktlintFormat
lauzadis Dec 20, 2024
22e9b92
kn: merge from main (#127)
lauzadis Jan 21, 2025
f8bc8d7
kn: merge from main, upgrade to latest aws-kotlin-repo-tools (#129)
lauzadis Jan 31, 2025
f77f3f8
kn: upgrade to latest build plugin (#130)
lauzadis Feb 4, 2025
a76360f
kn: move `WithCrt` to common source set (#137)
lauzadis Mar 21, 2025
3cd6fda
kn: make `log` public for `CrtLogger` (#138)
lauzadis Mar 24, 2025
aed1325
kn: initialize CRT in `TlsContext` (#140)
lauzadis Mar 31, 2025
e6e18b4
kn: parallelize CMake builds (#142)
lauzadis Apr 1, 2025
d3c8108
Use `providers.gradleProperty` which allows passing of properties thr…
lauzadis Apr 4, 2025
91a33a8
kn: upgrade crt dependencies (#135)
lauzadis Apr 4, 2025
7073b54
Only attempt to cross-compile on non-Linux hosts
lauzadis Apr 4, 2025
415d3cb
Clarify comment
lauzadis Apr 4, 2025
195e7eb
.getOrNull()
lauzadis Apr 7, 2025
c861e77
Use 0.4.25-kn
lauzadis Apr 7, 2025
9ff2bf5
kn: re-enable cross-compilation on Linux hosts (#145)
lauzadis Apr 15, 2025
714c6b2
chore: bump CRT submodules to latest commits (#147)
ianbotsf May 2, 2025
0e1aae3
feat: Kotlin/Native Windows compilation (#152)
ianbotsf Jul 8, 2025
8b95fc4
Merge branch 'main' of github.com:awslabs/aws-crt-kotlin into kn-main
lauzadis Jul 10, 2025
94e6f84
kn: update CRT dependencies (#163)
lauzadis Jul 10, 2025
23eeac0
fix: correctly close HTTP-related CRT resources in native sourceset (…
ianbotsf Jul 29, 2025
d903938
kn: merge from main, upgrade to latest version of aws-kotlin-repo-too…
lauzadis Aug 6, 2025
8297b18
chore: fix some broken K/N tests by upgrading CRT submodules and addi…
ianbotsf Aug 8, 2025
d3cfab0
chore: fix more instances of flaky native reference handling (#176)
ianbotsf Aug 13, 2025
e936caf
kn: address misc issues (#173)
lauzadis Aug 13, 2025
6764ff8
kn: release setup (#174)
lauzadis Aug 14, 2025
5e8082c
Merge branch 'main' of github.com:awslabs/aws-crt-kotlin into kn-main…
lauzadis Aug 14, 2025
ecdcf29
changelog
lauzadis Aug 14, 2025
2612c71
Remove finch installation
lauzadis Aug 14, 2025
ab7851f
Delete run-container-test script
lauzadis Aug 14, 2025
0596588
Re-enable K/N for artifactSizeMetrics task?
lauzadis Aug 14, 2025
ce6bfcb
Revert "Delete run-container-test script"
lauzadis Aug 14, 2025
c21eec1
Can we enable this test now?
lauzadis Aug 14, 2025
09e6d0b
minor fixes
lauzadis Aug 14, 2025
0e42b2d
Disable K/N for artifact size metrics
lauzadis Aug 14, 2025
b32411a
kn: final merge from main! (#177)
lauzadis Aug 14, 2025
533a897
Merge pull request #179 from awslabs/kn-main-merge
lauzadis Aug 14, 2025
3a74f8f
Add changelog with link to issue and requiresMinorVersionBump
lauzadis Aug 14, 2025
495d7c4
update comment
lauzadis Aug 14, 2025
c72c6e9
update one more comment
lauzadis Aug 14, 2025
fd7aaef
Replace runTest with runBlocking
lauzadis Aug 14, 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
9 changes: 9 additions & 0 deletions .changes/2461e178-b595-4fa3-9cf1-4bc5d7672d01.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "2461e178-b595-4fa3-9cf1-4bc5d7672d01",
"type": "feature",
"description": "⚠️ **IMPORTANT**: Add support for Kotlin/Native",
"issues": [
"https://github.com/awslabs/aws-sdk-kotlin/issues/229"
],
"requiresMinorVersionBump": true
}
24 changes: 24 additions & 0 deletions .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup build
description: Common repository and build tool setup

runs:
using: composite

steps:
- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
cache: 'gradle'

# 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-
207 changes: 207 additions & 0 deletions .github/scripts/run-container-test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
#!/usr/bin/env python3
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

"""
Run precompiled Kotlin/Native test binaries in a Docker container for a specific Linux distribution and architecture.

This requires Docker multiarch support, see https://docs.docker.com/build/building/multi-platform/ and https://github.com/multiarch/qemu-user-static
In GitHub we use a provided action for this: https://github.com/docker/setup-qemu-action

Locally you would need to run one of:

`docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes`

OR

`docker run --privileged --rm tonistiigi/binfmt --install all`
"""

import argparse
import os
import subprocess
import shlex
import shutil
import textwrap

VERBOSE = False

DISTRO_TO_IMAGE_NAME = {
"ubuntu-22.04": "public.ecr.aws/lts/ubuntu:22.04_stable",
"al2023": "public.ecr.aws/amazonlinux/amazonlinux:2023",
"al2": "public.ecr.aws/amazonlinux/amazonlinux:2"
}

DISTRO_TO_PACKAGES = {
"al2023": [ "libxcrypt-compat" ],
}

DOCKER_PLATFORM_BY_ARCH = {
"x64": "linux/amd64",
"arm64": "linux/arm64"
}


def vprint(message):
global VERBOSE
if VERBOSE:
print(message)


def running_in_github_action():
"""
Test if currently running in a GitHub action or running locally
:return: True if running in GH, False otherwise
"""
return "GITHUB_WORKFLOW" in os.environ


def shell(command, cwd=None, check=True, capture_output=False):
"""
Run a command
:param command: command to run
:param cwd: the current working directory to change to before executing the command
:param check: flag indicating if the status code should be checked. When true an exception will be
thrown if the command exits with a non-zero exit status.
:returns: the subprocess CompletedProcess output
"""
vprint(f"running `{command}`")
return subprocess.run(command, shell=True, check=check, cwd=cwd, capture_output=capture_output)


def oci_executable():
"""
Attempt to find the OCI container executor used to build and run docker containers
"""
oci_exe = os.environ.get('OCI_EXE')
if oci_exe is not None:
return oci_exe

executors = ['finch', 'podman', 'docker']

for exe in executors:
if shutil.which(exe) is not None:
return exe

print("cannot find container executor")
exit(1)


def create_docker_image(opts, oci_exe, base_image_name, packages):
lines = []

# Set base image
lines.append(f"FROM {base_image_name}")

# Install extra packages if necessary
if packages:
cmd = [
"RUN yum -y install",
*packages,
]
lines.append(' '.join(cmd))

# Compile the contents
content = '\n'.join(lines) + '\n'

# Write the Dockerfile
with open("Dockerfile", "w") as f:
f.write(content)

# Build the image
image_name = f"container-test-{opts.distro}:latest"
platform = DOCKER_PLATFORM_BY_ARCH[opts.arch]
cmd = shlex.join([
oci_exe,
"build",
"-t",
image_name,
"--platform",
platform,
".",
])
shell(cmd)

print(f"Created Docker image {image_name}. Listing hosted images to be certain:")
shell("docker image ls --all")

return image_name


def get_docker_image(opts, oci_exe):
base_image_name = DISTRO_TO_IMAGE_NAME[opts.distro]
packages = DISTRO_TO_PACKAGES.get(opts.distro)
if packages:
return create_docker_image(opts, oci_exe, base_image_name, packages)
else:
return base_image_name


def run_docker_test(opts):
"""
Run a docker test for a precompiled Kotlin/Native binary

:param opts: the parsed command line options
"""
platform = DOCKER_PLATFORM_BY_ARCH[opts.arch]
oci_exe = oci_executable()
image_name = get_docker_image(opts, oci_exe)

test_bin_dir = os.path.abspath(opts.test_bin_dir)
path_to_exe = f'./linux{opts.arch.capitalize()}/debugTest/test.kexe'

cmd = [
oci_exe,
'run',
'--rm',
f'-v{test_bin_dir}:/test',
]
if not opts.no_system_certs:
cmd.append(f'-v/etc/ssl:/etc/ssl')

cmd.extend(
[
'-w/test',
'-e DEBIAN_FRONTEND=noninteractive',
'--platform',
platform,
image_name,
path_to_exe,
]
)

cmd = shlex.join(cmd)
print(cmd)
shell(cmd)


def create_cli():
parser = argparse.ArgumentParser(
prog="run-container-test",
description="Run cross platform test binaries in a container",
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)

parser.add_argument("-v", "--verbose", help="enable verbose output", action="store_true")

parser.add_argument("--distro", required=True, choices=DISTRO_TO_IMAGE_NAME.keys(), help="the distribution name to run the task on")
parser.add_argument("--arch", required=True, choices=DOCKER_PLATFORM_BY_ARCH.keys(), help="the architecture to use")
parser.add_argument("--test-bin-dir", required=True, help="the path to the test binary directory root")
parser.add_argument("--no-system-certs", action='store_true', help="disable mounting system certificates into the container")

return parser


def main():
cli = create_cli()
opts = cli.parse_args()
if opts.verbose:
global VERBOSE
VERBOSE = True

run_docker_test(opts)


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion .github/workflows/artifact-size-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Configure Gradle
uses: awslabs/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
- name: Generate Artifact Size Metrics
run: ./gradlew artifactSizeMetrics
run: ./gradlew -Paws.kotlin.native=false artifactSizeMetrics
- name: Analyze Artifact Size Metrics
run: ./gradlew analyzeArtifactSizeMetrics

Expand Down
Loading
Loading