Skip to content

Instantly share code, notes, and snippets.

@sbesson
Last active November 9, 2015 09:52
Show Gist options
  • Select an option

  • Save sbesson/37599a0b0f1562ef4ed3 to your computer and use it in GitHub Desktop.

Select an option

Save sbesson/37599a0b0f1562ef4ed3 to your computer and use it in GitHub Desktop.
A script to decouple the components from Bio-Formats
#! /bin/bash
here=$(pwd)
# Initial clone
cd /tmp
rm -rf /tmp/bioformats-cpp || echo "Already cleaned"
# Clone Bio-Formats
git clone https://github.com/openmicroscopy/bioformats.git bioformats-cpp
# Filter branch to keep only the model components
cd bioformats-cpp
PATHS_TO_KEEP="cpp"
git filter-branch -f --index-filter "git rm --ignore-unmatch --cached -qr -- . && git reset -q \$GIT_COMMIT -- $PATHS_TO_KEEP" --prune-empty -- HEAD
# Clean empty commits
tmpfile=`mktemp -t splitgit`
chmod 755 $tmpfile
echo '#!/usr/bin/env ruby
old_parents = gets.chomp.gsub("-p ", " ")
new_parents = old_parents.empty? ? [] : `git show-branch --independent #{old_parents}`.split
puts new_parents.map{|p| "-p " + p}.join(" ")' > $tmpfile
git filter-branch -f --prune-empty --parent-filter $tmpfile HEAD
rm $tmpfile
#! /bin/bash
here=$(pwd)
# Initial clone
cd /tmp
# rm -rf /tmp/bioformats || echo "Already cleaned"
# Clone Bio-Formats
# git clone https://github.com/openmicroscopy/bioformats.git bf-cppwrap
# Filter branch to keep only the model components
cd bf-cppwrap
PATHS_TO_KEEP="components/formats-bsd/cppwrap components/formats-bsd/pom.xml pom.xml .travis.yml"
git filter-branch -f --index-filter "git rm --ignore-unmatch --cached -qr -- . && git reset -q \$GIT_COMMIT -- $PATHS_TO_KEEP" --prune-empty -- HEAD
# Clean empty commits
tmpfile=`mktemp -t splitgit`
chmod 755 $tmpfile
echo '#!/usr/bin/env ruby
old_parents = gets.chomp.gsub("-p ", " ")
new_parents = old_parents.empty? ? [] : `git show-branch --independent #{old_parents}`.split
puts new_parents.map{|p| "-p " + p}.join(" ")' > $tmpfile
git filter-branch -f --prune-empty --parent-filter $tmpfile HEAD
rm $tmpfile
diff --git a/.travis.yml b/.travis.yml
index 5c71fde..abb63c1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,60 +1,16 @@
language: java
+# This (sudo: false) is needed to "run on container-based infrastructure" on
+# which cache: is available
+# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
+sudo: false
+
+# http://docs.travis-ci.com/user/caching/#Arbitrary-directories
+cache:
+ directories:
+ - $HOME/.m2
+
jdk:
- oraclejdk8
- oraclejdk7
- openjdk6
-
-env:
- - BUILD=maven
- - BUILD=cpp
- - BUILD=cppwrap
- - BUILD=flake8
- - BUILD=sphinx
- - BUILD=ant
-
-matrix:
- fast_finish: true
- allow_failures:
- - env: "BUILD=cppwrap"
-
-before_install:
- - if [[ $BUILD == 'cpp' ]]; then sudo add-apt-repository -y ppa:kubuntu-ppa/backports; fi
- - if [[ $BUILD == 'cpp' ]]; then sudo apt-get -qq update; fi
- - if [[ $BUILD == 'cpp' ]] || [[ $BUILD == 'cppwrap' ]]; then sudo apt-get install -qq cmake; fi
- - if [[ $BUILD == 'sphinx' ]]; then sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"; fi
- - if [[ $BUILD == 'cpp' ]]; then sudo add-apt-repository -y ppa:dhor/myway; fi
- - sudo apt-get -qq update
- - if [[ $BUILD != 'sphinx' ]]; then sudo apt-get install -qq python-genshi; fi
- - if [[ $BUILD == 'cpp' ]] || [[ $BUILD == 'cppwrap' ]]; then sudo apt-get install -qq build-essential libboost1.48-all-dev; fi
- - if [[ $BUILD == 'cpp' ]]; then sudo apt-get install -qq libgtest-dev libxerces-c-dev libtiff4-dev doxygen graphviz graphicsmagick; fi
- - if [[ $BUILD == 'sphinx' ]] || [[ $BUILD == 'flake8' ]]; then sudo pip install flake8 Sphinx==1.2.3; fi
- - if [[ $BUILD == 'sphinx' ]]; then sudo apt-get -y install texlive-latex-base texlive-latex-recommended texlive-xetex; fi
- - if [[ $BUILD == 'sphinx' ]]; then sudo apt-get -y install texlive-latex-extra texlive-fonts-recommended fonts-texgyre; fi
- - if [[ $BUILD == 'sphinx' ]]; then sudo fc-cache -rsfv; fi
-
-install:
- - if [[ $BUILD != 'ant' ]] && [[ $BUILD != 'sphinx' ]] && [[ $BUILD != 'flake8' ]]; then git fetch --tags; fi
- - if [[ $BUILD == 'maven' ]]; then mvn install -DskipTests=true; fi
-
-script:
- - ./tools/test-build $BUILD
-
-matrix:
- exclude:
- - jdk: openjdk6
- env: BUILD=flake8
- - jdk: oraclejdk7
- env: BUILD=flake8
- - jdk: openjdk6
- env: BUILD=sphinx
- - jdk: oraclejdk7
- env: BUILD=sphinx
- - jdk: openjdk6
- env: BUILD=cpp
- - jdk: oraclejdk7
- env: BUILD=cpp
- - jdk: oraclejdk8
- env: BUILD=cppwrap
- - jdk: openjdk6
- env: BUILD=cppwrap
diff --git a/pom.xml b/pom.xml
index d91982f..ef690a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,28 +16,7 @@
<inceptionYear>2005</inceptionYear>
<modules>
- <module>components/specification</module>
- <module>components/forks/jai</module>
- <module>components/forks/mdbtools</module>
- <module>components/forks/poi</module>
- <module>components/forks/turbojpeg</module>
- <module>components/autogen</module>
- <module>components/formats-api</module>
- <module>components/formats-bsd</module>
- <module>components/formats-gpl</module>
- <module>components/bundles/bioformats_package</module>
<module>components/formats-common</module>
- <module>components/bio-formats-plugins</module>
- <module>components/bundles/loci-tools</module>
- <module>components/metakit</module>
- <module>components/bundles/ome-tools</module>
- <module>components/ome-jxr</module>
- <module>components/ome-xml</module>
- <module>components/bio-formats-tools</module>
- <module>components/test-suite</module>
- <module>components/stubs/lwf-stubs</module>
- <module>components/stubs/mipav</module>
- <module>components/xsd-fu</module>
</modules>
<properties>
@@ -136,130 +115,6 @@
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.4</version>
- <executions>
- <execution>
- <phase>initialize</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <defaults>
- <default>UNKNOWN</default>
- </defaults>
- <source>
- import java.util.regex.Pattern
-
- def ant = new AntBuilder()
- try {
- ant.exec(outputproperty:"shortrevision",
- failifexecutionfails:"false",
- executable: 'git') {
- arg(line:"rev-parse --short HEAD")
- }
- }
- catch (Exception e) { }
- try {
- ant.exec(outputproperty:"revision",
- failifexecutionfails:"false",
- executable: 'git') {
- arg(line:"rev-parse HEAD")
- }
- }
- catch (Exception e) { }
-
- try {
- ant.exec(outputproperty:"exactTag",
- resultproperty:"exactTagRC",
- failifexecutionfails:"true",
- failonerror:"false",
- executable: 'git') {
- arg(line:"describe --match=v[0-9]* --exact")
- }
- }
- catch (Exception e) {
- ant.project.properties.exactTagRC = ""
- ant.project.properties.exactTag = ""
- }
-
- try {
- ant.exec(outputproperty:"describe",
- failifexecutionfails:"true",
- executable: 'git') {
- arg(line:"describe --match=v[0-9]*")
- }
- }
- catch (Exception e) {
- ant.project.properties.describe = ""
- }
-
- println ant.project.properties.exactTagRC
- println ant.project.properties.exactTag
- println ant.project.properties.describe
-
- if (ant.project.properties.exactTagRC == 0) {
- // if we're building from a tag, set the release name
- // to be the tag name, minus the leading 'v'
- project.properties.release = ant.project.properties.exactTag.substring(1)
- }
- else if (ant.project.properties.describe) {
- // if we're building within Git, but not from a tag,
- // then use the last known tag's number to set a snapshot
- // version
- try {
- def regex = Pattern.compile("v([0-9]+)[.]([0-9]+)[.]([0-9]+)(.*)")
- def groups = regex.matcher(ant.project.properties.describe)
- groups.matches()
- def major = groups.group(1)
- def minor = groups.group(2)
- def patch = groups.group(3)
- project.properties.release = major + "." + minor + "." + patch + "-SNAPSHOT"
- }
- catch (IllegalStateException e) {
- project.properties.release = ""
- }
- }
- else {
- // if we're building outside of Git, set a default
- // version number
- project.properties.release = project.properties.default
- }
- project.properties.shortrevision = ant.project.properties.shortrevision
- project.properties.revision = ant.project.properties.revision
-
- if (!project.properties.release) {
- // assume this is a source package outside of Git
- // there should be a ant/gitversion.xml file with the
- // version information used when the package was created
-
- def xmlfile = project.properties.get('project.rootdir') + "/ant/gitversion.xml"
-
- def xml = new XmlParser().parse(xmlfile)
- for (property in xml.property) {
- println "parsing " + property.'@name'
- if ('release.version' == property.'@name') {
- project.properties.release = property.'@value'
- }
- else if ('vcs.revision' == property.'@name') {
- project.properties.revision = property.'@value'
- }
- else if ('vcs.shortrevision' == property.'@name') {
- project.properties.shortrevision = property.'@value'
- }
- }
- }
-
- println "shortrevision = " + project.properties.shortrevision
- println "revision = " + project.properties.revision
- println "release = " + project.properties.release
- </source>
- </configuration>
- </execution>
- </executions>
- </plugin>
<!-- Add Implementation-Build entry to JAR manifest. -->
<plugin>
#! /bin/bash
here=$(pwd)
# Initial clone
cd /tmp
rm -rf /tmp/formats-common || echo "Already cleaned"
# Clone Bio-Formats
git clone https://github.com/openmicroscopy/bioformats.git formats-common
# Filter branch to keep only the common components
cd formats-common
PATHS_TO_KEEP="components/formats-common pom.xml .travis.yml"
git filter-branch -f --index-filter "git rm --ignore-unmatch --cached -qr -- . && git reset -q \$GIT_COMMIT -- $PATHS_TO_KEEP" --prune-empty -- HEAD
# Clean empty commits
tmpfile=`mktemp -t splitgit`
chmod 755 $tmpfile
echo '#!/usr/bin/env ruby
old_parents = gets.chomp.gsub("-p ", " ")
new_parents = old_parents.empty? ? [] : `git show-branch --independent #{old_parents}`.split
puts new_parents.map{|p| "-p " + p}.join(" ")' > $tmpfile
git filter-branch -f --prune-empty --parent-filter $tmpfile HEAD
rm $tmpfile
# Apply git diff to let Travis compile
git apply $here/ome-model-diff
diff --git a/.travis.yml b/.travis.yml
index 5c71fde..abb63c1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,60 +1,16 @@
language: java
+# This (sudo: false) is needed to "run on container-based infrastructure" on
+# which cache: is available
+# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
+sudo: false
+
+# http://docs.travis-ci.com/user/caching/#Arbitrary-directories
+cache:
+ directories:
+ - $HOME/.m2
+
jdk:
- oraclejdk8
- oraclejdk7
- openjdk6
-
-env:
- - BUILD=maven
- - BUILD=cpp
- - BUILD=cppwrap
- - BUILD=flake8
- - BUILD=sphinx
- - BUILD=ant
-
-matrix:
- fast_finish: true
- allow_failures:
- - env: "BUILD=cppwrap"
-
-before_install:
- - if [[ $BUILD == 'cpp' ]]; then sudo add-apt-repository -y ppa:kubuntu-ppa/backports; fi
- - if [[ $BUILD == 'cpp' ]]; then sudo apt-get -qq update; fi
- - if [[ $BUILD == 'cpp' ]] || [[ $BUILD == 'cppwrap' ]]; then sudo apt-get install -qq cmake; fi
- - if [[ $BUILD == 'sphinx' ]]; then sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"; fi
- - if [[ $BUILD == 'cpp' ]]; then sudo add-apt-repository -y ppa:dhor/myway; fi
- - sudo apt-get -qq update
- - if [[ $BUILD != 'sphinx' ]]; then sudo apt-get install -qq python-genshi; fi
- - if [[ $BUILD == 'cpp' ]] || [[ $BUILD == 'cppwrap' ]]; then sudo apt-get install -qq build-essential libboost1.48-all-dev; fi
- - if [[ $BUILD == 'cpp' ]]; then sudo apt-get install -qq libgtest-dev libxerces-c-dev libtiff4-dev doxygen graphviz graphicsmagick; fi
- - if [[ $BUILD == 'sphinx' ]] || [[ $BUILD == 'flake8' ]]; then sudo pip install flake8 Sphinx==1.2.3; fi
- - if [[ $BUILD == 'sphinx' ]]; then sudo apt-get -y install texlive-latex-base texlive-latex-recommended texlive-xetex; fi
- - if [[ $BUILD == 'sphinx' ]]; then sudo apt-get -y install texlive-latex-extra texlive-fonts-recommended fonts-texgyre; fi
- - if [[ $BUILD == 'sphinx' ]]; then sudo fc-cache -rsfv; fi
-
-install:
- - if [[ $BUILD != 'ant' ]] && [[ $BUILD != 'sphinx' ]] && [[ $BUILD != 'flake8' ]]; then git fetch --tags; fi
- - if [[ $BUILD == 'maven' ]]; then mvn install -DskipTests=true; fi
-
-script:
- - ./tools/test-build $BUILD
-
-matrix:
- exclude:
- - jdk: openjdk6
- env: BUILD=flake8
- - jdk: oraclejdk7
- env: BUILD=flake8
- - jdk: openjdk6
- env: BUILD=sphinx
- - jdk: oraclejdk7
- env: BUILD=sphinx
- - jdk: openjdk6
- env: BUILD=cpp
- - jdk: oraclejdk7
- env: BUILD=cpp
- - jdk: oraclejdk8
- env: BUILD=cppwrap
- - jdk: openjdk6
- env: BUILD=cppwrap
diff --git a/pom.xml b/pom.xml
index 07ba51e..38302d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,26 +17,7 @@
<modules>
<module>components/specification</module>
- <module>components/forks/jai</module>
- <module>components/forks/mdbtools</module>
- <module>components/forks/poi</module>
- <module>components/forks/turbojpeg</module>
- <module>components/autogen</module>
- <module>components/formats-api</module>
- <module>components/formats-bsd</module>
- <module>components/formats-gpl</module>
- <module>components/bundles/bioformats_package</module>
- <module>components/formats-common</module>
- <module>components/bio-formats-plugins</module>
- <module>components/bundles/loci-tools</module>
- <module>components/metakit</module>
- <module>components/bundles/ome-tools</module>
- <module>components/ome-jxr</module>
<module>components/ome-xml</module>
- <module>components/bio-formats-tools</module>
- <module>components/test-suite</module>
- <module>components/stubs/lwf-stubs</module>
- <module>components/stubs/mipav</module>
<module>components/xsd-fu</module>
</modules>
@@ -136,130 +117,6 @@
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.4</version>
- <executions>
- <execution>
- <phase>initialize</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <defaults>
- <default>UNKNOWN</default>
- </defaults>
- <source>
- import java.util.regex.Pattern
-
- def ant = new AntBuilder()
- try {
- ant.exec(outputproperty:"shortrevision",
- failifexecutionfails:"false",
- executable: 'git') {
- arg(line:"rev-parse --short HEAD")
- }
- }
- catch (Exception e) { }
- try {
- ant.exec(outputproperty:"revision",
- failifexecutionfails:"false",
- executable: 'git') {
- arg(line:"rev-parse HEAD")
- }
- }
- catch (Exception e) { }
-
- try {
- ant.exec(outputproperty:"exactTag",
- resultproperty:"exactTagRC",
- failifexecutionfails:"true",
- failonerror:"false",
- executable: 'git') {
- arg(line:"describe --match=v[0-9]* --exact")
- }
- }
- catch (Exception e) {
- ant.project.properties.exactTagRC = ""
- ant.project.properties.exactTag = ""
- }
-
- try {
- ant.exec(outputproperty:"describe",
- failifexecutionfails:"true",
- executable: 'git') {
- arg(line:"describe --match=v[0-9]*")
- }
- }
- catch (Exception e) {
- ant.project.properties.describe = ""
- }
-
- println ant.project.properties.exactTagRC
- println ant.project.properties.exactTag
- println ant.project.properties.describe
-
- if (ant.project.properties.exactTagRC == 0) {
- // if we're building from a tag, set the release name
- // to be the tag name, minus the leading 'v'
- project.properties.release = ant.project.properties.exactTag.substring(1)
- }
- else if (ant.project.properties.describe) {
- // if we're building within Git, but not from a tag,
- // then use the last known tag's number to set a snapshot
- // version
- try {
- def regex = Pattern.compile("v([0-9]+)[.]([0-9]+)[.]([0-9]+)(.*)")
- def groups = regex.matcher(ant.project.properties.describe)
- groups.matches()
- def major = groups.group(1)
- def minor = groups.group(2)
- def patch = groups.group(3)
- project.properties.release = major + "." + minor + "." + patch + "-SNAPSHOT"
- }
- catch (IllegalStateException e) {
- project.properties.release = ""
- }
- }
- else {
- // if we're building outside of Git, set a default
- // version number
- project.properties.release = project.properties.default
- }
- project.properties.shortrevision = ant.project.properties.shortrevision
- project.properties.revision = ant.project.properties.revision
-
- if (!project.properties.release) {
- // assume this is a source package outside of Git
- // there should be a ant/gitversion.xml file with the
- // version information used when the package was created
-
- def xmlfile = project.properties.get('project.rootdir') + "/ant/gitversion.xml"
-
- def xml = new XmlParser().parse(xmlfile)
- for (property in xml.property) {
- println "parsing " + property.'@name'
- if ('release.version' == property.'@name') {
- project.properties.release = property.'@value'
- }
- else if ('vcs.revision' == property.'@name') {
- project.properties.revision = property.'@value'
- }
- else if ('vcs.shortrevision' == property.'@name') {
- project.properties.shortrevision = property.'@value'
- }
- }
- }
-
- println "shortrevision = " + project.properties.shortrevision
- println "revision = " + project.properties.revision
- println "release = " + project.properties.release
- </source>
- </configuration>
- </execution>
- </executions>
- </plugin>
<!-- Add Implementation-Build entry to JAR manifest. -->
<plugin>
#! /bin/bash
here=$(pwd)
# Initial clone
cd /tmp
rm -rf /tmp/bioformats || echo "Already cleaned"
# Clone Bio-Formats
git clone https://github.com/openmicroscopy/bioformats.git ome-model
# Filter branch to keep only the model components
cd ome-model
PATHS_TO_KEEP="cpp components/specification components/ome-xml components/xsd-fu CMakeLists.txt pom.xml .travis.yml docs/sphinx"
git filter-branch -f --index-filter "git rm --ignore-unmatch --cached -qr -- . && git reset -q \$GIT_COMMIT -- $PATHS_TO_KEEP" --prune-empty -- HEAD
# Clean empty commits
tmpfile=`mktemp -t splitgit`
chmod 755 $tmpfile
echo '#!/usr/bin/env ruby
old_parents = gets.chomp.gsub("-p ", " ")
new_parents = old_parents.empty? ? [] : `git show-branch --independent #{old_parents}`.split
puts new_parents.map{|p| "-p " + p}.join(" ")' > $tmpfile
git filter-branch -f --prune-empty --parent-filter $tmpfile HEAD
rm $tmpfile
# Apply git diff to let Travis compile
git apply $here/ome-model-diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment