Permalink
Browse files

Fix version checking, reintroduce build properties

  • Loading branch information...
eugener committed Aug 24, 2014
1 parent fc6346c commit 560279e072cd9528fc4f88d69189d89501d8f61c
@@ -2,5 +2,8 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
<classpathentry kind="con" path="org.springsource.ide.eclipse.gradle.dsld.classpathcontainer"/>
<classpathentry kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="con" path="GROOVY_SUPPORT"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -14,10 +14,11 @@
<natures>
<nature>org.springsource.ide.eclipse.gradle.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
</natures>
<filteredResources>
<filter>
<id>1408901131627</id>
<id>1408918714062</id>
<name></name>
<type>26</type>
<matcher>
@@ -8,12 +8,16 @@ subprojects {
apply plugin: 'maven'
apply from : '../mavenPublish.gradle'

Properties cfg = new Properties()
cfg.load(new FileInputStream("$rootDir/controlsfx-build.properties"))

ext {
artifact_suffix = '-SNAPSHOT'
specification_title = 'Java 8u20'
specification_version = '8.20.7'
artifact_suffix = cfg.artifact_suffix
specification_title = cfg.controlsfx_specification_title //'Java 8u20'
specification_version = cfg.controlsfx_specification_version //'8.20.7'
controlsfx_name = 'controlsfx'
fxsampler_name = 'fxsampler'
fxsampler_version = '1.0.8' + artifact_suffix
fxsampler_version = cfg.fxsampler_specification_version + artifact_suffix
fxsampler_mainClass = 'fxsampler.FXSampler'
}

@@ -0,0 +1,12 @@
controlsfx_group=org.controlsfx

# The name of Java version required by ControlsFX.
controlsfx_specification_title=Java 8u20

# The minimum required JavaFX version for ControlsFX.
# Set it to String obtained by VersionInfo.getVersion() method.
controlsfx_specification_version=8.20.7

fxsampler_specification_version=1.0.8

artifact_suffix=-SNAPSHOT
@@ -3,7 +3,26 @@
<classpathentry kind="src" path="src/deploy/package"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry exported="true" kind="lib" path="C:/Program Files/Java/jdk1.8.0_20/jre/lib/ext/jfxrt.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.gradle/caches/artifacts-26/filestore/junit/junit/4.12-beta-1/jar/f516376d8dbcaf37ab11975cd7807e5e1782a847/junit-4.12-beta-1.jar" sourcepath="C:/Users/Eugene/.gradle/caches/artifacts-26/filestore/junit/junit/4.12-beta-1/source/6b1bbf7aedba23e3e43cb7afe0e9842c364065bd/junit-4.12-beta-1-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar" sourcepath="C:/Users/Eugene/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" sourcepath="C:/Users/Eugene/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/net/sf/json-lib/json-lib/2.3/json-lib-2.3-jdk15.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/net/sourceforge/nekohtml/nekohtml/1.9.16/nekohtml-1.9.16.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/apache/httpcomponents/httpclient/4.2.1/httpclient-4.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/apache/httpcomponents/httpcore/4.2.1/httpcore-4.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/codehaus/groovy/modules/http-builder/http-builder/0.7.1/http-builder-0.7.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/controlsfx/controlsfx/8.20.7-SNAPSHOT/controlsfx-8.20.7-SNAPSHOT.jar" sourcepath="C:/Users/Eugene/.m2/repository/org/controlsfx/controlsfx/8.20.7-SNAPSHOT/controlsfx-8.20.7-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/controlsfx/fxsampler/1.0.8-SNAPSHOT/fxsampler-1.0.8-SNAPSHOT.jar" sourcepath="C:/Users/Eugene/.m2/repository/org/controlsfx/fxsampler/1.0.8-SNAPSHOT/fxsampler-1.0.8-SNAPSHOT-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/controlsfx/openjfx-dialogs/1.0.0/openjfx-dialogs-1.0.0.jar" sourcepath="C:/Users/Eugene/.m2/repository/org/controlsfx/openjfx-dialogs/1.0.0/openjfx-dialogs-1.0.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" sourcepath="C:/Users/Eugene/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -2,7 +2,6 @@ import org.apache.tools.ant.filters.*
apply plugin: 'application'
apply from: '../javafx.plugin'


applicationName = 'FXSampler'
mainClassName = fxsampler_mainClass

@@ -18,7 +17,7 @@ sourceSets {

dependencies {
compile group + ':' + fxsampler_name +':' + fxsampler_version
compile group + ':controlsfx:' + version
compile group + ':' + controlsfx_name + ':' + version

try {
jdk files(jfxrtJar)
@@ -3,8 +3,24 @@
<classpathentry kind="src" path="src/main/groovy"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.gradle/caches/artifacts-26/filestore/junit/junit/4.12-beta-1/jar/f516376d8dbcaf37ab11975cd7807e5e1782a847/junit-4.12-beta-1.jar" sourcepath="C:/Users/Eugene/.gradle/caches/artifacts-26/filestore/junit/junit/4.12-beta-1/source/6b1bbf7aedba23e3e43cb7afe0e9842c364065bd/junit-4.12-beta-1-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.gradle/wrapper/dists/gradle-1.8-bin/vruqmccc8532n7gr46qavsii8/gradle-1.8/lib/groovy-all-1.8.6.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar" sourcepath="C:/Users/Eugene/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" sourcepath="C:/Users/Eugene/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/net/sf/json-lib/json-lib/2.3/json-lib-2.3-jdk15.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/net/sourceforge/nekohtml/nekohtml/1.9.16/nekohtml-1.9.16.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/apache/httpcomponents/httpclient/4.2.1/httpclient-4.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/apache/httpcomponents/httpcore/4.2.1/httpcore-4.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/codehaus/groovy/modules/http-builder/http-builder/0.7.1/http-builder-0.7.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/controlsfx/openjfx-dialogs/1.0.0/openjfx-dialogs-1.0.0.jar" sourcepath="C:/Users/Eugene/.m2/repository/org/controlsfx/openjfx-dialogs/1.0.0/openjfx-dialogs-1.0.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" sourcepath="C:/Users/Eugene/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -29,6 +29,7 @@
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Optional;
import java.util.Properties;

import com.sun.javafx.runtime.VersionInfo;
@@ -42,13 +43,15 @@

private static final Package controlsFX;

private static Properties props;

static {
controlsFX = VersionChecker.class.getPackage();

javaFXVersion = VersionInfo.getVersion();
controlsFXSpecTitle = getControlsFXSpecificationTitle();
javaFXVersion = VersionInfo.getVersion();
controlsFXSpecTitle = getControlsFXSpecificationTitle();
controlsFXSpecVersion = getControlsFXSpecificationVersion();
controlsFXImpVersion = getControlsFXImplementationVersion();
controlsFXImpVersion = getControlsFXImplementationVersion();
}

private VersionChecker() {
@@ -78,11 +81,12 @@ public static void doVersionCheck() {
// javaFXVersion may contain '-' like 8.0.20-ea so replace them with '.' before splitting.
String[] splitJavaVersion = javaFXVersion.replace('-', '.').split("\\.");

for (int i=0; i < 3; i++) {
if (Integer.parseInt(splitJavaVersion[i]) < Integer.parseInt(splitSpecVersion[i])) {
// for (int i=0; i < 3; i++) {
// if (Integer.parseInt(splitJavaVersion[i]) < Integer.parseInt(splitSpecVersion[i])) {
if ( splitSpecVersion[0] != splitJavaVersion[0] || splitSpecVersion[1] != splitJavaVersion[2] ) {
throw new RuntimeException("ControlsFX Error: ControlsFX " +
controlsFXImpVersion + " requires at least " + controlsFXSpecTitle);
}
// }
}
}

@@ -96,21 +100,24 @@ private static String getControlsFXSpecificationTitle() {

// try to read it from the controlsfx-build.properties if running
// from within an IDE
try {
Properties prop = new Properties();
File file = new File("../controlsfx-build.properties");
if (file.exists()) {
prop.load(new FileReader(file));
String version = prop.getProperty("controlsfx_specification_title");
if (version != null && !version.isEmpty()) {
return version;
}
}
} catch (IOException e) {
// no-op
}
return getPropertyValue("controlsfx_specification_title");


return null;
// try {
// Properties prop = new Properties();
// File file = new File("../controlsfx-build.properties");
// if (file.exists()) {
// prop.load(new FileReader(file));
// String version = prop.getProperty("controlsfx_specification_title");
// if (version != null && !version.isEmpty()) {
// return version;
// }
// }
// } catch (IOException e) {
// // no-op
// }
//
// return null;
}

private static String getControlsFXSpecificationVersion() {
@@ -124,21 +131,23 @@ private static String getControlsFXSpecificationVersion() {

// try to read it from the controlsfx-build.properties if running
// from within an IDE
try {
Properties prop = new Properties();
File file = new File("../controlsfx-build.properties");
if (file.exists()) {
prop.load(new FileReader(file));
String version = prop.getProperty("controlsfx_specification_version");
if (version != null && !version.isEmpty()) {
return version;
}
}
} catch (IOException e) {
// no-op
}
return getPropertyValue("controlsfx_specification_title");

return null;
// try {
// Properties prop = new Properties();
// File file = new File("../controlsfx-build.properties");
// if (file.exists()) {
// prop.load(new FileReader(file));
// String version = prop.getProperty("controlsfx_specification_version");
// if (version != null && !version.isEmpty()) {
// return version;
// }
// }
// } catch (IOException e) {
// // no-op
// }
//
// return null;
}

private static String getControlsFXImplementationVersion() {
@@ -152,20 +161,40 @@ private static String getControlsFXImplementationVersion() {

// try to read it from the controlsfx-build.properties if running
// from within an IDE
try {
Properties prop = new Properties();
File file = new File("../controlsfx-build.properties");
if (file.exists()) {
prop.load(new FileReader(file));
String version = prop.getProperty("controlsfx_version");
if (version != null && !version.isEmpty()) {
return version;

return getPropertyValue("controlsfx_specification_title") +
getPropertyValue("artifact_suffix");


// try {
// Properties prop = new Properties();
// File file = new File("../controlsfx-build.properties");
// if (file.exists()) {
// prop.load(new FileReader(file));
// String version = prop.getProperty("controlsfx_version");
// if (version != null && !version.isEmpty()) {
// return version;
// }
// }
// } catch (IOException e) {
// // no-op
// }
//
// return null;
}

private static synchronized String getPropertyValue(String key) {

if ( props == null ) {
try {
File file = new File("../controlsfx-build.properties");
if (file.exists()) {
props.load(new FileReader(file));
}
} catch (IOException e) {
// no-op
}
} catch (IOException e) {
// no-op
}

return null;
}
return props.getProperty(key);
}
}
@@ -2,7 +2,8 @@
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.gradle/caches/artifacts-26/filestore/junit/junit/4.12-beta-1/jar/f516376d8dbcaf37ab11975cd7807e5e1782a847/junit-4.12-beta-1.jar" sourcepath="C:/Users/Eugene/.gradle/caches/artifacts-26/filestore/junit/junit/4.12-beta-1/source/6b1bbf7aedba23e3e43cb7afe0e9842c364065bd/junit-4.12-beta-1-sources.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Eugene/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" sourcepath="C:/Users/Eugene/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -1,4 +1,3 @@

version = fxsampler_version

configurations {

0 comments on commit 560279e

Please sign in to comment.