Skip to content

Commit 5ad011c

Browse files
committed
give library root projects access to other libraries
1 parent af8211e commit 5ad011c

6 files changed

Lines changed: 17 additions & 18 deletions

File tree

build.gradle

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def fillModJson(project, task) {
157157
project.tasks.build.dependsOn task
158158
}
159159

160-
def setUpLibrary(project) {
160+
def setUpLibrary(project, String... dependencies) {
161161
project.apply plugin: 'java-library'
162162
project.apply plugin: 'eclipse'
163163
project.apply plugin: 'idea'
@@ -182,13 +182,19 @@ def setUpLibrary(project) {
182182
mavenCentral()
183183
}
184184

185+
def libraries = getLibraryDependencies(project, dependencies)
186+
185187
project.dependencies {
186188
implementation "net.fabricmc:fabric-loader:${project.rootProject.loader_version}"
187189

188190
implementation "org.apache.logging.log4j:log4j-api:2.19.0"
189191
implementation "org.apache.logging.log4j:log4j-core:2.19.0"
190192

191193
implementation project.dependencies.project(path: ':libraries:core', configuration: 'namedElements')
194+
195+
libraries.each { libraryPath ->
196+
implementation project.dependencies.project(path: libraryPath)
197+
}
192198
}
193199

194200
addPomDependency(project)
@@ -237,7 +243,6 @@ def setUpModule(project, String... dependencies) {
237243
setIntermediaryGeneration(2)
238244
}
239245

240-
def libraries = getLibraryDependencies(project, dependencies)
241246
def modules = getModuleDependencies(project, dependencies)
242247

243248
project.repositories {
@@ -281,9 +286,10 @@ def setUpModule(project, String... dependencies) {
281286
include "org.quiltmc.parsers:json:${project.rootProject.quilt_parsers_version}"
282287
}
283288

284-
libraries.each { libraryPath ->
285-
implementation project.dependencies.project(path: libraryPath)
289+
if (!isCore) {
290+
implementation project.dependencies.project(path: library.path)
286291
}
292+
287293
modules.each { modulePath ->
288294
implementation project.dependencies.project(path: modulePath, configuration: 'namedElements')
289295
}
@@ -424,17 +430,10 @@ def setUpModule(project, String... dependencies) {
424430
setUpJavadoc(project)
425431
}
426432

427-
def getLibraryDependencies(project, String... moduleNames) {
433+
def getLibraryDependencies(project, String... libraryNames) {
428434
def libraries = new ArrayList<>()
429435

430-
if (project.path != ':libraries:core') {
431-
libraries.add(project.parent.path)
432-
}
433-
434-
for (moduleName : moduleNames) {
435-
def i = moduleName.indexOf('-mc')
436-
def libraryName = moduleName.substring(0, i)
437-
436+
for (libraryName : libraryNames) {
438437
libraries.add(":libraries:${libraryName}")
439438
}
440439

libraries/branding/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
setUpLibrary(project)
1+
setUpLibrary(project, 'entrypoints', 'lifecycle-events')

libraries/config/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
setUpLibrary(project)
1+
setUpLibrary(project, 'entrypoints', 'lifecycle-events')
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
setUpLibrary(project)
1+
setUpLibrary(project, 'entrypoints')
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
setUpLibrary(project)
1+
setUpLibrary(project, 'entrypoints', 'lifecycle-events', 'networking')

libraries/networking/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
setUpLibrary(project)
1+
setUpLibrary(project, 'entrypoints', 'lifecycle-events')

0 commit comments

Comments
 (0)