plugins { id "com.github.johnrengelman.shadow" id 'java' id 'com.adarshr.test-logger' version '3.2.0' id 'checkstyle' id 'org.gradlex.extra-java-module-info' version '1.8' } java { // Must be disabled in order to use the gradle-modules-plugin 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'] repositories { mavenCentral() maven { url "https://repository.mulesoft.org/nexus/content/repositories/public/" } } checkstyle { ignoreFailures = false maxWarnings = 0 } // Some older libraries are not modularized, so we need to add module-info.java files for them. extraJavaModuleInfo { failOnMissingModuleInfo.set(false) module('obj-0.4.0.jar', 'de.javagl.obj', '0.4.0') } dependencies { implementation group: 'org.commonmark', name: 'commonmark', version: '0.19.0' // 0.21.0 implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.12' implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.0' //implementation group: 'org.slf4j', name: 'logback-classic', version: '2.0.12' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1' // 3.12.0 implementation group: 'com.google.inject', name: 'guice', version: '7.0.0' implementation group: 'com.opencsv', name: 'opencsv', version: '5.7.1' implementation group: 'org.graalvm.sdk', name: 'graal-sdk', version: '23.0.3' implementation group: 'org.graalvm.js', name: 'js-scriptengine', version: '23.0.3' implementation group: 'org.graalvm.js', name: 'js', version: '23.0.3' implementation group: 'org.graalvm.truffle', name: 'truffle-api', version: '23.0.3' implementation group: 'com.ibm.icu', name: 'icu4j', version: '71.1' // 72.1 //implementation group: 'com.sun.istack', name: 'istack-commons-tools', version: '4.1.1' // TODO: Should be gotten rid of? //implementation group: 'com.sun.istack', name: 'istack-commons-runtime', version: '4.1.1' // TODO: Should be gotten rid of? implementation group: 'io.github.classgraph', name: 'classgraph', version: '4.8.165' implementation 'de.javagl:obj:0.4.0' implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' implementation 'org.glassfish.jaxb:jaxb-runtime:2.3.1' implementation 'org.glassfish:javax.json:1.1.3' // 1.1.4 implementation 'org.eclipse:yasson:1.0.2' // 2.0.1 implementation group: 'javax.activation', name: 'javax.activation-api', version: '1.2.0' implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '2.1.2' } def serializedEnginesPath = './src/main/resources/datafiles/thrustcurves/thrustcurves.ser' 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 { println "Starting serializeEnginesDelete..." } doLast { println "...serializeEnginesDelete Completed" } } // 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 mainClass.set('info.openrocket.core.thrustcurve.SerializeThrustcurveMotors') args '../../resources-src/datafiles/thrustcurves/', '../.' + serializedEnginesPath doFirst { println "Starting serializeEnginesExecute..." // println "${serializedEnginesPath}" } doLast { println "...serializeEnginesExecute Completed" } } // Executes the Java serialization program to fetch ThrustCurve rocket data and serialize it. // 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 mainClass.set('info.openrocket.core.thrustcurve.SerializeThrustcurveMotors') args '../../resources-src/datafiles/thrustcurves/', '../.' + serializedEnginesPathDist doFirst { println "Starting serializeEnginesExecuteDist..." } doLast { println "...serializeEnginesExecuteDist Completed" } } // 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" "% ./gradlew serializeEngines\n" + "\n"; println message throw new GradleException('Invalid serialized engine file.') } else { def message = "Serialized engine file found.\n\n"; println message } } tasks.register('copyReadmeMain', Copy) { doLast { from('../') { include 'ReleaseNotes.md' } into './src/main/resources' } } processResources.dependsOn([copyReadmeMain]) //processResources.dependsOn([serializeEnginesValidate])