Advertisement
knakul853

Untitled

Apr 19th, 2020
1,029
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 11.43 KB | None | 0 0
  1. import org.gradle.internal.os.OperatingSystem
  2.  
  3. plugins {
  4.     id "java"
  5.     id "application"
  6.     id "org.openjfx.javafxplugin" version "0.0.5"
  7.     id "org.javamodularity.moduleplugin" version "1.5.0"
  8.     id "org.beryx.jlink" version "2.17.6"
  9. }
  10.  
  11. group = "io.github.mzmine"
  12. version = "3.0"
  13. description = "MZmine"
  14. sourceCompatibility = "14"
  15. targetCompatibility = "14"
  16. defaultTasks 'clean', 'jlinkZip'
  17.  
  18.  
  19. // Check the OS
  20. project.ext.osSuffix = OperatingSystem.current().getName().replaceAll(" ", "_")
  21. if (OperatingSystem.current().isMacOsX())
  22.     project.ext.osSuffix = "macOS"
  23. if (OperatingSystem.current().isLinux())
  24.     project.ext.osSuffix = "Linux"
  25. if (OperatingSystem.current().isWindows())
  26.     project.ext.osSuffix = "Windows"
  27. println "OS detected as " + project.ext.osSuffix
  28.  
  29.  
  30. repositories {
  31.     maven {
  32.         url = "file://" + projectDir + "/src/main/lib"
  33.     }
  34.     maven { // For jmztab 3.0.9+ (https://github.com/PRIDE-Utilities/jmzTab)
  35.         url = "https://dl.bintray.com/lifs/maven/"
  36.     }
  37.     maven { // For jmzml, etc.
  38.         url = "https://www.ebi.ac.uk/Tools/maven/repos/content/groups/ebi-repo/"
  39.     }
  40.     maven {
  41.         url = "https://repo.maven.apache.org/maven2"
  42.     }
  43.     maven { // For SIRIUS ID modules
  44.         url = "https://bio.informatik.uni-jena.de/repository/libs-oss/"
  45.     }
  46.     maven {
  47.         url = "https://jitpack.io"
  48.     }
  49.     maven {
  50.         url = "https://www.xypron.de/repository/"
  51.     }
  52.     maven { // For cpdetector
  53.         url = "https://nexus.nuiton.org/nexus/content/groups/releases/"
  54.     }
  55. }
  56.  
  57. ext {
  58.     msdkVersion = "0.0.27"
  59.     cdkVersion = "2.3"
  60.     jmztabVersion = "3.0.9"
  61.     swaggerVersion = "1.5.22"
  62.     okhttpVersion = "2.7.5"
  63.     guavaVersion = "28.1-jre"
  64.     slf4jVersion = "1.7.28"
  65.     poiVersion = "4.1.0"
  66.     batikVersion = "1.11"
  67.     controlsfxVersion = "11.0.1"
  68.     imageDirPath = "${buildDir}/${applicationName}-${version}-${osSuffix}"
  69.     imageZipPath = "${buildDir}/${applicationName}-${version}-${osSuffix}-.zip"
  70. }
  71.  
  72. dependencies {
  73.     implementation "com.github.graphstream:gs-core:2.0-alpha"
  74.     implementation "com.github.graphstream:gs-ui-javafx:2.0-alpha"
  75.     implementation "org.jfree:jfreechart:1.5.0"
  76.     implementation "org.jfree:jfreechart-fx:1.0.1"
  77.     implementation "org.jfree:fxgraphics2d:1.8"
  78.     implementation "org.jfree:jfreesvg:3.3"
  79.     implementation "com.orsonpdf:orsonpdf:1.9"
  80.     implementation "com.google.guava:guava:$guavaVersion"
  81.     implementation "org.apache.commons:commons-math:2.2"
  82.     implementation "edu.ucar:netcdf4:4.5.5"
  83.     implementation "org.ostermiller:utils:1.07.00"
  84.     implementation "com.google.code.findbugs:jsr305:3.0.2"
  85.     implementation "nz.ac.waikato.cms.weka:weka-stable:3.8.3"
  86.     implementation "net.sourceforge.jmol:jmol:14.29.27"
  87.     implementation "org.slf4j:slf4j-api:$slf4jVersion"
  88.     implementation "org.slf4j:slf4j-jdk14:$slf4jVersion"
  89.     implementation "org.apache.poi:poi:$poiVersion"
  90.     implementation "org.apache.poi:poi-ooxml:$poiVersion"
  91.     implementation "org.openscience.cdk:cdk-core:$cdkVersion"
  92.     implementation "org.openscience.cdk:cdk-io:$cdkVersion"
  93.     implementation "org.openscience.cdk:cdk-standard:$cdkVersion"
  94.     implementation "org.openscience.cdk:cdk-silent:$cdkVersion"
  95.     implementation "org.openscience.cdk:cdk-formula:$cdkVersion"
  96.     implementation "org.openscience.cdk:cdk-sdg:$cdkVersion"
  97.     implementation "org.openscience.cdk:cdk-renderbasic:$cdkVersion"
  98.     implementation "org.openscience.cdk:cdk-renderawt:$cdkVersion"
  99.     implementation "org.openscience.cdk:cdk-data:$cdkVersion"
  100.     implementation "org.openscience.cdk:cdk-interfaces:$cdkVersion"
  101.     implementation "org.openscience.cdk:cdk-smiles:$cdkVersion"
  102.     implementation "uk.ac.ebi.jmzml:jmzml:1.7.11"
  103.     implementation "org.postgresql:postgresql:9.3-1102-jdbc41"
  104.     implementation "mysql:mysql-connector-java:5.1.34"
  105.     implementation "org.rsc.chemspider:chemspider-api:1.0.0"
  106.     implementation "org.nuiton.thirdparty:REngine:1.8-5"
  107.     implementation "org.nuiton.thirdparty:Rserve:1.8-5"
  108.     implementation "com.github.jbytecode:RCaller:3.0"
  109.     implementation "mzmine:jmprojection:1.0"
  110.     implementation "mzmine:gslibml:0.0.1"
  111.     implementation "uk.ac.ebi.pride:jmztab-modular-model:$jmztabVersion"
  112.     implementation "uk.ac.ebi.pride:jmztab-modular-util:$jmztabVersion"
  113.     implementation "org.apache.xmlgraphics:fop:1.0"
  114.     implementation "org.freehep:freehep-graphicsio-emf:2.4"
  115.     implementation "io.github.msdk:msdk-io-mzml:$msdkVersion"
  116.     implementation "io.github.msdk:msdk-io-netcdf:$msdkVersion"
  117.     implementation "io.github.msdk:msdk-featuredetection-adap3d:$msdkVersion"
  118.     implementation "io.github.msdk:msdk-id-sirius:$msdkVersion"
  119.     implementation "org.xerial:sqlite-jdbc:3.8.11.2"
  120.     implementation "org.du-lab.adap:adap:4.1.4"
  121.     implementation "gnf:clustering:20130919"
  122.     implementation "it.unimi.dsi:fastutil:8.2.2"
  123.     implementation "com.itextpdf:itextpdf:5.5.13.1"
  124.     implementation "org.apache.xmlgraphics:xmlgraphics-commons:2.3"
  125.     implementation "org.apache.xmlgraphics:batik-util:$batikVersion"
  126.     implementation "org.apache.xmlgraphics:batik-transcoder:$batikVersion"
  127.     implementation "org.apache.xmlgraphics:batik-codec:$batikVersion"
  128.     implementation "org.apache.xmlgraphics:batik-ext:$batikVersion"
  129.     implementation "org.apache.xmlgraphics:batik-awt-util:$batikVersion"
  130.     implementation "org.apache.xmlgraphics:batik-dom:$batikVersion"
  131.     implementation "org.apache.xmlgraphics:batik-svggen:$batikVersion"
  132.     implementation "org.apache.xmlgraphics:batik-svg-dom:$batikVersion"
  133.     implementation "org.apache.xmlgraphics:batik-anim:$batikVersion"
  134.     implementation "org.apache.xmlgraphics:batik-rasterizer:$batikVersion"
  135.     implementation "org.apache.xmlgraphics:batik-swing:$batikVersion"
  136.     implementation "org.apache.xmlgraphics:batik-gui-util:$batikVersion"
  137.     implementation "org.apache.xmlgraphics:batik-ttf2svg:$batikVersion"
  138.     implementation "org.apache.xmlgraphics:batik-parser:$batikVersion"
  139.     implementation "net.sf.epsgraphics:epsgraphics:1.2"
  140.     implementation "com.miglayout:miglayout:3.7.4"
  141.     implementation "javax.xml.bind:jaxb-api:2.3.1"
  142.     implementation "com.sun.xml.bind:jaxb-core:2.3.0.1"
  143.     implementation "com.sun.xml.bind:jaxb-impl:2.3.2"
  144.     implementation "javax.activation:javax.activation-api:1.2.0"
  145.     implementation "javax.mail:javax.mail-api:1.6.2"
  146.     implementation "io.swagger:swagger-annotations:$swaggerVersion"
  147.     implementation "com.squareup.okhttp:okhttp:$okhttpVersion"
  148.     implementation "com.squareup.okhttp:logging-interceptor:$okhttpVersion"
  149.     implementation "com.google.code.gson:gson:2.8.5"
  150.     implementation "io.gsonfire:gson-fire:1.8.0"
  151.     implementation "org.threeten:threetenbp:1.3.8"
  152.     implementation "org.controlsfx:controlsfx:$controlsfxVersion"
  153.     implementation "org.drjekyll:fontchooser:2.4"
  154.     implementation "org.json:json:20190722"
  155.     implementation "com.panemu:tiwulfx:3.0" // For DetachableTabPane
  156.     implementation "com.github.oshi:oshi-core:4.5.2" // because the version that is pulled by SIRIUS crashes
  157. }
  158.  
  159. /*
  160.  * Remove the xml-apis dependencies to avoid a compilation error in Eclipse.
  161.  * The org.w3c.dom package is present in the java.xml module as well as in these dependencies.
  162.  * That is illegal (https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928).
  163.  */
  164. configurations.all {
  165.   exclude group: "xml-apis", module: "xml-apis"
  166.   exclude group: "xml-apis", module: "xml-apis-ext"
  167.   exclude group: "xom", module: "xom"
  168.   exclude group: "ch.qos.logback", module: "logback-core"
  169.   exclude group: "ch.qos.logback", module: "logback-classic"
  170.   exclude group: "gurobi", module: "gurobi-linux64"
  171.   exclude group: "cplex", module: "cplex"
  172. }
  173.  
  174.  
  175.  
  176. /*
  177.  * Include JavaFX modules
  178.  */
  179. javafx {
  180.     version = "14"
  181.     modules = ["javafx.controls",
  182.                "javafx.swing",
  183.                "javafx.fxml",
  184.                "javafx.web",
  185.                "javafx.graphics"
  186.               ]
  187. }
  188.  
  189. tasks.withType(JavaCompile) {
  190.     options.encoding = "UTF-8"
  191. }
  192.  
  193. prepareMergedJarsDir.doLast {
  194.            from dependencies.collect{zipTree(it)}
  195. }
  196.  
  197. /*
  198.  * Set the basic Java runtime parameters (heap size etc.)
  199.  */
  200. application {
  201.     mainClassName = "io.github.mzmine.main.MZmineCore"
  202.     applicationName = "MZmine"
  203.     executableDir = ""
  204.     applicationDefaultJvmArgs = ["-showversion",
  205.                                  "-XX:MaxHeapFreeRatio=100",
  206.                                  "-XX:InitialRAMPercentage=30",
  207.                                  "-XX:MinRAMPercentage=80",
  208.                                  "-XX:MaxRAMPercentage=80",
  209.                                  "-Djava.library.path=lib",
  210.                                  "-enableassertions",
  211.                                  "-Dapple.awt.application.name=MZmine ${version}"
  212.                                 ]
  213. }
  214. /*
  215.  * Provide a default start script for this platform
  216.  */
  217. startScripts {
  218.     applicationName = "startMZmine-" + osSuffix
  219.     classpath = files("lib/*")
  220.     doLast {
  221.         if (OperatingSystem.current().isWindows()) {
  222.             delete unixScript
  223.             // Temporary fix for https://github.com/gradle/gradle/issues/10387
  224.             windowsScript.text = windowsScript.text.replace('set JAVA_HOME=\"%~dp0.."', 'set JAVA_HOME="%~dp0"')
  225.         } else {
  226.             delete windowsScript
  227.         }
  228.     }
  229. }
  230.  
  231. /*
  232.  * Build the JVM runtime using jlink
  233.  */
  234.  
  235.  
  236. jlink {
  237.     imageDir = file(imageDirPath)
  238.     imageZip = file(imageZipPath)
  239.     mergedModule{
  240.         requires 'java.desktop'
  241.         requires "java.logging"
  242.         requires "java.rmi"
  243.         requires "java.sql"
  244.         requires "java.datatransfer"
  245.         requires "java.management"
  246.         requires "java.xml"
  247.         requires  "java.xml.crypto"
  248.         requires "jdk.xml.dom"
  249.         requires "java.naming"
  250.         requires "java.transaction.xa"
  251.         requires "java.scripting"
  252.         requires "jdk.jsobject"
  253.         requires "jdk.jfr"
  254.         requires "java.security.sasl"
  255.         requires "java.security.jgss"
  256.         requires "jdk.unsupported"
  257.         requires "jdk.unsupported.desktop"
  258.     }
  259.     launcher{
  260.         name = 'mzmine'
  261.     }
  262.         options = ["--compress=2", "--vm=server", "--no-header-files", "--no-man-pages", "--output", "jre/jre"]
  263. }
  264.  
  265. /*
  266.  * Copy the resources and logging properties
  267.  */
  268. tasks.jlink.doLast {
  269.  
  270.     // Remove the "release" file produced by jlink
  271.     delete file(relativePath(imageDir) + "/release")
  272.  
  273.     copy {
  274.         from("log")
  275.         into("${buildDir}/${applicationName}-${version}-${osSuffix}/log")
  276.     }
  277.     copy {
  278.         from("manual.pdf")
  279.         into("${buildDir}/${applicationName}-${version}-${osSuffix}")
  280.     }
  281.     copy {
  282.         from("LICENSE.txt")
  283.         into("${buildDir}/${applicationName}-${version}-${osSuffix}/legal/MZmine/")
  284.     }
  285.     copy {
  286.         from("src/main/lib/vendor_lib")
  287.         into("${buildDir}/${applicationName}-${version}-${osSuffix}/lib/vendor_lib")
  288.     }
  289.  
  290. }
  291.  
  292. /*
  293.  * This is important in order to copy all .java, .fxml, and help files into the final MZmine jar.
  294.  * The .java files are only for people who want to check the source codes.
  295.  * But the .fxml and help files are required for the GUI.
  296.  */
  297. jar {
  298.   sourceSets.main.resources.srcDirs += ["src/main/java"]
  299. }
  300.  
  301. /*
  302.  * Add MZmine version number to mzmineversion.properties
  303.  */
  304. processResources {
  305.     filesMatching("mzmineversion.properties") {
  306.         expand(project.properties)
  307.     }
  308. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement