[Yanel-commits] rev 44993 - in public/yanel/trunk/src: build build/realms realms/welcome-admin realms/yanel-website

guillaume at wyona.com guillaume at wyona.com
Tue Oct 13 14:46:49 CEST 2009


Author: guillaume
Date: 2009-10-13 14:46:49 +0200 (Tue, 13 Oct 2009)
New Revision: 44993

Added:
   public/yanel/trunk/src/build/realms/realm.build.xml
Modified:
   public/yanel/trunk/src/build/realms/build.xml
   public/yanel/trunk/src/build/yanel2realms.xsl
   public/yanel/trunk/src/realms/welcome-admin/build.xml
   public/yanel/trunk/src/realms/yanel-website/build.xml
Log:
Now using Yanel's new default generic Ant build script for realms which does the same as the specific ones and more, e.g. it supports:
 - a standalone 'clean' task
 - full support for realm's binary and source JAR build artifacts: building, patching into the app server webapp, Maven repo upload, ...
 - building under Eclipse!

Issue: 6942


Modified: public/yanel/trunk/src/build/realms/build.xml
===================================================================
--- public/yanel/trunk/src/build/realms/build.xml	2009-10-13 12:09:17 UTC (rev 44992)
+++ public/yanel/trunk/src/build/realms/build.xml	2009-10-13 12:46:49 UTC (rev 44993)
@@ -40,12 +40,14 @@
   </target>
 
   <target name="deploy-libs" description="Deploy libs of realm" depends="init" if="lib-dir-of-realm-exists">
+    <!--FIXME call realm-specific task if available! -->
     <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
       <fileset dir="${realm.lib.dir}"/>
     </copy>
   </target>
 
   <target name="clean" description="Clean realm" depends="init" if="build-dir-of-realm-exists">
+    <!--FIXME call realm-specific task if available! -->
     <delete dir="${realm.build.dir}"/>
   </target>
 

Copied: public/yanel/trunk/src/build/realms/realm.build.xml (from rev 44980, public/yanel/trunk/src/build/resource-types/resource-type.build.xml)
===================================================================
--- public/yanel/trunk/src/build/realms/realm.build.xml	                        (rev 0)
+++ public/yanel/trunk/src/build/realms/realm.build.xml	2009-10-13 12:46:49 UTC (rev 44993)
@@ -0,0 +1,144 @@
+<?xml version="1.0"?>
+
+<!-- Everything common to most realms. -->
+
+<project name="yanel-realm"
+ xmlns:artifact="antlib:org.apache.maven.artifact.ant"
+>
+
+<!-- 
+     The default task config attribute (for example default="compile") seems not to be imported at least with Ant 1.6.5 or Ant 1.7.1
+     which means it needs to be set within each realm build.xml (see also smilar note in ../resource-types/resource-type.build.xml)
+-->
+
+  <dirname property="realm.home.dir" file="${ant.file}"/>
+
+  <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+
+  <!-- For example set within build.sh ... -->
+  <property name="yanel.home" value="${yanel.source.home}"/>
+  <property file="${yanel.home}/src/build/local.build.properties"/>
+  <property file="${yanel.home}/src/build/build.properties"/>
+
+  <import file="${realm.home.dir}/src/build/dependencies.xml"/>
+
+  <!-- Initialize build -->
+  <target name="init" depends="dependencies">
+    <artifact:remoteRepository id="wyona.remote.repository" url="${maven.url}"/>
+
+    <property file="${realm.home.dir}/src/build/local.build.properties"/>
+    <property file="${realm.home.dir}/src/build/build.properties"/>
+
+    <path id="classpath">
+      <pathelement path="${maven2.cp}"/>
+      <pathelement path="${maven2.realm.cp}"/>
+    </path>
+    <property name="realm.build.dir" value="${realm.home.dir}/build"/>
+    <property name="realm.classes.dir" value="${realm.build.dir}/classes"/>
+    <property name="realm.lib.dir" value="${realm.build.dir}/lib"/>
+    <property name="realm.java.dir" value="${realm.home.dir}/src/java"/>
+  </target>
+
+  <property name="eclipse.yanel.build.classes.dir.link" value="yanel-build-webapp-classes"/>
+  <property name="eclipse.classes.dir.link" value="cnode1-webapp-WEB-INF-classes"/>
+
+  <target name="eclipse:classpath" description="Update Eclipse's .classpath file" depends="init">
+    <artifact:dependencies pathId="Yanel.test.jars.classpath" filesetId="Yanel.test.jars.fileset">
+      <remoteRepository refid="wyona.remote.repository"/>
+      <dependency groupId="wyona-org-yanel" artifactId="yanel-test" version="${yanel.source.version}"/>
+    </artifact:dependencies>
+    <echo level="verbose">Yanel test JARs classpath: ${toString:Yanel.test.jars.classpath}</echo>
+
+    <path id="eclipse.classpath">
+      <fileset refid="maven2.fileset"/>
+      <fileset refid="maven2.realm.fileset"/>
+      <fileset refid="Yanel.test.jars.fileset"/>
+    </path>
+    <condition property="eclipse.classes.dir" value="${eclipse.classes.dir.link}" else="">
+      <isset property="do.autopatch.cnode1.webapp.WEB-INF.classes"/>
+    </condition>
+    <condition property="eclipse.source.dirs" value="src/java:${eclipse.yanel.build.classes.dir.link}" else="">
+      <isset property="do.autopatch.cnode1.webapp.WEB-INF.classes"/>
+    </condition>
+    <ant dir="${yanel.home}/tools/eclipse.settings" target="update-classpath"
+     inheritAll="false" inheritRefs="false">
+      <reference torefid="classpath.ref" refid="eclipse.classpath"/>
+      <property name="classpath.dir" value="${realm.home.dir}"/>
+      <property name="classes.dir" value="${eclipse.classes.dir}"/>
+      <property name="source.dirs" value="${eclipse.source.dirs}"/>
+    </ant>
+    <echo><!--XXX -->WARNING (if you used -Ddo.autopatch.cnode1.webapp.WEB-INF.classes=foo to make Eclipse automatically patch the webapp's classes in place during compilation): the logs will show up in ${yanel.home}/build/log4j-cmdl.log and not in ${yanel.home}/build/log4j-cnode1.log (due to to way the build is currently set up).</echo>
+  </target>
+
+  <target name="eclipse" description="Generate all files needed to use the realm under Eclipse (WARNING: .project file will be overwritten!)" depends="eclipse:classpath">
+    <!--XXX HACK: we should generify this instead of stealing files from resource-types' build... -->
+    <copy file="${yanel.home}/src/build/resource-types/Eclipse-3.template.project" tofile="${realm.home.dir}/.project">
+      <filterset>
+        <filter token="RESOURCE_TYPE_NAME" value="${ant.project.name}"/>
+        <filter token="YANEL_VERSION" value="${yanel.source.version}"/>
+        <filter token="GENERATION_COMMAND" value="build -f ${ant.file} eclipse"/>
+        <filter token="YANEL_BUILD_CLASSES_DIR_LINK" value="${eclipse.yanel.build.classes.dir.link}"/>
+        <filter token="YANEL_BUILD_CLASSES_DIR" value="${yanel.build.webapp.classes.dir}"/>
+        <filter token="CLASSES_DIR_LINK" value="${eclipse.classes.dir.link}"/>
+        <filter token="CLASSES_DIR" value="${tomcat1.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes"/><!--FIXME: this should not be Tomcat-specific... -->
+      </filterset>
+    </copy>
+    <echo>Eclipse project created: in Eclipse you can now import (as an existing project into your workspace) this realm with root directory set to ${realm.home.dir} and build it there!</echo>
+  </target>
+
+  <target name="compile" description="Compile Java classes" depends="init">
+
+    <mkdir dir="${realm.classes.dir}"/>
+    <javac srcdir="${realm.java.dir}" destdir="${realm.classes.dir}"
+      classpathref="classpath"
+      encoding="${javac.encoding}"
+      debug="true"
+    />
+
+    <mkdir dir="${realm.lib.dir}"/>
+    <jar destfile="${realm.lib.dir}/yanel-realm-${realm.name}-${realm.version}.jar"
+      basedir="${realm.classes.dir}"
+    />
+    <available property="realm.install.needed" file="src/build/pom.xml"/>
+    <antcall target="install-jar"/>
+  </target>
+
+  <target name="clean" depends="init">
+    <delete dir="${realm.build.dir}"/>
+  </target>
+
+  <target name="copy-dependencies" depends="init">
+    <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
+      <fileset refid="maven2.realm.fileset"/>
+      <mapper type="flatten"/>
+    </copy>
+  </target>
+
+  <!-- Place jar file for this realm into local maven repository -->
+  <target name="install-jar" if="realm.install.needed">
+    <copy file="src/build/pom.xml" tofile="build/lib/pom.xml"/>
+
+    <replace file="build/lib/pom.xml" value="${realm.version}">
+      <replacetoken>@VERSION@</replacetoken>
+    </replace>
+    <replace file="build/lib/pom.xml" value="${realm.name}">
+      <replacetoken>@NAME@</replacetoken>
+    </replace>
+
+    <jar destfile="${realm.lib.dir}/yanel-realm-${realm.name}-${realm.version}-sources.jar"
+      basedir="${realm.java.dir}"
+    />
+
+    <artifact:pom id="maven.project.core" file="build/lib/pom.xml"/>
+    <artifact:install file="build/lib/yanel-realm-${realm.name}-${realm.version}.jar">
+      <pom refid="maven.project.core"/>
+      <attach file="build/lib/yanel-realm-${realm.name}-${realm.version}-sources.jar" classifier="sources"/>
+    </artifact:install>
+  </target>
+
+  <!-- Deploy jar file for this realm into local webapp libs directory -->
+  <target name="deploy-jar" depends="compile">
+    <copy todir="${tomcat1.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib" file="${realm.lib.dir}/yanel-realm-${realm.name}-${realm.version}.jar">
+    </copy>
+  </target>
+</project>


Property changes on: public/yanel/trunk/src/build/realms/realm.build.xml
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: public/yanel/trunk/src/build/yanel2realms.xsl
===================================================================
--- public/yanel/trunk/src/build/yanel2realms.xsl	2009-10-13 12:09:17 UTC (rev 44992)
+++ public/yanel/trunk/src/build/yanel2realms.xsl	2009-10-13 12:46:49 UTC (rev 44993)
@@ -107,6 +107,7 @@
       <property name="build.dir" value="${{build.dir}}"/>
       <property name="servlet.context.prefix" value="{$servlet.context.prefix}"/>
       <property name="yanel.source.version" value="{$yanel.source.version}"/>
+      <property name="yanel.source.home" value="{$yanel.source.home}"/>
       <property name="maven.url" value="{$maven.url}"/>
     </ant>
 </target>

Modified: public/yanel/trunk/src/realms/welcome-admin/build.xml
===================================================================
--- public/yanel/trunk/src/realms/welcome-admin/build.xml	2009-10-13 12:09:17 UTC (rev 44992)
+++ public/yanel/trunk/src/realms/welcome-admin/build.xml	2009-10-13 12:46:49 UTC (rev 44993)
@@ -1,57 +1,3 @@
-<?xml version="1.0"?>
-
-<project name="yanel-realm" default="compile">
-
-  <!-- For example set within build.sh ... -->
-  <property name="yanel.home" value="${yanel.source.home}"/>
-  <!-- See yanel.home ... -->
-  <property file="${user.home}/.ant-global.properties"/>
-  <echo>YANEL_HOME is set to: ${yanel.home}</echo>
-
-  <property file="${yanel.home}/src/build/local.build.properties"/>
-  <property file="${yanel.home}/src/build/build.properties"/>
-
-  <import file="src/build/dependencies.xml"/>
-
-  <target name="init" depends="dependencies">
-    <dirname property="realm.home.dir" file="${ant.file}"/>
-
-    <property file="src/build/local.build.properties"/>
-    <property file="src/build/build.properties"/>
-
-    <property name="realm.build.dir" value="${realm.home.dir}/build"/>
-    <property name="realm.classes.dir" value="${realm.build.dir}/classes"/>
-    <property name="realm.lib.dir" value="${realm.build.dir}/lib"/>
-    <property name="realm.java.dir" value="${realm.home.dir}/src/java"/>
-
-    <path id="classpath">
-      <pathelement path="${maven2.cp}"/>
-<!--
-      <pathelement path="${maven2.realm.cp}"/>
--->
-    </path>
-  </target>
-
-  <target name="compile" depends="init">
-    <echo>Compile java sources of Yanel welcome and admin realm!</echo>
-
-    <mkdir dir="${realm.classes.dir}"/>
-    <javac srcdir="${realm.java.dir}" destdir="${realm.classes.dir}"
-      classpathref="classpath"
-      debug="true"
-    />
-    <mkdir dir="${realm.lib.dir}"/>
-    <jar destfile="${realm.lib.dir}/yanel-realm-${realm.name}-${realm.version}.jar"
-      basedir="${realm.classes.dir}"
-    />
-  </target>
-
-  <target name="copy-dependencies" depends="init">
-    <echo>Copy dependencies of realm Welcome</echo>
-    <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
-      <fileset refid="maven2.realm.fileset"/>
-      <mapper type="flatten"/>
-    </copy>
-  </target>
-
+<project name="yanel--welcome-admin-realm">
+  <import file="${yanel.source.home}/src/build/realms/realm.build.xml"/>
 </project>

Modified: public/yanel/trunk/src/realms/yanel-website/build.xml
===================================================================
--- public/yanel/trunk/src/realms/yanel-website/build.xml	2009-10-13 12:09:17 UTC (rev 44992)
+++ public/yanel/trunk/src/realms/yanel-website/build.xml	2009-10-13 12:46:49 UTC (rev 44993)
@@ -1,57 +1,3 @@
-<?xml version="1.0"?>
-
-<project name="yanel-realm" default="compile">
-
-  <!-- For example set within build.sh ... -->
-  <property name="yanel.home" value="${yanel.source.home}"/>
-  <!-- See yanel.home ... -->
-  <property file="${user.home}/.ant-global.properties"/>
-  <echo>YANEL_HOME is set to: ${yanel.home}</echo>
-
-  <property file="${yanel.home}/src/build/local.build.properties"/>
-  <property file="${yanel.home}/src/build/build.properties"/>
-
-  <import file="src/build/dependencies.xml"/>
-
-  <target name="init" depends="dependencies">
-    <dirname property="realm.home.dir" file="${ant.file}"/>
-
-    <property file="src/build/local.build.properties"/>
-    <property file="src/build/build.properties"/>
-
-    <property name="realm.build.dir" value="${realm.home.dir}/build"/>
-    <property name="realm.classes.dir" value="${realm.build.dir}/classes"/>
-    <property name="realm.lib.dir" value="${realm.build.dir}/lib"/>
-    <property name="realm.java.dir" value="${realm.home.dir}/src/java"/>
-
-    <path id="classpath">
-      <pathelement path="${maven2.cp}"/>
-<!--
-      <pathelement path="${maven2.realm.cp}"/>
--->
-    </path>
-  </target>
-
-  <target name="compile" depends="init">
-    <echo>Compile java sources of Yanel website realm!</echo>
-
-    <mkdir dir="${realm.classes.dir}"/>
-    <javac srcdir="${realm.java.dir}" destdir="${realm.classes.dir}"
-      classpathref="classpath"
-      debug="true"
-    />
-    <mkdir dir="${realm.lib.dir}"/>
-    <jar destfile="${realm.lib.dir}/yanel-realm-${realm.name}-${realm.version}.jar"
-      basedir="${realm.classes.dir}"
-    />
-  </target>
-
-  <target name="copy-dependencies" depends="init">
-    <echo>Copy dependencies of realm Yanel Website</echo>
-    <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
-      <fileset refid="maven2.realm.fileset"/>
-      <mapper type="flatten"/>
-    </copy>
-  </target>
-
+<project name="yanel--website-realm">
+  <import file="${yanel.source.home}/src/build/realms/realm.build.xml"/>
 </project>



More information about the Yanel-commits mailing list