Skip to content

Commit

Permalink
LUCENE-6938: Fix Lucene's src.tgz file; remove svnkit stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
uschindler authored and dweiss committed Jan 24, 2016
1 parent 55005f0 commit 9f0e2cc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 120 deletions.
121 changes: 6 additions & 115 deletions build.xml
Expand Up @@ -20,8 +20,6 @@
<project name="lucene-solr" default="-projecthelp" basedir=".">
<import file="lucene/common-build.xml"/>

<property name="svnkit.version" value="1.8.10"/>

<property name="tests.heap-dump-dir" location="heapdumps"/>

<property name="maven-build-dir" value="maven-build"/>
Expand All @@ -45,7 +43,7 @@
</target>

<target name="precommit" description="Run basic checks before committing"
depends="check-svn-working-copy,validate,documentation-lint"/>
depends="check-working-copy,validate,documentation-lint"/>

<target name="test" description="Test both Lucene and Solr" depends="resolve-groovy">
<mkdir dir="lucene/build" />
Expand Down Expand Up @@ -553,115 +551,8 @@ File | Project Structure | Platform Settings | SDKs):
<delete dir="${smokeTestRelease.tmp}"/>
</target>

<macrodef xmlns:ivy="antlib:org.apache.ivy.ant" name="svn-checker">
<attribute name="failonmodifications" default="true"/> <!-- false if file modifications are allowed -->
<sequential>
<ivy:cachepath organisation="org.tmatesoft.svnkit" module="svnkit" revision="${svnkit.version}"
inline="true" conf="default" transitive="true" pathid="svnkit.classpath"/>
<local name="svn.checkprops.failed"/>
<local name="svn.unversioned.failed"/>
<local name="svn.keywords.failed"/>
<local name="svn.changed.failed"/>
<groovy taskname="svn" classpathref="svnkit.classpath"><![CDATA[
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.*;
import org.apache.tools.ant.Project;
SVNClientManager manager = SVNClientManager.newInstance();
SVNStatusClient statusClient = manager.getStatusClient();
SVNWCClient wcClient = manager.getWCClient();
File basedir = new File(properties['basedir']).getAbsoluteFile();
int baseLen = basedir.toString().length();
// do some fake check, to verify if this is valid SVN working copy. If this fails ignore checks but log some useful message.
task.log('Initializing working copy...', Project.MSG_INFO);
try {
wcClient.doInfo(basedir, SVNRevision.WORKING);
} catch (SVNException ex) {
def ec = ex.getErrorMessage().getErrorCode();
int code = ec.getCode();
int category = ec.getCategory();
if (code == SVNErrorCode.WC_NOT_DIRECTORY.getCode() || code == SVNErrorCode.WC_NOT_FILE.getCode()) {
task.log('WARNING: Development directory is not an SVN checkout! Disabling checks...', Project.MSG_WARN);
return;
} else if (category == SVNErrorCode.WC_CATEGORY) {
task.log('WARNING: Development directory is not a valid SVN checkout (' + ex.getErrorMessage() + '). Disabling checks...', Project.MSG_WARN);
return;
} else {
throw ex;
}
}
def convertRelative = {
file -> '.' + file.getAbsolutePath().substring(baseLen).replace(File.separatorChar, (char)'/');
}
Set missingProps = new TreeSet(), withKeywords = new TreeSet(), unversioned = new TreeSet(), changed = new TreeSet();
task.log('Getting all versioned and unversioned files...', Project.MSG_INFO);
statusClient.doStatus(basedir, SVNRevision.WORKING, SVNDepth.fromRecurse(true), false, true, false, false, {
status ->
SVNStatusType nodeStatus = status.getNodeStatus();
if (nodeStatus == SVNStatusType.STATUS_UNVERSIONED || nodeStatus == SVNStatusType.STATUS_MISSING) {
unversioned.add(convertRelative(status.getFile()));
} else if (status.getKind() == SVNNodeKind.FILE && nodeStatus != SVNStatusType.STATUS_DELETED) {
missingProps.add(convertRelative(status.getFile()));
}
if (nodeStatus == SVNStatusType.STATUS_MODIFIED || nodeStatus == SVNStatusType.STATUS_REPLACED ||
nodeStatus == SVNStatusType.STATUS_DELETED || nodeStatus == SVNStatusType.STATUS_ADDED) {
changed.add(convertRelative(status.getFile()));
}
} as ISVNStatusHandler, null);
task.log('Filtering files with existing svn:eol-style...', Project.MSG_INFO);
wcClient.doGetProperty(basedir, 'svn:eol-style', SVNRevision.WORKING, SVNRevision.WORKING, true, {
file, prop -> missingProps.remove(convertRelative(file));
} as ISVNPropertyHandler);
task.log('Filtering files with binary svn:mime-type...', Project.MSG_INFO);
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));
}
} as ISVNPropertyHandler);
task.log('Scanning for files with svn:keywords property...', Project.MSG_INFO);
wcClient.doGetProperty(basedir, 'svn:keywords', SVNRevision.WORKING, SVNRevision.WORKING, true, {
file, prop -> withKeywords.add(convertRelative(file));
} as ISVNPropertyHandler);
def setProjectPropertyFromSet(prop, set) {
if (set) {
properties[prop] = '* ' + set.join(properties['line.separator'] + '* ');
}
};
setProjectPropertyFromSet('svn.checkprops.failed', missingProps);
setProjectPropertyFromSet('svn.keywords.failed', withKeywords);
setProjectPropertyFromSet('svn.unversioned.failed', unversioned);
setProjectPropertyFromSet('svn.changed.failed', changed);
]]></groovy>
<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.keywords.failed"
message="The following files have the svn:keywords property set:${line.separator}${svn.keywords.failed}"/>
<fail if="svn.unversioned.failed"
message="Source checkout is dirty after running tests!!! Offending files:${line.separator}${svn.unversioned.failed}"/>
<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>
</sequential>
</macrodef>

<target name="check-svn-working-copy" depends="ivy-availability-check,ivy-fail,ivy-configure,resolve-groovy">
<svn-checker failonmodifications="false"/>
<target name="check-working-copy">
<echo>This task is currently disabled due to migration to GIT</echo>
</target>

<target name="run-clover" description="Runs all tests to measure coverage and generates report (pass &quot;ANT_OPTS=-Xmx1536M&quot; as environment)" depends="clean">
Expand Down Expand Up @@ -754,8 +645,8 @@ File | Project Structure | Platform Settings | SDKs):
</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"/>
<target name="-check-after-regeneration">
<!-- TODO -->
</target>

<!-- TODO: remove me when jenkins works -->
Expand All @@ -771,7 +662,7 @@ File | Project Structure | Platform Settings | SDKs):
</target>

<!-- Jenkins tasks -->
<target name="-jenkins-base" depends="-print-java-info,clean,test-with-heapdumps,validate,documentation-lint,jar-checksums,check-svn-working-copy"/>
<target name="-jenkins-base" depends="-print-java-info,clean,test-with-heapdumps,validate,documentation-lint,jar-checksums,check-working-copy"/>

<target name="-print-java-info">
<echo level="info" taskname="java-info">java version &quot;${java.version}&quot;
Expand Down
11 changes: 7 additions & 4 deletions lucene/build.xml
Expand Up @@ -341,7 +341,7 @@
<target name="package-tgz-src" depends="init-dist"
description="--> Generates the Lucene source distribution as .tgz">
<property name="source.package.file"
value="${dist.dir}/lucene-${version}-src.tgz"/>
location="${dist.dir}/lucene-${version}-src.tgz"/>
<delete file="${source.package.file}"/>
<export-source source.dir="."/>

Expand All @@ -350,11 +350,14 @@
<!-- Exclude clover license files incompatible with the ASL -->
<delete dir="${src.export.dir}/tools/clover"/>

<build-changes changes.src.file="${src.export.dir}/CHANGES.txt"
changes.target.dir="${src.export.dir}/docs/changes"
<!-- because we only package the "lucene/" folder, we have to adjust dir to work on: ->
<property name="local.src.export.dir" location="${src.export.dir}/lucene"/>
<build-changes changes.src.file="${local.src.export.dir}/CHANGES.txt"
changes.target.dir="${local.src.export.dir}/docs/changes"
changes.product="LUCENE"/>
<tar tarfile="${source.package.file}" compression="gzip" longfile="gnu">
<tarfileset prefix="lucene-${version}" dir="${src.export.dir}"/>
<tarfileset prefix="lucene-${version}" dir="${local.src.export.dir}"/>
</tar>
<make-checksums file="${source.package.file}"/>
</target>
Expand Down
2 changes: 1 addition & 1 deletion solr/build.xml
Expand Up @@ -453,7 +453,7 @@
<target name="package-src-tgz" depends="init-dist"
description="Packages the Solr Source Distribution">
<property name="source.package.file"
value="${package.dir}/${fullnamever}-src.tgz"/>
location="${package.dir}/${fullnamever}-src.tgz"/>
<delete file="${source.package.file}" failonerror="false" />
<export-source source.dir=".."/>

Expand Down

0 comments on commit 9f0e2cc

Please sign in to comment.