plugins { id "com.github.johnrengelman.shadow" id 'java' id 'com.adarshr.test-logger' version '3.2.0' id 'checkstyle' } 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() maven { url "https://jitpack.io" } } checkstyle { ignoreFailures = false maxWarnings = 0 } 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 'com.github.weisj:darklaf-core:3.0.2' implementation 'com.github.Dansoftowner:jSystemThemeDetector:3.8' // implementation 'io.github.g00fy2:versioncompare:1.4.1' // 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: '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' // Copies the external components to the Swing resource folder. 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 ..." } } // Deletes the external components resource folder. tasks.register('externalComponentsDelete', Delete) { group = '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 = 'openrocket' def externalResourceComponents = './resources-src/datafiles/components-dbcook/orc'; def git = '../.git'; if (!project.file(externalResourceComponents).exists()) { // println "found: ${project.file(externalResourceComponents)}" def message = "The component database is now a submodule, and must be included into " + "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, " + "the Gradle build will initialize the submodule if missing.\n" + "\n" + "You can also manually initialize and update the submodule from the command line\n" + "% git submodule init\n" + "% git submodule update --remote\n" + "\n"; println message dependsOn subModuleUpdate } else { message += "If you retrieved this code by downloading and uncompressing a zip file,\n" + "Download the code from https://github.com/dbcook/openrocket-database and uncompress it.\n" + "Copy the files and directories under openrocket-database-master into ''./swing/${externalResourceComponents}''\n" + "\n"; println message throw new GradleException('Invalid external component resources.') } } } // Initializes the submodules in Git. tasks.register('submoduleInit') { group = 'openrocket' doLast { exec { workingDir "../" executable 'git' args 'submodule', 'init' } println "Executed submoduleInit!" } } // Updates the initialized submodules in Git. tasks.register('subModuleUpdate') { group = 'openrocket' dependsOn 'submoduleInit' doLast { exec { workingDir "../" executable 'git' args 'submodule', 'update', '--remote' } println "Executed subModuleUpdate!" } } clean.dependsOn([externalComponentsDelete]) //compileJava.dependsOn([externalComponentsCopy]) processResources.dependsOn([externalComponentsCopy])