+ build scripts for base64

# updated build scripts to use the same common base (tools/ant-js.xml)
This commit is contained in:
cbonar 2012-01-27 14:11:31 +01:00
parent 52f5273ae5
commit 3b6f5f091f
11 changed files with 267 additions and 210 deletions

View file

@ -7,3 +7,9 @@ tools/yuicompressor-*.jar
tools/ivy-*.jar
codecs/hex/local.properties
codecs/hex/target
codecs/base64/target
tools/jsdoc-toolkit
codecs/rsa/build
codecs/base64/build
codecs/base64/local.properties
codecs/hex/build

View file

@ -0,0 +1,72 @@
########################################
#
# This file is a convenient way to define some parameters,
# rather than from inside the build script.
#
# Depending on the ant targets that will be invoked,
# some properties will be required, some others won't.
#
# Some important properties are marked "required" so you can spot
# the ones to define locally if you want to build this project.
#
# You should not need to override those properties.
# If you really need to, you can create a new file called "local.properties"
# in the same directory and put inside any property you want to fit your local configuration.
#
# Do NOT commit the "local.properties" file to the version control system
# (CVS, SVN, ...) : it should stay as a local configuration only.
# Do not commit or remove this file from the v.c.s. either ;-o
#
# If you don't wish to create such a file, you can pass the required properties
# to ant as command line arguments using the -D option.
#
########################################
basedir=.
# Where the source files are : here Maven-style
src.dir=${basedir}/src/main/javascript
# Directory used to put temporary files during build
build.dir=${basedir}/build
# Where the generated files are going
target.dir=${basedir}/target
# Where the generated libraries are going
lib.dir=${target.dir}/lib
# Where to copy the documentation
doc.dir=${target.dir}/doc
########################################
#
# External programs : you should copy this section to "local.properties"
# and change it for your configuration.
#
########################################
# (convenience) -> set to common 'tools' directory
#tools.dir=../../tools
# JsUnit files
#jsunit.dir=/opt/jsunit
jsunit.coreJs=${jsunit.dir}/app/jsUnitCore.js
#jsunit.build=${jsunit.dir}/build.xml
jsunit.testRunner=${jsunit.dir}/testRunner.html
#jsunit.browsers=/usr/bin/firefox,/usr/bin/konqueror
# Ant settings
# (required) -> set to Ivy library containing Ant task
#ant.ivytask.path=${tools.dir}/ivy-2.2.0.jar
# (required) -> set to Javascript Ant template project
#ant.jsproject.path=${tools.dir}/ant-js.xml
# (required) -> define this property in your "local.properties" file
# Full path to the jar of the YUI compressor (http://developer.yahoo.com/yui/compressor)
#yuicompressor.jar=${tools.dir}/yuicompressor-2.4.7.jar
# (required) -> define this property in your "local.properties" file
# Installation directory of JSDoc-toolkit (http://code.google.com/p/jsdoc-toolki)
#jsdoc.dir=${tools.dir}/jsdoc-toolkit

16
codecs/base64/build.xml Normal file
View file

@ -0,0 +1,16 @@
<!--
Build script for the project "Crypto.Base64".
This script is based on a template for Javascript projects.
-->
<project name="Crypto.Base64" default="javascript.package" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- custom, local only, properties for this project -->
<property file="local.properties"/>
<!-- default properties for this project -->
<property file="build.properties"/>
<!-- template for javascript projects -->
<import file="${ant.jsproject.path}" />
</project>

22
codecs/base64/ivy.xml Normal file
View file

@ -0,0 +1,22 @@
<ivy-module version="2.0">
<info organisation="crypto" module="base64" revision="1.0.0" status="integration" publication="20120127121502">
<license name="Copyright 2005 Herbert Hanewinkel" url="www.haneWIN.de"/>
<ivyauthor name="Nicolas BONARDELLE" url="http://nicobo.net/contact?subject=crypto+hex+ivy"/>
<description homepage="http://code.google.com/p/ciform">
OpenPGP radix-64/base64 string encoding/decoding.
</description>
</info>
<configurations>
<!-- The source script as plain text, including all inner informations and comments. -->
<conf name="source"/>
<!-- An obfuscated, size-reduced version of the script. Use to speed up loading time in final environment. -->
<conf name="minified"/>
</configurations>
<publications>
<artifact name="base64" type="js" conf="source"/>
<artifact name="base64-min" type="js" conf="minified"/>
</publications>
<dependencies>
<!-- no dependency required -->
</dependencies>
</ivy-module>

View file

@ -27,6 +27,9 @@ basedir=.
# Where the source files are : here Maven-style
src.dir=${basedir}/src/main/javascript
# Directory used to put temporary files during build
build.dir=${basedir}/build
# Where the generated files are going
target.dir=${basedir}/target
@ -54,16 +57,16 @@ jsunit.coreJs=${jsunit.dir}/app/jsUnitCore.js
jsunit.testRunner=${jsunit.dir}/testRunner.html
#jsunit.browsers=/usr/bin/firefox,/usr/bin/konqueror
# Ivy settings
# (required) -> set to Ivy libraries directory (contains all required *.jar)
#ivy.lib.dir=/opt/ivy
#ivy.file = ${basedir}/ivy.xml
#repository.dir=${target}/ivy
# Ant settings
# (required) -> set to Ivy library containing Ant task
#ant.ivytask.path=${tools.dir}/ivy-2.2.0.jar
# (required) -> set to Javascript Ant template project
#ant.jsproject.path=${tools.dir}/ant-js.xml
# (required) -> define this property in your "local.properties" file
# Full path to the jar of the YUI compressor (http://developer.yahoo.com/yui/compressor)
#yuicompressor.jar=${tools.dir}/yuicompressor-2.4.7.jar
# (required) -> define this property in your "local.properties" file
# Command line to execute JSDoc (http://jsdoc.sourceforge.net)
#jsdoc=${tools.dir}/JSDoc/jsdoc.pl
# Installation directory of JSDoc-toolkit (http://code.google.com/p/jsdoc-toolki)
#jsdoc.dir=${tools.dir}/jsdoc-toolkit

View file

@ -1,107 +1,16 @@
<!--
Build script for the project "Crypto.Hex".
This script is an Ant script using Ivy extension to resolve dependencies.
You will need both Ant (http://ant.apache.org/) and Ivy (http://ant.apache.org/ivy) to use it.
This script is based on a template for Javascript projects.
-->
<project name="Crypto.Hex" default="package" xmlns:ivy="antlib:org.apache.ivy.ant">
<project name="Crypto.Hex" default="javascript.package" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- ==================== -->
<!-- Settings -->
<!-- ==================== -->
<!-- default properties, specific to this project -->
<!-- custom, local only, properties for this project -->
<property file="local.properties"/>
<!-- default properties for this project -->
<property file="build.properties"/>
<!-- ==================== -->
<!-- Third party tasks -->
<!-- ==================== -->
<path id="ivy.lib.path">
<fileset file="${ant.ivytask.path}" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<!-- ==================== -->
<!-- Main targets : they are greatly inspired from the Maven build lifecycle -->
<!-- ==================== -->
<target name="validate" description="Validates the project is correct and all necessary information is available.">
<!-- Retrieves dependencies with ivy : required to initialize the cache and to get informations about the module being built -->
<ivy:retrieve />
<!-- Creates required directories -->
<mkdir dir="${target.dir}" />
</target>
<target name="compile" depends="validate" description="Compiles the source code of the project.">
<!-- nothing more to do -->
</target>
<target name="test" depends="compile" description="Tests the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed.">
<!-- nothing more to do -->
</target>
<target name="package" depends="build-src, build-min, test, doc" description="Takes the compiled code and package it in its distributable format, such as a JAR.">
<!-- nothing more to do -->
</target>
<target name="integration-test" depends="package" description="Processes and deploys the package if necessary into an environment where integration tests can be run.">
<!-- nothing more to do -->
</target>
<target name="verify" depends="integration-test" description="Runs any checks to verify the package is valid and meets quality criteria.">
<!-- nothing more to do -->
</target>
<target name="install" depends="verify" description="Installs the package into the local repository, for use as a dependency in other projects locally.">
<!-- 'local' resolver is a default one bundled with Ivy -->
<!-- 'artifactspattern' must match the name of the files this script builds -->
<ivy:publish resolver="local" srcivypattern="ivy.xml" artifactspattern="${lib.dir}/[artifact]-[revision].[ext]" overwrite="true" forcedeliver="true" />
<!--<echo message="Published to default local Ivy repository." />-->
</target>
<target name="deploy" depends="verify" description="Done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.">
<!-- nothing more to do -->
</target>
<target name="clean" description="Cleans this project.">
<delete includeemptydirs="true" dir="${target.dir}"/>
</target>
<!-- ==================== -->
<!-- Some more specific targets -->
<!-- ==================== -->
<target name="doc" depends="validate" description="Generates developer documentation.">
<!-- Generates a report of dependencies -->
<ivy:report todir="${doc.dir}/ivy"/>
<!-- Generates the API doc -->
<exec command="${jsdoc}" failonerror="true">
<arg value="-d"/> <arg value="${doc.dir}/api"/>
<arg value="--no-lexical-privates"/>
<arg value="--package-naming"/>
<arg value="--nested-file-naming"/>
<arg line="--project-name ${ant.project.name}"/>
<arg value="${src.dir}"/>
</exec>
<echo message="Done generating doc." />
</target>
<target name="build-src" depends="validate" description="Builds the default .js.">
<copy file="${src.dir}/hex.js" tofile="${lib.dir}/hex-${ivy.revision}.js" />
<echo message="Copied : ${lib.dir}/hex-${ivy.revision}.js" />
</target>
<target name="build-min" depends="validate" description="Builds a minified version of the .js.">
<java jar="${yuicompressor.jar}" fork="true" output="${lib.dir}/hex-min-${ivy.revision}.js" failonerror="true">
<arg line="--type js" />
<arg file="${src.dir}/hex.js"/>
</java>
<echo message="Minified : ${lib.dir}/hex-min-${ivy.revision}.js" />
</target>
<!-- template for javascript projects -->
<import file="${ant.jsproject.path}" />
</project>

View file

@ -1,5 +1,5 @@
<ivy-module version="2.0">
<info organisation="crypto" module="hex" revision="1.0.0" status="integration">
<info organisation="crypto" module="hex" revision="1.0.0" status="integration" publication="20120127121502">
<ivyauthor name="Nicolas BONARDELLE" url="http://nicobo.net/contact?subject=crypto+hex+ivy"/>
<description homepage="http://code.google.com/p/ciform">
This library provides conversion functions from/to hexadecimal format.

View file

@ -27,6 +27,9 @@ basedir=.
# Where the source files are : here Maven-style
src.dir=${basedir}/src/main/javascript
# Directory used to put temporary files during build
build.dir=${basedir}/build
# Where the generated files are going
target.dir=${basedir}/target
@ -54,16 +57,16 @@ jsunit.coreJs=${jsunit.dir}/app/jsUnitCore.js
jsunit.testRunner=${jsunit.dir}/testRunner.html
#jsunit.browsers=/usr/bin/firefox,/usr/bin/konqueror
# Ivy settings
# (required) -> set to Ivy libraries directory (contains all required *.jar)
#ivy.lib.dir=/opt/ivy
#ivy.file = ${basedir}/ivy.xml
#repository.dir=${target}/ivy
# Ant settings
# (required) -> set to Ivy library containing Ant task
#ant.ivytask.path=${tools.dir}/ivy-2.2.0.jar
# (required) -> set to Javascript Ant template project
#ant.jsproject.path=${tools.dir}/ant-js.xml
# (required) -> define this property in your "local.properties" file
# Full path to the jar of the YUI compressor (http://developer.yahoo.com/yui/compressor)
#yuicompressor.jar=${tools.dir}/yuicompressor-2.4.7.jar
# (required) -> define this property in your "local.properties" file
# Command line to execute JSDoc (http://jsdoc.sourceforge.net)
#jsdoc=${tools.dir}/JSDoc/jsdoc.pl
# Installation directory of JSDoc-toolkit (http://code.google.com/p/jsdoc-toolki)
#jsdoc.dir=${tools.dir}/jsdoc-toolkit

View file

@ -1,107 +1,16 @@
<!--
Build script for the project "Crypto.RSA".
This script is an Ant script using Ivy extension to resolve dependencies.
You will need both Ant (http://ant.apache.org/) and Ivy (http://ant.apache.org/ivy) to use it.
This script is based on a template for Javascript projects.
-->
<project name="Crypto.RSA" default="package" xmlns:ivy="antlib:org.apache.ivy.ant">
<project name="Crypto.RSA" default="javascript.package" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- ==================== -->
<!-- Settings -->
<!-- ==================== -->
<!-- default properties, specific to this project -->
<!-- custom, local only, properties for this project -->
<property file="local.properties"/>
<!-- default properties for this project -->
<property file="build.properties"/>
<!-- ==================== -->
<!-- Third party tasks -->
<!-- ==================== -->
<path id="ivy.lib.path">
<fileset file="${ant.ivytask.path}" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<!-- ==================== -->
<!-- Main targets : they are greatly inspired from the Maven build lifecycle -->
<!-- ==================== -->
<target name="validate" description="Validates the project is correct and all necessary information is available.">
<!-- Retrieves dependencies with ivy : required to initialize the cache and to get informations about the module being built -->
<ivy:retrieve />
<!-- Creates required directories -->
<mkdir dir="${target.dir}" />
</target>
<target name="compile" depends="validate" description="Compiles the source code of the project.">
<!-- nothing more to do -->
</target>
<target name="test" depends="compile" description="Tests the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed.">
<!-- nothing more to do -->
</target>
<target name="package" depends="build-src, build-min, test, doc" description="Takes the compiled code and package it in its distributable format, such as a JAR.">
<!-- nothing more to do -->
</target>
<target name="integration-test" depends="package" description="Processes and deploys the package if necessary into an environment where integration tests can be run.">
<!-- nothing more to do -->
</target>
<target name="verify" depends="integration-test" description="Runs any checks to verify the package is valid and meets quality criteria.">
<!-- nothing more to do -->
</target>
<target name="install" depends="verify" description="Installs the package into the local repository, for use as a dependency in other projects locally.">
<!-- 'local' resolver is a default one bundled with Ivy -->
<!-- 'artifactspattern' must match the name of the files this script builds -->
<ivy:publish resolver="local" srcivypattern="ivy.xml" artifactspattern="${lib.dir}/[artifact]-[revision].[ext]" overwrite="true" forcedeliver="true" />
<!--<echo message="Published to default local Ivy repository." />-->
</target>
<target name="deploy" depends="verify" description="Done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.">
<!-- nothing more to do -->
</target>
<target name="clean" description="Cleans this project.">
<delete includeemptydirs="true" dir="${target.dir}"/>
</target>
<!-- ==================== -->
<!-- Some more specific targets -->
<!-- ==================== -->
<target name="doc" depends="validate" description="Generates developer documentation.">
<!-- Generates a report of dependencies -->
<ivy:report todir="${doc.dir}/ivy"/>
<!-- Generates the API doc -->
<exec command="${jsdoc}" failonerror="true">
<arg value="-d"/> <arg value="${doc.dir}/api"/>
<arg value="--no-lexical-privates"/>
<arg value="--package-naming"/>
<arg value="--nested-file-naming"/>
<arg line="--project-name ${ant.project.name}"/>
<arg value="${src.dir}"/>
</exec>
<echo message="Done generating doc." />
</target>
<target name="build-src" depends="validate" description="Builds the default .js.">
<copy file="${src.dir}/rsa.js" tofile="${lib.dir}/rsa-${ivy.revision}.js" />
<echo message="Copied : ${lib.dir}/rsa-${ivy.revision}.js" />
</target>
<target name="build-min" depends="validate" description="Builds a minified version of the .js.">
<java jar="${yuicompressor.jar}" fork="true" output="${lib.dir}/rsa-min-${ivy.revision}.js" failonerror="true">
<arg line="--type js" />
<arg file="${src.dir}/rsa.js"/>
</java>
<echo message="Minified : ${lib.dir}/rsa-min-${ivy.revision}.js" />
</target>
<!-- template for javascript projects -->
<import file="${ant.jsproject.path}" />
</project>

View file

@ -1,5 +1,5 @@
<ivy-module version="2.0">
<info organisation="crypto" module="rsa" revision="1.0.0" status="integration" publication="20120126183301">
<info organisation="crypto" module="rsa" revision="1.0.0" status="integration" publication="20120127120313">
<license name="Copyright 2000 by John M Hanna" url="http://sourceforge.net/projects/shop-js"/>
<license name="GNU General Public License (GPL)" url="http://www.gnu.org/copyleft/gpl.html"/>
<ivyauthor name="Nicolas BONARDELLE" url="http://nicobo.net/contact?subject=crypto+rsa+ivy"/>

117
tools/ant-js.xml Normal file
View file

@ -0,0 +1,117 @@
<!--
Ant build template for Javascript projects.
To use it, projects must import this file into their own build.xml and define all variables.
-->
<project name="javascript" default="package" xmlns:ivy="antlib:org.apache.ivy.ant">
<!--
Loads dependent tasks
-->
<path id="ivy.lib.path">
<fileset file="${ant.ivytask.path}" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<!--
Main targets : they are greatly inspired from the Maven build lifecycle
-->
<target name="validate" description="Validates the project is correct and all necessary information is available.">
<!-- Retrieves dependencies with ivy : required to initialize the cache and to get informations about the module being built -->
<ivy:retrieve />
<!-- Creates required directories -->
<mkdir dir="${target.dir}" />
</target>
<target name="compile" depends="validate" description="Compiles the source code of the project.">
<!-- nothing more to do -->
</target>
<target name="test" depends="compile" description="Tests the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed.">
<!-- nothing more to do -->
</target>
<target name="package" depends="build-src, build-min, test, doc" description="Takes the compiled code and package it in its distributable format, such as a JAR.">
<!-- nothing more to do -->
</target>
<target name="integration-test" depends="package" description="Processes and deploys the package if necessary into an environment where integration tests can be run.">
<!-- nothing more to do -->
</target>
<target name="verify" depends="integration-test" description="Runs any checks to verify the package is valid and meets quality criteria.">
<!-- nothing more to do -->
</target>
<target name="install" depends="build-src, build-min, test" description="Installs the package into the local repository, for use as a dependency in other projects locally.">
<!-- 'local' resolver is a default one bundled with Ivy -->
<!-- 'artifactspattern' must match the name of the files this script builds -->
<ivy:publish resolver="local" srcivypattern="ivy.xml" artifactspattern="${lib.dir}/[artifact]-[revision].[ext]" overwrite="true" forcedeliver="true" />
</target>
<target name="deploy" depends="verify" description="Done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.">
<!-- nothing more to do -->
</target>
<target name="clean" description="Cleans this project.">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${build.dir}"/>
<fileset dir="${target.dir}"/>
</delete>
</target>
<!--
Some more specific targets
-->
<target name="doc" depends="validate" description="Generates developer documentation.">
<!-- Generates a report of dependencies -->
<ivy:report todir="${doc.dir}/ivy"/>
<!-- Generates the API doc -->
<!--<mkdir dir="${doc.dir}/api" />-->
<java jar="${jsdoc.dir}/jsrun.jar" fork="true" failonerror="true">
<arg file="${jsdoc.dir}/app/run.js" />
<arg file="${src.dir}"/>
<arg prefix="--template=" file="${jsdoc.dir}/templates/jsdoc" />
<arg value="--allfunctions" />
<arg value="--private" />
<arg prefix="--directory=" file="${doc.dir}/api"/>
<arg value="--recurse"/>
<arg value="--verbose" />
</java>
<echo message="Done generating doc." />
</target>
<!--
Takes all *.js files inside ${src.dir} as input.
Creates a file name after the new property 'build.bigsource.js'.
-->
<target name="concat-sources" depends="validate" description="Copies all source scripts into one big file for further work on it." >
<tempfile property="build.bigsource.js" destDir="${build.dir}" prefix="${ant.project.name}" suffix=".js" />
<!-- TODO handle encoding (and eol?) -->
<concat destfile="${build.bigsource.js}">
<fileset dir="${src.dir}">
<include name="**/*.js" />
</fileset>
</concat>
<echo message="Created : ${build.bigsource.js}" level="verbose" />
</target>
<target name="build-src" depends="concat-sources" description="Builds the default .js.">
<copy file="${build.bigsource.js}" tofile="${lib.dir}/${ivy.module}-${ivy.revision}.js" />
<echo message="Copied : ${lib.dir}/${ivy.module}-${ivy.revision}.js" />
</target>
<target name="build-min" depends="concat-sources" description="Builds a minified version of the .js.">
<java jar="${yuicompressor.jar}" fork="true" output="${lib.dir}/${ivy.module}-min-${ivy.revision}.js" failonerror="true">
<arg line="--type js" />
<arg file="${build.bigsource.js}"/>
</java>
<echo message="Minified : ${lib.dir}/${ivy.module}-min-${ivy.revision}.js" />
</target>
</project>