You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2014/01/24 13:28:26 UTC
svn commit: r1560970 - in
/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy:
Release.groovy Svn.groovy
Author: olegk
Date: Fri Jan 24 12:28:25 2014
New Revision: 1560970
URL: http://svn.apache.org/r1560970
Log:
Fixed inconsistent line delimiter issue on Windows platforms caused by what appears to be a bug in JDom (solution copied from Maven release namager)
Modified:
httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Release.groovy
httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy
Modified: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Release.groovy
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Release.groovy?rev=1560970&r1=1560969&r2=1560970&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Release.groovy (original)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Release.groovy Fri Jan 24 12:28:25 2014
@@ -27,9 +27,11 @@
import org.apache.maven.artifact.versioning.ArtifactVersion
import org.apache.maven.artifact.versioning.DefaultArtifactVersion
+import org.jdom2.Comment
import org.jdom2.Document
import org.jdom2.Element
import org.jdom2.Namespace
+import org.jdom2.filter.ContentFilter
import org.jdom2.input.SAXBuilder
import org.jdom2.output.Format
import org.jdom2.output.XMLOutputter
@@ -90,6 +92,15 @@ class Release {
new URI(uri.scheme, uri.userInfo, uri.host, uri.port, path, null, null)
}
+ // Copied from Maven release manager
+ static private fixLineDelimitersInComments(Document document) {
+ ContentFilter filter = new ContentFilter(ContentFilter.COMMENT)
+ for (Iterator it = document.getDescendants(filter); it.hasNext(); ) {
+ Comment c = (Comment) it.next();
+ c.setText(c.getText().replaceAll('\n', Line.DELIM));
+ }
+ }
+
static void rewritePom(File dir, String version, URI repoUrl) {
File pomFile = new File(dir, 'pom.xml')
SAXBuilder parser = new SAXBuilder()
@@ -137,6 +148,7 @@ class Release {
moduleVersionEl.text = version
}
}
+ fixLineDelimitersInComments(doc)
XMLOutputter xmlOutputter = new XMLOutputter(format)
modulePomFile.withWriter('UTF-8') { Writer writer ->
xmlOutputter.output(doc, writer)
@@ -144,6 +156,7 @@ class Release {
}
}
+ fixLineDelimitersInComments(maindoc)
XMLOutputter xmlOutputter = new XMLOutputter(format)
pomFile.withWriter('UTF-8') { Writer writer ->
xmlOutputter.output(maindoc, writer)
@@ -183,6 +196,7 @@ class Release {
parentEl.removeChild('relativePath', ns)
+ fixLineDelimitersInComments(doc)
Format format = Format.getRawFormat()
format.lineSeparator = Line.DELIM
XMLOutputter xmlOutputter = new XMLOutputter(format)
Modified: httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy
URL: http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy?rev=1560970&r1=1560969&r2=1560970&view=diff
==============================================================================
--- httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy (original)
+++ httpcomponents/project-release-tools/trunk/buildSrc/src/main/groovy/Svn.groovy Fri Jan 24 12:28:25 2014
@@ -34,11 +34,13 @@ import org.tmatesoft.svn.core.SVNDepth
import org.tmatesoft.svn.core.SVNException
import org.tmatesoft.svn.core.SVNURL
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager
+import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions
import org.tmatesoft.svn.core.internal.wc17.SVNWCContext
import org.tmatesoft.svn.core.internal.wc2.compat.SvnCodec
import org.tmatesoft.svn.core.io.ISVNEditor
import org.tmatesoft.svn.core.io.SVNRepository
import org.tmatesoft.svn.core.io.SVNRepositoryFactory
+import org.tmatesoft.svn.core.wc.ISVNOptions
import org.tmatesoft.svn.core.wc.SVNRevision
import org.tmatesoft.svn.core.wc.SVNWCUtil
import org.tmatesoft.svn.core.wc2.ISvnObjectReceiver
@@ -70,6 +72,10 @@ class Svn {
opfactory
}
+ static ISVNOptions getOptions() {
+ SVNWCUtil.createDefaultOptions(SVNWCUtil.getDefaultConfigurationDirectory(), true);
+ }
+
static SVNRepository getRepository(URI src) {
SVNURL url = SVNURL.parseURIEncoded(src.toASCIIString())
SVNRepository repo = SVNRepositoryFactory.create(url)