mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 02:26:00 +01:00
Add webapp.zip to release outputs and move version substitution from runtime to build-time
This commit is contained in:
parent
41bd685bfb
commit
3193912914
@ -3,9 +3,6 @@ plugins {
|
|||||||
id ( "io.github.goooler.shadow" )
|
id ( "io.github.goooler.shadow" )
|
||||||
}
|
}
|
||||||
|
|
||||||
val Project.releaseDirectory: File
|
|
||||||
get() = rootProject.projectDir.resolve("build/release")
|
|
||||||
|
|
||||||
tasks.shadowJar {
|
tasks.shadowJar {
|
||||||
archiveFileName = "${project.name}-${project.version}-shadow.jar"
|
archiveFileName = "${project.name}-${project.version}-shadow.jar"
|
||||||
}
|
}
|
||||||
|
5
buildSrc/src/main/kotlin/release.kt
Normal file
5
buildSrc/src/main/kotlin/release.kt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import org.gradle.api.Project
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
val Project.releaseDirectory: File
|
||||||
|
get() = rootProject.projectDir.resolve("build/release")
|
@ -43,8 +43,17 @@ tasks.register("zipWebapp", type = Zip::class) {
|
|||||||
archiveFileName = "webapp.zip"
|
archiveFileName = "webapp.zip"
|
||||||
destinationDirectory = file("src/main/resources/de/bluecolored/bluemap/")
|
destinationDirectory = file("src/main/resources/de/bluecolored/bluemap/")
|
||||||
|
|
||||||
|
val replacements = mapOf(
|
||||||
|
"version" to project.version
|
||||||
|
)
|
||||||
|
|
||||||
|
inputs.properties(replacements)
|
||||||
inputs.dir("webapp/dist/")
|
inputs.dir("webapp/dist/")
|
||||||
outputs.file("src/main/resources/de/bluecolored/bluemap/webapp.zip")
|
outputs.file("src/main/resources/de/bluecolored/bluemap/webapp.zip")
|
||||||
|
|
||||||
|
filesMatching(listOf(
|
||||||
|
"index.html",
|
||||||
|
)) { expand(properties) }
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.processResources {
|
tasks.processResources {
|
||||||
@ -55,6 +64,14 @@ tasks.getByName("sourcesJar") {
|
|||||||
dependsOn("zipWebapp")
|
dependsOn("zipWebapp")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register<CopyFileTask>("release") {
|
||||||
|
group = "publishing"
|
||||||
|
dependsOn("zipWebapp")
|
||||||
|
|
||||||
|
inputFile = tasks.getByName("zipWebapp").outputs.files.singleFile
|
||||||
|
outputFile = releaseDirectory.resolve("bluemap-${project.version}-webapp.zip")
|
||||||
|
}
|
||||||
|
|
||||||
tasks.clean {
|
tasks.clean {
|
||||||
doFirst {
|
doFirst {
|
||||||
if (!file("webapp/dist/").deleteRecursively())
|
if (!file("webapp/dist/").deleteRecursively())
|
||||||
|
@ -114,12 +114,6 @@ public void updateFiles() throws IOException {
|
|||||||
// extract zip to webroot
|
// extract zip to webroot
|
||||||
Files.createDirectories(webRoot);
|
Files.createDirectories(webRoot);
|
||||||
FileHelper.extractZipFile(zippedWebapp, webRoot, StandardCopyOption.REPLACE_EXISTING);
|
FileHelper.extractZipFile(zippedWebapp, webRoot, StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
// set version in index.html
|
|
||||||
Path indexFile = webRoot.resolve("index.html");
|
|
||||||
String indexContent = Files.readString(indexFile);
|
|
||||||
indexContent = indexContent.replace("%version%", BlueMap.VERSION);
|
|
||||||
Files.writeString(indexFile, indexContent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal", "unused", "MismatchedQueryAndUpdateOfCollection"})
|
@SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal", "unused", "MismatchedQueryAndUpdateOfCollection"})
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<meta name="description"
|
<meta name="description"
|
||||||
content="BlueMap is a tool that generates 3D maps of your Minecraft worlds and displays them in your browser">
|
content="BlueMap is a tool that generates 3D maps of your Minecraft worlds and displays them in your browser">
|
||||||
<meta name="version" content="%version%">
|
<meta name="version" content="${version}">
|
||||||
<meta name="keywords" content="bluemap, map, minecraft, minecraft map">
|
<meta name="keywords" content="bluemap, map, minecraft, minecraft map">
|
||||||
<meta name="theme-color" content="#006EDE">
|
<meta name="theme-color" content="#006EDE">
|
||||||
<meta name="og:site_name" content="BlueMap">
|
<meta name="og:site_name" content="BlueMap">
|
||||||
|
Loading…
Reference in New Issue
Block a user