You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2012/09/22 16:44:24 UTC
svn commit: r1388814 - in /lucene/dev/branches/branch_4x: ./
extra-targets.xml lucene/ lucene/build.xml lucene/common-build.xml solr/
solr/build.xml solr/common-build.xml
Author: uschindler
Date: Sat Sep 22 14:44:23 2012
New Revision: 1388814
URL: http://svn.apache.org/viewvc?rev=1388814&view=rev
Log:
Merged revision(s) 1388813 from lucene/dev/trunk:
LUCENE-4415: Port javascript in build files to Groovy (JSR-223)
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/extra-targets.xml
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/build.xml (contents, props changed)
lucene/dev/branches/branch_4x/lucene/common-build.xml (contents, props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/build.xml (contents, props changed)
lucene/dev/branches/branch_4x/solr/common-build.xml (contents, props changed)
Modified: lucene/dev/branches/branch_4x/extra-targets.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/extra-targets.xml?rev=1388814&r1=1388813&r2=1388814&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/extra-targets.xml (original)
+++ lucene/dev/branches/branch_4x/extra-targets.xml Sat Sep 22 14:44:23 2012
@@ -59,60 +59,59 @@
</mvn>
</target>
- <target xmlns:ivy="antlib:org.apache.ivy.ant" name="check-svn-working-copy" depends="ivy-availability-check,ivy-fail,ivy-configure">
+ <target xmlns:ivy="antlib:org.apache.ivy.ant" name="check-svn-working-copy" depends="ivy-availability-check,ivy-fail,ivy-configure,resolve-groovy">
<ivy:cachepath organisation="org.tmatesoft.svnkit" module="svnkit" revision="1.7.5-v1"
inline="true" conf="default" type="jar" transitive="true" pathid="svnkit.classpath"/>
- <script language="javascript" classpathref="svnkit.classpath" taskname="svn"><![CDATA[
- importClass(java.io.File);
- importClass(java.util.TreeSet);
- importPackage(org.tmatesoft.svn.core);
- importPackage(org.tmatesoft.svn.core.wc);
- var manager = SVNClientManager.newInstance();
- var statusClient = manager.getStatusClient();
- var wcClient = manager.getWCClient();
+ <script language="groovy" taskname="svn">
+ <classpath>
+ <path refid="groovy.classpath"/>
+ <path refid="svnkit.classpath"/>
+ </classpath><![CDATA[
+ import org.tmatesoft.svn.core.*;
+ import org.tmatesoft.svn.core.wc.*;
- var basedir = new File(project.getProperty("basedir")).getAbsoluteFile();
- var baseLen = basedir.toString().length();
- var convertRelative = function(file) {
- return file.getAbsolutePath().substring(baseLen + 1).replace(File.separatorChar, '/');
+ 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 = {
+ file -> file.getAbsolutePath().substring(baseLen + 1).replace(File.separatorChar, (char)'/');
}
- var missingProps = new TreeSet(), unversioned = new TreeSet();
+ Set missingProps = new TreeSet(), unversioned = new TreeSet();
- self.log("Getting all versioned and unversioned files...");
- statusClient.doStatus(basedir, SVNRevision.WORKING, SVNDepth.fromRecurse(true), false, true, false, false, new ISVNStatusHandler({
- handleStatus: function(status) {
- var nodeStatus = status.getNodeStatus();
- if (nodeStatus == SVNStatusType.STATUS_UNVERSIONED) {
- unversioned.add(convertRelative(status.getFile()));
- } else if (status.getKind() == SVNNodeKind.FILE && nodeStatus != SVNStatusType.STATUS_DELETED) {
- missingProps.add(convertRelative(status.getFile()));
- }
+ self.log('Getting all versioned and unversioned files...');
+ statusClient.doStatus(basedir, SVNRevision.WORKING, SVNDepth.fromRecurse(true), false, true, false, false, {
+ status ->
+ SVNStatusType nodeStatus = status.getNodeStatus();
+ if (nodeStatus == SVNStatusType.STATUS_UNVERSIONED) {
+ unversioned.add(convertRelative(status.getFile()));
+ } else if (status.getKind() == SVNNodeKind.FILE && nodeStatus != SVNStatusType.STATUS_DELETED) {
+ missingProps.add(convertRelative(status.getFile()));
}
- }), null);
+ } as ISVNStatusHandler, null);
- self.log("Filtering files with existing svn:eol-style...");
- wcClient.doGetProperty(basedir, "svn:eol-style", SVNRevision.WORKING, SVNRevision.WORKING, true, new ISVNPropertyHandler({
- handleProperty: function(file, prop) {
- missingProps.remove(convertRelative(file));
- }
- }));
+ self.log('Filtering files with existing svn:eol-style...');
+ wcClient.doGetProperty(basedir, 'svn:eol-style', SVNRevision.WORKING, SVNRevision.WORKING, true, {
+ file, prop -> missingProps.remove(convertRelative(file));
+ } as ISVNPropertyHandler);
- self.log("Filtering files with binary svn:mime-type...");
- wcClient.doGetProperty(basedir, "svn:mime-type", SVNRevision.WORKING, SVNRevision.WORKING, true, new ISVNPropertyHandler({
- handleProperty: function(file, prop) {
- prop = SVNPropertyValue.getPropertyAsString(prop.getValue());
- if (prop.startsWith("application/") || prop.startsWith("image/")) {
- missingProps.remove(convertRelative(file));
- }
+ self.log('Filtering files with binary svn:mime-type...');
+ 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);
- var convertSet2String = function(set) {
- return set.isEmpty() ? null : ("* " + set.toArray().join(project.getProperty("line.separator") + "* "))
+ def convertSet2String = {
+ set -> set.isEmpty() ? null : ('* ' + set.toArray().join(project.getProperty('line.separator') + '* '))
};
- project.setProperty("svn.checkprops.failed", convertSet2String(missingProps));
- project.setProperty("svn.unversioned.failed", convertSet2String(unversioned));
+ project.setProperty('svn.checkprops.failed', convertSet2String(missingProps));
+ project.setProperty('svn.unversioned.failed', convertSet2String(unversioned));
]]></script>
<fail if="svn.checkprops.failed"
message="The following files are missing svn:eol-style (or binary svn:mime-type):${line.separator}${svn.checkprops.failed}"/>
Modified: lucene/dev/branches/branch_4x/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/build.xml?rev=1388814&r1=1388813&r2=1388814&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/build.xml (original)
+++ lucene/dev/branches/branch_4x/lucene/build.xml Sat Sep 22 14:44:23 2012
@@ -268,7 +268,7 @@
</sequential>
</target>
- <target name="process-webpages" depends="resolve-pegdown">
+ <target name="process-webpages" depends="resolve-groovy,resolve-pegdown">
<makeurl property="process-webpages.buildfiles" separator="|">
<fileset dir="." includes="**/build.xml" excludes="build.xml,analysis/*,build/**,tools/**,backwards/**,site/**"/>
</makeurl>
Modified: lucene/dev/branches/branch_4x/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/common-build.xml?rev=1388814&r1=1388813&r2=1388814&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/common-build.xml (original)
+++ lucene/dev/branches/branch_4x/lucene/common-build.xml Sat Sep 22 14:44:23 2012
@@ -240,6 +240,7 @@
<propertyref regex=".*\.uptodate$$"/>
<propertyref regex=".*\.compiled$$"/>
<propertyref regex=".*\.loaded$$"/>
+ <propertyref name="lucene.javadoc.url"/><!-- for Solr -->
</propertyset>
<patternset id="lucene.local.src.package.patterns"
@@ -1750,6 +1751,13 @@ ${tests-output}/junit4-*.suites - pe
</sequential>
</macrodef>
+ <!-- GROOVY scripting engine for ANT tasks -->
+ <target name="resolve-groovy" unless="groovy.loaded" depends="ivy-availability-check,ivy-fail,ivy-configure">
+ <ivy:cachepath organisation="org.codehaus.groovy" module="groovy-all" revision="2.0.4"
+ inline="true" conf="default" type="jar" transitive="true" pathid="groovy.classpath"/>
+ <property name="groovy.loaded" value="true"/>
+ </target>
+
<!-- PEGDOWN macro: Before using depend on the target "resolve-pegdown" -->
<target name="resolve-pegdown" unless="pegdown.loaded" depends="ivy-availability-check,ivy-fail,ivy-configure">
@@ -1771,24 +1779,25 @@ ${tests-output}/junit4-*.suites - pe
<tokenfilter>
<filetokenizer/>
<replaceregex pattern="\b(LUCENE|SOLR)\-\d+\b" replace="[\0](https://issues.apache.org/jira/browse/\0)" flags="gs"/>
- <scriptfilter language="javascript" classpathref="pegdown.classpath"><![CDATA[
- importClass(java.lang.StringBuilder);
- importClass(org.pegdown.PegDownProcessor);
- importClass(org.pegdown.Extensions);
- importClass(org.pegdown.FastEncoder);
- var markdownSource = self.getToken();
- var title = undefined;
- // match the first heading in markdown and use as title:
- if (markdownSource.search(/^#+\s*(.+)$/m) >= 0) {
- title = RegExp.$1;
- }
- var processor = new PegDownProcessor(
+ <scriptfilter language="groovy">
+ <classpath>
+ <path refid="groovy.classpath"/>
+ <path refid="pegdown.classpath"/>
+ </classpath><![CDATA[
+ import org.pegdown.PegDownProcessor;
+ import org.pegdown.Extensions;
+ import org.pegdown.FastEncoder;
+
+ String markdownSource = self.getToken();
+ PegDownProcessor processor = new PegDownProcessor(
Extensions.ABBREVIATIONS | Extensions.AUTOLINKS |
Extensions.FENCED_CODE_BLOCKS | Extensions.SMARTS
);
- var html = new StringBuilder('<html>\n<head>\n');
- if (title) {
- html.append('<title>').append(FastEncoder.encode(title)).append('</title>\n');
+ StringBuilder html = new StringBuilder('<html>\n<head>\n');
+ // match the first heading in markdown and use as title:
+ def matcher = (markdownSource =~ /(?m)^#+\s*(.+)$/);
+ if (matcher.find()) {
+ html.append('<title>').append(FastEncoder.encode(matcher.group(1))).append('</title>\n');
}
html.append('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n')
.append('</head>\n<body>\n')
Modified: lucene/dev/branches/branch_4x/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/build.xml?rev=1388814&r1=1388813&r2=1388814&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/build.xml (original)
+++ lucene/dev/branches/branch_4x/solr/build.xml Sat Sep 22 14:44:23 2012
@@ -138,12 +138,12 @@
<target name="compile-test" description="Compile unit tests."
depends="compile-solr-test-framework, compile-test-solr-core, compile-test-solrj, compile-test-contrib"/>
<target name="javadocs" description="Calls javadocs-all, javadocs-solrj, and javadocs-test-framework"
- depends="javadocs-solr-core,javadocs-solrj,javadocs-test-framework,javadocs-contrib"/>
+ depends="define-lucene-javadoc-url,javadocs-solr-core,javadocs-solrj,javadocs-test-framework,javadocs-contrib"/>
<target name="documentation" description="Generate all documentation"
depends="javadocs,changes-to-html,process-webpages"/>
<target name="compile-core" depends="compile-solr-core" unless="solr.core.compiled"/>
- <target name="process-webpages" depends="define-lucene-javadoc-url"> <!--depends="resolve-pegdown">-->
+ <target name="process-webpages" depends="define-lucene-javadoc-url"><!--depends="resolve-groovy,resolve-pegdown">-->
<makeurl property="process-webpages.buildfiles" separator="|">
<fileset dir="." includes="core/build.xml,test-framework/build.xml,solrj/build.xml,contrib/**/build.xml"/>
</makeurl>
@@ -505,10 +505,6 @@
<sign-artifacts-macro artifacts.dir="${package.dir}"/>
</target>
- <target name="javadocs-dep">
- <!-- NOOP -->
- </target>
-
<target name="resolve" depends="resolve-example">
<sequential>
<ant dir="core" target="resolve" inheritall="false">
Modified: lucene/dev/branches/branch_4x/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/common-build.xml?rev=1388814&r1=1388813&r2=1388814&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/common-build.xml (original)
+++ lucene/dev/branches/branch_4x/solr/common-build.xml Sat Sep 22 14:44:23 2012
@@ -275,17 +275,17 @@
</sequential>
</macrodef>
- <target name="define-lucene-javadoc-url" unless="lucene.javadoc.url">
- <script language="javascript"><![CDATA[
- var url, version = project.getProperty('version');
+ <target name="define-lucene-javadoc-url" depends="resolve-groovy" unless="lucene.javadoc.url">
+ <script language="groovy" classpathref="groovy.classpath"><![CDATA[
+ String url, version = project.getProperty('version');
if (version.contains('-SNAPSHOT')) {
- importClass(java.io.File);
url = new File(project.getProperty('common.dir'), 'build' + File.separator + 'docs').toURI().toASCIIString();
- if (!(/\/$/.test(url))) url += '/';
+ if (!(url =~ /\/$/)) url += '/';
} else {
version = version.replace('.', '_');
url = 'http://lucene.apache.org/core/' + version + '/';
}
+ self.log('Using the following URL to refer to Lucene Javadocs: ' + url);
project.setProperty('lucene.javadoc.url', url);
]]></script>
</target>