import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent buildscript { repositories { mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } dependencies { classpath "net.saliman:gradle-cobertura-plugin:4.0.0" } } plugins { id 'net.saliman.cobertura' version '4.0.0' id "de.undercouch.download" version "4.1.2" } apply plugin: 'net.saliman.cobertura' subprojects { apply plugin: 'java' sourceCompatibility = 1.8 targetCompatibility = 1.8 apply plugin: 'eclipse' repositories { mavenCentral() } } repositories { mavenCentral() } //========================================================================================= // // RELEASE VERSION, RELEASE DATE AND BINARY PACK INFORMATION ARE // CONTROLLED BY THE SECTION BELOW // //========================================================================================= ext.YEAR = '2023' ext.BuildDate = 'Thu Mar 10 20:00:00 CDT ' + "$YEAR" ext.SpecificationVersion = '3.7.0.0' ext.SpecificationVersionShort = '3.7.0' // Comment out line below to publish offical release // ext.SpecificationVersion = "$SpecificationVersion" + "-SNAPSHOT" // Update below to L1.all.rrg, G1.all.gload, or E1.all.eload when needed ext.etaImplementationVersion = 'etaj' + "$SpecificationVersionShort" + '.L1.all.rrg' ext.emaImplementationVersion = 'emaj' + "$SpecificationVersionShort" + '.L1.all.rrg' // NOTE! update with new asset version ext.BINARY_PACK_VERSION_TO_DOWNLOAD = '2.1.0.L1' //========================================================================================= // // END OF SECTION CONTROLLING THE RELEASE INFORMATION // //========================================================================================= ext.vendor = 'Refinitiv' ext.javadoc_footer = 'Refinitiv' ext.javadoc_header = 'Refinitiv' ext.javadoc_bottom = 'Copyright @ ' + "$YEAR" + ' Refinitiv. All Rights Reserved.' task downloadBinaryPack(type: Download) { description 'This task downloads the RTSDK-BinaryPack file from GitHub.' def releaseToDownload = "RTSDK-BinaryPack-" + BINARY_PACK_VERSION_TO_DOWNLOAD def zipFileToDownload = releaseToDownload + ".zip" src 'https://github.com/Refinitiv/Real-Time-SDK/releases/download/Real-Time-SDK-' + BINARY_PACK_VERSION_TO_DOWNLOAD + '/' + zipFileToDownload dest new File('../.', 'RTSDK-BinaryPack.zip') } task unzipBinaryPack(dependsOn: downloadBinaryPack, type: Copy) { ext.temp = new File('../temp') from zipTree(downloadBinaryPack.dest) into ext.temp } task getBinaryPack () { // check if we are in GSG package File gsgDir = file('../RTSDK-BinaryPack') if (!gsgDir.exists()) { dependsOn unzipBinaryPack } else { println "RTSDK-BinaryPack already exists, skip downloading." } doLast { // check if Binary Pack exists File gsgDirNew = file('../RTSDK-BinaryPack') if (!gsgDirNew.exists()) { // move the file file('../temp/RTSDK-BinaryPack').renameTo(file('../RTSDK-BinaryPack')) // delete temp directory and downloaded file unzipBinaryPack.ext.temp.deleteDir() downloadBinaryPack.dest.delete() } } } allprojects { dependencies { testImplementation ('junit:junit:4.12') { exclude group: 'org.hamcrest' } testImplementation 'org.hamcrest:hamcrest-core:1.3' testImplementation 'org.mockito:mockito-all:1.9.0' } compileJava { options.compilerArgs += ["-Xlint:cast"] options.compilerArgs += ["-Xlint:deprecation"] options.compilerArgs += ["-Xlint:divzero"] options.compilerArgs += ["-Xlint:empty"] options.compilerArgs += ["-Xlint:fallthrough"] options.compilerArgs += ["-Xlint:finally"] options.compilerArgs += ["-Xlint:overrides"] options.compilerArgs += ["-Xlint:path"] options.compilerArgs += ["-Xlint:serial"] options.compilerArgs += ["-Xlint:unchecked"] } tasks.withType( JavaCompile ) { dependsOn getBinaryPack options.fork = true options.incremental = true } // set the jvmArgs and commandLineArgs for all applications tasks.withType ( JavaExec ) { if ( project.hasProperty("vmArgs") ) { jvmArgs Eval.me( buildArgsList( vmArgs ) ) } if ( project.hasProperty("commandLineArgs") ) { args Eval.me( buildArgsList( commandLineArgs ) ) } } // set the jvmArgs for junit tasks.withType ( Test ) { if ( project.hasProperty("vmArgs") ) { jvmArgs Eval.me( buildArgsList( vmArgs ) ) } minHeapSize = "1024m" maxHeapSize = "2048m" testLogging { // set options for log level LIFECYCLE events TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_OUT exceptionFormat TestExceptionFormat.FULL showExceptions true showCauses true showStackTraces true // print tests summary afterSuite { desc, result -> if (!desc.parent) { // will match the outermost suite def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)" def startItem = '| ', endItem = ' |' def repeatLength = startItem.length() + output.length() + endItem.length() println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength)) } } } } } wrapper { gradleVersion = '7.3.3' } task uploadAll ( ) { group 'Upload' description 'Uploads All artifacts to maven central, run with -Pmavencentral' if (project.hasProperty("mavencentral")) { dependsOn ':Eta:AnsiPage:publish' dependsOn ':Eta:Core:publish' dependsOn ':Eta:ValueAdd:publish' dependsOn ':Eta:ValueAddCache:publish' dependsOn ':Eta:Converter:publish' dependsOn ':Ema:Core:publish' } else { doLast { println "" println "/////////////////////////////////////////////////////////" println "" println "This task needs to be run with -Pmavencentral option" println "Exiting without publishing to Maven Central" println "" println "/////////////////////////////////////////////////////////" println "" } } } // this method creates a list of arguments that are used in setting the jvmArgs and commandLineArgs def buildArgsList ( options ) { // remove spaces def arguments = options.tokenize() // create a string that can be used by Eval def cla = "[" // go through the list to get each argument arguments.each { cla += "'" + "${it}" + "'," } // remove last "," add "]" and set the args return cla.substring( 0, cla.lastIndexOf(',') ) + "]" } // can't use a dynamic date for manifest since it triggers a build each time even when nothing changed def getDate() { def date = new Date() def formattedDate = date.format('E MMM dd HH:mm:ss z yyyy ') return formattedDate } // disable creating empty Java.jar file jar.enabled = false