Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Import Ant build.xml into Gradle and use old compile of servlets in Gradle
reger243e34f7c59646
diff --git a/.gitignore b/.gitignoreindex 1e2bb8ca6..e4c8e7eb3 100644--- a/.gitignore+++ b/.gitignore@@ -21,3 +21,4 @@ yacy.log/javadoc//build/.gradle+source/net/yacy/peers/operation/yacyBuildProperties.javadiff --git a/build.gradle b/build.gradleindex 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 filediff --git a/build.xml b/build.xmlindex 1f482df63..560bbb828 100644--- a/build.xml+++ b/build.xml@@ -43,7 +43,7 @@<property name="lib" location="lib"/><property name="libt" location="libt"/><property name="libbuild" location="libbuild"/>- <property name="build" location="classes"/>+ <property name="build" location="build/classes/java/main"/> <!-- reuse Gradle build path --><property name="javadoc" location="javadoc"/><property name="htroot" location="htroot"/><property name="test" location="test/java"/>@@ -81,7 +81,7 @@</condition><target name="buildGitRevTask">- <delete file="${libbuild}/GitRevTask.jar" failonerror="false" />+ <!-- <delete file="${libbuild}/GitRevTask.jar" failonerror="false" /> deleted via clean no need to do it all the time --><javac srcdir="${libbuild}/GitRevTask" includeantruntime="true" encoding="UTF-8"><classpath><pathelement location="${libbuild}/org.eclipse.jgit-4.5.0.201609210915-r.jar" />@@ -146,11 +146,10 @@<filter token="REPL_RESTARTCMD" value="${RESTARTCMD}"/><!-- apply replacments -->- <delete file="${build}/net/yacy/peers/operation/yacyBuildProperties.java" failonerror="false"/>- <copy file="${src}/net/yacy/peers/operation/yacyBuildProperties.java" tofile="${build}/net/yacy/peers/operation/yacyBuildProperties.java" overwrite="true" filtering="true" />+ <copy file="${src}/net/yacy/peers/operation/yacyBuildProperties.java.template" tofile="${src}/net/yacy/peers/operation/yacyBuildProperties.java" overwrite="true" filtering="true" /><!-- copy log4j config file -->- <copy file="${src}/log4j.properties" tofile="${build}/log4j.properties" overwrite="true" filtering="true" />+ <copy file="${src}/log4j.properties" tofile="${build}/log4j.properties" overwrite="true" filtering="true" /> <!-- @TODO: obsolete, contains no replace/filter pattern --></target>@@ -159,7 +158,8 @@windowtitle="YaCy API: javadoc documentation"encoding="UTF-8"charset="UTF-8"- access="private">+ access="private"+ useexternalfile="true"><fileset dir="${src}"><include name="**/*.java"/></fileset>@@ -280,6 +280,7 @@<target name="compile-core" depends="init" description="compile YaCy core"><!-- compile yacyBuildProperties.java -->+ <!-- *obsolete* - for Gradle migration process changed to use *.java.template file for filtered copy<javac srcdir="${build}" destdir="${build}" sourcepath="${src}"debug="true" debuglevel="lines,vars,source" includeantruntime="false"includes="net/yacy/peers/operation/yacyBuildProperties.java"@@ -288,11 +289,10 @@<compilerarg value="-Xlint"/></javac><delete file="${build}/BuildProperties.java" />-+--><!-- compile the core sources --><javac srcdir="${src}/" destdir="${build}"debug="true" debuglevel="lines,vars,source" includeantruntime="false"- excludes="net/yacy/peers/operation/yacyBuildProperties.java"source="${javacSource}" target="${javacTarget}" encoding="UTF-8"><classpath refid="project.class.path" /><compilerarg value="-Xlint"/>@@ -319,7 +319,7 @@</target>- <target name="compile" depends="compile-core" description="compile YaCy core and YaCy servlets">+ <target name="compile-htroot" depends="init" description="compile YaCy servlets"><!-- compile htroot, htroot/yacy and htroot/htdocsdefault --><javac srcdir="${htroot}/"excludes="processing/**"@@ -329,6 +329,8 @@<compilerarg value="-Xlint"/></javac></target>++ <target name="compile" depends="compile-core, compile-htroot" description="compile YaCy core and YaCy servlets" /><target name="all" depends="compile"></target>@@ -538,18 +540,17 @@<!-- make clean --><target name="clean" description="make clean"><delete dir="${release_main}" failonerror="false"/>- <delete file="${build}/net/yacy/peers/operation/yacyBuildProperties.java" failonerror="false"/><delete file="${build}/log4j.properties" failonerror="false"/><delete file="${lib}/yacycore.jar" failonerror="false"/>- <delete file="${lib}/svnRevNr.jar" failonerror="false"/>- <delete file="${libbuild}/svnRevNr.jar" failonerror="false"/>+ <delete file="${lib}/svnRevNr.jar" failonerror="false"/> <!-- @TODO: obsolete, never generated -->+ <delete file="${libbuild}/svnRevNr.jar" failonerror="false"/> <!-- @TODO: obsolete, never generated --><delete file="${libbuild}/GitRevTask.jar" failonerror="false"/><delete failonerror="false"><fileset dir="${src}" includes="**/*.class" /><fileset dir="${build}" includes="**/*.class" /><fileset dir="${htroot}" includes="**/*.class" /><fileset dir="test/" includes="**/*.class" />- <fileset dir="${libbuild}/svnRevNr" includes="**/*.class" />+ <fileset dir="${libbuild}/svnRevNr" includes="**/*.class" /> <!-- @TODO: obsolete, never generated --><fileset dir="${libbuild}/GitRevTask" includes="**/*.class" /><fileset dir="." includes="TEST-*" /></delete>diff --git a/source/net/yacy/peers/operation/yacyBuildProperties.java.template b/source/net/yacy/peers/operation/yacyBuildProperties.java.templatenew file mode 100644index 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@";+ }+}