Skip to content
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9b624db
Add repositories configuration option in swift-java.config
bo2themax Aug 26, 2025
7bf0de7
Add a repositories configuration example and fix artifactUrls output
bo2themax Aug 26, 2025
6a126ec
Update naming convention
bo2themax Aug 26, 2025
ef69b18
Rename descriptionGradleStyle
bo2themax Aug 28, 2025
5a6616b
Add JavaJson Example
bo2themax Aug 28, 2025
9416c56
Change JavaRepositoryDescriptor to enum
bo2themax Aug 28, 2025
149358a
Add JavaRepositoryTests to test dependencies resolving with custom re…
bo2themax Aug 28, 2025
52243ad
Add documentation for swift-java resolve
bo2themax Aug 28, 2025
764d586
Add another non-resolvable config to verify artifactUrls
bo2themax Aug 28, 2025
7f6cd04
Move JavaRepositoryTests to SwiftJavaToolTests
bo2themax Aug 29, 2025
8bb6cfa
Rename JavaJson to OrgAndrejsJson
bo2themax Aug 29, 2025
c57c017
Add referenced issue in the document
bo2themax Aug 29, 2025
ab8f3ab
[Test] Change minified json to pretty printed
bo2themax Aug 29, 2025
f6f9800
Remove System dependency from OrgAndrejsJsonTests
bo2themax Aug 29, 2025
de3dab3
Add more referenced documents for JavaRepositoryDescriptor
bo2themax Aug 29, 2025
f6ad15f
[Test] Add a SimpleJavaProject to JavaRepositoryTests
bo2themax Aug 29, 2025
8e0687b
Merge branch 'swiftlang:main' into main
bo2themax Aug 29, 2025
a61c518
[Test] Update error messages in JavaRepositoryTests.swift
bo2themax Aug 29, 2025
967ccaf
[Test] Add missing license headers
bo2themax Aug 31, 2025
8fe1360
Add JavaResolver in SwiftJavaToolLib to resolve for ResolveCommand
bo2themax Sep 1, 2025
be87290
[Test] Move SwiftJavaToolTests/JavaRepositoryTests
bo2themax Sep 1, 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
Prev Previous commit
Next Next commit
Update naming convention
  • Loading branch information
bo2themax committed Aug 26, 2025
commit 6a126ec95b37b9f7801bc365122220d2e1efff34
15 changes: 8 additions & 7 deletions Sources/SwiftJavaTool/Commands/ResolveCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ extension SwiftJava.ResolveCommand {
return
}

var repositoriesToResolve: [JavaRepositoryDescriptor] = []
var configuredRepositories: [JavaRepositoryDescriptor] = []

if let repositories = config.repositories {
repositoriesToResolve += repositories
configuredRepositories += repositories
}

if !repositoriesToResolve.contains(where: { $0.type == .mavenCentral }) {
if !configuredRepositories.contains(where: { $0.type == .mavenCentral }) {
// swift-java dependencies are originally located in mavenCentral
repositoriesToResolve.append(JavaRepositoryDescriptor(type: .mavenCentral))
configuredRepositories.append(JavaRepositoryDescriptor(type: .mavenCentral))
}

let dependenciesClasspath =
try await resolveDependencies(swiftModule: swiftModule, dependencies: dependenciesToResolve, repositories: repositoriesToResolve)
try await resolveDependencies(swiftModule: swiftModule, dependencies: dependenciesToResolve, repositories: configuredRepositories)

// FIXME: disentangle the output directory from SwiftJava and then make it a required option in this Command
guard let outputDirectory = self.commonOptions.outputDirectory else {
Expand All @@ -102,11 +102,12 @@ extension SwiftJava.ResolveCommand {


/// Resolves Java dependencies from swift-java.config and returns classpath information.
///
///
/// - Parameters:
/// - swiftModule: module name from --swift-module. e.g.: --swift-module MySwiftModule
/// - dependencies: parsed maven-style dependency descriptors (groupId:artifactId:version)
/// from Sources/MySwiftModule/swift-java.config "dependencies" array.
/// - repositories: repositories used to resolve dependencies
///
/// - Throws:
func resolveDependencies(
Expand All @@ -133,7 +134,7 @@ extension SwiftJava.ResolveCommand {
/// Resolves maven-style dependencies from swift-java.config under temporary project directory.
///
/// - Parameter dependencies: maven-style dependencies to resolve
/// - Parameter repositories: maven-style repositories to resolve
/// - Parameter repositories: repositories used to resolve dependencies
/// - Returns: Colon-separated classpath
func resolveDependencies(dependencies: [JavaDependencyDescriptor], repositories: [JavaRepositoryDescriptor]) async -> String {
let workDir = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)
Expand Down