openrocket/swing/build.gradle

147 lines
5.7 KiB
Groovy
Raw Normal View History

2023-04-18 21:48:26 -05:00
plugins {
id "com.github.johnrengelman.shadow"
id 'java'
id 'com.adarshr.test-logger' version '3.2.0'
2023-04-18 21:48:26 -05:00
}
group 'net.sf.openrocket'
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']
repositories {
mavenCentral()
}
//test {
// testLogging {
// events "PASSED", "SKIPPED", "FAILED"
// }
//}
2023-04-18 21:48:26 -05:00
configurations {
testArtifactsClasspath {
canBeConsumed = false
canBeResolved = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation group: 'org.commonmark', name: 'commonmark', version: '0.19.0' // 0.21.0
implementation group: 'com.google.inject', name: 'guice', version: '4.2.2' // 4.2.3
implementation group: 'com.itextpdf', name: 'itextpdf', version: '5.5.13' // 5.5.13.2
implementation group: 'org.jfree', name: 'jcommon', version: '1.0.24'
implementation group: 'org.jfree', name: 'jfreechart', version: '1.0.15' // 1.5.4
implementation group: 'com.miglayout', name: 'miglayout-swing', version: '5.2' // 5.3, 11.0
implementation group: 'com.fifesoft', name: 'rsyntaxtextarea', version: '2.6.1' // 3.3.2
implementation group: 'com.yuvimasory', name: 'orange-extensions', version: '1.3.0'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
implementation project(':core')
// TODO: Including output from coreotherwise NoClassDefFound issue with BaseTestCase
// The Cross Project Publications should work, but not seeming too.
testImplementation project(':core').sourceSets.test.output
// https://docs.gradle.org/7.4/userguide/cross_project_publications.html
testImplementation project (path: ':core', configuration: 'testArtifacts')
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 group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
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 externalComponentsPath = './src/main/resources/datafiles/components'
tasks.register('externalComponentsCopy', Copy) {
group = 'openrocket'
dependsOn 'externalComponentsValidate'
// gradle always performs up-to-date check which causes copying be skipped.
from('./resources-src/datafiles/components-openrocket') {
}
from('./resources-src/datafiles/components-dbcook/orc') {
}
into externalComponentsPath
exclude '**/*.bak'
includeEmptyDirs = false
eachFile { details ->
println "Copying $details.sourcePath to $details.path ..."
}
}
tasks.register('externalComponentsDelete', Delete) {
group = 'openrocket'
delete fileTree(externalComponentsPath)
}
tasks.register('externalComponentsInit') {
group = 'openrocket'
doLast {
exec {
workingDir "../"
executable 'git'
args 'submodule', 'init'
}
println "Executed externalComponentsInit!"
}
}
tasks.register('externalComponentsValidate') {
group = 'openrocket'
def externalResourceComponents = './resources-src/datafiles/components-dbcook/orc';
def git = '../.git';
if (!project.file(externalResourceComponents).exists()) {
2023-05-05 18:57:55 -05:00
println "found: ${project.file(externalResourceComponents)}"
2023-04-18 21:48:26 -05:00
def message = "The component database is now a submodule, and must be included into\n" +
"this project to compile and run the app.\n" +
"\n";
if (project.file(git).exists()) {
message +=
"If you retrieved this code by cloning the openrocket repository, \n" +
"the Gradle build will initialize the submodule if missing.\n" +
"\n" +
"You can also manually initialize and update the submodule from the \n" +
"command line\n" +
"% git submodule init\n" +
"% git submodule update --remote\n" +
"\n";
println message
dependsOn externalComponentsUpdate
} else {
message +=
"If you retrieved this code by downloading and uncompressing a zip file,\n" +
2023-05-06 11:17:44 -05:00
"Download the code\n" +
"from https://github.com/dbcook/openrocket-database and uncompress it.\n" +
"Copy the files and directories under openrocket-database-master\n" +
"into ''./swing/${externalResourceComponents}''\n" +
"\n";
2023-04-18 21:48:26 -05:00
println message
throw new GradleException('Invalid external component resources.')
}
}
}
tasks.register('externalComponentsUpdate') {
group = 'openrocket'
2023-04-26 07:48:38 -05:00
dependsOn 'externalComponentsInit'
2023-04-18 21:48:26 -05:00
doLast {
exec {
workingDir "../"
executable 'git'
args 'submodule', 'update', '--remote'
}
println "Executed externalComponentsUpdate!"
}
}
clean.dependsOn([externalComponentsDelete])
//compileJava.dependsOn([externalComponentsCopy])
processResources.dependsOn([externalComponentsCopy])