You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2012/04/08 06:07:42 UTC

svn commit: r1310949 - in /lucene/dev/trunk: dev-tools/scripts/crawl.maven.release.dist.sh dev-tools/scripts/write.stage.maven.build.xml.pl lucene/CHANGES.txt lucene/common-build.xml

Author: sarowe
Date: Sun Apr  8 04:07:42 2012
New Revision: 1310949

URL: http://svn.apache.org/viewvc?rev=1310949&view=rev
Log:
LUCENE-3964: Enable Maven artifact staging

Added:
    lucene/dev/trunk/dev-tools/scripts/crawl.maven.release.dist.sh
    lucene/dev/trunk/dev-tools/scripts/write.stage.maven.build.xml.pl
Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/common-build.xml

Added: lucene/dev/trunk/dev-tools/scripts/crawl.maven.release.dist.sh
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/scripts/crawl.maven.release.dist.sh?rev=1310949&view=auto
==============================================================================
--- lucene/dev/trunk/dev-tools/scripts/crawl.maven.release.dist.sh (added)
+++ lucene/dev/trunk/dev-tools/scripts/crawl.maven.release.dist.sh Sun Apr  8 04:07:42 2012
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Crawls all Maven release distribution artifacts at the given URL
+# and downloads them to the current directory.
+#
+#
+# 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.
+#
+
+if [ -z "$1" ] ; then
+    echo "Usage: $0 <RC-url-to-lucene-or-solr-maven-dist-dir>"
+    echo "Example: $0 'http://people.apache.org/~rmuir/staging_area/lucene-solr-3.6RC0-rev1309642/solr/maven/'"
+    exit 1;
+fi
+
+wget -r -np -l 0 -nH -erobots=off --cut-dirs=8 --reject="*.md5,*.sha1,maven-metadata.xml*,index.html*" "$1/"
\ No newline at end of file

Added: lucene/dev/trunk/dev-tools/scripts/write.stage.maven.build.xml.pl
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/scripts/write.stage.maven.build.xml.pl?rev=1310949&view=auto
==============================================================================
--- lucene/dev/trunk/dev-tools/scripts/write.stage.maven.build.xml.pl (added)
+++ lucene/dev/trunk/dev-tools/scripts/write.stage.maven.build.xml.pl Sun Apr  8 04:07:42 2012
@@ -0,0 +1,121 @@
+#!/usr/bin/perl
+#
+# This script is called from lucene/build.xml and solr/build.xml, by target
+# stage-maven-artifacts, to populate an internal Maven repository created by
+# generate-maven-artifacts with Ant build files, one per POM.  The
+# stage-maven target is then called from each of these Ant build files.
+#
+# Command line parameters:
+#
+#  1. The directory in which to find Maven distribution POMs,
+#     jars, wars, and signatures.
+#  2. The pathname of the Ant build script to be built.
+#  3. The pathname of common-build.xml, which will be imported
+#     in the Ant build script to be built.
+#
+# 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.
+#
+
+use strict;
+use warnings;
+use File::Basename;
+use File::Find;
+use File::Path qw(make_path);
+
+my $num_artifacts = 0;
+my $maven_dist_dir = $ARGV[0];
+my $output_build_xml_file = $ARGV[1];
+my $common_build_xml = $ARGV[2];
+if ($^O eq 'cygwin') { # Make sure Cygwin Perl can find the output path
+  $output_build_xml_file = `cygpath -u "$output_build_xml_file"`;
+  $output_build_xml_file =~ s/\s+$//; # Trim trailing whitespace
+  $output_build_xml_file =~ s/^\s+//; # Trim leading whitespace
+}
+my ($output_file, $output_dir) = fileparse($output_build_xml_file);
+make_path($output_dir);
+open my $output_build_xml, ">$output_build_xml_file"
+    or die "ERROR opening '$ARGV[1]' for writing: $!";
+
+print $output_build_xml qq!<?xml version="1.0"?>
+<project>
+  <import file="${common_build_xml}"/>
+
+  <target name="stage-maven" depends="install-maven-tasks">
+    <sequential>
+!;
+
+sub wanted;
+
+File::Find::find({follow => 1, wanted => \&wanted}, $maven_dist_dir);
+
+print $output_build_xml q!
+    </sequential>
+  </target>
+</project>
+!;
+
+close $output_build_xml;
+
+print "Wrote '$output_build_xml_file' to stage $num_artifacts Maven artifacts.\n";
+exit;
+
+sub wanted {
+  /^(.*)\.pom\z/s && do {
+    my $pom_dir = $File::Find::dir;
+    if ($^O eq 'cygwin') { # Output windows-style paths on Windows
+      $pom_dir = `cygpath -w "$pom_dir"`;
+      $pom_dir =~ s/\s+$//; # Trim trailing whitespace
+      $pom_dir =~ s/^\s+//; # Trim leading whitespace
+    }
+    my $basefile = $_;
+    $basefile =~ s/\.pom\z//;
+    my $basepath = "$pom_dir/$basefile";
+    my $pom_file = "$basepath.pom";
+    my $jar_file = "$basepath.jar";
+    my $war_file = "$basepath.war";
+
+    if (-f $war_file) {
+      print $output_build_xml qq!
+      <m2-deploy pom.xml="${pom_file}" jar.file="${war_file}">
+        <artifact-attachments>
+          <attach file="${pom_file}.asc" type="pom.asc"/>
+          <attach file="${war_file}.asc" type="war.asc"/>
+        </artifact-attachments>
+      </m2-deploy>\n!;
+    } elsif (-f $jar_file) {
+      print $output_build_xml qq!
+      <m2-deploy pom.xml="${pom_file}" jar.file="${jar_file}">
+        <artifact-attachments>
+          <attach file="${basepath}-sources.jar" classifier="sources"/>
+          <attach file="${basepath}-javadoc.jar" classifier="javadoc"/>
+          <attach file="${pom_file}.asc" type="pom.asc"/>
+          <attach file="${jar_file}.asc" type="jar.asc"/>
+          <attach file="${basepath}-sources.jar.asc" classifier="sources" type="jar.asc"/>
+          <attach file="${basepath}-javadoc.jar.asc" classifier="javadoc" type="jar.asc"/>
+        </artifact-attachments>
+      </m2-deploy>\n!;
+    } else {
+      print $output_build_xml qq!
+      <m2-deploy pom.xml="${pom_file}">
+        <artifact-attachments>
+          <attach file="${pom_file}.asc" type="pom.asc"/>
+        </artifact-attachments>
+      </m2-deploy>\n!;
+    }
+
+    ++$num_artifacts;
+  };
+}

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1310949&r1=1310948&r2=1310949&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Sun Apr  8 04:07:42 2012
@@ -721,6 +721,12 @@ Documentation
 * LUCENE-3958: Javadocs corrections for IndexWriter.
   (Iulius Curt via Robert Muir)
 
+Build
+
+* LUCENE-3964: Added target stage-maven-artifacts, which stages
+  Maven release artifacts to a Maven staging repository in preparation
+  for release.  (Steve Rowe)
+
 ======================= Lucene 3.6.0 =======================
 
 Changes in backwards compatibility policy

Modified: lucene/dev/trunk/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/common-build.xml?rev=1310949&r1=1310948&r2=1310949&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/common-build.xml (original)
+++ lucene/dev/trunk/lucene/common-build.xml Sun Apr  8 04:07:42 2012
@@ -907,6 +907,25 @@
     <property name="deployed.grandparent.pom.uptodate" value="true"/>
   </target>
 
+  <target name="stage-maven-artifacts">
+    <sequential>
+      <property name="output.build.xml" location="${build.dir}/stage_maven_build.xml"/>
+      <property name="dev-tools.scripts.dir" value="../dev-tools/scripts"/>
+      <exec dir="." executable="perl" failonerror="true" outputproperty="stage.maven.script.output">
+        <arg value="${dev-tools.scripts.dir}/write.stage.maven.build.xml.pl"/>
+        <arg value="${maven.dist.dir}"/>              <!-- Maven distribution artifacts directory -->
+        <arg value="${output.build.xml}"/>            <!-- Ant build file to be written -->
+        <arg value="${common.dir}/common-build.xml"/> <!-- Imported from the ant file to be written -->
+      </exec>
+      <echo message="${stage.maven.script.output}"/>
+    </sequential>
+    <echo>Invoking target stage-maven in ${output.build.xml} now...</echo>
+    <ant target="stage-maven" antfile="${output.build.xml}" inheritall="false">
+      <property name="m2.repository.id" value="${m2.repository.id}"/>
+      <property name="m2.repository.url" value="${m2.repository.url}"/>
+    </ant>
+  </target>
+
   <!-- TODO: add cool detector like the ivy one? this requires you have rat -->
   <target name="rat-sources-typedef">
     <typedef resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:rat.anttasks">