Skip to content

Resolve & jextract subcommands and further dis-entangle commands #276

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
merged 37 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
aa84e19
Introduce resolve subcommand and further dis-entangle commands
ktoso Jun 16, 2025
8278923
_Subprocess: Update to a more recent version of vendored lib.
ktoso Jun 17, 2025
bcdb03a
fix unacceptablelanguageignore for new paths
ktoso Jun 18, 2025
62e0190
ignore .swift-version
ktoso Jun 18, 2025
b9fbf6e
license ignore: the vendored subprocess has a slightly differnetly
ktoso Jun 18, 2025
5377f9f
start using wrap-java subcommand
ktoso Jun 18, 2025
76d33b8
New commands: wrap-java and resolve work from swift-java CLI tool
ktoso Jun 18, 2025
ec05d34
cleanups, remove dead code, commented code etc
ktoso Jun 18, 2025
6ab9ee6
add explicit dependency on swift-system
ktoso Jun 18, 2025
c2f66d5
fixing subprocess build on linux
ktoso Jun 18, 2025
3f15bc1
introduce swift-java jextract subcommand, completing our migration
ktoso Jun 19, 2025
799e666
debug output on linux
ktoso Jun 19, 2025
0813c5f
refactor jextract plugin to be a BUILD plugin; unblocks swift 6.2
ktoso Jun 19, 2025
d8b9429
Correct the SwiftAndJavaJarSampleLib example and actually verify created
ktoso Jun 20, 2025
e71e079
git-ignore sdkman filest
ktoso Jun 23, 2025
ba159c9
wip: bringing validation of sample to linux
ktoso Jun 23, 2025
7c6a812
JDK: Update install_jdk script such that we use Corretto JDK 24
ktoso Jun 23, 2025
8461aa0
enable complete validation of SwiftAndJavaJarSampleLib on linux
ktoso Jun 23, 2025
16de903
move installing swift to Swiftly, so we can pick 6.1 / 6.2 easily
ktoso Jun 23, 2025
1c1f9b8
install JDK 21 for gradle, and JDK 24 for runtime
ktoso Jun 23, 2025
5c49306
Reworking CI validation for samples to pass on linux
ktoso Jun 23, 2025
f721854
adjust jdk version we need for runtime to match installed jdk
ktoso Jun 23, 2025
57865db
make sure we have JAVA_HOME/bin on the PATH in validation
ktoso Jun 23, 2025
6d5e3dc
correct jdk caching, now that we have to cache two JDKs
ktoso Jun 23, 2025
f8deab8
fixing classpaths and library paths...
ktoso Jun 23, 2025
5ba1365
some shellcheck fixes
ktoso Jun 23, 2025
816c77c
swift-java: print the complete invocation args, to help debugging when
ktoso Jun 23, 2025
f48bcca
fix shellcheck with swiftly
ktoso Jun 23, 2025
1ba1eb5
Make use of jextract build plugin from all gradle builds (TODO: make …
ktoso Jun 23, 2025
740af4d
bump samples to macOS 15 base for now
ktoso Jun 23, 2025
8ff4d87
shellcheck disable checking swiftly script
ktoso Jun 23, 2025
f0f9cfa
fix shellcheck for swiftly
ktoso Jun 24, 2025
a947193
jextract: also emit empty files when --write-empty-files is passed
ktoso Jun 24, 2025
59aef18
fix: seems these workaround decls not necessary on 6.1 linux anymore?
ktoso Jun 24, 2025
f2a195f
fix: adjust tests to take config, not just module name
ktoso Jun 24, 2025
8794b66
remove runtime workarounds, seems not needed on linux anymore with 6.1
ktoso Jun 24, 2025
d44b762
we don't use swiftly in docker, remove the script
ktoso Jun 24, 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
6 changes: 3 additions & 3 deletions .github/actions/prepare_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ runs:
- name: Install System Dependencies
run: apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
shell: bash
- name: Cache JDK
- name: Cache JDKs
id: cache-jdk
uses: actions/cache@v4
continue-on-error: true
with:
path: /usr/lib/jvm/default-jdk/
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/*') }}
path: /usr/lib/jvm/
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/*') }}
restore-keys: |
${{ runner.os }}-jdk-
- name: Install JDK
Expand Down
26 changes: 9 additions & 17 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ jobs:
strategy:
fail-fast: true
matrix:
# swift_version: ['nightly-main']
swift_version: ['6.0.2']
swift_version: ['6.1.2']
os_version: ['jammy']
jdk_vendor: ['Corretto']
container:
Expand All @@ -36,7 +35,7 @@ jobs:
- name: Gradle :SwiftKit:build
run: ./gradlew build -x test
- name: Gradle :SwiftKit:check
run: ./gradlew :SwiftKit:check --info
run: ./gradlew :SwiftKit:check --debug
- name: Gradle compile JMH benchmarks
run: ./gradlew compileJmh --info

Expand All @@ -46,8 +45,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# swift_version: ['nightly-main']
swift_version: ['6.0.2']
swift_version: ['6.1.2']
os_version: ['jammy']
jdk_vendor: ['Corretto']
container:
Expand All @@ -70,8 +68,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# swift_version: ['nightly-main']
swift_version: ['6.0.2']
swift_version: ['6.1.2']
os_version: ['jammy']
jdk_vendor: ['Corretto']
container:
Expand All @@ -90,8 +87,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# swift_version: ['nightly-main']
swift_version: ['6.0.2']
swift_version: ['6.1.2']
os_version: ['jammy']
jdk_vendor: ['Corretto']
container:
Expand All @@ -110,8 +106,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# swift_version: ['nightly-main']
swift_version: ['6.0.2']
swift_version: ['6.1.2']
os_version: ['jammy']
jdk_vendor: ['Corretto']
container:
Expand All @@ -130,8 +125,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# swift_version: ['nightly-main']
swift_version: ['6.0.2']
swift_version: ['6.1.2']
os_version: ['jammy']
jdk_vendor: ['Corretto']
container:
Expand All @@ -150,8 +144,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# swift_version: ['nightly-main']
swift_version: ['6.0.2']
swift_version: ['6.1.2']
os_version: ['jammy']
jdk_vendor: ['Corretto']
container:
Expand All @@ -170,8 +163,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# swift_version: ['nightly-main']
swift_version: ['6.0.2']
swift_version: ['6.1.2']
os_version: ['jammy']
jdk_vendor: ['Corretto']
container:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.swift-version
.sdkmanrc

.DS_Store
.build
.idea
Expand Down
3 changes: 2 additions & 1 deletion .licenseignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ Plugins/**/_PluginsShared
Plugins/**/0_PLEASE_SYMLINK*
Plugins/PluginsShared/JavaKitConfigurationShared
Samples/JavaDependencySampleApp/gradle
Sources/_Subprocess/_nio_locks.swift
Sources/_Subprocess/**
Sources/_SubprocessCShims/**
Samples/gradle
13 changes: 1 addition & 12 deletions .unacceptablelanguageignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,5 @@ Sources/SwiftJavaBootstrapJavaTool/SwiftJavaBootstrapJavaTool.swift
Sources/_Subprocess/Platforms/Subprocess+Darwin.swift
Sources/_Subprocess/Platforms/Subprocess+Linux.swift
Sources/_Subprocess/Platforms/Subprocess+Unix.swift
Sources/_Subprocess/Platforms/Subprocess+Unix.swift
Sources/_Subprocess/Platforms/Subprocess+Unix.swift
Sources/_Subprocess/Platforms/Subprocess+Unix.swift
Sources/_Subprocess/Platforms/Subprocess+Unix.swift
Sources/_Subprocess/Platforms/Subprocess+Unix.swift
Sources/_Subprocess/Subprocess+Teardown.swift
Sources/_Subprocess/Subprocess+Teardown.swift
Sources/_Subprocess/Subprocess+Teardown.swift
Sources/_Subprocess/Subprocess+Teardown.swift
Sources/_Subprocess/Subprocess+Teardown.swift
Sources/_Subprocess/Subprocess+Teardown.swift
Sources/_Subprocess/Subprocess+Teardown.swift
Sources/_Subprocess/Teardown.swift
Sources/_Subprocess/Subprocess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(22)
languageVersion = JavaLanguageVersion.of(24)
}
}

Expand Down
51 changes: 29 additions & 22 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Foundation
// Library/Java/JavaVirtualMachines/openjdk-21.jdk/Contents/Home.
func findJavaHome() -> String {
if let home = ProcessInfo.processInfo.environment["JAVA_HOME"] {
print("JAVA_HOME = \(home)")
return home
}

Expand Down Expand Up @@ -85,7 +86,7 @@ let javaIncludePath = "\(javaHome)/include"
let package = Package(
name: "SwiftJava",
platforms: [
.macOS(.v10_15)
.macOS(.v15)
],
products: [
// ==== JavaKit (i.e. calling Java directly Swift utilities)
Expand Down Expand Up @@ -174,12 +175,6 @@ let package = Package(
"JExtractSwiftPlugin"
]
),
.plugin(
name: "JExtractSwiftCommandPlugin",
targets: [
"JExtractSwiftCommandPlugin"
]
),

// ==== Examples

Expand All @@ -195,6 +190,10 @@ let package = Package(
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
.package(url: "https://github.com/apple/swift-system", from: "1.4.0"),

// // FIXME: swift-subprocess stopped supporting 6.0 when it moved into a package;
// // we'll need to drop 6.0 as well, but currently blocked on doing so by swiftpm plugin pending design questions
// .package(url: "https://github.com/swiftlang/swift-subprocess.git", revision: "de15b67f7871c8a039ef7f4813eb39a8878f61a6"),

// Benchmarking
.package(url: "https://github.com/ordo-one/package-benchmark", .upToNextMajor(from: "1.4.0")),
],
Expand Down Expand Up @@ -363,7 +362,8 @@ let package = Package(
"JavaTypes",
"JavaKitShared",
"JavaKitConfigurationShared",
"_Subprocess", // using process spawning
// .product(name: "Subprocess", package: "swift-subprocess")
"_Subprocess",
],
swiftSettings: [
.swiftLanguageMode(.v5),
Expand All @@ -379,6 +379,7 @@ let package = Package(
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SystemPackage", package: "swift-system"),
"JavaKit",
"JavaKitJar",
"JavaKitNetwork",
Expand All @@ -387,11 +388,14 @@ let package = Package(
"JavaKitShared",
"JavaKitConfigurationShared",
],

swiftSettings: [
.swiftLanguageMode(.v5),
.unsafeFlags(["-I\(javaIncludePath)", "-I\(javaPlatformIncludePath)"]),
.enableUpcomingFeature("BareSlashRegexLiterals"),
.define(
"SYSTEM_PACKAGE_DARWIN",
.when(platforms: [.macOS, .macCatalyst, .iOS, .watchOS, .tvOS, .visionOS])),
.define("SYSTEM_PACKAGE"),
]
),

Expand Down Expand Up @@ -419,16 +423,6 @@ let package = Package(
"SwiftJavaTool"
]
),
.plugin(
name: "JExtractSwiftCommandPlugin",
capability: .command(
intent: .custom(verb: "jextract", description: "Extract Java accessors from Swift module"),
permissions: [
]),
dependencies: [
"SwiftJavaTool"
]
),

.testTarget(
name: "JavaKitTests",
Expand Down Expand Up @@ -467,6 +461,15 @@ let package = Package(
]
),

.testTarget(
name: "JavaKitConfigurationSharedTests",
dependencies: ["JavaKitConfigurationShared"],
swiftSettings: [
.swiftLanguageMode(.v5),
.unsafeFlags(["-I\(javaIncludePath)", "-I\(javaPlatformIncludePath)"])
]
),

.testTarget(
name: "JExtractSwiftTests",
dependencies: [
Expand All @@ -480,19 +483,23 @@ let package = Package(

// Experimental Foundation Subprocess Copy
.target(
name: "_CShims",
name: "_SubprocessCShims",
swiftSettings: [
.swiftLanguageMode(.v5)
]
),
.target(
name: "_Subprocess",
dependencies: [
"_CShims",
"_SubprocessCShims",
.product(name: "SystemPackage", package: "swift-system"),
],
swiftSettings: [
.swiftLanguageMode(.v5)
.swiftLanguageMode(.v5),
.define(
"SYSTEM_PACKAGE_DARWIN",
.when(platforms: [.macOS, .macCatalyst, .iOS, .watchOS, .tvOS, .visionOS])),
.define("SYSTEM_PACKAGE"),
]
),
]
Expand Down
Loading