Skip to content

Commit aa4e11f

Browse files
committed
cleanup JavaKit's DependencyResolver
1 parent 69212ce commit aa4e11f

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

JavaKit/build.gradle

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import groovy.json.JsonSlurper
16-
1715
plugins {
1816
id("build-logic.java-library-conventions")
1917
}
@@ -31,21 +29,8 @@ java {
3129
}
3230
}
3331

34-
List<String> loadDependenciesFromSwiftJavaJSON() {
35-
def jsonFile = file("../Sources/JavaKitDependencyResolver/swift-java.config")
36-
if (!jsonFile.exists()) {
37-
throw new FileNotFoundException("Dependencies must be declared in Swift config file! Not found: ${jsonFile.absolutePath}")
38-
}
39-
def jsonContent = new JsonSlurper().parseText(jsonFile.text)
40-
return jsonContent.dependencies
41-
}
42-
4332
dependencies {
44-
// We load dependencies from one source of truth: the swift-java.config of module
45-
// that is used to access this Java code.
46-
loadDependenciesFromSwiftJavaJSON().each {
47-
implementation(it)
48-
}
33+
implementation("dev.gradleplugins:gradle-api:8.10.1")
4934

5035
testImplementation(platform("org.junit:junit-bom:5.10.0"))
5136
testImplementation("org.junit.jupiter:junit-jupiter")
@@ -57,3 +42,12 @@ tasks.test {
5742
events("passed", "skipped", "failed")
5843
}
5944
}
45+
46+
// Task necessary to bootstrap
47+
task printRuntimeClasspath {
48+
def runtimeClasspath = sourceSets.main.runtimeClasspath
49+
inputs.files(runtimeClasspath)
50+
doLast {
51+
println("CLASSPATH:${runtimeClasspath.asPath}")
52+
}
53+
}

JavaKit/gradlew

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../gradlew

JavaKit/gradlew.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../gradlew.bat

JavaKit/src/main/java/org/swift/javakit/dependencies/DependencyResolver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ private static String resolveDependenciesUsingAPI(File projectDir, String[] depe
193193
.filter(s -> s.startsWith(COMMAND_OUTPUT_LINE_PREFIX_CLASSPATH))
194194
.map(s -> s.substring(COMMAND_OUTPUT_LINE_PREFIX_CLASSPATH.length()))
195195
.findFirst().orElseThrow(() -> new RuntimeException("Could not find classpath output from ':printRuntimeClasspath' task."));
196-
simpleLog("DEPENDENCY BUILD PATH = " + projectDir.getAbsolutePath());
197196

198197
// remove output directories of the project we used for the dependency resolution
199198
var classpath = Arrays.stream(classpathString

0 commit comments

Comments
 (0)