@@ -9,7 +9,7 @@ plugins {
99 `signing`
1010}
1111
12- val baseVersion = " 0.1.0-platform.7 "
12+ val baseVersion = " 0.1.0-platform.8 "
1313val commitHash = System .getenv(" COMMIT_HASH" )
1414val isSnapshot = commitHash != null
1515
@@ -64,7 +64,7 @@ subprojects {
6464 exclude(" META-INF/proguard/**" )
6565 exclude(" META-INF/versions/**" )
6666
67- archiveFileName.set(" ${project.name} .jar" )
67+ archiveFileName.set(" ${rootProject.name} - ${ project.name} .jar" )
6868 }
6969 }
7070
@@ -93,3 +93,50 @@ subprojects {
9393// }
9494// }
9595}
96+
97+ tasks.register(" buildTemplates" ) {
98+ group = " build"
99+ description = " Builds all platform JARs and copies them to run/templates structure"
100+
101+ val platformProjects = listOf (" paper" , " spigot" , " spigot-legacy" , " bungeecord" , " velocity" )
102+
103+ platformProjects.forEach { platform ->
104+ dependsOn(" :platform:$platform :shadowJar" )
105+ }
106+
107+ doLast {
108+ platformProjects.forEach { platform ->
109+ val shadowJarTask = project(" :platform:$platform " ).tasks.named<ShadowJar >(" shadowJar" ).get()
110+ val jarFile = shadowJarTask.archiveFile.get().asFile
111+
112+ val folderName = platform.removeSuffix(" -legacy" )
113+ val templateDir = file(" run/templates/every_$folderName /plugins" )
114+ templateDir.mkdirs()
115+
116+ val targetName = if (platform.endsWith(" -legacy" )) {
117+ " ${rootProject.name} -${platform} .jar.legacy"
118+ } else {
119+ " ${rootProject.name} -${platform} .jar"
120+ }
121+
122+ jarFile.copyTo(File (templateDir, targetName), overwrite = true )
123+ println (" Copied $jarFile to ${File (templateDir, targetName)} " )
124+ }
125+
126+ val waterfallDir = file(" run/templates/every_waterfall" )
127+ waterfallDir.deleteRecursively()
128+ file(" run/templates/every_bungeecord" ).copyRecursively(waterfallDir)
129+ println (" Copied every_bungeecord to every_waterfall" )
130+ }
131+ }
132+
133+ tasks.register<Zip >(" zipTemplates" ) {
134+ group = " build"
135+ description = " Builds templates and creates a zip archive"
136+
137+ dependsOn(" buildTemplates" )
138+
139+ from(" run/templates" )
140+ archiveFileName.set(" templates.zip" )
141+ destinationDirectory.set(file(" build" ))
142+ }
0 commit comments