Loading .gitignore +2 −1 Original line number Diff line number Diff line Loading @@ -10,3 +10,4 @@ igv.log .classpath /.idea/ /.settings /proguard_log No newline at end of file ant/bcel-6.0.jardeleted 100644 → 0 −655 KiB File deleted. View file build-shrink.xmldeleted 100644 → 0 +0 −165 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!-- ~ The MIT License (MIT) ~ ~ Copyright (c) 2007-2018 Broad Institute ~ ~ Permission is hereby granted, free of charge, to any person obtaining a copy ~ of this software and associated documentation files (the "Software"), to deal ~ in the Software without restriction, including without limitation the rights ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ~ copies of the Software, and to permit persons to whom the Software is ~ furnished to do so, subject to the following conditions: ~ ~ The above copyright notice and this permission notice shall be included in ~ all copies or substantial portions of the Software. ~ ~ ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ~ THE SOFTWARE. --> <!-- Ant build script to create a unified IGV JAR, shrunk with BCEL. This is difficult to do in Gradle so it's handled here. We may eventually switch to a different method (e.g. ProGuard) that makes this unnecessary. --> <project name="igv-release" default="allBuild" basedir="."> <!-- build specific properties. Generally set through Jenkins, command line, or properties file--> <property name="build-number" value="0"/> <property name="version" value="user"/> <property name="vendor" value="user"/> <property name="include.libs" value="true" /> <property name="main-class" value="org.broad.igv.ui.Main"/> <property name="lib.dir" value="${basedir}/lib/"/> <property name="tmp.dir" value="${basedir}/build/tmp/IGV-dist"/> <property name="jar.name" value="igv.jar"/> <property name="dist.dir" value="build/IGV-dist/"/> <property name="jar.path" value="${dist.dir}${jar.name}"/> <property name="batik-codec-finame" value="batik-codec-1.10.jar" /> <property name="goby-io-finame" value="goby-io-igv-1.1.jar" /> <property name="log4j-core-finame" value="log4j-core-2.11.0.jar" /> <!-- These paths are dictated by Gradle. --> <property name="class.dir" value="build/classes/java/main" /> <property name="resource.dir" value="build/resources/main" /> <condition property="act.include.libs"> <and> <available classname="org.apache.tools.ant.util.depend.bcel.FullAnalyzer" /> <istrue value="${include.libs}" /> </and> </condition> <!-- Unzip jars to the tmp directory and copy IGV classes & resources. Could do this step in Gradle, but may not be required in the future (ProGuard can work on jars directly, for example). --> <target name="prepare" if="act.include.libs"> <mkdir dir="${dist.dir}" /> <unzip dest="${tmp.dir}"> <!-- Copy almost everything to tmp directory Certain jars we include whole, because we need their manifests Goby get copied later. Certain jars we just want to ignore (junit, appbundler). --> <patternset> <include name="**/*"/> <exclude name="META-INF/**"/> <exclude name="${lib.dir}/*"/> </patternset> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> <exclude name="appbundler*.jar"/> <exclude name="**/*junit*.jar"/> <exclude name="**/${batik-codec-finame}"/> <exclude name="**/${goby-io-finame}"/> <exclude name="**/${log4j-core-finame}"/> <exclude name="**/*AppleJavaExtensions.jar"/> </fileset> </unzip> <copy todir="${tmp.dir}"> <fileset dir="${class.dir}" includes="**/*" /> </copy> <copy todir="${tmp.dir}"> <fileset dir="${resource.dir}" includes="**/*" /> </copy> </target> <target name="shrinkJar" depends="prepare" if="act.include.libs" description="Build the unified IGV JAR, including libraries, using BCEL to take only required classes"> <classfileset dir="${tmp.dir}" id="rootFiles"> <rootfileset dir="${tmp.dir}" includes="org/broad/**/*.class" /> </classfileset> <property name="class-path" value="${batik-codec-finame} ${goby-io-finame} ${log4j-core-finame}" /> <jar destfile="${jar.path}" basedir="${tmp.dir}" compress="true" duplicate="preserve"> <fileset refid="rootFiles"/> <manifest> <attribute name="Permissions" value="all-permissions"/> <attribute name="Application-Name" value="IGV"/> <!-- Here just to be a good citizen. Apparently reading from the correct manifest is tricky. We rely on a separate properties file--> <attribute name="Class-Path" value="${class-path}"/> <attribute name="Built-By" value="${user.name}"/> <attribute name="Main-Class" value="${main-class}"/> <section name="org/broad/igv/"> <attribute name="Specification-Title" value="IGV"/> <attribute name="Specification-Version" value="${version}"/> <attribute name="Specification-Vendor" value="${vendor}"/> <attribute name="Implementation-Version" value="${version} ${build-number}"/> <attribute name="Implementation-Vendor" value="${vendor}"/> </section> </manifest> </jar> <delete dir="${tmp.dir}" /> <copy file="${lib.dir}${batik-codec-finame}" tofile="${dist.dir}${batik-codec-finame}" overwrite="true"/> <copy file="${lib.dir}${goby-io-finame}" tofile="${dist.dir}${goby-io-finame}" overwrite="true"/> <copy file="${lib.dir}${log4j-core-finame}" tofile="${dist.dir}${log4j-core-finame}" overwrite="true"/> </target> <!--Add permissions attribute to manifest of jars --> <!-- We use exec because it's easier, this will only run on *nix--> <macrodef name="addPermsMacro"> <attribute name="jarfile"/> <sequential> <!--Newline is important!--> <echo file="tmp.txt">Permissions: all-permissions${line.separator}</echo> <exec executable="jar"> <arg value="ufm"/> <arg value="@{jarfile}"/> <arg value="tmp.txt"/> </exec> <delete file="tmp.txt"/> </sequential> </macrodef> <target name="addPerms"> <addPermsMacro jarfile="${dist.dir}${batik-codec-finame}"/> <addPermsMacro jarfile="${dist.dir}${goby-io-finame}"/> <addPermsMacro jarfile="${dist.dir}${log4j-core-finame}"/> </target> <target name="allBuild" depends="shrinkJar,addPerms"> <copy file="scripts/igv.sh" todir="${dist.dir}" /> <copy file="scripts/igv.bat" todir="${dist.dir}" /> <copy file="scripts/igv.command" todir="${dist.dir}" /> <chmod perm="775" file="${dist.dir}igv.sh" /> <chmod perm="775" file="${dist.dir}igv.command" /> </target> </project> No newline at end of file build.gradle +214 −12 Original line number Diff line number Diff line Loading @@ -26,6 +26,16 @@ import org.apache.tools.ant.filters.ReplaceTokens // Define the main class for the application ext.mainClassName = 'org.broad.igv.ui.Main' // Set up the ProGuard optimizing task buildscript { repositories { flatDir dirs: 'lib_build' } dependencies { classpath ':proguard:' } } sourceSets { main { java { Loading @@ -38,7 +48,14 @@ sourceSets { } } configurations { jarsToShipUntouched compile.extendsFrom jarsToShipUntouched } dependencies { jarsToShipUntouched fileTree(dir: 'lib', include: ['batik-codec-1.10.jar', 'goby-io-igv-1.1.jar', 'log4j-core-2.11.0.jar']) compile fileTree(dir: 'lib', include: '*.jar') testCompile fileTree(dir: 'test/lib', include: '*.jar') } Loading @@ -52,7 +69,12 @@ targetCompatibility = 1.8 processResources { // Set the current timestamp for release builds; pass in a blank property to enable (i.e. -Ptimestamp="" at CLI) if (timestamp.equals("")) { timestamp = new Date().format("MM/dd/yyyy hh:mm aa") } if (timestamp.equals("")) { ext.date = new Date() timestamp = date.format("MM/dd/yyyy hh:mm aa") // This is a more filesystem-friendly date format. timestamp_fs = date.format("yyyy-MM-dd_HHmmss") } filesMatching('resources/about.properties') { filter (ReplaceTokens, Loading @@ -62,7 +84,7 @@ processResources { } jar { archiveName = 'igv.jar' archiveName = 'igv-minimal.jar' manifest { attributes( "Permissions": "all-permissions", Loading @@ -74,6 +96,82 @@ jar { } } task fullJar(type: Jar, dependsOn: jar) { // Based on https://discuss.gradle.org/t/removing-dependencies-from-a-jar-file-during-jar-task/5521/3 archiveName = 'igv.jar' from { ((configurations.compile - configurations.jarsToShipUntouched) + "${buildDir}/libs/igv-minimal.jar").collect { zipTree(it) } } { exclude "META-INF/**" } manifest { attributes( "Permissions": "all-permissions", "Application-Name": "IGV", "Built-By": System.getProperty('user.name'), "Main-Class": mainClassName, "Class-Path": configurations.jarsToShipUntouched.collect { it.getName() }.join(' ') ) } } task toolJar(type: Jar, dependsOn: jar) { from { ((configurations.compile - configurations.jarsToShipUntouched) + "${buildDir}/libs/igv-minimal.jar").collect { zipTree(it) } } { exclude "META-INF/**" } archiveName = 'igvtools.jar' manifest { attributes( "Implementation-Title": "IGVTools", "Built-By": System.getProperty('user.name'), "Main-Class": "org.broad.igv.tools.IgvTools", "Class-Path": configurations.jarsToShipUntouched.collect { it.getName() }.join(' ') ) } } task optimizeFullJar(type: proguard.gradle.ProGuardTask, dependsOn: fullJar) { // EXPERIMENTAL: Optimize the fullJar to remove unused classes. // This still needs tuning for correctness, and as a result we are not distributing the // jar it creates. It is still useful because of the reports it generates, however. doFirst { mkdir "proguard_log" } verbose injars "${buildDir}/libs/igv.jar" outjars "${buildDir}/libs/igv-OPT.jar" // Note that this points to the *JRE* jars. libraryjars "${System.getProperty('java.home')}/lib", jarfilter: 'rt.jar,charsets.jar,jce.jar,jfr.jar,jsse.jar,resources.jar,ext/jfxrt.jar' libraryjars "lib", jarfilter: 'batik-codec-1.10.jar,goby-io-igv-1.1.jar,log4j-core-2.11.0.jar' configuration "lib_build/proguard_full_client.cfg" printusage "proguard_log/proguard_full_client_log_${timestamp_fs}.txt" printseeds "proguard_log/proguard_full_client_seeds_${timestamp_fs}.txt" } task optimizeMinJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) { // EXPERIMENTAL: Optimize the minimal jar to remove unused classes (that is, our code base only). // As above, needs tuning for correctness. The IGV-focused report it produces is more useful. doFirst { mkdir "proguard_log" } verbose injars "${buildDir}/libs/igv-minimal.jar" outjars "${buildDir}/libs/igv-minimal-OPT.jar" libraryjars "${System.getProperty('java.home')}/lib", jarfilter: 'rt.jar,charsets.jar,jce.jar,jfr.jar,jsse.jar,resources.jar,ext/jfxrt.jar' // This is the difference from the above: consider all dependencies as libraryjars libraryjars "lib", filter: '!META-INF/**/module-info.class' configuration "lib_build/proguard_min_client.cfg" printusage "proguard_log/proguard_min_client_log_${timestamp_fs}.txt" printseeds "proguard_log/proguard_min_client_seeds_${timestamp_fs}.txt" } tasks.withType(Test) { systemProperties = System.getProperties() systemProperties['java.awt.headless'] = 'true' Loading @@ -84,26 +182,50 @@ tasks.withType(Test) { forkEvery = 1 } task createDist(type: Copy, dependsOn: jar) { task createDist(type: Copy, dependsOn: fullJar) { from ("scripts") { include 'igv.bat' include 'igv.command' include 'igv.sh' include 'readme.txt' } with copySpec { from ("${buildDir}/libs") { include 'igv*.jar' include 'igv.jar' } from ("lib") { include '*.jar' from (configurations.jarsToShipUntouched) { } into "lib" } into "${buildDir}/dist" into "${buildDir}/IGV-dist" } task createDistZip(type: Zip, dependsOn: createDist) { task signJars(dependsOn: createDist) { doLast { // Only sign if the keystoreFile exists ext.keystoreFile = file("${keystore}") if (keystoreFile.exists()) { ant.jar( update: true, file: "build/IGV-dist/lib/batik-codec-1.10.jar") { delegate.manifest { attribute(name: 'Permissions', value: 'all-permissions') } } ant.jar( update: true, file: "build/IGV-dist/lib/goby-io-igv-1.1.jar") { delegate.manifest { attribute(name: 'Permissions', value: 'all-permissions') } } ant.jar( update: true, file: "build/IGV-dist/lib/log4j-core-2.11.0.jar") { delegate.manifest { attribute(name: 'Permissions', value: 'all-permissions') } } ant.signjar( jar: 'build/IGV-dist/lib/*.jar', keystore:"${keystoreFile.absolutePath}", alias: "${alias}", keypass: "${keyPassword}", storepass: "${storePassword}", tsaurl: "${tsaurl}" ) } } } task createDistZip(type: Zip, dependsOn: [createDist, signJars]) { archiveName = "IGV_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGV" from "${buildDir}/dist" from "${buildDir}/IGV-dist" exclude "igv.bat" into createDistZip.baseName + "_${version}" doLast { Loading @@ -111,4 +233,84 @@ task createDistZip(type: Zip, dependsOn: createDist) { } } build.dependsOn createDistZip task createMacDist(type: Copy, dependsOn: [createDist, signJars]) { with copySpec { from ("scripts/mac.app") exclude "Contents/Info.plist.template" into "IGV_${version}.app" } with copySpec { from ("scripts/mac.app/Contents/Info.plist.template") filter (ReplaceTokens, tokens: [ VERSION: version ]) rename "Info.plist.template", "Info.plist" into "IGV_${version}.app/Contents" } with copySpec { from ("${buildDir}/IGV-dist/lib") include '*.jar' into "IGV_${version}.app/Contents/Java" } into "${buildDir}/IGV-Mac-dist" doLast { project.exec { commandLine('chmod', '775', "${buildDir}/IGV-Mac-dist/IGV_${version}.app" ) } } } task createMacDistZip(type: Zip, dependsOn: createMacDist) { archiveName = "IGV_${version}.app.zip" destinationDir = file("${buildDir}/distZip") from "${buildDir}/IGV-Mac-dist" doLast { project.exec { commandLine('chmod', '775', createMacDistZip.archivePath ) } } } task createWinDistZip(type: Zip, dependsOn: [createDist, signJars]) { archiveName = "IGV_Win_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGV_Win" from("${buildDir}/IGV-dist") { exclude "igv.sh" exclude "igv.command" } into createWinDistZip.baseName + "_${version}" doLast { project.exec { commandLine('chmod', '775', createWinDistZip.archivePath ) } } } task createToolsDist(type: Copy, dependsOn: toolJar) { from ("scripts") { include 'igvtools*' include 'igvtools*.bat' include 'igvtools*.command' } with copySpec { from ("${buildDir}/libs") { include 'igvtools.jar' } from (configurations.jarsToShipUntouched) { } into "lib" } with copySpec { from ("genomes") { } into "genomes" } into "${buildDir}/IGVTools-dist" } task createToolsDistZip(type: Zip, dependsOn: createToolsDist) { destinationDir = file("${buildDir}/distZip") archiveName = "igvtools_${version}.zip" baseName = "IGVTools" from "${buildDir}/IGVTools-dist" into createToolsDistZip.baseName doLast { project.exec { commandLine('chmod', '775', createToolsDistZip.archivePath ) } } } build.dependsOn createDistZip,createMacDistZip,createWinDistZip,createToolsDistZip build_java9.gradle +121 −18 Original line number Diff line number Diff line Loading @@ -78,6 +78,20 @@ jar { } } task tooljar(type: Jar, dependsOn: jar) { // This jar is the same as the client jar above, just a different jar name and manifest archiveName = 'igvtools.jar' from(sourceSets.main.output) { } manifest { attributes( "Implementation-Title": "IGVTools", "Built-By": System.getProperty('user.name'), "Main-Class": "org.broad.igv.tools.IgvTools", ) } } compileJava { inputs.property("moduleName", moduleName) doFirst { Loading Loading @@ -131,7 +145,17 @@ test { } } def modulepathContent = copySpec { task createDist(type: Copy, dependsOn: jar) { from ('scripts/java9') { include 'igv.bat' include 'igv.command' include 'igv.sh' include 'igv_hidpi.*' include 'igv.args' include 'readme.txt' } with copySpec { from ("lib") { include '*.jar' exclude 'jide-oss-3.5.5.jar' Loading @@ -140,28 +164,19 @@ def modulepathContent = copySpec { include '*.jar' } from ("${buildDir}/libs") { include 'igv*.jar' include 'igv.jar' } into "lib" } task createDist(type: Copy, dependsOn: jar) { from ('scripts/java9') { include 'igv.bat' include 'igv.command' include 'igv.sh' include 'igv.args' } with modulepathContent into "${buildDir}/dist" into "${buildDir}/IGV-dist" } task createDistZip(type: Zip, dependsOn: createDist) { archiveName = "IGV_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGV" from "${buildDir}/dist" from "${buildDir}/IGV-dist" exclude "*.bat" into createDistZip.baseName + "_${version}" doLast { Loading @@ -169,4 +184,92 @@ task createDistZip(type: Zip, dependsOn: createDist) { } } build.dependsOn createDistZip task createMacDist(type: Copy, dependsOn: createDist) { with copySpec { from ("scripts/mac.app") exclude "Contents/Info.plist.template" into "IGV_${version}.app" } with copySpec { from ("scripts/java9/Info.plist.template") filter (ReplaceTokens, tokens: [ VERSION: version ]) rename "Info.plist.template", "Info.plist" into "IGV_${version}.app/Contents" } with copySpec { from ("${buildDir}/IGV-dist/lib") include '*.jar' into "IGV_${version}.app/Contents/Java" } into "${buildDir}/IGV-Mac-dist" doLast { project.exec { commandLine('chmod', '775', "${buildDir}/IGV-Mac-dist/IGV_${version}.app" ) } } } task createMacDistZip(type: Zip, dependsOn: createMacDist) { archiveName = "IGV_${version}.app.zip" destinationDir = file("${buildDir}/distZip") from "${buildDir}/IGV-Mac-dist" doLast { project.exec { commandLine('chmod', '775', createMacDistZip.archivePath ) } } } task createWinDistZip(type: Zip, dependsOn: createDist) { archiveName = "IGV_Win_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGV_Win" from("${buildDir}/IGV-dist") { exclude "*.sh" exclude "igv.command" } into createWinDistZip.baseName + "_${version}" doLast { project.exec { commandLine('chmod', '775', createWinDistZip.archivePath ) } } } task createToolsDist(type: Copy, dependsOn: tooljar) { from ("scripts/java9") { include 'igvtools*' include 'igvtools*.bat' include 'igvtools*.command' include 'igv.args' } with copySpec { from ("${buildDir}/libs") { include 'igvtools.jar' } from ("lib") { include '*.jar' exclude 'jide-oss-3.5.5.jar' } from ("lib_java9") { include '*.jar' } into "lib" } with copySpec { from ("genomes") { } into "genomes" } into "${buildDir}/IGVTools-dist" } task createToolsDistZip(type: Zip, dependsOn: createToolsDist) { archiveName = "igvtools_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGVTools" from "${buildDir}/IGVTools-dist" into createToolsDistZip.baseName doLast { project.exec { commandLine('chmod', '775', createToolsDistZip.archivePath ) } } } build.dependsOn createDistZip,createMacDistZip,createWinDistZip,createToolsDistZip Loading
.gitignore +2 −1 Original line number Diff line number Diff line Loading @@ -10,3 +10,4 @@ igv.log .classpath /.idea/ /.settings /proguard_log No newline at end of file
build-shrink.xmldeleted 100644 → 0 +0 −165 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!-- ~ The MIT License (MIT) ~ ~ Copyright (c) 2007-2018 Broad Institute ~ ~ Permission is hereby granted, free of charge, to any person obtaining a copy ~ of this software and associated documentation files (the "Software"), to deal ~ in the Software without restriction, including without limitation the rights ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ~ copies of the Software, and to permit persons to whom the Software is ~ furnished to do so, subject to the following conditions: ~ ~ The above copyright notice and this permission notice shall be included in ~ all copies or substantial portions of the Software. ~ ~ ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ~ THE SOFTWARE. --> <!-- Ant build script to create a unified IGV JAR, shrunk with BCEL. This is difficult to do in Gradle so it's handled here. We may eventually switch to a different method (e.g. ProGuard) that makes this unnecessary. --> <project name="igv-release" default="allBuild" basedir="."> <!-- build specific properties. Generally set through Jenkins, command line, or properties file--> <property name="build-number" value="0"/> <property name="version" value="user"/> <property name="vendor" value="user"/> <property name="include.libs" value="true" /> <property name="main-class" value="org.broad.igv.ui.Main"/> <property name="lib.dir" value="${basedir}/lib/"/> <property name="tmp.dir" value="${basedir}/build/tmp/IGV-dist"/> <property name="jar.name" value="igv.jar"/> <property name="dist.dir" value="build/IGV-dist/"/> <property name="jar.path" value="${dist.dir}${jar.name}"/> <property name="batik-codec-finame" value="batik-codec-1.10.jar" /> <property name="goby-io-finame" value="goby-io-igv-1.1.jar" /> <property name="log4j-core-finame" value="log4j-core-2.11.0.jar" /> <!-- These paths are dictated by Gradle. --> <property name="class.dir" value="build/classes/java/main" /> <property name="resource.dir" value="build/resources/main" /> <condition property="act.include.libs"> <and> <available classname="org.apache.tools.ant.util.depend.bcel.FullAnalyzer" /> <istrue value="${include.libs}" /> </and> </condition> <!-- Unzip jars to the tmp directory and copy IGV classes & resources. Could do this step in Gradle, but may not be required in the future (ProGuard can work on jars directly, for example). --> <target name="prepare" if="act.include.libs"> <mkdir dir="${dist.dir}" /> <unzip dest="${tmp.dir}"> <!-- Copy almost everything to tmp directory Certain jars we include whole, because we need their manifests Goby get copied later. Certain jars we just want to ignore (junit, appbundler). --> <patternset> <include name="**/*"/> <exclude name="META-INF/**"/> <exclude name="${lib.dir}/*"/> </patternset> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> <exclude name="appbundler*.jar"/> <exclude name="**/*junit*.jar"/> <exclude name="**/${batik-codec-finame}"/> <exclude name="**/${goby-io-finame}"/> <exclude name="**/${log4j-core-finame}"/> <exclude name="**/*AppleJavaExtensions.jar"/> </fileset> </unzip> <copy todir="${tmp.dir}"> <fileset dir="${class.dir}" includes="**/*" /> </copy> <copy todir="${tmp.dir}"> <fileset dir="${resource.dir}" includes="**/*" /> </copy> </target> <target name="shrinkJar" depends="prepare" if="act.include.libs" description="Build the unified IGV JAR, including libraries, using BCEL to take only required classes"> <classfileset dir="${tmp.dir}" id="rootFiles"> <rootfileset dir="${tmp.dir}" includes="org/broad/**/*.class" /> </classfileset> <property name="class-path" value="${batik-codec-finame} ${goby-io-finame} ${log4j-core-finame}" /> <jar destfile="${jar.path}" basedir="${tmp.dir}" compress="true" duplicate="preserve"> <fileset refid="rootFiles"/> <manifest> <attribute name="Permissions" value="all-permissions"/> <attribute name="Application-Name" value="IGV"/> <!-- Here just to be a good citizen. Apparently reading from the correct manifest is tricky. We rely on a separate properties file--> <attribute name="Class-Path" value="${class-path}"/> <attribute name="Built-By" value="${user.name}"/> <attribute name="Main-Class" value="${main-class}"/> <section name="org/broad/igv/"> <attribute name="Specification-Title" value="IGV"/> <attribute name="Specification-Version" value="${version}"/> <attribute name="Specification-Vendor" value="${vendor}"/> <attribute name="Implementation-Version" value="${version} ${build-number}"/> <attribute name="Implementation-Vendor" value="${vendor}"/> </section> </manifest> </jar> <delete dir="${tmp.dir}" /> <copy file="${lib.dir}${batik-codec-finame}" tofile="${dist.dir}${batik-codec-finame}" overwrite="true"/> <copy file="${lib.dir}${goby-io-finame}" tofile="${dist.dir}${goby-io-finame}" overwrite="true"/> <copy file="${lib.dir}${log4j-core-finame}" tofile="${dist.dir}${log4j-core-finame}" overwrite="true"/> </target> <!--Add permissions attribute to manifest of jars --> <!-- We use exec because it's easier, this will only run on *nix--> <macrodef name="addPermsMacro"> <attribute name="jarfile"/> <sequential> <!--Newline is important!--> <echo file="tmp.txt">Permissions: all-permissions${line.separator}</echo> <exec executable="jar"> <arg value="ufm"/> <arg value="@{jarfile}"/> <arg value="tmp.txt"/> </exec> <delete file="tmp.txt"/> </sequential> </macrodef> <target name="addPerms"> <addPermsMacro jarfile="${dist.dir}${batik-codec-finame}"/> <addPermsMacro jarfile="${dist.dir}${goby-io-finame}"/> <addPermsMacro jarfile="${dist.dir}${log4j-core-finame}"/> </target> <target name="allBuild" depends="shrinkJar,addPerms"> <copy file="scripts/igv.sh" todir="${dist.dir}" /> <copy file="scripts/igv.bat" todir="${dist.dir}" /> <copy file="scripts/igv.command" todir="${dist.dir}" /> <chmod perm="775" file="${dist.dir}igv.sh" /> <chmod perm="775" file="${dist.dir}igv.command" /> </target> </project> No newline at end of file
build.gradle +214 −12 Original line number Diff line number Diff line Loading @@ -26,6 +26,16 @@ import org.apache.tools.ant.filters.ReplaceTokens // Define the main class for the application ext.mainClassName = 'org.broad.igv.ui.Main' // Set up the ProGuard optimizing task buildscript { repositories { flatDir dirs: 'lib_build' } dependencies { classpath ':proguard:' } } sourceSets { main { java { Loading @@ -38,7 +48,14 @@ sourceSets { } } configurations { jarsToShipUntouched compile.extendsFrom jarsToShipUntouched } dependencies { jarsToShipUntouched fileTree(dir: 'lib', include: ['batik-codec-1.10.jar', 'goby-io-igv-1.1.jar', 'log4j-core-2.11.0.jar']) compile fileTree(dir: 'lib', include: '*.jar') testCompile fileTree(dir: 'test/lib', include: '*.jar') } Loading @@ -52,7 +69,12 @@ targetCompatibility = 1.8 processResources { // Set the current timestamp for release builds; pass in a blank property to enable (i.e. -Ptimestamp="" at CLI) if (timestamp.equals("")) { timestamp = new Date().format("MM/dd/yyyy hh:mm aa") } if (timestamp.equals("")) { ext.date = new Date() timestamp = date.format("MM/dd/yyyy hh:mm aa") // This is a more filesystem-friendly date format. timestamp_fs = date.format("yyyy-MM-dd_HHmmss") } filesMatching('resources/about.properties') { filter (ReplaceTokens, Loading @@ -62,7 +84,7 @@ processResources { } jar { archiveName = 'igv.jar' archiveName = 'igv-minimal.jar' manifest { attributes( "Permissions": "all-permissions", Loading @@ -74,6 +96,82 @@ jar { } } task fullJar(type: Jar, dependsOn: jar) { // Based on https://discuss.gradle.org/t/removing-dependencies-from-a-jar-file-during-jar-task/5521/3 archiveName = 'igv.jar' from { ((configurations.compile - configurations.jarsToShipUntouched) + "${buildDir}/libs/igv-minimal.jar").collect { zipTree(it) } } { exclude "META-INF/**" } manifest { attributes( "Permissions": "all-permissions", "Application-Name": "IGV", "Built-By": System.getProperty('user.name'), "Main-Class": mainClassName, "Class-Path": configurations.jarsToShipUntouched.collect { it.getName() }.join(' ') ) } } task toolJar(type: Jar, dependsOn: jar) { from { ((configurations.compile - configurations.jarsToShipUntouched) + "${buildDir}/libs/igv-minimal.jar").collect { zipTree(it) } } { exclude "META-INF/**" } archiveName = 'igvtools.jar' manifest { attributes( "Implementation-Title": "IGVTools", "Built-By": System.getProperty('user.name'), "Main-Class": "org.broad.igv.tools.IgvTools", "Class-Path": configurations.jarsToShipUntouched.collect { it.getName() }.join(' ') ) } } task optimizeFullJar(type: proguard.gradle.ProGuardTask, dependsOn: fullJar) { // EXPERIMENTAL: Optimize the fullJar to remove unused classes. // This still needs tuning for correctness, and as a result we are not distributing the // jar it creates. It is still useful because of the reports it generates, however. doFirst { mkdir "proguard_log" } verbose injars "${buildDir}/libs/igv.jar" outjars "${buildDir}/libs/igv-OPT.jar" // Note that this points to the *JRE* jars. libraryjars "${System.getProperty('java.home')}/lib", jarfilter: 'rt.jar,charsets.jar,jce.jar,jfr.jar,jsse.jar,resources.jar,ext/jfxrt.jar' libraryjars "lib", jarfilter: 'batik-codec-1.10.jar,goby-io-igv-1.1.jar,log4j-core-2.11.0.jar' configuration "lib_build/proguard_full_client.cfg" printusage "proguard_log/proguard_full_client_log_${timestamp_fs}.txt" printseeds "proguard_log/proguard_full_client_seeds_${timestamp_fs}.txt" } task optimizeMinJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) { // EXPERIMENTAL: Optimize the minimal jar to remove unused classes (that is, our code base only). // As above, needs tuning for correctness. The IGV-focused report it produces is more useful. doFirst { mkdir "proguard_log" } verbose injars "${buildDir}/libs/igv-minimal.jar" outjars "${buildDir}/libs/igv-minimal-OPT.jar" libraryjars "${System.getProperty('java.home')}/lib", jarfilter: 'rt.jar,charsets.jar,jce.jar,jfr.jar,jsse.jar,resources.jar,ext/jfxrt.jar' // This is the difference from the above: consider all dependencies as libraryjars libraryjars "lib", filter: '!META-INF/**/module-info.class' configuration "lib_build/proguard_min_client.cfg" printusage "proguard_log/proguard_min_client_log_${timestamp_fs}.txt" printseeds "proguard_log/proguard_min_client_seeds_${timestamp_fs}.txt" } tasks.withType(Test) { systemProperties = System.getProperties() systemProperties['java.awt.headless'] = 'true' Loading @@ -84,26 +182,50 @@ tasks.withType(Test) { forkEvery = 1 } task createDist(type: Copy, dependsOn: jar) { task createDist(type: Copy, dependsOn: fullJar) { from ("scripts") { include 'igv.bat' include 'igv.command' include 'igv.sh' include 'readme.txt' } with copySpec { from ("${buildDir}/libs") { include 'igv*.jar' include 'igv.jar' } from ("lib") { include '*.jar' from (configurations.jarsToShipUntouched) { } into "lib" } into "${buildDir}/dist" into "${buildDir}/IGV-dist" } task createDistZip(type: Zip, dependsOn: createDist) { task signJars(dependsOn: createDist) { doLast { // Only sign if the keystoreFile exists ext.keystoreFile = file("${keystore}") if (keystoreFile.exists()) { ant.jar( update: true, file: "build/IGV-dist/lib/batik-codec-1.10.jar") { delegate.manifest { attribute(name: 'Permissions', value: 'all-permissions') } } ant.jar( update: true, file: "build/IGV-dist/lib/goby-io-igv-1.1.jar") { delegate.manifest { attribute(name: 'Permissions', value: 'all-permissions') } } ant.jar( update: true, file: "build/IGV-dist/lib/log4j-core-2.11.0.jar") { delegate.manifest { attribute(name: 'Permissions', value: 'all-permissions') } } ant.signjar( jar: 'build/IGV-dist/lib/*.jar', keystore:"${keystoreFile.absolutePath}", alias: "${alias}", keypass: "${keyPassword}", storepass: "${storePassword}", tsaurl: "${tsaurl}" ) } } } task createDistZip(type: Zip, dependsOn: [createDist, signJars]) { archiveName = "IGV_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGV" from "${buildDir}/dist" from "${buildDir}/IGV-dist" exclude "igv.bat" into createDistZip.baseName + "_${version}" doLast { Loading @@ -111,4 +233,84 @@ task createDistZip(type: Zip, dependsOn: createDist) { } } build.dependsOn createDistZip task createMacDist(type: Copy, dependsOn: [createDist, signJars]) { with copySpec { from ("scripts/mac.app") exclude "Contents/Info.plist.template" into "IGV_${version}.app" } with copySpec { from ("scripts/mac.app/Contents/Info.plist.template") filter (ReplaceTokens, tokens: [ VERSION: version ]) rename "Info.plist.template", "Info.plist" into "IGV_${version}.app/Contents" } with copySpec { from ("${buildDir}/IGV-dist/lib") include '*.jar' into "IGV_${version}.app/Contents/Java" } into "${buildDir}/IGV-Mac-dist" doLast { project.exec { commandLine('chmod', '775', "${buildDir}/IGV-Mac-dist/IGV_${version}.app" ) } } } task createMacDistZip(type: Zip, dependsOn: createMacDist) { archiveName = "IGV_${version}.app.zip" destinationDir = file("${buildDir}/distZip") from "${buildDir}/IGV-Mac-dist" doLast { project.exec { commandLine('chmod', '775', createMacDistZip.archivePath ) } } } task createWinDistZip(type: Zip, dependsOn: [createDist, signJars]) { archiveName = "IGV_Win_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGV_Win" from("${buildDir}/IGV-dist") { exclude "igv.sh" exclude "igv.command" } into createWinDistZip.baseName + "_${version}" doLast { project.exec { commandLine('chmod', '775', createWinDistZip.archivePath ) } } } task createToolsDist(type: Copy, dependsOn: toolJar) { from ("scripts") { include 'igvtools*' include 'igvtools*.bat' include 'igvtools*.command' } with copySpec { from ("${buildDir}/libs") { include 'igvtools.jar' } from (configurations.jarsToShipUntouched) { } into "lib" } with copySpec { from ("genomes") { } into "genomes" } into "${buildDir}/IGVTools-dist" } task createToolsDistZip(type: Zip, dependsOn: createToolsDist) { destinationDir = file("${buildDir}/distZip") archiveName = "igvtools_${version}.zip" baseName = "IGVTools" from "${buildDir}/IGVTools-dist" into createToolsDistZip.baseName doLast { project.exec { commandLine('chmod', '775', createToolsDistZip.archivePath ) } } } build.dependsOn createDistZip,createMacDistZip,createWinDistZip,createToolsDistZip
build_java9.gradle +121 −18 Original line number Diff line number Diff line Loading @@ -78,6 +78,20 @@ jar { } } task tooljar(type: Jar, dependsOn: jar) { // This jar is the same as the client jar above, just a different jar name and manifest archiveName = 'igvtools.jar' from(sourceSets.main.output) { } manifest { attributes( "Implementation-Title": "IGVTools", "Built-By": System.getProperty('user.name'), "Main-Class": "org.broad.igv.tools.IgvTools", ) } } compileJava { inputs.property("moduleName", moduleName) doFirst { Loading Loading @@ -131,7 +145,17 @@ test { } } def modulepathContent = copySpec { task createDist(type: Copy, dependsOn: jar) { from ('scripts/java9') { include 'igv.bat' include 'igv.command' include 'igv.sh' include 'igv_hidpi.*' include 'igv.args' include 'readme.txt' } with copySpec { from ("lib") { include '*.jar' exclude 'jide-oss-3.5.5.jar' Loading @@ -140,28 +164,19 @@ def modulepathContent = copySpec { include '*.jar' } from ("${buildDir}/libs") { include 'igv*.jar' include 'igv.jar' } into "lib" } task createDist(type: Copy, dependsOn: jar) { from ('scripts/java9') { include 'igv.bat' include 'igv.command' include 'igv.sh' include 'igv.args' } with modulepathContent into "${buildDir}/dist" into "${buildDir}/IGV-dist" } task createDistZip(type: Zip, dependsOn: createDist) { archiveName = "IGV_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGV" from "${buildDir}/dist" from "${buildDir}/IGV-dist" exclude "*.bat" into createDistZip.baseName + "_${version}" doLast { Loading @@ -169,4 +184,92 @@ task createDistZip(type: Zip, dependsOn: createDist) { } } build.dependsOn createDistZip task createMacDist(type: Copy, dependsOn: createDist) { with copySpec { from ("scripts/mac.app") exclude "Contents/Info.plist.template" into "IGV_${version}.app" } with copySpec { from ("scripts/java9/Info.plist.template") filter (ReplaceTokens, tokens: [ VERSION: version ]) rename "Info.plist.template", "Info.plist" into "IGV_${version}.app/Contents" } with copySpec { from ("${buildDir}/IGV-dist/lib") include '*.jar' into "IGV_${version}.app/Contents/Java" } into "${buildDir}/IGV-Mac-dist" doLast { project.exec { commandLine('chmod', '775', "${buildDir}/IGV-Mac-dist/IGV_${version}.app" ) } } } task createMacDistZip(type: Zip, dependsOn: createMacDist) { archiveName = "IGV_${version}.app.zip" destinationDir = file("${buildDir}/distZip") from "${buildDir}/IGV-Mac-dist" doLast { project.exec { commandLine('chmod', '775', createMacDistZip.archivePath ) } } } task createWinDistZip(type: Zip, dependsOn: createDist) { archiveName = "IGV_Win_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGV_Win" from("${buildDir}/IGV-dist") { exclude "*.sh" exclude "igv.command" } into createWinDistZip.baseName + "_${version}" doLast { project.exec { commandLine('chmod', '775', createWinDistZip.archivePath ) } } } task createToolsDist(type: Copy, dependsOn: tooljar) { from ("scripts/java9") { include 'igvtools*' include 'igvtools*.bat' include 'igvtools*.command' include 'igv.args' } with copySpec { from ("${buildDir}/libs") { include 'igvtools.jar' } from ("lib") { include '*.jar' exclude 'jide-oss-3.5.5.jar' } from ("lib_java9") { include '*.jar' } into "lib" } with copySpec { from ("genomes") { } into "genomes" } into "${buildDir}/IGVTools-dist" } task createToolsDistZip(type: Zip, dependsOn: createToolsDist) { archiveName = "igvtools_${version}.zip" destinationDir = file("${buildDir}/distZip") baseName = "IGVTools" from "${buildDir}/IGVTools-dist" into createToolsDistZip.baseName doLast { project.exec { commandLine('chmod', '775', createToolsDistZip.archivePath ) } } } build.dependsOn createDistZip,createMacDistZip,createWinDistZip,createToolsDistZip