2012-08-28 02:50:46 -04:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<project name="extra-targets" basedir=".">
|
|
|
|
<description>
|
|
|
|
This file is designed for importing into a main build file, and not intended
|
|
|
|
for standalone use.
|
|
|
|
</description>
|
|
|
|
|
|
|
|
<import file="lucene/common-build.xml"/>
|
|
|
|
|
2013-11-15 03:37:00 -05:00
|
|
|
<target name="-run-test">
|
|
|
|
<mkdir dir="lucene/build" />
|
|
|
|
<tempfile property="tests.totals.tmpfile"
|
|
|
|
destdir="lucene/build"
|
|
|
|
prefix=".test-totals-"
|
|
|
|
suffix=".tmp"
|
|
|
|
deleteonexit="true"
|
|
|
|
createfile="true" />
|
|
|
|
|
|
|
|
<subant target="test" inheritall="false" failonerror="true">
|
|
|
|
<fileset dir="lucene" includes="build.xml" />
|
|
|
|
<fileset dir="solr" includes="build.xml" />
|
|
|
|
<propertyset>
|
|
|
|
<propertyref name="tests.totals.tmpfile" />
|
|
|
|
</propertyset>
|
|
|
|
</subant>
|
|
|
|
|
|
|
|
<property name="tests.totals.toplevel" value="true" />
|
|
|
|
<antcall target="-check-totals" />
|
|
|
|
</target>
|
|
|
|
|
2012-08-28 02:50:46 -04:00
|
|
|
<!--
|
|
|
|
Run after Junit tests.
|
|
|
|
|
|
|
|
This target is in a separate file, as it needs to include common-build.xml,
|
|
|
|
but must run from top-level!
|
|
|
|
-->
|
2012-09-28 09:44:36 -04:00
|
|
|
<target name="-generate-clover-reports" depends="clover">
|
2012-08-28 02:50:46 -04:00
|
|
|
<fail unless="run.clover">Clover not enabled!</fail>
|
|
|
|
<mkdir dir="${clover.report.dir}"/>
|
|
|
|
<fileset dir="." id="clover.test.result.files">
|
|
|
|
<include name="*/build/**/test/TEST-*.xml"/>
|
|
|
|
<exclude name="lucene/build/backwards/**"/>
|
|
|
|
</fileset>
|
|
|
|
<clover-report>
|
|
|
|
<current outfile="${clover.report.dir}" title="${final.name}" numThreads="0">
|
|
|
|
<format type="html" filter="assert"/>
|
|
|
|
<testresults refid="clover.test.result.files"/>
|
|
|
|
</current>
|
|
|
|
<current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
|
|
|
|
<format type="xml" filter="assert"/>
|
|
|
|
<testresults refid="clover.test.result.files"/>
|
|
|
|
</current>
|
|
|
|
</clover-report>
|
|
|
|
<echo>You can find the merged Lucene/Solr Clover report in '${clover.report.dir}'.</echo>
|
|
|
|
</target>
|
|
|
|
|
2012-09-28 09:44:36 -04:00
|
|
|
<target name="-run-maven-build" depends="install-maven-tasks">
|
2012-09-09 05:19:32 -04:00
|
|
|
<mvn xmlns="antlib:org.apache.maven.artifact.ant" pom="${maven-build-dir}/pom.xml"
|
|
|
|
mavenVersion="${maven-version}" failonerror="true" fork="true">
|
|
|
|
<arg value="-fae"/>
|
|
|
|
<arg value="install"/>
|
2012-12-14 17:19:58 -05:00
|
|
|
<syspropertyset>
|
|
|
|
<propertyref builtin="commandline"/>
|
|
|
|
</syspropertyset>
|
2012-09-09 05:19:32 -04:00
|
|
|
</mvn>
|
|
|
|
</target>
|
|
|
|
|
2013-07-23 17:38:51 -04:00
|
|
|
<target name="-check-svn-working-copy" depends="ivy-availability-check,ivy-fail,ivy-configure,resolve-groovy">
|
2013-07-23 17:59:18 -04:00
|
|
|
<svn-checker failonmodifications="false"/>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- should only be called by jenkins, not precommit! -->
|
|
|
|
<target name="-check-after-regeneration" depends="ivy-availability-check,ivy-fail,ivy-configure,resolve-groovy">
|
|
|
|
<svn-checker failonmodifications="true"/>
|
2013-07-23 17:38:51 -04:00
|
|
|
</target>
|
2013-12-03 19:54:08 -05:00
|
|
|
|
|
|
|
<property name="svnkit.version" value="1.7.8"/>
|
2013-07-23 17:38:51 -04:00
|
|
|
|
|
|
|
<macrodef xmlns:ivy="antlib:org.apache.ivy.ant" name="svn-checker">
|
2013-07-23 17:59:18 -04:00
|
|
|
<attribute name="failonmodifications" default="true"/> <!-- false if file modifications are allowed -->
|
2013-07-23 17:38:51 -04:00
|
|
|
<sequential>
|
2013-12-03 19:54:08 -05:00
|
|
|
<ivy:cachepath organisation="org.tmatesoft.svnkit" module="svnkit" revision="${svnkit.version}"
|
2013-07-08 19:19:37 -04:00
|
|
|
inline="true" conf="default" transitive="true" pathid="svnkit.classpath"/>
|
2013-07-23 17:38:51 -04:00
|
|
|
<local name="svn.checkprops.failed"/>
|
|
|
|
<local name="svn.unversioned.failed"/>
|
2013-07-23 17:59:18 -04:00
|
|
|
<local name="svn.changed.failed"/>
|
2013-09-14 07:19:33 -04:00
|
|
|
<groovy taskname="svn" classpathref="svnkit.classpath"><![CDATA[
|
2012-09-22 10:42:46 -04:00
|
|
|
import org.tmatesoft.svn.core.*;
|
|
|
|
import org.tmatesoft.svn.core.wc.*;
|
2012-08-28 02:50:46 -04:00
|
|
|
|
2012-09-22 10:42:46 -04:00
|
|
|
SVNClientManager manager = SVNClientManager.newInstance();
|
|
|
|
SVNStatusClient statusClient = manager.getStatusClient();
|
|
|
|
SVNWCClient wcClient = manager.getWCClient();
|
|
|
|
|
|
|
|
File basedir = new File(project.getProperty('basedir')).getAbsoluteFile();
|
|
|
|
int baseLen = basedir.toString().length();
|
|
|
|
def convertRelative = {
|
2013-07-24 09:37:39 -04:00
|
|
|
file -> '.' + file.getAbsolutePath().substring(baseLen).replace(File.separatorChar, (char)'/');
|
2012-08-28 02:50:46 -04:00
|
|
|
}
|
|
|
|
|
2013-07-23 17:59:18 -04:00
|
|
|
Set missingProps = new TreeSet(), unversioned = new TreeSet(), changed = new TreeSet();
|
2012-08-28 02:50:46 -04:00
|
|
|
|
2013-09-14 07:19:33 -04:00
|
|
|
task.log('Getting all versioned and unversioned files...');
|
2012-09-22 10:42:46 -04:00
|
|
|
statusClient.doStatus(basedir, SVNRevision.WORKING, SVNDepth.fromRecurse(true), false, true, false, false, {
|
|
|
|
status ->
|
|
|
|
SVNStatusType nodeStatus = status.getNodeStatus();
|
2013-04-22 10:49:54 -04:00
|
|
|
if (nodeStatus == SVNStatusType.STATUS_UNVERSIONED || nodeStatus == SVNStatusType.STATUS_MISSING) {
|
2012-09-22 10:42:46 -04:00
|
|
|
unversioned.add(convertRelative(status.getFile()));
|
|
|
|
} else if (status.getKind() == SVNNodeKind.FILE && nodeStatus != SVNStatusType.STATUS_DELETED) {
|
|
|
|
missingProps.add(convertRelative(status.getFile()));
|
2012-08-28 02:50:46 -04:00
|
|
|
}
|
2013-07-24 09:37:39 -04:00
|
|
|
if (nodeStatus == SVNStatusType.STATUS_MODIFIED || nodeStatus == SVNStatusType.STATUS_REPLACED ||
|
|
|
|
nodeStatus == SVNStatusType.STATUS_DELETED || nodeStatus == SVNStatusType.STATUS_ADDED) {
|
|
|
|
changed.add(convertRelative(status.getFile()));
|
2013-07-23 17:59:18 -04:00
|
|
|
}
|
2012-09-22 10:42:46 -04:00
|
|
|
} as ISVNStatusHandler, null);
|
2012-08-28 02:50:46 -04:00
|
|
|
|
2013-09-14 07:19:33 -04:00
|
|
|
task.log('Filtering files with existing svn:eol-style...');
|
2012-09-22 10:42:46 -04:00
|
|
|
wcClient.doGetProperty(basedir, 'svn:eol-style', SVNRevision.WORKING, SVNRevision.WORKING, true, {
|
|
|
|
file, prop -> missingProps.remove(convertRelative(file));
|
|
|
|
} as ISVNPropertyHandler);
|
2012-08-28 02:50:46 -04:00
|
|
|
|
2013-09-14 07:19:33 -04:00
|
|
|
task.log('Filtering files with binary svn:mime-type...');
|
2012-09-22 10:42:46 -04:00
|
|
|
wcClient.doGetProperty(basedir, 'svn:mime-type', SVNRevision.WORKING, SVNRevision.WORKING, true, {
|
|
|
|
file, prop ->
|
|
|
|
prop = SVNPropertyValue.getPropertyAsString(prop.getValue());
|
|
|
|
if (prop.startsWith('application/') || prop.startsWith('image/')) {
|
|
|
|
missingProps.remove(convertRelative(file));
|
2012-08-28 02:50:46 -04:00
|
|
|
}
|
2012-09-22 10:42:46 -04:00
|
|
|
} as ISVNPropertyHandler);
|
2012-08-28 02:50:46 -04:00
|
|
|
|
2012-09-22 10:42:46 -04:00
|
|
|
def convertSet2String = {
|
2012-10-01 18:44:46 -04:00
|
|
|
set -> set ? ('* ' + set.join(project.getProperty('line.separator') + '* ')) : null
|
2012-08-28 02:50:46 -04:00
|
|
|
};
|
2012-09-22 10:42:46 -04:00
|
|
|
project.setProperty('svn.checkprops.failed', convertSet2String(missingProps));
|
|
|
|
project.setProperty('svn.unversioned.failed', convertSet2String(unversioned));
|
2013-07-23 17:59:18 -04:00
|
|
|
project.setProperty('svn.changed.failed', convertSet2String(changed));
|
2013-09-14 07:19:33 -04:00
|
|
|
]]></groovy>
|
2012-08-28 02:50:46 -04:00
|
|
|
<fail if="svn.checkprops.failed"
|
|
|
|
message="The following files are missing svn:eol-style (or binary svn:mime-type):${line.separator}${svn.checkprops.failed}"/>
|
|
|
|
<fail if="svn.unversioned.failed"
|
|
|
|
message="Source checkout is dirty after running tests!!! Offending files:${line.separator}${svn.unversioned.failed}"/>
|
2013-07-23 17:59:18 -04:00
|
|
|
<fail message="Source checkout is modified !!! Offending files:${line.separator}${svn.changed.failed}">
|
|
|
|
<condition>
|
|
|
|
<and>
|
|
|
|
<istrue value="@{failonmodifications}"/>
|
|
|
|
<isset property="svn.changed.failed"/>
|
|
|
|
</and>
|
|
|
|
</condition>
|
|
|
|
</fail>
|
2013-07-23 17:38:51 -04:00
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
2012-08-28 02:50:46 -04:00
|
|
|
</project>
|