diff --git a/assembly.xml b/assembly.xml index 403bf2682..7586a9633 100644 --- a/assembly.xml +++ b/assembly.xml @@ -73,9 +73,22 @@ - false + + true + + net.yacy:yacycore + runtime lib + ${artifact.artifactId}.${artifact.extension} + + + + false + false + runtime + lib diff --git a/libbuild/java-templates/net/yacy/peers/operation/yacyBuildProperties.java b/libbuild/java-templates/net/yacy/peers/operation/yacyBuildProperties.java new file mode 100644 index 000000000..ad8477102 --- /dev/null +++ b/libbuild/java-templates/net/yacy/peers/operation/yacyBuildProperties.java @@ -0,0 +1,78 @@ +package net.yacy.peers.operation; + +import java.util.Locale; +import java.util.regex.Pattern; +/** + * Attention: this is a template file (a 1:1 copy of net/yacy/peers/operation/yacyBuildProperties.java + * to produce a genrated source filtered by the Maven build to replace the placeholder variables (like "@REPL_REVISION_NR@") + * with current build values. + * + */ + + +/** + * Properties set when compiling this release/version + */ +public final class yacyBuildProperties { + private yacyBuildProperties() { + } + + /** + * returns the SVN-Revision Number as a String + */ + public static String getSVNRevision() { + final String revision = "@REPL_REVISION_NR@"; + if (revision.contains("@") || revision.contains("$")) { + return "0"; + } + return revision; + } + + /** + * returns the version String (e. g. 0.9) + */ + public static String getVersion() { + if ("@REPL_VERSION@".contains("@") ) { + return "0.1"; + } + return "@REPL_VERSION@"; + } + + public static final Pattern versionMatcher = Pattern.compile("\\A(\\d+\\.\\d{1,3})(\\d{0,5})\\z"); + + /** + * returns the long version String (e. g. 0.9106712) + */ + public static String getLongVersion() { + return String.format(Locale.US, "%.3f%05d", Float.valueOf(getVersion()), Integer.valueOf(getSVNRevision())); + } + + /** + * returns the date, when this release was build + */ + public static String getBuildDate() { + if ("@REPL_DATE@".contains("@")) { + return "19700101"; + } + return "@REPL_DATE@"; + } + + /** + * determines, if this release was compiled and installed + * by a package manager + */ + public static boolean isPkgManager() { + return "@REPL_PKGMANAGER@".equals("true"); + } + + /** + * returns command to use to restart the YaCy daemon, + * when YaCy was installed with a packagemanger + */ + public static String getRestartCmd() { + if ("@REPL_RESTARTCMD@".contains("@")) { + return "echo 'error'"; + } + return "@REPL_RESTARTCMD@"; + } +} diff --git a/pom.xml b/pom.xml index 7eaaceba4..c62286bb5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ net.yacy yacycore - 1.64 + 1.65 jar YaCy - a Peer to Peer Web Search Engine YaCy @@ -34,7 +34,16 @@ 1.6 1.6 - 4.5.0 + 4.5.0 + + + ${DSTAMP} + yacy_v${project.version}_${DSTAMP}_${releaseNr}.tar.gz + ${project.version} + ${releaseNr} + . + false + /etc/init.d/yacy restart @@ -58,6 +67,17 @@ maven-compiler-plugin 3.1 + + + **/net/yacy/peers/operation/yacyBuildProperties.java + ${maven.compiler.source} ${maven.compiler.target} @@ -75,9 +95,9 @@ true - ${project.version}-${buildNumber} + ${project.version}-${releaseNr} - + @@ -88,7 +108,7 @@ assembly.xml - yacy_v${project.version}_${buildNumber} + yacy_v${project.version}_${DSTAMP}_${releaseNr} RELEASE false @@ -142,71 +162,59 @@ - + + - org.codehaus.mojo - buildnumber-maven-plugin - 1.2 + net.yacy + maven-plugin-gitrevisionnumber + 1.0 - 1 - - generate-sources + initialize create + - - false - false - 5 - 9000 - - {0,date,yyyyMMdd}_{1} - - timestamp - ${releaseNr} - scmVersion - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.6 + org.codehaus.mojo + templating-maven-plugin + 1.0-alpha-3 - - generate-resources + + filter-src - build-classpath + filter-sources - - - true - ${project.build.directory}/classpath.properties - + + + ${basedir}/libbuild/java-templates + ${project.build.directory}/generated-sources + - + - - org.codehaus.mojo - properties-maven-plugin - 1.0-alpha-2 - + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + - initialize + generate-resources - read-project-properties + build-classpath - - - libbuild/gitbuildnumber.properties - -