Skip to content

Commit

Permalink
First phase of integrating bundlor into Grails build
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Nov 18, 2009
1 parent 856e87c commit 51d7889
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 17 deletions.
48 changes: 47 additions & 1 deletion ant/build/bundle.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<project name="grails-bundle">
<project name="grails-bundle"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:bundlor="antlib:com.springsource.bundlor.ant">
<property name="targetDistDirectory" value="${grails.dist}"/>
<import file="maven.xml"/>
<import file="resolve.xml"/>

<target name="-jar-app-files" description="Bundles all the template files for applications and plugins into a JAR files.">
<!-- Clear the old JAR files out. -->
Expand Down Expand Up @@ -56,6 +59,45 @@

</target>

<property name="bundlor.version" value="1.0.0.M6" />
<property name="bundlor.home" location="${user.home}/.grails/bundlor-${bundlor.version}" />
<available file="${bundlor.home}" property="bundlor.installed" />

<target name="--bundlor-jar" depends="bundlor.init" unless="disable.bundlor">
<copy file="${basedir}/maven/grails-${bundle.name}.mf.in" tofile="${grails.target}/grails-${bundle.name}.mf" overwrite="true" />
<replace file="${grails.target}/grails-${bundle.name}.mf" token="@grails.version@" value="${grails.version}" />
<bundlor:bundlor bundlePath="${jar.file}"
outputPath="${jar.file}"
bundleVersion="${grails.version}"
manifestTemplatePath="${grails.target}/grails-${bundle.name}.mf"
failOnWarnings="true">
<!--<propertyset refid="bundlor.properties"/>-->
<propertyset>
<propertyref builtin="all"/>
</propertyset>
</bundlor:bundlor>
</target>

<target name="bundlor.init">
<taskdef resource="com/springsource/bundlor/ant/antlib.xml"
uri="antlib:com.springsource.bundlor.ant">
<classpath id="bundlor.classpath">
<fileset dir="${bundlor.home}/dist"/>
<fileset dir="${bundlor.home}/lib"/>
</classpath>
</taskdef>
</target>

<target name="bundlor.download" unless="bundlor.installed">
<get src="http://s3.amazonaws.com/dist.springframework.org/milestone/BNDLR/bundlor-${bundlor.version}.zip"
dest="${user.home}/.grails/bundlor.zip"
usetimestamp="true"/>

<unzip src="${user.home}/.grails/bundlor.zip"
dest="${user.home}/.grails" />

</target>

<target name="jar" depends="build,build-scripts,-jar-app-files" description="Build the entire source, run all tests and create the Grails JAR file.">
<delete>
<fileset dir="${grails.dist}" includes="*"/>
Expand Down Expand Up @@ -97,6 +139,10 @@
</fileset>
<file file="${basedir}/build.properties"/>
</jar>
<antcall target="--bundlor-jar">
<param name="jar.file" value="${grails.dist}/grails-bootstrap-${grails.version}.jar" />
<param name="bundle.name" value="bootstrap" />
</antcall>
<jar destfile="${grails.dist}/grails-scripts-${grails.version}.jar" manifest="${grails.build}/META-INF/MANIFEST.MF">
<fileset dir="${grails.target}/compiled-scripts"/>
<file file="${basedir}/scripts/log4j.properties"/>
Expand Down
45 changes: 30 additions & 15 deletions ant/build/resolve.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,49 @@
<project name="grails-resolve" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
<property name="ivy.install.version" value="1.4-RC1" />
<property environment="env"/>
<property name="ivy.install.version" value="2.0.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ivy" />
<property name="ivy.jar.dir" value="${ivy.home}/jars" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<property name="ivy.home" value="${user.home}/.grails/ivy" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />

<target name="download-ivy" unless="offline">
<available file="${ivy.jar.file}" property="ivy.available"/>
<antcall target="-download-ivy" />
</target>

<target name="-download-ivy" unless="ivy.available">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://www.jayasoft.org/downloads/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
<get src="http://www.apache.org/dist/ant/ivy/${ivy.install.version}/apache-ivy-${ivy.install.version}-bin.zip"
dest="${ivy.home}/ivy.zip" usetimestamp="true" verbose="true"/>
<unzip src="${ivy.home}/ivy.zip" dest="${ivy.jar.dir}">
<patternset>
<include name="**/*.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</target>

<target name="ivy.init" depends="download-ivy" unless="ivy.lib.path">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>


<target name="resolve" depends="init-ivy">
<target name="resolve" depends="ivy.init">
<ivy:retrieve />
</target>

<target name="dep-report" depends="init-ivy">
<target name="dep-report" depends="ivy.init">
<mkdir dir="${grails.dist}/ivy" />
<ivy:report organisation="codehaus" module="grails" conf="compile" todir="${grails.dist}/ivy" />
</target>
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
grails.version=1.2-SNAPSHOT
grails.version=1.2.0.SNAPSHOT
grails.src.commons=src/commons
grails.src.groovy=src/groovy

Expand Down
Empty file added bundlor.properties
Empty file.
26 changes: 26 additions & 0 deletions ivysettings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<ivy-settings>
<conf defaultResolver="grails"/>
<include url="${ivy.default.conf.dir}/ivyconf-public.xml"/>
<include url="${ivy.default.conf.dir}/ivyconf-shared.xml"/>
<include url="${ivy.default.conf.dir}/ivyconf-local.xml"/>
<include url="${ivy.default.conf.dir}/ivyconf-main-chain.xml"/>
<include url="${ivy.default.conf.dir}/ivyconf-default-chain.xml"/>

<resolvers>
<ibiblio pattern="[organisation]/[type]s/[artifact]-[revision].[ext]"
name="ibiblio-retry" />
<chain name="grails" dual="true">
<resolver ref="shared"/>
<resolver ref="public"/>
<resolver ref="ibiblio-retry"/>
</chain>
<chain name="spring-portfolio-lookup" returnFirst="true">
<s3repo name="bundle-release-repository" bucket="repository.springsource.com" artifact.type="bundles" release.type="release"/>
<s3repo name="bundle-milestone-repository" bucket="repository.springsource.com" artifact.type="bundles" release.type="milestone"/>
<s3repo name="bundle-snapshot-repository" bucket="repository.springsource.com" artifact.type="bundles" release.type="snapshot"/>
<s3repo name="library-release-repository" bucket="repository.springsource.com" artifact.type="libraries" release.type="release"/>
<s3repo name="library-milestone-repository" bucket="repository.springsource.com" artifact.type="libraries" release.type="milestone"/>
<s3repo name="library-snapshot-repository" bucket="repository.springsource.com" artifact.type="libraries" release.type="snapshot"/>
</chain>
</resolvers>
</ivy-settings>
14 changes: 14 additions & 0 deletions maven/grails-bootstrap.mf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Grails
Bundle-Vendor: SpringSource Inc.
Bundle-SymbolicName: org.grails.bootstrap
Bundle-Version: @grails.version@
Import-Package:
org.apache.ant;version="[1.7.1, inf)",
Export-Package:
grails.util;version="@grails.version@",
grails.ant;version="@grails.version@",
org.codehaus.groovy.grails.cli;version="@grails.version@",
org.codehaus.groovy.grails.cli.support;version="@grails.version@",
org.codehaus.groovy.grails.resolve;version="@grails.version@"

0 comments on commit 51d7889

Please sign in to comment.