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

Fetching dependencies declared in swift-java.config #191

Merged
merged 25 commits into from
Dec 10, 2024

Conversation

ktoso
Copy link
Collaborator

@ktoso ktoso commented Nov 29, 2024

This will allow Swift users to fetch Java dependencies and "just use them".

It will become a pre-step to extract steps, such that we can "pull that dependency and expose the API I need from it" while we prepare the whole classpath for it etc.

// MyProject/Sources/JavaReactiveStreams/swift-java.config
{
  "dependencies": [
    "org.reactivestreams:reactive-streams:1.0.4"
  ],
  // FIXME: we should not need to express this classpath!
  "classPath": "JavaKit/build/classes/java/main",
}

So effectively we can expose existing Java libraries using such mini modules and such config file.

Example:

Java2Swift --fetch Samples/JavaDependencySampleApp/Sources/JavaKitExample/swift-java.config

[swift-java] Initialize JVM with classpath: JavaKit/build/classes/java/main
[debug][swift-java] Fetch dependencies: ["org.reactivestreams:reactive-streams:1.0.4"]
[trace][swift-java][JavaVirtualMachine] init complete JavaVirtualMachine(0x00000001049ef450)
[info][swift-java/DependencyResolver] Fetch dependencies: [org.reactivestreams:reactive-streams:1.0.4]
[info][swift-java/DependencyResolver] projectBaseDirectoryString =  /Users/ktoso/code/swift-java
[info][swift-java/DependencyResolver] Gradle API not available on classpath, bootstrap DependencyResolver dependencies: [dev.gradleplugins:gradle-api:8.10.1]
[info][swift-java/DependencyResolver] Bootstrap gradle-api for DependencyResolver: [dev.gradleplugins:gradle-api:8.10.1]
[info][swift-java/DependencyResolver] Bootstrap dependencies using project at: /var/folders/hn/c22y4jsn4j74mw23_kpgn88w0000gn/T/swift-java-dependency-resolver14393824301967899957
[info][swift-java/DependencyResolver] Prepared dependency resolver bootstrap classpath: 48 entries
[info][swift-java/DependencyResolver] Cache DependencyResolver dependencies classpath at: '/Users/ktoso/code/swift-java/.build/JavaKitDependencyResolver.classpath.swift-java'. Subsequent dependency resolutions will use gradle-api.
[info][swift-java] Resolved classpath for 1 dependencies of 'JavaKitExample': classpath entries: 3... done.
[debug][swift-java] Classpath entry: /private/var/folders/hn/c22y4jsn4j74mw23_kpgn88w0000gn/T/java-swift-dependencies6600421546298984751/build/classes/java/main
[debug][swift-java] Classpath entry: /private/var/folders/hn/c22y4jsn4j74mw23_kpgn88w0000gn/T/java-swift-dependencies6600421546298984751/build/resources/main
[debug][swift-java] Classpath entry: /Users/ktoso/.gradle/caches/modules-2/files-2.1/org.reactivestreams/reactive-streams/1.0.4/3864a1320d97d7b045f729a326e1e077661f31b7/reactive-streams-1.0.4.jar

@ktoso ktoso force-pushed the wip-dependency-fetching branch from fe7ee50 to 4d0b38f Compare December 6, 2024 02:15
@ktoso ktoso force-pushed the wip-dependency-fetching branch from e1713b6 to 69212ce Compare December 9, 2024 06:07
@ktoso ktoso changed the title Prepare fetching dependencies declared in swift-java.config Fetching dependencies declared in swift-java.config Dec 10, 2024
@ktoso ktoso merged commit 79882d8 into swiftlang:main Dec 10, 2024
12 checks passed
@ktoso ktoso deleted the wip-dependency-fetching branch December 10, 2024 02:00
@ktoso
Copy link
Collaborator Author

ktoso commented Dec 10, 2024

Squashed it all, will do followups to cleanup and add more things to this workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant