From f93d5392f8cb5ca85b718a10fd9e472907512c0b Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 24 Feb 2015 11:38:45 -0600 Subject: Build the project using Maven This introduces a pom.xml which tells Maven how the project is structured. To avoid a boatload of disruptive renames, we override some of Maven's default settings. It updates the code generation scheme to generate VersionInfo.java using the templating-maven-plugin. Lastly, it removes the Ant build files to avoid maintaining multiple build systems. --- .gitignore | 5 +- README-FIRST.txt | 2 - README-build.html | 162 ----- build-old.xml | 908 ----------------------------- build-tools/VersionInfo.java | 318 ---------- build.xml | 138 ----- pom.xml | 231 ++++++++ templates/javax/media/j3d/VersionInfo.java | 318 ++++++++++ 8 files changed, 553 insertions(+), 1529 deletions(-) delete mode 100644 README-build.html delete mode 100644 build-old.xml delete mode 100644 build-tools/VersionInfo.java delete mode 100644 build.xml create mode 100644 pom.xml create mode 100644 templates/javax/media/j3d/VersionInfo.java diff --git a/.gitignore b/.gitignore index 84c048a..10d81e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -/build/ +/.classpath +/.project +/.settings/ +/target/ diff --git a/README-FIRST.txt b/README-FIRST.txt index dd87e0d..05809d2 100644 --- a/README-FIRST.txt +++ b/README-FIRST.txt @@ -9,8 +9,6 @@ The source code license information for this project is in LICENSE.txt Additional information and license restrictions for third party source code are found in the THIRDPARTY-LICENSE-*.txt files. -Instructions for building this project are in README-build.html - Note that the source code in this directory is untested and presumed incompatible with the Java 3D(TM) API specification. You must only use this code in accordance with the terms under which the code is diff --git a/README-build.html b/README-build.html deleted file mode 100644 index c12cd7f..0000000 --- a/README-build.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - README-build: build instructions for the j3d-core project - - -

Building -the 3D packages

-

-

To -build the 3D packages, you must clone the following three -repositories:
-

- -

These three top-level directories must be named exactly as -shown above and they must be sibling directories. To ensure this, run -the git clone command for each of the respositories from the same -parent directory. You will also need the gluegen and jogl builds for at least -version 2.3.1. For example:
-

- -

NOTE: you must first build the javax.vecmath package before building -the javax.media.j3d and com.sun.j3d.* packages. See the README-build.html file in the -"vecmath" directory for instructions.
-

-

System Requirements

-

-

The -following operating environments have been tested:
-

- -

The following software must be installed:
-

- -

Building the 3D packages

-

Before -you start building, your PATH must include the -following directories: -

- -

The default target, jar-opt, creates an optimized jar files -and native libraries. -

-

On Amd64 platform an OutOfMemoryError can be seen. In this case set -the environment variable ANT_OPTS to -Xmx256m.
-

-

Steps: -

- -

The above steps build both the Java and native code for -javax.media.j3d and com.sun.j3d.* -packages. -

-

The build will be placed in j3d-core/build/<platform>/opt -where <platform> is determined from the ant -echo command: -

- -To see other targets that are available, type "ant --projecthelp". Note that ant must be run from the top-level -directory. -

The default compiler for native code compilation is set to "gcc". -This -value is set in the build.properties -file located -in the j3d-core directory. The compiler property is "build.comp".
-

-

On a Solaris platform with Forte compiler installed, -build.comp -can be set to "forte". On a Windows platform installed Visual C++, -build.properties -can be set to "vc".
-

-

NOTE: For Windows platform only, the property "build.rend" in -build.properties can be modified to use "d3d" (Direct3D API for -rendering) besides the default value "ogl".
-

-

NOTE: You can also modify the properties via command-line options to -ant, -for example, "ant -Dbuild.comp=vc"
-

-

Running -the 3D examples

-

Please refer to README-build.html in -j3d-examples for -details -on building and running the 3D example programs.
-

- - diff --git a/build-old.xml b/build-old.xml deleted file mode 100644 index b444cc5..0000000 --- a/build-old.xml +++ /dev/null @@ -1,908 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The following ant targets are available ("jar-opt" is the default): - - all - execute targets jar-debug and dist. - - clean - removes build/ and dist/ for current platform - - clean-all - removes build/ and dist/ for all platforms - - clean-dist - removes dist. - - clean-javaonly - removes java portion of build for current platform - - compile - execute targets compile-debug and compile-opt. - - compile-debug - builds all classes and native layer in src into - class files under build/${platform}/debug/classes/ and - native files under build/${platform}/debug/native/ - - compile-opt - builds all classes and native layer in src into - class files under build/${platform}/opt/classes/ and - native files under build/${platform}/opt/native/ - - dist - THIS TARGET IS FOR RELEASE ENGINEERING ONLY; DEVELOPERS NEED NOT - USE THIS TARGET. - Copies the shared jars, and the platform-specific native - libraries, src files, and javadoc to dist/${platform}. - The dist-common target must be run first. - - dist-common - THIS TARGET IS FOR RELEASE ENGINEERING ONLY; DEVELOPERS NEED NOT - USE THIS TARGET. - This target must be run on a 32-bit Linux-x86 system. - Creates the shared jar from the linux-i586 and - windows-i586-vc build directories. - The jar-opt target must be run first. - - docs - builds all classes in src into javadoc under - build/javadocs. - - docs-jcp - builds JCP docs of all classes in src into javadoc - under build/javadocs/docs-jcp. - - docs-private - builds private docs of all classes in src into javadoc - under build/javadocs/docs-private. - - docs-public - builds public docs of all classes in src into javadoc - under build/javadocs/docs-public. - - echo - echo some useful information, such as user.home, - ant.home, java.home and platform. - - jar - execute targets jar-debug and jar-opt. - - jar-debug - creates build/${platform}/debug/lib for all jar - files and libraries from class and native code files under - build/${platform}/debug/classes and - build/${platform}/debug/native. - - jar-debug-javaonly - - compiles only the java portion of j3d and builds - jars in same locations as jar-debug - - jar-opt - creates build/${platform}/opt/lib for all jar - files and libraries from class and native code files under - build/${platform}/opt/classes and - build/${platform}/opt/native. - - jar-opt-javaonly - - compiles only the java portion of j3d and builds - jars in same location as jar-opt - - install-debug - installs the debug build into the JDK pointed to by JAVA_HOME - - src - generate a zip file j3d project source code. - - uninstall - uninstalls j3d from the JDK pointed to by JAVA_HOME - - diff --git a/build-tools/VersionInfo.java b/build-tools/VersionInfo.java deleted file mode 100644 index f76df88..0000000 --- a/build-tools/VersionInfo.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - */ - -package javax.media.j3d; - -/** - * The VersionInfo class contains strings that describe the implementation - * and specification version of the javax.media.j3d pacakge. These strings - * are made available as properties obtained from the VirtualUniverse class. - * - *

NOTE TO DEVELOPERS:

- * - *

- * Developers are strongly encouraged to do the following whenever they - * modify the 3D graphics API for the Java platform: - * - *

    - *
  1. The VENDOR_DEVELOPER string should be modified to - * indicate the name of the individuals or organizations who have - * modified the source code.
  2. - * - *
  3. The VERSION_DEV_STRING may be modified to indicate - * additional information about the particular build, but this is - * not required.
  4. - * - *
  5. The strings denoted as being unmodifiable should not be - * modified.
  6. - *
- * - *

- * The tags of the form @STRING@ are populated by ant when the project is built - * - * @see VirtualUniverse#getProperties - */ -class VersionInfo extends Object { - /** - * Developer who has modified the 3D graphics API for the Java platform. - * This string should be modified to indicate the name of the - * individual(s) or organization(s) who modified the code. - */ - private static final String VENDOR_DEVELOPER = null; - - - /** - * An optional string appended to the end of the version string, - * after the time stamp. A space will be automatically prepended - * to this string. This string should be null if no dev string is - * desired. - */ - private static final String VERSION_DEV_STRING = null; - - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- - // END OF DEVELOPER-MODIFIABLE PARAMETERS - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- - - - // ------------------------------------------------------------------- - // The following set of constants should not be modified by developers. - // ------------------------------------------------------------------- - - /** - * Constant that indicates whether or not this is a debug build. - */ - static final boolean isDebug = @IS_DEBUG@; - - /** - * This static final variable is used to enable debugging and - * assertion checking during the development phase of a particular - * version of 3D graphics API for the Java platform. It is disabled - * for "opt" production builds (beta, release candidate, fcs, and - * patch builds). It is enabled for all "debug" builds and for daily - * and stable "opt" builds. - * - *

- * This parameter is controlled by ant via the build.xml file. The - * default value is true. - */ - static final boolean isDevPhase = @IS_DEV_PHASE@; - - /** - * This static final variable is used indicate a production - * (beta, release candidate, fcs, or patch) build. - *

- * This parameter is controlled by ant via the build.xml file. The - * default value is false. - */ - static final boolean isProduction = @IS_PRODUCTION@; - - /** - * If this flag is set to true, the verbose buildtime string - * will be appended to the version string) - *

- * This parameter is controlled by ant via the build.xml file. The - * default value is true. - */ - private static final boolean useVerboseBuildTime = @USE_VERBOSE_BUILDTIME@; - - /** - * String identifying the type of build, one of: - * "daily", "stable", "beta", "fcs", or "patch". The default value - * is "daily". - */ - private static final String BUILD_TYPE = "@BUILD_TYPE@"; - - /** - * String identifying the build number in the format - * "buildNN", where "NN" is the sequential build number, for - * example, build47. This string contain only letters and - * numbers, It must not contain any other characters or spaces. - * - * For production builds, this string appears parenthetically, - * after the first space. - */ - private static final String VERSION_BUILD = "@VERSION_BUILD@"; - - /** - * String identifying the particular build of the 3D API, for - * example, "-beta1", "-build47", "-rc1", "_01", etc. Note that - * this includes the leading dash or underscore. It will typically - * be empty for FCS builds. This string may only contain letters, - * numbers, periods, dashes, or underscores. It must not contain - * any other characters or spaces. - * - * This us used as part of the j3d.version that appears before the - * optional first space. - */ - private static final String VERSION_SUFFIX = "@VERSION_SUFFIX@"; - - /** - * Date stamp - * - * This is only used for daily builds. - */ - private static final String BUILDTIME = "@BUILDTIME@"; - - /** - * Specification version (major and minor version only). This - * string must not be modified by developers. - */ - private static final String SPECIFICATION_VERSION = "1.6"; - - /** - * Specification vendor. - */ - private static final String SPECIFICATION_VENDOR = "@SPEC_VENDOR@"; - - /** - * Primary implementation vendor. - */ - private static final String VENDOR_PRIMARY = "@IMPL_VENDOR@"; - - /** - * Base version number. This is the major.minor.subminor version - * number. Version qualifiers are specified separately. The - * major and minor version must be the same as the specification - * version. - */ - private static final String VERSION_BASE = "@VERSION_BASE@"; - - /** - * Boolean flag indicating that the version of the 3D API is - * experimental. This must not be modified by developers. - * All non-official builds must contain the string - * "experimental" as part of the release name that - * appears before the optional first space. - */ - private static final boolean isExperimental = !isProduction; - - /** - * The composite version string. This is composed in the static - * initializer for this class. - */ - private static final String VERSION; - - /** - * The composite vendor string. This is composed in the static - * initializer for this class. - */ - private static final String VENDOR; - - /** - * Verbose time and date stamp appended to the end of the version string. - * This is appended to the version string - * after the build identifier (and after the first space, which - * will automatically be added) and before the optional dev - * string. This string is only used for non-fcs builds. - */ - private static final String BUILDTIME_VERBOSE = "@BUILDTIME_VERBOSE@"; - - private static boolean isNonEmpty(String str) { - if ((str == null) || (str.length() == 0)) { - return false; - } - else { - return true; - } - } - - // The static initializer composes the version and vendor strings - static { - final boolean isPatchBuild = BUILD_TYPE.equals("patch"); - final boolean isFcsBuild = BUILD_TYPE.equals("fcs"); - final boolean isBetaBuild = BUILD_TYPE.equals("beta"); - final boolean isStableBuild = BUILD_TYPE.equals("stable"); - final boolean isDailyBuild = BUILD_TYPE.equals("daily"); - - // Assign the vendor by concatenating primary and developer - // vendor strings - String tmpVendor = VENDOR_PRIMARY; - if (isNonEmpty(VENDOR_DEVELOPER)) { - tmpVendor += " & " + VENDOR_DEVELOPER; - } - - String tmpVersion = VERSION_BASE; - if (isNonEmpty(VERSION_SUFFIX)) { - if (isPatchBuild) { - tmpVersion += "_"; - } - else { - tmpVersion += "-"; - } - tmpVersion += VERSION_SUFFIX; - } - - if (isDailyBuild && isNonEmpty(BUILDTIME)) { - tmpVersion += "-" + BUILDTIME; - } - - if (isExperimental) { - tmpVersion += "-experimental"; - } - - // Append the optional fields that follow the first space - - if (isProduction) { - if (isFcsBuild) { - tmpVersion += " fcs"; - } - else if (isPatchBuild) { - tmpVersion += " fcs+patch"; - } - - if (isNonEmpty(VERSION_BUILD)) { - tmpVersion += " (" + VERSION_BUILD + ")"; - } - } - - if (useVerboseBuildTime && isNonEmpty(BUILDTIME_VERBOSE)) { - tmpVersion += " " + BUILDTIME_VERBOSE; - } - - if (isNonEmpty(VERSION_DEV_STRING)) { - tmpVersion += " " + VERSION_DEV_STRING; - } - - VERSION = tmpVersion; - VENDOR = tmpVendor; - } - - /** - * Returns the specification version string. - * @return the specification version string - */ - static String getSpecificationVersion() { - return SPECIFICATION_VERSION; - } - - /** - * Returns the specification vendor string. - * @return the specification vendor string - */ - static String getSpecificationVendor() { - return SPECIFICATION_VENDOR; - } - - - /** - * Returns the implementation version string. - * @return the implementation version string - */ - static String getVersion() { - return VERSION; - } - - /** - * Returns the implementation vendor string. - * @return the implementation vendor string - */ - static String getVendor() { - return VENDOR; - } - -} diff --git a/build.xml b/build.xml deleted file mode 100644 index 9bfe448..0000000 --- a/build.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3836085 --- /dev/null +++ b/pom.xml @@ -0,0 +1,231 @@ + + + 4.0.0 + + org.jogamp.java3d + j3dcore + 1.6.0-SNAPSHOT + + Java 3D Core + 3D Graphics API for the Java Platform + + + + GPLv2 with Classpath exception + http://www.gnu.org/licenses/gpl-2.0.txt + repo + + + + + + gouessej + Julien Gouesse + https://github.com/gouessej + JogAmp + http://jogamp.org/ + + + hharrison + Harvey Harrison + https://github.com/hharrison + JogAmp + http://jogamp.org/ + + + + + Kevin Rushforth + https://www.linkedin.com/in/kevin-rushforth-8ba3b43 + Oracle Corporation + http://oracle.com/ + + + Chien Yang + https://www.linkedin.com/in/chien-yang-0884122 + Oracle Corporation + http://oracle.com/ + + + Curtis Rueden + http://loci.wisc.edu/people/curtis-rueden + UW-Madison LOCI + http://loci.wisc.edu/ + + + Alessandro Borges + + + August Lammersdorf + + + Kavon Farvardin + + + Ken Russell + + + Saeid Nourian + + + Ken Mc Neill + + + Julian Ibarz + + + + + 2.3.2 + + + 1.6.0 + ${project.name} + + ${project.name} + + + daily + daily + daily + false + true + false + true + 11 + pre${version_buildnum} + ${version_build} + + + UTF-8 + UTF-8 + + + + + ${project.groupId} + vecmath + ${project.version} + + + org.jogamp.gluegen + gluegen-rt + ${jogl.version} + + + org.jogamp.jogl + jogl-all + ${jogl.version} + + + + + install + + ${basedir}/src + + + ${project.basedir}/src + + **/*.java + **/package.html + + + + + + + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + + maven-jar-plugin + 2.5 + + + + true + + + + + + maven-javadoc-plugin + 2.9.1 + + ${project.basedir}/src + + http://docs.oracle.com/javase/7/docs/api/ + + + + + org.codehaus.mojo + templating-maven-plugin + 1.0-alpha-3 + + + + filter-sources + + + + + ${basedir}/templates + + + + + + + + only-eclipse + + + m2e.version + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + templating-maven-plugin + 1.0-alpha-3 + + filter-sources + + + + + true + false + + + + + + + + + + + + + diff --git a/templates/javax/media/j3d/VersionInfo.java b/templates/javax/media/j3d/VersionInfo.java new file mode 100644 index 0000000..9545370 --- /dev/null +++ b/templates/javax/media/j3d/VersionInfo.java @@ -0,0 +1,318 @@ +/* + * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +package javax.media.j3d; + +/** + * The VersionInfo class contains strings that describe the implementation + * and specification version of the javax.media.j3d pacakge. These strings + * are made available as properties obtained from the VirtualUniverse class. + * + *

NOTE TO DEVELOPERS:

+ * + *

+ * Developers are strongly encouraged to do the following whenever they + * modify the 3D graphics API for the Java platform: + * + *

    + *
  1. The VENDOR_DEVELOPER string should be modified to + * indicate the name of the individuals or organizations who have + * modified the source code.
  2. + * + *
  3. The VERSION_DEV_STRING may be modified to indicate + * additional information about the particular build, but this is + * not required.
  4. + * + *
  5. The strings denoted as being unmodifiable should not be + * modified.
  6. + *
+ * + *

+ * The tags of the form ${string} are populated by Maven when the project is built + * + * @see VirtualUniverse#getProperties + */ +class VersionInfo extends Object { + /** + * Developer who has modified the 3D graphics API for the Java platform. + * This string should be modified to indicate the name of the + * individual(s) or organization(s) who modified the code. + */ + private static final String VENDOR_DEVELOPER = null; + + + /** + * An optional string appended to the end of the version string, + * after the time stamp. A space will be automatically prepended + * to this string. This string should be null if no dev string is + * desired. + */ + private static final String VERSION_DEV_STRING = null; + + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + // END OF DEVELOPER-MODIFIABLE PARAMETERS + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + + + // ------------------------------------------------------------------- + // The following set of constants should not be modified by developers. + // ------------------------------------------------------------------- + + /** + * Constant that indicates whether or not this is a debug build. + */ + static final boolean isDebug = ${is_debug}; + + /** + * This static final variable is used to enable debugging and + * assertion checking during the development phase of a particular + * version of 3D graphics API for the Java platform. It is disabled + * for "opt" production builds (beta, release candidate, fcs, and + * patch builds). It is enabled for all "debug" builds and for daily + * and stable "opt" builds. + * + *

+ * This parameter is controlled by ant via the build.xml file. The + * default value is true. + */ + static final boolean isDevPhase = ${is_dev_phase}; + + /** + * This static final variable is used indicate a production + * (beta, release candidate, fcs, or patch) build. + *

+ * This parameter is controlled by ant via the build.xml file. The + * default value is false. + */ + static final boolean isProduction = ${is_production}; + + /** + * If this flag is set to true, the verbose buildtime string + * will be appended to the version string) + *

+ * This parameter is controlled by ant via the build.xml file. The + * default value is true. + */ + private static final boolean useVerboseBuildTime = ${use_verbose_buildtime}; + + /** + * String identifying the type of build, one of: + * "daily", "stable", "beta", "fcs", or "patch". The default value + * is "daily". + */ + private static final String BUILD_TYPE = "${build.type}"; + + /** + * String identifying the build number in the format + * "buildNN", where "NN" is the sequential build number, for + * example, build47. This string contain only letters and + * numbers, It must not contain any other characters or spaces. + * + * For production builds, this string appears parenthetically, + * after the first space. + */ + private static final String VERSION_BUILD = "${version_build}"; + + /** + * String identifying the particular build of the 3D API, for + * example, "-beta1", "-build47", "-rc1", "_01", etc. Note that + * this includes the leading dash or underscore. It will typically + * be empty for FCS builds. This string may only contain letters, + * numbers, periods, dashes, or underscores. It must not contain + * any other characters or spaces. + * + * This us used as part of the j3d.version that appears before the + * optional first space. + */ + private static final String VERSION_SUFFIX = "${version_suffix}"; + + /** + * Date stamp + * + * This is only used for daily builds. + */ + private static final String BUILDTIME = "${buildtime}"; + + /** + * Specification version (major and minor version only). This + * string must not be modified by developers. + */ + private static final String SPECIFICATION_VERSION = "1.6"; + + /** + * Specification vendor. + */ + private static final String SPECIFICATION_VENDOR = "${build.spec.vendor}"; + + /** + * Primary implementation vendor. + */ + private static final String VENDOR_PRIMARY = "${build.impl.vendor}"; + + /** + * Base version number. This is the major.minor.subminor version + * number. Version qualifiers are specified separately. The + * major and minor version must be the same as the specification + * version. + */ + private static final String VERSION_BASE = "${project.version}"; + + /** + * Boolean flag indicating that the version of the 3D API is + * experimental. This must not be modified by developers. + * All non-official builds must contain the string + * "experimental" as part of the release name that + * appears before the optional first space. + */ + private static final boolean isExperimental = !isProduction; + + /** + * The composite version string. This is composed in the static + * initializer for this class. + */ + private static final String VERSION; + + /** + * The composite vendor string. This is composed in the static + * initializer for this class. + */ + private static final String VENDOR; + + /** + * Verbose time and date stamp appended to the end of the version string. + * This is appended to the version string + * after the build identifier (and after the first space, which + * will automatically be added) and before the optional dev + * string. This string is only used for non-fcs builds. + */ + private static final String BUILDTIME_VERBOSE = "${buildtime_verbose}"; + + private static boolean isNonEmpty(String str) { + if ((str == null) || (str.length() == 0)) { + return false; + } + else { + return true; + } + } + + // The static initializer composes the version and vendor strings + static { + final boolean isPatchBuild = BUILD_TYPE.equals("patch"); + final boolean isFcsBuild = BUILD_TYPE.equals("fcs"); + final boolean isBetaBuild = BUILD_TYPE.equals("beta"); + final boolean isStableBuild = BUILD_TYPE.equals("stable"); + final boolean isDailyBuild = BUILD_TYPE.equals("daily"); + + // Assign the vendor by concatenating primary and developer + // vendor strings + String tmpVendor = VENDOR_PRIMARY; + if (isNonEmpty(VENDOR_DEVELOPER)) { + tmpVendor += " & " + VENDOR_DEVELOPER; + } + + String tmpVersion = VERSION_BASE; + if (isNonEmpty(VERSION_SUFFIX)) { + if (isPatchBuild) { + tmpVersion += "_"; + } + else { + tmpVersion += "-"; + } + tmpVersion += VERSION_SUFFIX; + } + + if (isDailyBuild && isNonEmpty(BUILDTIME)) { + tmpVersion += "-" + BUILDTIME; + } + + if (isExperimental) { + tmpVersion += "-experimental"; + } + + // Append the optional fields that follow the first space + + if (isProduction) { + if (isFcsBuild) { + tmpVersion += " fcs"; + } + else if (isPatchBuild) { + tmpVersion += " fcs+patch"; + } + + if (isNonEmpty(VERSION_BUILD)) { + tmpVersion += " (" + VERSION_BUILD + ")"; + } + } + + if (useVerboseBuildTime && isNonEmpty(BUILDTIME_VERBOSE)) { + tmpVersion += " " + BUILDTIME_VERBOSE; + } + + if (isNonEmpty(VERSION_DEV_STRING)) { + tmpVersion += " " + VERSION_DEV_STRING; + } + + VERSION = tmpVersion; + VENDOR = tmpVendor; + } + + /** + * Returns the specification version string. + * @return the specification version string + */ + static String getSpecificationVersion() { + return SPECIFICATION_VERSION; + } + + /** + * Returns the specification vendor string. + * @return the specification vendor string + */ + static String getSpecificationVendor() { + return SPECIFICATION_VENDOR; + } + + + /** + * Returns the implementation version string. + * @return the implementation version string + */ + static String getVersion() { + return VERSION; + } + + /** + * Returns the implementation vendor string. + * @return the implementation vendor string + */ + static String getVendor() { + return VENDOR; + } + +} -- cgit v1.2.3