Skip to content
Commits on Source (11)
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="source/java"/>
<classpathentry kind="src" path="sourceTest/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/libraries/testng/testng-jdk15.jar" sourcepath="/libraries/testng/src.zip"/>
<classpathentry kind="lib" path="/libraries/restrictionchecker/restrictions.jar"/>
<classpathentry kind="lib" path="/libraries/commons-io/commons-io.jar" sourcepath="/libraries/commons-io/src.zip"/>
<classpathentry kind="lib" path="/libraries/commons-lang/commons-lang.jar" sourcepath="/libraries/commons-lang/src.zip"/>
<classpathentry kind="lib" path="/libraries/unix"/>
<classpathentry kind="lib" path="/libraries/nativedata"/>
<classpathentry kind="output" path="targets/classes"/>
</classpath>
/targets
/test-output
/bin
/build
#!/bin/bash
if [ `dirname $0` != "." ]
then
echo "Please run from the same directory than the script source file is in"
exit 1
fi
if [ $# -ne 1 ]
then
echo "Usage: ./branch.sh [branch]"
echo ""
echo "Example: ./branch.sh release/13.04.x"
exit 1
fi
svn info svn+ssh://svncisd.ethz.ch/repos/cisd/base/branches/$1 2>/dev/null
if [ $? -eq 0 ]; then echo "Branch already exists!"; exit 1; fi
CURRENT=`svn info|grep URL|cut -d" " -f2`
svn copy $CURRENT svn+ssh://svncisd.ethz.ch/repos/cisd/base/branches/$1 -m "create branch $1"
mkdir -p out
rm -r out/temp_checkout
svn checkout --depth=empty svn+ssh://svncisd.ethz.ch/repos/cisd/base/branches/$1 out/temp_checkout
if [ $? -ne 0 ]; then echo "Checkout of new branch $1 failed!"; exit 1; fi
cd out/temp_checkout
svn update gradlew gradle build.gradle
./gradlew dependencyReport
cat out/reports/project/dependencies.txt|egrep ^.---|grep \>|sort|uniq|awk '{print $2 ":" $4}'|awk -F: '{print "s/" $1 ":" $2 ":" $3 "/" $1 ":" $2 ":" $4 "/g"}' > sed_commands
sed -f sed_commands build.gradle > build.gradle.tmp
mv build.gradle.tmp build.gradle
svn commit build.gradle -m "fixed dependencies for branch $1"
cd ../..
apply from: '../gradle/javaproject.gradle'
apply from: './javaproject.gradle'
group='sis'
......@@ -24,6 +24,14 @@ sourceSets {
}
jar {
manifest {
attributes 'Main-Class': 'ch.systemsx.cisd.base.BuildAndEnvironmentInfo'
}
from('targets/dist') {
include 'BUILD*INFO'
}
from fileTree("libs/")
}
......
#! /bin/bash
ME="$0"
MYDIR=${ME%/*}
cd $MYDIR
ant -lib ../../build_resources/lib/ecj.jar "$@"
<project name="base" default="dist" basedir="..">
<target name="clean">
<delete dir="${dist}" />
</target>
<import file="../../build_resources/ant/build-common.xml" />
<project-classpath name="ecp" classes="${classes}" />
<property name="distfolder" value="sis-base" />
<property name="mainfolder" value="base" />
<property name="jar.file" value="${dist}/sis-base.jar" />
<property name="dist.file" value="${dist}/sis-base" />
<property name="jar.test.file" value="${dist}/sis-base-test.jar" />
<property name="src.zip.file" value="${dist}/sis-base-src.zip" />
<property name="javadoc.zip.file" value="${dist}/sis-base-javadoc.zip" />
<property name="original.dist" value="../${ant.project.name}/dist" />
<property name="nativesrc" value="libs/native" />
<property name="nativeroot" value="${targets}/ant" />
<property name="native" value="${nativeroot}/native" />
<property name="dist.common" value="${dist}/${mainfolder}" />
<property name="dist.common.lib" value="${dist.common}/lib" />
<target name="ci" depends="build-common.ci, check-dependencies, dist" />
<target name="jar" depends="compile">
<mkdir dir="${dist.common.lib}" />
<build-info revision="revision.number" version="version.number" clean="clean.flag" />
<echo file="${build.info.file}">${version.number}:${revision.number}:${clean.flag}</echo>
<copy todir="${native}">
<fileset dir="${nativesrc}">
<include name="**/libunix.so" />
<include name="**/libunix.jnilib" />
</fileset>
</copy>
<copy todir="${native}">
<fileset dir="${nativesrc}">
<include name="**/libnativedata.so" />
<include name="**/libnativedata.jnilib" />
<include name="**/nativedata.dll" />
</fileset>
</copy>
<recursive-jar destfile="${jar.file}">
<fileset dir="${classes}">
<include name="**/*.class" />
<include name="${build.info.filename}" />
</fileset>
<fileset dir="${nativeroot}">
<include name="native/**/*.so" />
<include name="native/**/*.jnilib" />
<include name="native/**/*.dll" />
</fileset>
<manifest>
<attribute name="Main-Class"
value="ch.systemsx.cisd.base.BuildAndEnvironmentInfo" />
<attribute name="Version" value="${version.number}" />
<attribute name="Build-Number"
value="${version.number} (r${revision.number},${clean.flag})" />
</manifest>
</recursive-jar>
</target>
<target name="jar-test" depends="compile-tests">
<mkdir dir="${dist.common.lib}" />
<build-info revision="revision.number" version="version.number" clean="clean.flag" />
<echo file="${build.info.file}">${version.number}:${revision.number}:${clean.flag}</echo>
<copy todir="${native}">
<fileset dir="${nativesrc}">
<include name="**/libunix.so" />
<include name="**/libunix.jnilib" />
</fileset>
</copy>
<copy todir="${native}">
<fileset dir="${nativesrc}">
<include name="**/libnativedata.so" />
<include name="**/libnativedata.jnilib" />
<include name="**/nativedata.dll" />
</fileset>
</copy>
<recursive-jar destfile="${jar.test.file}">
<fileset dir="${classes}">
<include name="**/*.class" />
<include name="${build.info.filename}" />
</fileset>
<fileset dir="${nativeroot}">
<include name="native/**/*.so" />
<include name="native/**/*.jnilib" />
<include name="native/**/*.dll" />
</fileset>
<zipfileset src="${lib}/testng/testng-jdk15.jar" />
<zipfileset src="${lib}/commons-lang/commons-lang.jar" />
<zipfileset src="${lib}/commons-io/commons-io.jar" />
<manifest>
<attribute name="Main-Class" value="ch.systemsx.cisd.base.AllTests" />
<attribute name="Version" value="${version.number}" />
<attribute name="Build-Number"
value="${version.number} (r${revision.number},${clean.flag})" />
</manifest>
</recursive-jar>
</target>
<target name="src-zip">
<build-info revision="revision.number" version="version.number" clean="clean.flag" />
<mkdir dir="${classes}" />
<echo file="${build.info.file}">${version.number}:${revision.number}:${clean.flag}</echo>
<jar destfile="${src.zip.file}">
<fileset dir="${classes}">
<include name="${build.info.filename}" />
</fileset>
<fileset dir="${sources}">
<include name="**/*.java" />
</fileset>
<fileset dir="${sources.test}">
<include name="ch/systemsx/cisd/base/tests/**/*.java" />
</fileset>
<manifest>
<attribute name="Version" value="${version.number}" />
<attribute name="Build-Number"
value="${version.number} (r${revision.number},${clean.flag})" />
</manifest>
</jar>
</target>
<target name="doc">
<delete dir="targets/doc" />
<javadoc sourcepath="source/java"
packagenames="ch.systemsx.cisd.base.*"
classpath="../libraries/commons-lang/commons-lang.jar:../libraries/commons-io/commons-io.jar:../libraries/testng/testng-jdk15.jar:../libraries/restrictionchecker/restrictions.jar"
destdir="targets/doc"
access="public" />
</target>
<target name="dist" depends="clean, jar, jar-test, src-zip, doc">
<zip destfile="${javadoc.zip.file}" basedir="${targets}" includes="doc/**" />
<delete dir="${dist}/${mainfolder}" />
<delete dir="${dist}/${distfolder}" />
<move file="${jar.file}" todir="${dist}/${distfolder}/lib" />
<move file="${jar.test.file}" todir="${dist}/${distfolder}/lib" />
<move file="${src.zip.file}" todir="${dist}/${distfolder}/src" />
<move file="${javadoc.zip.file}" todir="${dist}/${distfolder}/doc" />
<copy todir="${dist}/${distfolder}/doc">
<fileset dir="doc" includes="**" />
</copy>
<copy todir="${dist}/${distfolder}">
<fileset dir="${original.dist}"/>
</copy>
<zip destfile="${dist.file}-${version.number}-r${revision.number}.zip"
basedir="${dist}"
includes="${distfolder}/**" />
<delete dir="${dist}/${distfolder}" />
</target>
<!--
// Runs the test suite 'tests.xml'.
-->
<target name="run-tests" description="Runs the test suite 'tests.xml'.">
<antcall target="build-common.run-tests">
<param name="test.suite" value="tests.xml" />
</antcall>
</target>
</project>
libsis-base-java (18.08~pre+git20180810.9248fca+dfsg-1) UNRELEASED; urgency=medium
* New upstream Git checkout
* Upstream moved to Gitlab
* d/watch: use git mode
* Fix homepage
* Drop binary files from upstream source
* Drop now unneeded get-orig-source target
* Point Vcs fields to salsa.debian.org
* Standards-Version: 4.2.0
TODO: Run time test failure: testGetLinkInfoRegularFile
-- Andreas Tille <tille@debian.org> Tue, 14 Aug 2018 09:31:05 +0200
libsis-base-java (14.12.0-5) unstable; urgency=medium
* d/watch: Enable parsing verisoned dirs
......
......@@ -13,10 +13,10 @@ Build-Depends: debhelper (>= 11),
testng,
libtool,
procps
Standards-Version: 4.1.3
Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/libsis-base-java.git
Vcs-Git: https://anonscm.debian.org/git/debian-med/libsis-base-java.git
Homepage: https://svnsis.ethz.ch/repos/cisd/libraries/trunk/sis-base/
Standards-Version: 4.2.0
Vcs-Browser: https://salsa.debian.org/med-team/libsis-base-java
Vcs-Git: https://salsa.debian.org/med-team/libsis-base-java.git
Homepage: https://sissource.ethz.ch/sispub/base
Package: libsis-base-java
Architecture: all
......
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: sis-base
Upstream-Contact: https://www1.ethz.ch/id/about/sections/sis/index_EN
Upstream-Contact: https://sissource.ethz.ch/sispub/base
Bernd Rinn <brinn@ethz.ch>
Source: http://bs-svn01.ethz.ch/repos/cisd/libraries/trunk/sis-base/sis-base.jar
Source: https://sissource.ethz.ch/sispub/base
Files-Excluded: */native
Files: *
Copyright: 2007-2012 ETH Zuerich, CISD
Copyright: 2007-2018 ETH Zuerich, CISD
License: Apache
On Debian systems, you can read the full text of the Apache
License in ‘/usr/share/common-licenses/Apache-2.0’.
Files: source/c/*
Copyright: 1988-2004, the Board of Trustees of the University of Illinois.
2007-2009, Center for Information Sciences and Databases, ETH Zurich, Switzerland.
2007-2018, Center for Information Sciences and Databases, ETH Zurich, Switzerland.
License: hdf5
Contributors to the library: National Center for Supercomputing
Applications (NCSA) at the University of Illinois, Lawrence
......@@ -90,6 +91,7 @@ License: hdf5
Files: debian/*
Copyright: 2015 Tim Booth <tbooth@ceh.ac.uk>
2015 Olivier Sallou <osallou@debian.org>
2015-2018 Andreas Tille <tille@debian.org>
License: GPL-3
On Debian systems, the full text of the GNU General Public
License version 3 can be found in the file
......
#!/bin/bash
set -e
PKG=`dpkg-parsechangelog | awk '/^Source/ { print $2 }'`
VERSION=`dpkg-parsechangelog | awk '/^Version:/ { print $2 }' | sed 's/\([0-9\.]\+\)-[0-9]\+$/\1/'`
cd ..
mkdir -p tarballs
cd tarballs
svn export https://svnsis.ethz.ch/repos/cisd/base/tags/release/14.12.x/${VERSION}/base ${PKG}-${VERSION}
rm -rf ${PKG}-${VERSION}/build
rm -rf ${PKG}-${VERSION}/libs
GZIP="--best --no-name" tar --owner=root --group=root --mode=a+rX --exclude-vcs -caf "$PKG"_"$VERSION".orig.tar.xz "$PKG"-"$VERSION"
rm -rf "$PKG"-"$VERSION"
......@@ -10,9 +10,6 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
get-orig-source:
. debian/get-orig-source
%:
dh $@ --with javahelper
......
version=4
# This watch file does not really work since it is pointing to a directory instead of a file
https://svnsis.ethz.ch/repos/cisd/base/tags/release/(\d+\.\d+\.x)/(\d+\.\d+\.\d+) \
debian debian/get-orig-source
opts="mode=git,pretty=18.08~pre+git%cd.%h,repacksuffix=+dfsg,dversionmangle=s/\+dfsg//g,repack,compression=xz" \
https://sissource.ethz.ch/sispub/base.git HEAD
# The versioning is <year>.<month>.<patch level>. So the next release will be
# something like 18.09.0 or 18.10.0. If you call the pre-release 18.08, you will
# be fine
#Wed Apr 23 11:31:33 CEST 2014
#Tue Jun 13 15:27:00 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://svncisd.ethz.ch/repos/cisd/ivy-repository/trunk/gradle/distribution/1.8/gradle-1.8-all.zip
distributionUrl=http\://svnsis.ethz.ch/repos/cisd/ivy-repository/trunk/gradle/distribution/3.5/gradle-3.5-all.zip
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
......@@ -6,12 +6,30 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
......@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
......@@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
......@@ -90,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
......@@ -114,6 +113,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
......@@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
......@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
......@@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
......@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
......
apply plugin: 'java'
apply plugin: 'project-report'
evaluationDependsOnChildren()
configurations {
tests {
extendsFrom testRuntime
}
}
configurations {
ecj
}
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 0, 'hours'
resolutionStrategy.cacheChangingModulesFor 0, 'hours'
}
task wrapper(type: Wrapper) {
gradleVersion = '3.5'
distributionUrl = "http://svnsis.ethz.ch/repos/cisd/ivy-repository/trunk/gradle/distribution/3.5/gradle-3.5-all.zip"
}
sourceCompatibility='1.8'
targetCompatibility='1.8'
sourceSets {
main {
java {
srcDirs = ['source/java']
}
}
test {
java {
srcDirs = ['sourceTest/java']
}
resources {
srcDirs = ['sourceTest/java']
}
}
examples {
java {
srcDirs = ['sourceExamples/java']
}
}
}
buildDir = 'targets/gradle'
buildscript {
apply from: './repository.gradle'
repositories repositoryConfig
dependencies {
classpath 'cisd:cisd-ant-tasks:+'
}
}
repositories repositoryConfig
def execute(command, arguments) {
new ByteArrayOutputStream().withStream { os ->
print "execute: ${command}"
arguments.collect({print " ${it}"})
println ''
def result = exec {
executable = command
args = arguments
standardOutput = os
}
return os.toString().split('\n')
}
}
ext.executeFunction = {
command, arguments -> execute(command, arguments)
}
def execute_working_dir(command, arguments, working_dir) {
new ByteArrayOutputStream().withStream { os ->
print "execute: ${command}"
arguments.collect({print " ${it}"})
println ''
def result = exec {
executable = command
args = arguments
standardOutput = os
}
return os.toString().split('\n')
}
}
ext.svnCommand = 'svn'
def isSvnProject() {
return new java.io.File(projectDir, ".svn").isDirectory() || new java.io.File(projectDir, "../.svn").isDirectory()
}
def isGitProject() {
return new java.io.File(projectDir, ".git").isDirectory() || new java.io.File(projectDir, "../.git").isDirectory()
}
def executeSVN(arguments) {
arguments.add(0, '--non-interactive')
return execute(svnCommand, arguments)
}
def calculateCleanFlag() {
return 'clean'
for (childProject in project.childProjects.values()) {
if (childProject.cleanFlag == 'dirty') {
return 'dirty'
}
}
def isSvn = isSvnProject()
if (isSvn) {
def output = executeSVN(['status', '../' + project.name])
def lines = output.findAll({ (it.startsWith('?') || it.trim().isEmpty()) == false})
return lines.isEmpty() ? 'clean' : 'dirty'
} else if (isGitProject()) {
def output = execute_working_dir('git', ['status', '--porcelain'], '../' + project.name)
return output.length == 0 ? 'clean' : 'dirty'
} else {
return 'dirty'
}
}
def findMaximum(lines, key) {
return lines.findAll({ it.startsWith(key)}).collect({element -> element.split(':')[1].toInteger()}).max()
}
def calculateBuildInfo() {
if (isSvnProject()) {
def output = executeSVN(['info', '-R', '../' + project.name])
def maxRevisionNumber = findMaximum(output, 'Revision:')
project.ext.revisionNumber = findMaximum(output, 'Last Changed Rev:')
if (maxRevisionNumber < project.ext.revisionNumber) {
throw new GradleException("Maximum revision ($maxRevisionNumber) is less than the maximum "
+ "last changed revision ($project.ext.revisionNumber).")
}
project.ext.versionNumber = 'SNAPSHOT'
def url = output.findAll({ it.startsWith('URL:')})[0].split('URL:')[1].trim()
if (url.contains('/trunk') == false) {
def pathElements = url.split('/')
project.ext.versionNumber = 'libraries' == pathElements[-2] ? pathElements[-3] : pathElements[-2]
}
} else if (isGitProject()) {
def gitlogoutput = execute_working_dir('git', ['log', '-1', '--format=%at'], '../' + project.name)
project.ext.revisionNumber = Integer.parseInt(gitlogoutput[0])
def tag = 'git tag -l --points-at HEAD'.execute().text.trim()
if (tag == null || tag.isEmpty()) {
project.ext.versionNumber = 'SNAPSHOT'
} else if (tag.contains('pybis')) {
throw new GradleException("project must contain a readme file")
} else {
project.ext.versionNumber = tag
}
} else {
project.ext.revisionNumber = 1
project.ext.versionNumber = 'SNAPSHOT'
}
for (childProject in project.childProjects.values()) {
project.ext.revisionNumber = Math.max(project.ext.revisionNumber, childProject.revisionNumber)
if (project.ext.versionNumber != childProject.versionNumber) {
throw new GradleException("Inconsistent version numbers: "
+ "${project.name} at version ${project.ext.versionNumber} but "
+ "${childProject.name} at version ${childProject.versionNumber}.")
}
}
version = "${project.ext.versionNumber}-r${project.ext.revisionNumber}"
project.ext.revisionForPublication = project.ext.versionNumber.startsWith('SNAPSHOT') ? "r${project.ext.revisionNumber}" : project.ext.versionNumber
project.ext.cleanFlag = calculateCleanFlag()
def buildInfo = "${project.ext.versionNumber}:${project.ext.revisionNumber}:${project.ext.cleanFlag}"
println "BUILD INFO for $project: $buildInfo"
def targetsDist = 'targets/dist'
def distFolder = new File("${project.projectDir}/$targetsDist")
distFolder.deleteDir()
distFolder.mkdirs()
file("${project.projectDir}/$targetsDist/BUILD-${project.name}.INFO") << buildInfo
}
calculateBuildInfo()
group='cisd'
task checkRestrictions(type: Exec, dependsOn: [classes, testClasses]) {
doFirst {
def cp = configurations.testCompile.filter({ f -> f.name.startsWith('restrictionchecker') || f.name.startsWith('bcel')}).asPath
def cmd = ['java', '-cp', cp, 'ch.rinn.restrictions.RestrictionChecker', '-r', sourceSets.main.output.classesDir]
if (sourceSets.test.output.classesDir.exists()) {
cmd.add(sourceSets.test.output.classesDir)
}
cmd.add('-cp')
cmd.add(sourceSets.main.output.classesDir)
if (sourceSets.test.output.classesDir.exists()) {
cmd.add(sourceSets.test.output.classesDir)
}
cmd.add(configurations.testCompile.asPath)
commandLine cmd
}
}
def deleteSymbolicLinksRecursively(file) {
def absolutePath = file.getAbsolutePath()
def canonicalPath = file.getCanonicalPath()
if (absolutePath.equals(canonicalPath) == false) {
file.delete();
} else if (file.isDirectory()) {
File[] files = file.listFiles()
for (File child : files) {
deleteSymbolicLinksRecursively(child)
}
}
}
task deleteSymLinks {
doFirst {
println "DELETE SYM LINKS in $buildDir"
deleteSymbolicLinksRecursively buildDir
}
}
clean.dependsOn deleteSymLinks
test {
useTestNG()
options.suites('sourceTest/java/tests.xml')
systemProperty "ant.project.name", project.name
maxHeapSize = "8192m"
jvmArgs '-XX:MaxPermSize=1024m', '-Duser.timezone=Europe/Zurich'
testLogging.showStandardStreams = true
ignoreFailures = true
}
test.dependsOn checkRestrictions
dependencies {
ecj "eclipse:ecj:+"
}
compileJava {
options.encoding = 'utf-8'
options.fork = true
doFirst {
options.forkOptions.with {
executable = 'java'
jvmArgs = createJvmArgs()
}
}
}
compileTestJava {
options.encoding = 'utf-8'
options.fork = true
doFirst {
options.forkOptions.with {
executable = 'java'
jvmArgs = createJvmArgs()
}
}
}
def createJvmArgs() {
def args = ['-cp', configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', '-nowarn']
return args
}
processTestResources {
fileMode=0666
}
apply plugin: 'eclipse'
eclipse {
classpath {
downloadSources=true
defaultOutputDir = file('targets/classes')
}
}
eclipse.classpath.file {
whenMerged{ classpath ->
def projectRefs = classpath.entries.findAll{entry -> entry.kind =='src' && entry.path.startsWith('/')}
classpath.entries.removeAll(projectRefs)
classpath.entries.addAll(projectRefs)
}
}
task testJar(type: Jar, dependsOn: testClasses) {
baseName = "test-${project.archivesBaseName}"
from sourceSets.test.output
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
compileJava.dependsOn sourcesJar
artifacts {
tests testJar
}
artifacts {
archives sourcesJar
}
task compileDependencies(type: Copy) {
into "$buildDir/output/compile-dependencies"
from configurations.compile
}
task runtimeDependencies(type: Copy) {
into "$buildDir/output/runtime-dependencies"
from configurations.runtime
}
task testCompileDependencies(type: Copy) {
into "$buildDir/output/testCompile-dependencies"
from configurations.testCompile
}
task testRuntimeDependencies(type: Copy) {
into "$buildDir/output/testRuntime-dependencies"
from configurations.testRuntime
}
task checkDependencies(dependsOn: classes) << {
ant.taskdef(name: 'dependencychecker', classname: 'classycle.ant.DependencyCheckingTask', classpath: configurations.testRuntime.asPath)
ant.dependencychecker(
definitionFile: 'resource/dependency-structure.ddf',
failOnUnwantedDependencies: 'true',
mergeInnerClasses: 'true') {
fileset(dir: "${buildDir}", includes: "**/*.class")
}
}
apply plugin: 'ivy-publish'
if (hasProperty('ivyRepository') == false || ''.equals(project.ivyRepository))
{
project.ext.ivyRepository = "${project.projectDir}/../ivy-repository"
}
publishing {
repositories {
ivy {
ivyPattern "file://${project.ivyRepository}/[organisation]/[module]/[revision]/ivy.xml"
artifactPattern "file://${project.ivyRepository}/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
}
}
}
publish {
dependsOn build
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
ext.repositoryConfig = {
ivy {
ivyPattern "${project.projectDir}/../ivy-repository/[organisation]/[module]/[revision]/ivy.xml"
artifactPattern "${project.projectDir}/../ivy-repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
}
ivy {
ivyPattern "http://svnsis.ethz.ch/repos/cisd/ivy-repository/trunk/[organisation]/[module]/[revision]/ivy.xml"
artifactPattern "http://svnsis.ethz.ch/repos/cisd/ivy-repository/trunk/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
}
}
......@@ -141,8 +141,10 @@ public final class NativeLibraryUtilities
*/
public static String tryCopyNativeLibraryToTempFile(final String libraryName)
{
// Request clean-up of old native library temp files as under Windows the files are locked and
// cannot be deleted on regular shutdown.
return ResourceUtilities.tryCopyResourceToTempFile(getLibPath("/native", libraryName),
libraryName, ".so");
libraryName, ".so", true);
}
private static String getLibPath(final String prefix, final String libraryName)
......
......@@ -18,11 +18,13 @@ package ch.systemsx.cisd.base.utilities;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel;
import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked;
......@@ -56,6 +58,29 @@ public class ResourceUtilities
}
}
/**
* Tries to copy the resource with the given name to a temporary file.
*
* @param resource The name of the resource to copy.
* @param prefix The prefix to use for the temporary name.
* @param postfix The postfix to use for the temporary name.
* @param cleanUpOldResources If <code>true</code>, remove old leftover temporary files for this
* <var>prefix</var> and <var>postfix</var>.
* @return The name of the temporary file, or <code>null</code>, if the resource could not be
* copied.
*/
public static String tryCopyResourceToTempFile(final String resource, final String prefix,
final String postfix, final boolean cleanUpOldResources)
{
try
{
return copyResourceToTempFile(resource, prefix, postfix, cleanUpOldResources);
} catch (final Exception ex)
{
return null;
}
}
/**
* Copies the resource with the given name to a temporary file. The file will be deleted on
* program exit.
......@@ -70,6 +95,29 @@ public class ResourceUtilities
public static String copyResourceToTempFile(final String resource, final String prefix,
final String postfix) throws IOExceptionUnchecked
{
return copyResourceToTempFile(resource, prefix, postfix, false);
}
/**
* Copies the resource with the given name to a temporary file. The file will be deleted on
* program exit.
*
* @param resource The name of the resource to copy.
* @param prefix The prefix to use for the temporary name.
* @param postfix The postfix to use for the temporary name.
* @param cleanUpOldResources If <code>true</code>, remove old leftover temporary files for this
* <var>prefix</var> and <var>postfix</var>.
* @return The name of the temporary file.
* @throws IllegalArgumentException If the resource cannot be found in the class path.
* @throws IOExceptionUnchecked If an {@link IOException} occurs.
*/
public static String copyResourceToTempFile(final String resource, final String prefix,
final String postfix, final boolean cleanUpOldResources) throws IOExceptionUnchecked
{
if (cleanUpOldResources)
{
deleteOldResourceTempFiles(prefix, postfix);
}
final InputStream resourceStream = ResourceUtilities.class.getResourceAsStream(resource);
if (resourceStream == null)
{
......@@ -98,4 +146,13 @@ public class ResourceUtilities
}
}
private static void deleteOldResourceTempFiles(final String prefix, final String postfix)
{
final FilenameFilter filter = new WildcardFileFilter(prefix + "*" + postfix);
for (File file : new File(System.getProperty("java.io.tmpdir")).listFiles(filter))
{
file.delete();
}
}
}