Advertisement
knakul853

Untitled

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