[Jython-checkins] jython: Add bundle and install for the standalone jar; get install actually working.

frank.wierzbicki jython-checkins at python.org
Wed Jun 27 21:26:42 CEST 2012


http://hg.python.org/jython/rev/0895176ff7b4
changeset:   6756:0895176ff7b4
user:        Toby Crawley <toby at tcrawley.org>
date:        Wed Jun 27 12:25:56 2012 -0700
summary:
  Add bundle and install for the standalone jar; get install actually working.

files:
  maven/build.xml |  285 +++++++++++++++++++----------------
  maven/pom.xml   |   54 +++---
  2 files changed, 180 insertions(+), 159 deletions(-)


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-template.xml
rename from maven/pom.xml
rename to maven/pom-template.xml
--- a/maven/pom.xml
+++ b/maven/pom-template.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