v0.8.19 fix fatjar

This commit is contained in:
az 2021-11-24 22:04:53 +01:00
parent 7b9ad38bcf
commit f2fcc5ab77
4 changed files with 19 additions and 44 deletions

View file

@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization'
group = 'org.domaindrivenarchitecture.provs' group = 'org.domaindrivenarchitecture.provs'
version = '0.8.18' version = '0.8.19'
repositories { repositories {
mavenCentral() mavenCentral()
@ -83,30 +83,17 @@ dependencies {
} }
//create a single Jar with all dependencies excl. Kotlin libs //create a single Jar with all dependencies excl. Kotlin libs without version-number
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
}
archivesBaseName = project.name + '-all'
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
//create a single Jar with all dependencies excl. Kotlin libs without version-number but with suffix "latest"
task fatJarLatest(type: Jar) { task fatJarLatest(type: Jar) {
doFirst { from {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
} }
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
manifest { manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example', attributes 'Implementation-Title': 'Fatjar of provs',
'Implementation-Version': project.version, 'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt' 'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
} }
@ -127,7 +114,7 @@ task uberjarWorkplace(type: Jar) {
} }
manifest { manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example', attributes 'Implementation-Title': 'Uberjar of provs',
'Implementation-Version': project.version, 'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt' 'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
} }

View file

@ -10,20 +10,3 @@ import java.io.FileWriter
@Serializable @Serializable
class UserConfig(val userName: String, val gitEmail: String? = null, val gpg: KeyPairSource? = null, val ssh: KeyPairSource? = null) class UserConfig(val userName: String, val gitEmail: String? = null, val gpg: KeyPairSource? = null, val ssh: KeyPairSource? = null)
// -------------------------------------------- file methods ------------------------------------
@Suppress("unused")
fun readUserConfigFromFile(filename: String = "UserConfig.json") : UserConfig {
// read from file
val inputAsString = BufferedReader(FileReader(filename)).use { it.readText() }
// serializing objects
return Json.decodeFromString(UserConfig.serializer(), inputAsString)
}
fun writeUserConfigToFile(config: UserConfig) {
val fileName = "UserConfig.json"
FileWriter(fileName).use { it.write(Json.encodeToString(UserConfig.serializer(), config)) }
}

View file

@ -1,11 +1,13 @@
package org.domaindrivenarchitecture.provs.workplace.application package org.domaindrivenarchitecture.provs.workplace.application
import org.domaindrivenarchitecture.provs.core.* import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.core.local
import org.domaindrivenarchitecture.provs.core.remote
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.GopassSecretSource import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.GopassSecretSource
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecretSource import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecretSource
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig
import java.lang.RuntimeException import java.io.File
/** /**
* Provisions according to the options either a meissa workplace, reposOnly or gopassOnly. * Provisions according to the options either a meissa workplace, reposOnly or gopassOnly.
@ -37,9 +39,12 @@ private fun provision(cliCommand: CliCommand) {
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
println( println(
"Error: File\u001b[31m $filename \u001b[0m was not found.\n" + "Error: File\u001b[31m $filename \u001b[0m was not found.\n" +
"Pls copy file \u001B[31m MeissaWorkplaceConfigExample.yaml \u001B[0m to file \u001B[31m $filename \u001B[0m " + "Pls copy file \u001B[31m WorkplaceConfigExample.yaml \u001B[0m to file \u001B[31m $filename \u001B[0m " +
"and change the content according to your needs.\n" "and change the content according to your needs.\n"
) )
// provide example config
File("WorkplaceConfigExample.yaml").writeText("type: \"MINIMAL\"\n")
} }
} }

View file

@ -29,7 +29,7 @@ internal fun getConfig(filename: String = "WorkplaceConfig.json"): WorkplaceConf
} }
@Api @Api
internal fun writeConfig(config: WorkplaceConfig, fileName: String = "WorkplaceConfig.yaml") { internal fun writeConfig(config: WorkplaceConfig, fileName: String = "WorkplaceConfigExample.yaml") {
if (fileName.lowercase().endsWith(".yaml")) { if (fileName.lowercase().endsWith(".yaml")) {
FileWriter(fileName).use { FileWriter(fileName).use {
it.write( it.write(