Skip to content

Commit cb672a1

Browse files
committed
patch(build): Properly expose dependencies
The tooling API is now bundled into the JAR. Other dependencies are exposed via feature variants. Consumers using figwheel should depend on those specifically. Though in many cases, they might have direct dependencies avoiding the need to use the feature variants. We likely won't be able to publish this to Clojars, due to their current lack of support for Gradle's module metadata. However, we should be able to publish to Central while waiting for any solution from Clojars themselves.
1 parent 9506f02 commit cb672a1

File tree

1 file changed

+35
-21
lines changed

1 file changed

+35
-21
lines changed

build.gradle.kts

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,55 @@ java {
2020
languageVersion.set(JavaLanguageVersion.of(8))
2121
}
2222
withSourcesJar()
23+
24+
registerFeature("figwheelRepl") {
25+
usingSourceSet(sourceSets["main"])
26+
}
27+
registerFeature("figwheelMain") {
28+
usingSourceSet(sourceSets["main"])
29+
}
2330
}
2431

2532
dependencies {
26-
implementation("org.clojure:clojure:1.11.1")
27-
implementation("org.gradle:gradle-tooling-api:7.5")
28-
testRuntimeOnly("org.ajoberstar:jovial:0.3.0")
29-
devRuntimeOnly("org.slf4j:slf4j-simple:1.7.36")
33+
// clojure
34+
api("org.clojure:clojure:1.11.1")
3035

31-
compileOnly("org.clojure:clojurescript:1.11.60")
32-
devImplementation("org.clojure:clojurescript:1.11.60")
36+
// gradle
37+
compileOnlyApi("org.gradle:gradle-tooling-api:7.5")
3338

34-
compileOnly("nrepl:nrepl:0.9.0")
35-
compileOnly("cider:piggieback:0.5.3")
36-
devImplementation("cider:piggieback:0.5.3")
39+
// clojurescript and nrepl
40+
api("org.clojure:clojurescript:1.11.60")
41+
api("nrepl:nrepl:0.9.0")
42+
api("cider:piggieback:0.5.3")
3743

38-
compileOnly("com.bhauman:figwheel-repl:0.2.18")
39-
devImplementation("com.bhauman:figwheel-repl:0.2.18")
44+
// figwheel repl
45+
"figwheelReplApi"("com.bhauman:figwheel-repl:0.2.18")
46+
"figwheelReplApi"("ring:ring-jetty-adapter:1.9.5")
47+
"figwheelReplApi"("org.eclipse.jetty.websocket:websocket-server:9.4.7.v20180619")
4048

41-
compileOnly("ring:ring-jetty-adapter:1.9.5")
42-
devImplementation("ring:ring-jetty-adapter:1.9.5")
43-
compileOnly("org.eclipse.jetty.websocket:websocket-server:9.4.7.v20180619")
44-
devImplementation("org.eclipse.jetty.websocket:websocket-server:9.4.7.v20180619")
49+
// figwheel main
50+
"figwheelMainApi"("com.bhauman:figwheel-main:0.2.18")
4551

46-
compileOnly("com.bhauman:figwheel-main:0.2.18")
47-
devImplementation("com.bhauman:figwheel-main:0.2.18")
52+
// testing
53+
testRuntimeOnly("org.ajoberstar:jovial:0.3.0")
54+
devRuntimeOnly("org.slf4j:slf4j-simple:1.7.36")
4855
}
4956

5057
tasks.withType<Test>() {
5158
useJUnitPlatform()
5259
}
5360

61+
tasks.named<Jar>("jar") {
62+
dependsOn(configurations.compileClasspath)
63+
from({
64+
configurations.compileClasspath.files { dep ->
65+
dep.getGroup() == "org.gradle"
66+
}.map {
67+
zipTree(it).matching { include("org/gradle/**/*") }
68+
}
69+
})
70+
}
71+
5472
publishing {
5573
repositories {
5674
maven {
@@ -69,7 +87,3 @@ publishing {
6987
}
7088
}
7189
}
72-
73-
tasks.withType<GenerateModuleMetadata>() {
74-
enabled = false
75-
}

0 commit comments

Comments
 (0)