[Jython-checkins] jython (2.5): Backport Toby Crawley's maven fixes to 2.5.

frank.wierzbicki jython-checkins at python.org
Thu Jul 5 21:20:59 CEST 2012


http://hg.python.org/jython/rev/3a0502b1eaa5
changeset:   6785:3a0502b1eaa5
branch:      2.5
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Thu Jul 05 12:09:34 2012 -0700
summary:
  Backport Toby Crawley's maven fixes to 2.5.

files:
  build.xml       |   27 +++-
  maven/build.xml |  285 +++++++++++++++++++----------------
  maven/pom.xml   |   54 +++---
  3 files changed, 206 insertions(+), 160 deletions(-)


diff --git a/build.xml b/build.xml
--- a/build.xml
+++ b/build.xml
@@ -226,6 +226,7 @@
         </path>
         <property name="jython.dev.jar" value="jython-dev.jar" />
         <property name="jython.deploy.jar" value="jython.jar" />
+        <property name="jython.standalone.jar" value="jython-standalone.jar" />
     </target>
 
     <target name="full-preinit">
@@ -673,6 +674,29 @@
         </jarjar>
     </target>
 
+<target name="jar-standalone" depends="jar-complete, copy-lib">
+        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="extlibs/jarjar-0.7.jar"/>
+        <jarjar destfile="${dist.dir}/${jython.standalone.jar}">
+            <zipfileset src="${dist.dir}/${jython.deploy.jar}"/>
+            <fileset dir="${dist.dir}" includes="Lib/**" excludes="Lib/test/**,Lib/email/test/**"/>
+
+            <manifest>
+                <attribute name="Main-Class" value="org.python.util.jython" />
+                <attribute name="Built-By" value="${user.name}" />
+                <!-- info section. ATTN: no blanks, no '.' in the names -->
+                <section name="Build-Info">
+                    <attribute name="version" value="${jython.version}" />
+                    <attribute name="svn-build" value="${do.checkout}" />
+                    <attribute name="oracle" value="${oracle.present}" />
+                    <attribute name="informix" value="${informix.present}" />
+                    <attribute name="build-compiler" value="${build.compiler}" />
+                    <attribute name="jdk-target-version" value="${jdk.target.version}" />
+                    <attribute name="debug" value="${debug}" />
+                </section>
+            </manifest>
+        </jarjar>
+    </target>
+
     <target name="jar" depends="compile,expose">
        <typedef name="nameunion" classname="org.python.util.NameUnionAntType">
            <classpath>
@@ -843,7 +867,7 @@
     </target>
 
     <!-- wrap the build into the installer -->
-    <target name="install" depends="brand-readme-version, install-init, jar-complete, javadoc, copy-full">
+    <target name="install" depends="brand-readme-version, install-init, jar-standalone, javadoc, copy-full">
         <property name="install.src.dir" value="${jython.base.dir}/../installer/src/java" />
         <echo>compiling installer from ${install.src.dir}</echo>
         <javac srcdir="${install.src.dir}"
@@ -876,6 +900,7 @@
         <jar destfile="${work.dir}/jython_installer-${jython.version.noplus}.jar" update="true">
             <fileset dir="${dist.dir}">
                 <exclude name="${jython.dev.jar}"/>
+                <exclude name="${jython.standalone.jar}"/>
                 <exclude name="callbacker_test.jar"/>
                 <exclude name="extlibs/svnant-jars/**" />
                 <exclude name="extlibs/antlr*.jar" />
diff --git a/maven/build.xml b/maven/build.xml
--- a/maven/build.xml
+++ b/maven/build.xml
@@ -8,9 +8,9 @@
    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
@@ -18,141 +18,162 @@
    specific language governing permissions and limitations
    under the License.
 -->
- 
-<!-- 
-	This file was modified from the Apache Cayenne project's build system
-	to suit the needs of the Jython project's build system.
+
+<!--
+       This file was modified from the Apache Cayenne project's build system
+       to suit the needs of the Jython project's build system.
 -->
 
 <!-- ================================================= -->
 <!--            Maven Bundle Buildfile                 -->
 <!-- ================================================= -->
 <project name="jython-maven" default="bundle-all" basedir="..">
-	
-	<property file="${basedir}/default.properties"/>
-	
-	<property name="m2.repo" value="${user.home}/.m2/repository"/>
-	<property name="build.base" value="${basedir}/build"/>
-	<property name="build" value="${build.base}/maven"/>
-	<property name="dist.base" value="${basedir}/dist"/>
-	<property name="dist"
-		value="${dist.base}/${project.name}-${project.version}"/>
-	<property name="src.dir" value="${basedir}/src"/>
-	
-	<property name="m2.groupDir" value="org.python"/>
-	<property name="m2.artifactId" value="jython"/>
-	
-	
-	<target name="bundle-all" depends="build-jython">
-		
-		<antcall target="bundle">
-			<param name="stage-target" value="stage"/>
-			<param name="m2.groupDir" value="org.python"/>
-			<param name="m2.artifactId" value="jython"/>
-		</antcall>
-		
-	</target>
-	
-	<!-- 
-		Removes staging dir.
-	-->
-	<target name="clean">
-		<delete dir="${build}"/>
-		
-		<delete>
-			<fileset dir="${dist.base}" includes="*-bundle.jar"/>
-		</delete>
-	</target>
-	
-	<!-- 
-		Installs artifact to the local repo specified.
-	-->
-	<target name="install" depends="stage">
-		
-		<property name="install.dir"
-			value="${m2.groupDir}/${m2.artifactId}/${project.version}"/>
-		<property name="install.name"
-			value="${m2.artifactId}-${project.version}"/>
-		<property name="stage" value="${build}"/>
-		
-		<mkdir dir="${install.dir}"/>
-		<copy file="maven/pom.xml"
-			tofile="${install.dir}/${install.name}.pom">
-			<filterset>
-				<filter token="PROJECT-VERSION" value="${project.version}"/>
-			</filterset>
-		</copy>
-		
-		<move file="${stage}/${install.name}.jar"
-			tofile="${install.dir}/${install.name}.jar"/>
-		<move file="${stage}/${install.name}-sources.jar"
-			tofile="${install.dir}/${install.name}-sources.jar"/>
-		
-		<checksum algorithm="SHA1" fileext=".sha1">
-			<fileset dir="${install.dir}" excludes="*.sha1,*.md5,*.tmp"/>
-		</checksum>
-		
-		<checksum algorithm="MD5" fileext=".md5">
-			<fileset dir="${install.dir}" excludes="*.sha1,*.md5,*.tmp"/>
-		</checksum>
-	</target>
-	
-	<!-- 
-		Bundles staged artifact to release to ibiblio
-	-->
-	<target name="bundle">
-		<antcall target="${stage-target}"/>
-		
-		<property name="stage" value="${build}"/>
-		
-		<jar
-			jarfile="${dist.base}/${m2.artifactId}-${project.version}-bundle.jar">
-			<fileset dir="${stage}"/>
-		</jar>
-	</target>
-	
-	<!-- 
-		Performs Maven build staging
-	-->
-	<target name="stage" depends="validate-pom">
-		<property name="stage" value="${build}/"/>
-		<mkdir dir="${stage}"/>
-		
-		<copy file="maven/pom.xml" tofile="${stage}/pom.xml">
-			<filterset>
-				<filter token="PROJECT-VERSION" value="${project.version}"/>
-			</filterset>
-		</copy>
-		
-		<copy file="LICENSE.txt" tofile="${stage}/LICENSE.txt"/>
-		
-		<copy
-			file="${dist.base}/jython.jar"
-			tofile="${stage}/${m2.artifactId}-${project.version}.jar"/>
-		
-		<jar jarfile="${stage}/${m2.artifactId}-${project.version}-sources.jar">
-			<fileset dir="${src.dir}" includes="**/*.java"/>
-		</jar>
-	</target>
 
-	<!-- 
-		Performs POM Schema validation.
-	-->
-	<target name="validate-pom">
-		<xmlvalidate failonerror="true" file="maven/pom.xml">
-			<attribute name="http://xml.org/sax/features/validation"
-				value="true"/>
-			<attribute name="http://apache.org/xml/features/validation/schema"
-				value="true"/>
-			<attribute name="http://xml.org/sax/features/namespaces"
-				value="true"/>
-			<property
-				name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
-				value="maven/maven-v4_0_0.xsd"/>
-		</xmlvalidate>
-	</target>
-	
-	<target name="build-jython" depends="clean">
-		<ant antfile="build.xml" target="jar-complete"/>
-	</target>
+  <property file="${basedir}/default.properties"/>
+
+  <property name="project.version" value="2.7.0-SNAPSHOT"/>
+
+  <property name="m2.repo" value="${user.home}/.m2/repository"/>
+  <property name="m2.groupDir" value="org/python"/>
+
+  <property name="build.base" value="${basedir}/build"/>
+  <property name="build.dir" value="${build.base}/maven"/>
+  <property name="dist.base" value="${basedir}/dist"/>
+  <property name="src.dir" value="${basedir}/src"/>
+
+  <condition property="do.build">
+    <not>
+      <and>
+        <available file="${dist.base}/jython.jar"/>
+        <available file="${dist.base}/jython-standalone.jar"/>
+      </and>
+    </not>
+  </condition>
+
+  <target name="install" depends="prep">
+    <m2-install artifactId="jython"/>
+  </target>
+
+  <target name="install-standalone" depends="prep">
+    <m2-install artifactId="jython-standalone"/>
+  </target>
+
+  <target name="bundle" depends="prep">
+    <m2-bundle artifactId="jython"/>
+  </target>
+
+  <target name="bundle-standalone" depends="prep">
+    <m2-bundle artifactId="jython-standalone"/>
+  </target>
+
+  <target name="install-all" depends="install, install-standalone"/>
+
+  <target name="bundle-all" depends="bundle, bundle-standalone"/>
+
+  <target name="clean">
+    <delete dir="${build.dir}"/>
+
+    <delete>
+      <fileset dir="${dist.base}" includes="*-bundle.jar"/>
+    </delete>
+  </target>
+
+  <!--
+       Installs artifact to the local repo specified.
+  -->
+
+  <macrodef name="m2-install">
+    <attribute name="artifactId"/>
+    <attribute name="install.dir"
+               default="${m2.repo}/${m2.groupDir}/@{artifactId}/${project.version}"/>
+    <attribute name="install.name"
+               default="@{artifactId}-${project.version}"/>
+
+    <sequential>
+      <stage artifactId="@{artifactId}"/>
+      <mkdir dir="@{install.dir}"/>
+      <copy file="maven/pom-template.xml"
+            tofile="@{install.dir}/@{install.name}.pom">
+        <filterset>
+          <filter token="PROJECT-VERSION" value="${project.version}"/>
+          <filter token="ARTIFACT-ID" value="@{artifactId}"/>
+        </filterset>
+      </copy>
+
+      <move file="${build.dir}/@{install.name}.jar"
+            tofile="@{install.dir}/@{install.name}.jar"/>
+      <move file="${build.dir}/@{install.name}-sources.jar"
+            tofile="@{install.dir}/@{install.name}-sources.jar"/>
+
+      <checksum algorithm="SHA1" fileext=".sha1">
+        <fileset dir="@{install.dir}" excludes="*.sha1,*.md5,*.tmp"/>
+      </checksum>
+
+      <checksum algorithm="MD5" fileext=".md5">
+        <fileset dir="@{install.dir}" excludes="*.sha1,*.md5,*.tmp"/>
+      </checksum>
+    </sequential>
+  </macrodef>
+
+  <!--
+       Bundles staged artifact to release to ibiblio
+  -->
+  <macrodef name="m2-bundle">
+    <attribute name="artifactId"/>
+    <sequential>
+      <stage artifactId="@{artifactId}"/>
+
+      <jar jarfile="${dist.base}/@{artifactId}-${project.version}-bundle.jar">
+        <fileset dir="${build.dir}"/>
+      </jar>
+    </sequential>
+  </macrodef>
+
+  <!--
+       Performs Maven build staging
+  -->
+  <macrodef name="stage">
+    <attribute name="artifactId"/>
+    <sequential>
+      <delete dir="${build.dir}"/>
+      <mkdir dir="${build.dir}"/>
+      <copy file="maven/pom-template.xml" tofile="${build.dir}/pom.xml">
+        <filterset>
+          <filter token="PROJECT-VERSION" value="${project.version}"/>
+          <filter token="ARTIFACT-ID" value="@{artifactId}"/>
+        </filterset>
+      </copy>
+
+      <copy file="LICENSE.txt" tofile="${build.dir}/LICENSE.txt"/>
+      <copy file="${dist.base}/@{artifactId}.jar"
+            tofile="${build.dir}/@{artifactId}-${project.version}.jar"/>
+
+      <jar jarfile="${build.dir}/@{artifactId}-${project.version}-sources.jar">
+        <fileset dir="${src.dir}" includes="**/*.java"/>
+      </jar>
+    </sequential>
+  </macrodef>
+
+  <!--
+       Performs POM Schema validation.
+  -->
+  <target name="validate-pom">
+    <xmlvalidate failonerror="true" file="maven/pom-template.xml">
+      <attribute name="http://xml.org/sax/features/validation"
+                 value="true"/>
+      <attribute name="http://apache.org/xml/features/validation/schema"
+                 value="true"/>
+      <attribute name="http://xml.org/sax/features/namespaces"
+                 value="true"/>
+      <property
+          name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
+          value="maven/maven-v4_0_0.xsd"/>
+    </xmlvalidate>
+  </target>
+
+  <target name="build-jython" if="do.build">
+    <ant antfile="build.xml" target="jar-standalone"/>
+  </target>
+
+  <target name="prep" depends="build-jython, validate-pom"/>
 </project>
diff --git a/maven/pom.xml b/maven/pom.xml
--- a/maven/pom.xml
+++ b/maven/pom.xml
@@ -1,30 +1,30 @@
 <?xml version="1.0"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.python</groupId>
-	<artifactId>jython</artifactId>
-	<packaging>jar</packaging>
-	<name>Jython</name>
-	<version>@PROJECT-VERSION@</version>
-	<url>http://www.jython.org/</url>
-	<description>
-		Jython is an implementation of the high-level, dynamic, object-oriented
-		language Python written in 100% Pure Java, and seamlessly integrated with
-		the Java platform. It thus allows you to run Python on any Java platform.
-	</description>
-	<licenses>
-    	<license>
-      		<name>Jython Software License</name>
-      		<url>http://www.jython.org/Project/license.html</url>
-      		<distribution>repo</distribution>
-    	</license>
-  	</licenses>
-  	<scm>
-  		<connection>scm:hg:http://hg.python.org/jython</connection>
-  		<developerConnection>scm:hg:ssh://hg@hg.python.org/jython</developerConnection>
-  		<url>http://hg.python.org/jython</url>
-  	</scm>
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.python</groupId>
+    <artifactId>@ARTIFACT-ID@</artifactId>
+    <packaging>jar</packaging>
+    <name>Jython</name>
+    <version>@PROJECT-VERSION@</version>
+    <url>http://www.jython.org/</url>
+    <description>
+        Jython is an implementation of the high-level, dynamic, object-oriented
+        language Python written in 100% Pure Java, and seamlessly integrated with
+        the Java platform. It thus allows you to run Python on any Java platform.
+    </description>
+    <licenses>
+        <license>
+            <name>Jython Software License</name>
+            <url>http://www.jython.org/Project/license.html</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+    <scm>
+        <connection>scm:hg:http://hg.python.org/jython</connection>
+        <developerConnection>scm:hg:ssh://hg@hg.python.org/jython</developerConnection>
+        <url>http://hg.python.org/jython</url>
+    </scm>
 </project>

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list