4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-05-29 16:54:38 +02:00

move settings from build file into gradle.properties

This commit is contained in:
LordMZTE 2020-08-14 15:06:38 +02:00
parent 54fc2f0fd0
commit 5844a7c488
3 changed files with 14 additions and 18 deletions

View file

@ -7,14 +7,6 @@ import org.jlleitschuh.gradle.ktlint.reporter.ReporterType.HTML
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType.JSON
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN
//settings for manifest and stuff
val specTitle = "ModPackTools"
val artifact = specTitle.toLowerCase()
val jarName = specTitle
val implTitle = "ley.anvil.modpacktools"
val jarVersion = "1.2-SNAPSHOT"
group = "ley.anvil"
application.mainClassName = "ley.anvil.modpacktools.Main"
plugins {
@ -45,9 +37,8 @@ dependencies {
"ley.anvil:addonscript:1.0-SNAPSHOT",
//Kotlin
"org.jetbrains.kotlin:kotlin-reflect:1.3.72",
"org.jetbrains.kotlin:kotlin-stdlib-jdk8",
"org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.3.8",
"org.jetbrains.kotlin:kotlin-reflect:1.3.72",
//IO
"com.squareup.okhttp3:okhttp:4.8.1", //HTTP client
@ -91,11 +82,11 @@ task("fatJar", Jar::class) {
group = "build" //sets group in intelliJ's side bar
manifest.attributes.apply {
set("Main-Class", application.mainClassName)
set("Implementation-Version", jarVersion)
set("Specification-Title", specTitle)
set("Implementation-Title", implTitle)
set("Implementation-Version", findProperty("jarVersion"))
set("Specification-Title", findProperty("specTitle"))
set("Implementation-Title", findProperty("implTitle"))
}
archiveBaseName.set(jarName)
archiveBaseName.set("${findProperty("jarName")}-${findProperty("jarVersion")}")
from(
configurations.runtimeClasspath.get()
.map {if(it.isDirectory) it else zipTree(it)}
@ -106,7 +97,7 @@ task("fatJar", Jar::class) {
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifactId = artifact
artifactId = findProperty("artifact") as String
artifact(tasks["fatJar"])
}
}

6
gradle.properties Normal file
View file

@ -0,0 +1,6 @@
specTitle = ModPackTools
jarName = ModPackTools
artifact = modpacktools
implTitle = ley.anvil.modpacktools
jarVersion = 1.2-SNAPSHOT
group = ley.anvil

View file

@ -1,6 +1,5 @@
package ley.anvil.modpacktools.commands
import com.google.gson.stream.JsonReader
import ley.anvil.addonscript.curse.ManifestJSON
import ley.anvil.modpacktools.GSON
import ley.anvil.modpacktools.MPJH
@ -9,12 +8,12 @@ import ley.anvil.modpacktools.command.CommandReturn.Companion.fail
import ley.anvil.modpacktools.command.CommandReturn.Companion.success
import ley.anvil.modpacktools.command.ICommand
import ley.anvil.modpacktools.command.LoadCommand
import ley.anvil.modpacktools.util.readAsJson
import net.sourceforge.argparse4j.ArgumentParsers
import net.sourceforge.argparse4j.impl.type.FileArgumentType
import net.sourceforge.argparse4j.inf.ArgumentParser
import net.sourceforge.argparse4j.inf.Namespace
import java.io.File
import java.io.FileReader
import java.io.FileWriter
@LoadCommand
@ -42,7 +41,7 @@ object Import : ICommand {
println("Converting...")
MPJH.modpackJsonFile.parentFile.mkdirs()
val mpjWriter = FileWriter(MPJH.modpackJsonFile)
GSON.fromJson<ManifestJSON>(JsonReader(FileReader(manifest)), ManifestJSON::class.java).toAS().write(mpjWriter)
GSON.fromJson<ManifestJSON>(manifest.readAsJson(), ManifestJSON::class.java).toAS().write(mpjWriter)
mpjWriter.close()
return success("Converted sucessfully")
}