Skip to content

Allow including external projects #4185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: api-14
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,6 @@ buildSrc/src/api
testplugins.settings.gradle.kts
spongeforge.settings.gradle.kts
projects.properties
# External plugin projects
/userplugins/userPluginBuilds
/userplugins/userPlugins
2 changes: 1 addition & 1 deletion SpongeAPI
Submodule SpongeAPI updated 0 files
4 changes: 4 additions & 0 deletions forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ val bootstrapDevProject = commonProject.project(":bootstrap-dev")
val transformersProject = commonProject.project(":modlauncher-transformers")
val libraryManagerProject = commonProject.project(":library-manager")
val testPluginsProject: Project? = rootProject.subprojects.find { "testplugins" == it.name }
val userPluginsProject: Project? = rootProject.subprojects.find { "userplugins" == it.name }

val apiVersion: String by project
val minecraftVersion: String by project
Expand Down Expand Up @@ -215,6 +216,9 @@ dependencies {
testPluginsProject?.also {
runtimeOnly(project(it.path))
}
userPluginsProject?.also {
runtimeOnly(project(it.path))
}
}

val awFiles: Set<File> = files(main.get().resources, forgeMain.resources).filter { it.name.endsWith(".accesswidener") }.files
Expand Down
4 changes: 4 additions & 0 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ val commonProject = parent!!
val transformersProject = commonProject.project(":modlauncher-transformers")
val libraryManagerProject = commonProject.project(":library-manager")
val testPluginsProject: Project? = rootProject.subprojects.find { "testplugins" == it.name }
val userPluginsProject: Project? = rootProject.subprojects.find { "userplugins" == it.name }

val apiVersion: String by project
val minecraftVersion: String by project
Expand Down Expand Up @@ -305,6 +306,9 @@ tasks {

dependsOn(it.tasks.classes)
}
userPluginsProject?.also {
dependsOn(it.tasks.classes)
}

argumentProviders += CommandLineArgumentProvider {
mixinConfigs.asSequence()
Expand Down
16 changes: 16 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ if (projects.contains("neoforge")) {
project(":SpongeNeo").projectDir = file("neoforge")
}

if (projects.contains("userplugins")) {
include(":userplugins")
val userPluginBuilds = file("userplugins/userPluginBuilds")
if (userPluginBuilds.exists()) {
userPluginBuilds.readLines().filter { !it.startsWith("#") && it.isNotBlank()}.forEach {
includeBuild(it)
}
} else {
userPluginBuilds.writeText("# Add paths to your plugin projects here")
}
val userPlugins = file("userplugins/userPlugins")
if (userPlugins.exists().not()) {
userPlugins.writeText("# Add dependencies to your plugins here")
}
}

if (projects.contains("testplugins")) {
include(":testplugins")
}
Expand Down
11 changes: 11 additions & 0 deletions userplugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
val apiVersion: String by project

dependencies {
annotationProcessor(implementation("org.spongepowered:spongeapi:$apiVersion")!!)
val userPlugins = file("userPlugins")
if (userPlugins.exists()) {
userPlugins.readLines().filter { !it.startsWith("#") && it.isNotBlank() }.forEach {
implementation(it)
}
}
}
4 changes: 4 additions & 0 deletions vanilla/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ val bootstrapDevProject = commonProject.project(":bootstrap-dev")
val transformersProject = commonProject.project(":modlauncher-transformers")
val libraryManagerProject = commonProject.project(":library-manager")
val testPluginsProject: Project? = rootProject.subprojects.find { "testplugins" == it.name }
val userPluginsProject: Project? = rootProject.subprojects.find { "userplugins" == it.name }

val apiVersion: String by project
val apiJavaTarget: String by project
Expand Down Expand Up @@ -246,6 +247,9 @@ dependencies {
testPluginsProject?.also {
runtimeOnly(project(it.path))
}
userPluginsProject?.also {
runtimeOnly(project(it.path))
}
}

minecraft {
Expand Down