Skip to content

Commit dd090b7

Browse files
committed
Allow including external projects
1 parent e624c20 commit dd090b7

File tree

7 files changed

+43
-1
lines changed

7 files changed

+43
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,6 @@ buildSrc/src/api
8585
testplugins.settings.gradle.kts
8686
spongeforge.settings.gradle.kts
8787
projects.properties
88+
# External plugin projects
89+
/userplugins/userPluginBuilds
90+
/userplugins/userPlugins

forge/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ val bootstrapDevProject = commonProject.project(":bootstrap-dev")
2525
val transformersProject = commonProject.project(":modlauncher-transformers")
2626
val libraryManagerProject = commonProject.project(":library-manager")
2727
val testPluginsProject: Project? = rootProject.subprojects.find { "testplugins" == it.name }
28+
val userPluginsProject: Project? = rootProject.subprojects.find { "userplugins" == it.name }
2829

2930
val apiVersion: String by project
3031
val minecraftVersion: String by project
@@ -215,6 +216,9 @@ dependencies {
215216
testPluginsProject?.also {
216217
runtimeOnly(project(it.path))
217218
}
219+
userPluginsProject?.also {
220+
runtimeOnly(project(it.path))
221+
}
218222
}
219223

220224
val awFiles: Set<File> = files(main.get().resources, forgeMain.resources).filter { it.name.endsWith(".accesswidener") }.files

neoforge/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ val commonProject = parent!!
2121
val transformersProject = commonProject.project(":modlauncher-transformers")
2222
val libraryManagerProject = commonProject.project(":library-manager")
2323
val testPluginsProject: Project? = rootProject.subprojects.find { "testplugins" == it.name }
24+
val userPluginsProject: Project? = rootProject.subprojects.find { "userplugins" == it.name }
2425

2526
val apiVersion: String by project
2627
val minecraftVersion: String by project
@@ -305,6 +306,9 @@ tasks {
305306

306307
dependsOn(it.tasks.classes)
307308
}
309+
userPluginsProject?.also {
310+
dependsOn(it.tasks.classes)
311+
}
308312

309313
argumentProviders += CommandLineArgumentProvider {
310314
mixinConfigs.asSequence()

settings.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,22 @@ if (projects.contains("neoforge")) {
110110
project(":SpongeNeo").projectDir = file("neoforge")
111111
}
112112

113+
if (projects.contains("userplugins")) {
114+
include(":userplugins")
115+
val userPluginBuilds = file("userplugins/userPluginBuilds")
116+
if (userPluginBuilds.exists()) {
117+
userPluginBuilds.readLines().filter { !it.startsWith("#") && it.isNotBlank()}.forEach {
118+
includeBuild(it)
119+
}
120+
} else {
121+
userPluginBuilds.writeText("# Add paths to your plugin projects here")
122+
}
123+
val userPlugins = file("userplugins/userPlugins")
124+
if (userPlugins.exists().not()) {
125+
userPlugins.writeText("# Add dependencies to your plugins here")
126+
}
127+
}
128+
113129
if (projects.contains("testplugins")) {
114130
include(":testplugins")
115131
}

userplugins/build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
val apiVersion: String by project
2+
3+
dependencies {
4+
annotationProcessor(implementation("org.spongepowered:spongeapi:$apiVersion")!!)
5+
val userPlugins = file("userPlugins")
6+
if (userPlugins.exists()) {
7+
userPlugins.readLines().filter { !it.startsWith("#") && it.isNotBlank() }.forEach {
8+
implementation(it)
9+
}
10+
}
11+
}

vanilla/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ val bootstrapDevProject = commonProject.project(":bootstrap-dev")
1414
val transformersProject = commonProject.project(":modlauncher-transformers")
1515
val libraryManagerProject = commonProject.project(":library-manager")
1616
val testPluginsProject: Project? = rootProject.subprojects.find { "testplugins" == it.name }
17+
val userPluginsProject: Project? = rootProject.subprojects.find { "userplugins" == it.name }
1718

1819
val apiVersion: String by project
1920
val apiJavaTarget: String by project
@@ -246,6 +247,9 @@ dependencies {
246247
testPluginsProject?.also {
247248
runtimeOnly(project(it.path))
248249
}
250+
userPluginsProject?.also {
251+
runtimeOnly(project(it.path))
252+
}
249253
}
250254

251255
minecraft {

0 commit comments

Comments
 (0)