Advertisement
knakul853

Untitled

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