| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | plugins { | 
					
						
							|  |  |  |     id "com.github.johnrengelman.shadow" | 
					
						
							|  |  |  |     id 'java' | 
					
						
							| 
									
										
										
										
											2023-04-19 17:36:08 -05:00
										 |  |  |     id 'com.adarshr.test-logger' version '3.2.0' | 
					
						
							| 
									
										
										
										
											2023-05-09 08:47:22 -05:00
										 |  |  |     id 'checkstyle' | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | group 'net.sf.openrocket' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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() | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-09 08:47:22 -05:00
										 |  |  | checkstyle { | 
					
						
							|  |  |  |     ignoreFailures = false | 
					
						
							|  |  |  |     maxWarnings = 0 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-04-19 17:36:08 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | dependencies { | 
					
						
							|  |  |  |     implementation group: 'org.commonmark', name: 'commonmark', version: '0.19.0' // 0.21.0
 | 
					
						
							|  |  |  |     implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' // 2.0.6
 | 
					
						
							|  |  |  |     implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1' // 3.12.0
 | 
					
						
							|  |  |  |     implementation group: 'com.google.inject', name: 'guice', version: '4.2.2' // 4.2.3, 5.1.0
 | 
					
						
							|  |  |  |     implementation group: 'com.opencsv', name: 'opencsv', version: '5.7.1' | 
					
						
							|  |  |  |     implementation group: 'eu.infomas', name: 'annotation-detector', version: '3.0.5' | 
					
						
							|  |  |  |     implementation group: 'org.graalvm.sdk', name: 'graal-sdk', version: '22.1.0.1' // 22.3.1
 | 
					
						
							|  |  |  |     implementation group: 'org.graalvm.js', name: 'js-scriptengine', version: '22.1.0.1' // 22.3.1
 | 
					
						
							|  |  |  | //    implementation group: 'javax.script', name: 'script-api', version: '1.0-osgi'
 | 
					
						
							|  |  |  |     implementation group: 'org.graalvm.truffle', name: 'truffle-api', version: '22.1.0.1' // 22.3.1
 | 
					
						
							|  |  |  |     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: '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' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.3.1' // 5.9.2
 | 
					
						
							|  |  |  |     testImplementation group: 'org.jmock', name: 'jmock', version: '2.9.0' // 2.12.0
 | 
					
						
							|  |  |  |     testImplementation group: 'org.jmock', name: 'jmock-junit4', version: '2.9.0' // 2.12.0
 | 
					
						
							|  |  |  |     testImplementation 'junit:junit:4.12' // 4.3.1 org.junit.jupiter
 | 
					
						
							|  |  |  | //    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
 | 
					
						
							|  |  |  | //    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def serializedEnginesPath = './src/main/resources/datafiles/thrustcurves/thrustcurves.ser' | 
					
						
							| 
									
										
										
										
											2023-05-08 19:40:52 -05:00
										 |  |  | def serializedEnginesPathDist = './build/resources/main/datafiles/thrustcurves/thrustcurves.ser' | 
					
						
							|  |  |  | // Executes the serialization of engines from ThrustCurve for a build.
 | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | tasks.register('serializeEngines') { | 
					
						
							|  |  |  |     group = 'openrocket' | 
					
						
							| 
									
										
										
										
											2023-05-08 19:40:52 -05:00
										 |  |  |     dependsOn serializeEnginesDelete | 
					
						
							|  |  |  |     dependsOn serializeEnginesExecute | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | tasks.register('serializeEnginesDist') { | 
					
						
							|  |  |  |     group = 'openrocket' | 
					
						
							|  |  |  |     dependsOn serializeEnginesExecuteDist | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-05-07 08:12:55 -05:00
										 |  |  | // Deletes the serialize engine file if it exists.
 | 
					
						
							|  |  |  | tasks.register('serializeEnginesDelete', Delete) { | 
					
						
							|  |  |  |     group = 'openrocket' | 
					
						
							|  |  |  |     delete fileTree(serializedEnginesPath) | 
					
						
							| 
									
										
										
										
											2023-05-08 19:40:52 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     doFirst { | 
					
						
							|  |  |  |         println "Starting serializeEnginesDelete..." | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     doLast { | 
					
						
							|  |  |  |         println "...serializeEnginesDelete Completed" | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-05-07 08:12:55 -05:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-05-08 19:40:52 -05:00
										 |  |  | // Executes the Java serialization program to fetch ThrustCurve rocket data and serialize it.
 | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | tasks.register('serializeEnginesExecute', JavaExec) { | 
					
						
							|  |  |  |     group = 'openrocket' | 
					
						
							| 
									
										
										
										
											2023-05-08 19:40:52 -05:00
										 |  |  |     dependsOn serializeEnginesDelete | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  |     workingDir  new File(projectDir, 'build/tmp') | 
					
						
							|  |  |  |     classpath = sourceSets.main.runtimeClasspath | 
					
						
							|  |  |  |     mainClass.set('net.sf.openrocket.thrustcurve.SerializeThrustcurveMotors') | 
					
						
							|  |  |  |     args '../../resources-src/datafiles/thrustcurves/', '../.' + serializedEnginesPath | 
					
						
							| 
									
										
										
										
											2023-05-08 19:40:52 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     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 = 'openrocket' | 
					
						
							|  |  |  |     dependsOn serializeEnginesDelete | 
					
						
							|  |  |  |     workingDir  new File(projectDir, 'build/tmp') | 
					
						
							|  |  |  |     classpath = sourceSets.main.runtimeClasspath | 
					
						
							|  |  |  |     mainClass.set('net.sf.openrocket.thrustcurve.SerializeThrustcurveMotors') | 
					
						
							|  |  |  |     args '../../resources-src/datafiles/thrustcurves/', '../.' + serializedEnginesPathDist | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     doFirst { | 
					
						
							|  |  |  |         println "Starting serializeEnginesExecuteDist..." | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     doLast { | 
					
						
							|  |  |  |         println "...serializeEnginesExecuteDist Completed" | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-05-09 07:28:34 -05:00
										 |  |  | // Validates that the serialize engines file exists.
 | 
					
						
							|  |  |  | tasks.register('serializeEnginesValidate') { | 
					
						
							|  |  |  |     group = '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 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | tasks.register('copyReadmeMain', Copy) { | 
					
						
							|  |  |  |     doLast { | 
					
						
							|  |  |  |         from('../') { | 
					
						
							|  |  |  |             include 'ReleaseNotes.md' | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         into './src/main/resources' | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-08 19:40:52 -05:00
										 |  |  | processResources.dependsOn([copyReadmeMain]) | 
					
						
							| 
									
										
										
										
											2023-05-09 07:28:34 -05:00
										 |  |  | processResources.dependsOn([serializeEnginesValidate]) | 
					
						
							| 
									
										
										
										
											2023-04-18 21:48:26 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | // https://docs.gradle.org/7.4/userguide/cross_project_publications.html
 | 
					
						
							|  |  |  | tasks.register('testCoreArtifactsJar', Jar) { | 
					
						
							|  |  |  |     archiveClassifier.set("tests") | 
					
						
							|  |  |  |     from sourceSets.test.output | 
					
						
							|  |  |  |     exclude "**/META-INF", "**/pix", "**/arch", "**/communication", "**/database", "**/file", "**/l10n", "**/models", "**/motor", "**/optimization", "**/plugin", "**/preset", "**/rocketcomponent", "**/simulation", "**/startup", "**/unit" | 
					
						
							|  |  |  |     include "**/ServicesForTesting.class", "**/util/BaseTestCase.class" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://docs.gradle.org/7.4/userguide/cross_project_publications.html
 | 
					
						
							|  |  |  | configurations { | 
					
						
							|  |  |  |     testArtifacts { | 
					
						
							|  |  |  |         canBeConsumed = true | 
					
						
							|  |  |  |         canBeResolved = false | 
					
						
							|  |  |  |         extendsFrom testImplementation | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://docs.gradle.org/7.4/userguide/cross_project_publications.html
 | 
					
						
							|  |  |  | artifacts { | 
					
						
							|  |  |  |     testArtifacts(testCoreArtifactsJar) | 
					
						
							|  |  |  | } |