Browse Source

Updated Image-Tools to use Java 8. Java 8 is now required to run Image-Tools. PHash functionality initially failed tests. Generated databases or caches of PHash output may need to be regenerated to avoid false positives.

master
Drew Short 10 years ago
parent
commit
5a709d2397
  1. 2
      build.sh
  2. 2
      buildWithoutTests.sh
  3. 2
      package.sh
  4. 75
      pom.xml
  5. 4
      src/includes/startCLI.sh
  6. 2
      src/includes/startGUI.sh
  7. 8
      src/test/scala/com/sothr/imagetools/hash/HashServiceTest.scala

2
build.sh

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
mvn clean jfx:jar
mvn clean package

2
buildWithoutTests.sh

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
mvn -Dmaven.test.skip=true clean jfx:jar
mvn -Dmaven.test.skip=true clean package

2
package.sh

@ -8,7 +8,7 @@ PACKAGEZIP=$PACKAGENAME.zip
TARGET=$PWD/target TARGET=$PWD/target
#Packaging Jar Distributable #Packaging Jar Distributable
cd target/jfx/app/
cd target/release/
echo "creating $PACKAGETAR in $TARGET" echo "creating $PACKAGETAR in $TARGET"
tar -zcvf $TARGET/$PACKAGETAR . tar -zcvf $TARGET/$PACKAGETAR .
echo "creating $PACKAGEZIP in $TARGET" echo "creating $PACKAGEZIP in $TARGET"

75
pom.xml

@ -27,14 +27,13 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.7</jdk.version>
<jdk.version>1.8</jdk.version>
<lib.junit.version>3.8.1</lib.junit.version> <lib.junit.version>3.8.1</lib.junit.version>
<lib.scalatest.version>2.0</lib.scalatest.version> <lib.scalatest.version>2.0</lib.scalatest.version>
<lib.logback.version>1.0.13</lib.logback.version> <lib.logback.version>1.0.13</lib.logback.version>
<lib.slf4j.version>1.7.5</lib.slf4j.version> <lib.slf4j.version>1.7.5</lib.slf4j.version>
<lib.grizzled-slf4j.version>1.0.1</lib.grizzled-slf4j.version> <lib.grizzled-slf4j.version>1.0.1</lib.grizzled-slf4j.version>
<lib.scala-library.version>2.10.3</lib.scala-library.version> <lib.scala-library.version>2.10.3</lib.scala-library.version>
<lib.scalafx.version>8.0.0-M3</lib.scalafx.version>
<lib.akka.version>2.2.3</lib.akka.version> <lib.akka.version>2.2.3</lib.akka.version>
<lib.jta.version>1.1</lib.jta.version> <lib.jta.version>1.1</lib.jta.version>
<lib.ehcache.version>2.8.0</lib.ehcache.version> <lib.ehcache.version>2.8.0</lib.ehcache.version>
@ -205,24 +204,16 @@
</testResource> </testResource>
</testResources> </testResources>
<pluginManagement> <pluginManagement>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<mainClass>com.sothr.imagetools.App</mainClass>
</configuration>
</plugin>
<plugins>
<plugin> <plugin>
<groupId>net.alchim31.maven</groupId> <groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId> <artifactId>scala-maven-plugin</artifactId>
<version>3.1.6</version> <version>3.1.6</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
@ -256,6 +247,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Version Management -->
<plugin> <plugin>
<groupId>com.code54.mojo</groupId> <groupId>com.code54.mojo</groupId>
<artifactId>buildversion-plugin</artifactId> <artifactId>buildversion-plugin</artifactId>
@ -268,6 +260,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Override Compilation Settings -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
@ -285,6 +278,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Handle Polygot Scala -->
<plugin> <plugin>
<groupId>net.alchim31.maven</groupId> <groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId> <artifactId>scala-maven-plugin</artifactId>
@ -312,7 +306,30 @@
</jvmArgs> </jvmArgs>
</configuration>--> </configuration>-->
</plugin> </plugin>
<!-- Build Management -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>
${project.build.directory}/release/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- Resource Management -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
<executions> <executions>
@ -339,7 +356,7 @@
<goal>copy-resources</goal> <goal>copy-resources</goal>
</goals> </goals>
<configuration> <configuration>
<outputDirectory>${project.build.directory}/jfx/app</outputDirectory>
<outputDirectory>${project.build.directory}/release</outputDirectory>
<resources> <resources>
<resource> <resource>
<directory>src/includes</directory> <directory>src/includes</directory>
@ -354,6 +371,34 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Packaging Configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.sothr.imagetools.App</mainClass>
</manifest>
</archive>
<outputDirectory>
${project.build.directory}/release
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- General Ant Tasks
Mostly Moving Files -->
<plugin> <plugin>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version> <version>1.4</version>

4
src/includes/startCLI.sh

@ -5,7 +5,7 @@ while (( "$#" )); do
args="$args $1" args="$args $1"
shift shift
done done
command="-Xmx1500m -cp ${project.name}-${project.version}-jfx.jar:lib/* com.sothr.imagetools.AppCLI"
command="-Xmx1500m -cp ${project.name}-${project.version}.jar:lib/* com.sothr.imagetools.AppCLI"
correct=false correct=false
#Check for existing commands and use them instead of asking if possible #Check for existing commands and use them instead of asking if possible
if [[ -z "$args" ]] if [[ -z "$args" ]]
@ -33,4 +33,4 @@ else
No ) exit;; No ) exit;;
esac esac
done done
fi
fi

2
src/includes/startGUI.sh

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
echo "Welcome to Image Tools version: ${project.version}" echo "Welcome to Image Tools version: ${project.version}"
command="-Xmx1500m -jar ${project.name}-${project.version}-jfx.jar"
command="-Xmx1500m -jar ${project.name}-${project.version}.jar"
java $command java $command

8
src/test/scala/com/sothr/imagetools/hash/HashServiceTest.scala

@ -220,8 +220,8 @@ class HashServiceTest extends BaseTest {
val image = ImageIO.read(sample) val image = ImageIO.read(sample)
debug(s"Image: width: ${image.getWidth} height: ${image.getHeight}") debug(s"Image: width: ${image.getWidth} height: ${image.getHeight}")
val hash = HashService.getPhash(image) val hash = HashService.getPhash(image)
debug(s"Testing that $hash = -9154589787976242949L")
assert(hash == -9154589787976242949L)
debug(s"Testing that $hash = -9154554603604154117L")
assert(hash == -9154554603604154117L)
} }
test("Calculate PHash Medium Sample Image 1") { test("Calculate PHash Medium Sample Image 1") {
@ -389,8 +389,8 @@ class HashServiceTest extends BaseTest {
test("Calculate ImageHash Large Sample Image 1") { test("Calculate ImageHash Large Sample Image 1") {
debug("Starting 'Calculate ImageHash Large Sample Image 1' test") debug("Starting 'Calculate ImageHash Large Sample Image 1' test")
val hash = HashService.getImageHashes(TestParams.LargeSampleImage1) val hash = HashService.getImageHashes(TestParams.LargeSampleImage1)
debug(s"Testing that ${hash.hashCode} = -812836666")
assert(hash.hashCode == -812836666)
debug(s"Testing that ${hash.hashCode} = -812844858")
assert(hash.hashCode == -812844858)
} }
test("Calculate ImageHash Medium Sample Image 1") { test("Calculate ImageHash Medium Sample Image 1") {

Loading…
Cancel
Save