Files
MCCustomSkinLoader/BuildScripts/sources.gradle
T
ZekerZhayard 1b2a4dc260 Make it easier to build the development environment. (#133)
* Fix the warning about removing duplicate source roots when open the project with Intellij IDEA.

* Add Gradle wrapper.

* CustomSkinLoader can be loaded in Forge development environment now.

* CustomSkinLoader can be loaded in Fabric development environment now.
2021-01-03 02:53:57 +08:00

46 lines
1.5 KiB
Groovy

// If you want to add dependent project sources for annotation processors in current project,
// use `projectImplementation project(":xxx")` instead of `dependencies { implementation project(":xxx") }`
class ProjectContainer {
static def implementationProjects = [:]
}
void projectImplementation(Project otherProject) {
dependencies {
implementation otherProject, {
transitive = false
}
}
ProjectContainer.implementationProjects.putIfAbsent project, []
ProjectContainer.implementationProjects.get project add otherProject
}
ext {
projectImplementation = this.&projectImplementation
}
// We need to add sourceSets at compile time to avoid IntelliJ IDEA from removing duplicated source roots and to avoid Eclipse add source dirs twice.
// The reason of that we don't just dependent other subprojects is to let Mixin AP work correctly.
task setupSourceSets {
doLast {
sourceSets.main {
java {
ProjectContainer.implementationProjects.get(project).forEach({
it.sourceSets.main.java.srcDirs.forEach({ targetDir ->
srcDir targetDir
})
})
}
resources {
ProjectContainer.implementationProjects.get(project).forEach({
it.sourceSets.main.resources.srcDirs.forEach({ targetDir ->
srcDir targetDir
})
})
}
}
}
}
deobfCompileDummyTask.dependsOn setupSourceSets