Clean up gradle build

This commit is contained in:
SiboVG 2024-03-23 14:45:43 +01:00
parent d32faea6c6
commit dbf2838cae
3 changed files with 10 additions and 34 deletions

View File

@ -100,10 +100,9 @@ shadowJar {
archiveBaseName.set('OpenRocket')
archiveVersion.set(buildProperties['build.version'])
archiveClassifier.set('')
dependsOn(distTar, distZip)
}
//shadowJar.dependsOn([':core:serializeEngines'])
// Package the application for distribution.
tasks.register('dist') {
group = 'info.openrocket'

View File

@ -11,13 +11,10 @@ java {
modularity.inferModulePath = false
}
Properties props = new Properties()
try {
props.load(file('./src/main/resources/build.properties').newDataInputStream())
} catch (Exception ex) {
throw new Exception("Missing build.properties. file: " + ex.getMessage())
}
version = props['build.version']
def buildProperties = new Properties()
file('./src/main/resources/build.properties').withInputStream { buildProperties.load(it) }
group = 'info.openrocket'
version = buildProperties['build.version']
repositories {
mavenCentral()
@ -62,17 +59,14 @@ def serializedEnginesPath = './src/main/resources/datafiles/thrustcurves/thrustc
def serializedEnginesPathDist = './build/resources/main/datafiles/thrustcurves/thrustcurves.ser'
// Executes the serialization of engines from ThrustCurve for a build.
tasks.register('serializeEngines') {
group = 'info.openrocket'
dependsOn serializeEnginesDelete
dependsOn serializeEnginesExecute
}
tasks.register('serializeEnginesDist') {
group = 'info.openrocket'
dependsOn serializeEnginesExecuteDist
}
// Deletes the serialize engine file if it exists.
tasks.register('serializeEnginesDelete', Delete) {
group = 'info.openrocket'
delete fileTree(serializedEnginesPath)
doFirst {
@ -84,7 +78,6 @@ tasks.register('serializeEnginesDelete', Delete) {
}
// Executes the Java serialization program to fetch ThrustCurve rocket data and serialize it.
tasks.register('serializeEnginesExecute', JavaExec) {
group = 'info.openrocket'
dependsOn serializeEnginesDelete
workingDir new File(projectDir, 'build/tmp')
classpath = sourceSets.main.runtimeClasspath
@ -103,7 +96,6 @@ tasks.register('serializeEnginesExecute', JavaExec) {
// TODO: Shouldn't need a seperate task, but the args are not changing when dynamically updating
// the variable.
tasks.register('serializeEnginesExecuteDist', JavaExec) {
group = 'info.openrocket'
dependsOn serializeEnginesDelete
workingDir new File(projectDir, 'build/tmp')
classpath = sourceSets.main.runtimeClasspath
@ -119,7 +111,6 @@ tasks.register('serializeEnginesExecuteDist', JavaExec) {
}
// Validates that the serialize engines file exists.
tasks.register('serializeEnginesValidate') {
group = 'info.openrocket'
if (!project.file(serializedEnginesPath).exists()) {
def message = "The serialized engine file does not exist at the following location:\n${project.file(serializedEnginesPath)}.\n" +
"You will need to run the following from the command line in order to generate the serialized engine file:\n"
@ -147,7 +138,6 @@ def externalResourceComponents = './resources-src/datafiles/openrocket-database'
// Initializes the submodules in Git.
tasks.register('submoduleInit') {
group = 'info.openrocket'
doLast {
exec {
workingDir "../"
@ -159,7 +149,6 @@ tasks.register('submoduleInit') {
}
// Updates the initialized submodules in Git.
tasks.register('subModuleUpdate') {
group = 'info.openrocket'
dependsOn 'submoduleInit'
doLast {
exec {
@ -173,7 +162,6 @@ tasks.register('subModuleUpdate') {
// Copies the external components to the Core resource folder.
tasks.register('externalComponentsCopy', Copy) {
group = 'info.openrocket'
dependsOn 'externalComponentsValidate'
from(externalResourceComponents + '/orc') {
include '**/*'
@ -187,13 +175,11 @@ tasks.register('externalComponentsCopy', Copy) {
}
// Deletes the external components resource folder.
tasks.register('externalComponentsDelete', Delete) {
group = 'info.openrocket'
delete fileTree(externalComponentsPath)
}
// Validates the external components resource folder. If it is a Git project, then
// calls the submodule updates to fetch the latest submodules.
tasks.register('externalComponentsValidate') {
group = 'info.openrocket'
File dir = project.file(externalResourceComponents + '/orc') as File
println "Validating external components at ${dir}..."
File gitDir = project.file('../.git') as File

View File

@ -11,13 +11,10 @@ java {
modularity.inferModulePath = false
}
Properties props = new Properties()
try {
props.load(file('../core/src/main/resources/build.properties').newDataInputStream())
} catch (Exception ex) {
throw new Exception("Missing build.properties. file: " + ex.getMessage())
}
version = props['build.version']
def buildProperties = new Properties()
file('../core/src/main/resources/build.properties').withInputStream { buildProperties.load(it) }
group = 'info.openrocket'
version = buildProperties['build.version']
repositories {
mavenCentral()
@ -71,7 +68,7 @@ dependencies {
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.12'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation group: 'org.commonmark', name: 'commonmark', version: '0.19.0' // 0.21.0
implementation group: 'org.commonmark', name: 'commonmark', version: '0.21.0'
implementation group: 'com.google.inject', name: 'guice', version: '7.0.0'
implementation group: 'com.itextpdf', name: 'itextpdf', version: '5.5.13.3'
implementation group: 'org.jfree', name: 'jcommon', version: '1.0.24'
@ -87,12 +84,6 @@ dependencies {
implementation group: 'com.formdev', name: 'flatlaf-extras', version: '3.4'
implementation group: 'com.formdev', name: 'flatlaf-intellij-themes', version: '3.4'
// implementation 'net.java.dev.jna:jna:5.13.0'
// implementation 'net.java.dev.jna:jna-platform:5.13.0'
// implementation 'de.jangassen:jfa:1.2.0'
// implementation 'com.github.oshi:oshi-core:6.4.4'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.5.0'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.0'