diff --git a/.gitignore b/.gitignore
index 1e2bb8ca6..e4c8e7eb3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ yacy.log
/javadoc/
/build/
.gradle
+source/net/yacy/peers/operation/yacyBuildProperties.java
diff --git a/build.gradle b/build.gradle
index 0735eee9c..a5b74a058 100644
--- a/build.gradle
+++ b/build.gradle
@@ -109,3 +109,29 @@ task copyDependenciesToLib(type: Copy) {
}
build.dependsOn(copyDependenciesToLib)
}
+
+/** -----------------------------------------------------------
+ * Settings during the migration from Ant to Gradle build
+ * importing Ant targets and to use them within this Gradle build
+ * until/where functionality has not been migrated yet
+ * ------------------------------------------------------------
+ */
+// Import Ant build and prefix all task names with 'ant_' to prevent naming conflict with Gradle tasks.
+ant.importBuild('build.xml') { antTaskName -> "ant_${antTaskName}".toString() }
+
+// Set group property for all Ant tasks.
+tasks.matching { task -> task.name.startsWith('ant_') }*.group = 'Ant'
+
+// include compile of htroot servlets in Gradle lifecycle somewhere after compileJava
+startScripts.dependsOn("ant_compile-htroot")
+
+tasks.named('ant_buildGitRevTask') {
+ doFirst {
+ println '====================================='
+ println 'In case this imported Ant task fails'
+ println '(stop ant jvm which on failure keeps a lock on libbuild/GitRevTask.jar (making supsequent builds fail too)'
+ println '- run the normal ant build "ant all" ONCE (to complile the libbuild/GitRevTask.jar)'
+ println '- after this Gradle build should work'
+ println '====================================='
+ }
+}
\ No newline at end of file
diff --git a/build.xml b/build.xml
index 1f482df63..560bbb828 100644
--- a/build.xml
+++ b/build.xml
@@ -43,7 +43,7 @@
-
+
@@ -81,7 +81,7 @@
-
+
@@ -146,11 +146,10 @@
-
-
+
-
+
@@ -159,7 +158,8 @@
windowtitle="YaCy API: javadoc documentation"
encoding="UTF-8"
charset="UTF-8"
- access="private">
+ access="private"
+ useexternalfile="true">
@@ -280,6 +280,7 @@
+
@@ -319,7 +319,7 @@
-
+
+
+
@@ -538,18 +540,17 @@
-
-
-
+
+
-
+
diff --git a/source/net/yacy/peers/operation/yacyBuildProperties.java.template b/source/net/yacy/peers/operation/yacyBuildProperties.java.template
new file mode 100644
index 000000000..9149ae567
--- /dev/null
+++ b/source/net/yacy/peers/operation/yacyBuildProperties.java.template
@@ -0,0 +1,72 @@
+package net.yacy.peers.operation;
+
+import java.util.Locale;
+import java.util.regex.Pattern;
+
+
+/**
+ * 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@";
+ }
+}