geirm 01/05/07 15:26:08 Added: jjar LICENSE README.txt build.xml jjar_notes.txt Log: initial commit Revision Changes Path 1.1 jakarta-commons-sandbox/jjar/LICENSE Index: LICENSE =================================================================== /* * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ 1.1 jakarta-commons-sandbox/jjar/README.txt Index: README.txt =================================================================== JJAR Sandbox ------------ What can you do : 1) BUILD To build, you need ant installed ;) and just type 'ant' as the default target will build the jar. There are also a few other targets like 'javadoc'. Look in build.xml 2) USE Currently, I set up a repository on 207.138.188.222/jjar/ and put a few jars there so we can play. Will move to jakarta at some point. Wanted to wait to see what people thought. I am using this repository, so more stuff will be added. The repository definition is repository.xml and is located on the repository itself, of course, but in CVS under src/conf along with it's DTD The easiest way to play is to use the 'command line' tool : list all packages in the repository ----------------------------------- java -jar jjar.jar list list a single package --------------------- java -jar jjar.jar list -p <package> Verify a jar (show package and version) ---------------------------------------- java -jar jjar.jar verify -j <jarname> Verify the jars in the classpath -------------------------------- java -jar jjar.jar verify (note only 'JJAR'-marked jars will be listed) fetch a specific package/version and dependencies -------------------------------------------------- java -jar jjar.jar fetch -p <package> [-v <version>] [-j <outputjarname>] w/o -j, will go to 'default name' w/o -v, will get 'default' version fetch a specific package/version only (no deps) -------------------------------------------------- java -jar jjar.jar fetch -nd -p <package> [-v <version>] [-j <outputjarname>] -nd = 'no dependencies' w/o -j, will go to 'default name' w/o -v, will get 'default' version fetch a specific package/version and deps, don't if they exist already ------------------------------------------------------------------------ java -jar jjar.jar fetch -nd -vi -p <package> [-v <version>] [-j <outputjarname>] -vi = 'verify ignore' : if can verify exists, ignore that part -nd = 'no dependencies' w/o -j, will go to 'default name' w/o -v, will get 'default' version fetch (any above) and specify local directory ---------------------------------------------- java -jar jjar.jar fetch -d <directory> -p <package> will add a -r to specify non-default repository next There are two included examples : - examples/boot-build : took the commons-collections tree and made a little script, boot.sh which uses the repository to get ant. It then uses ant to build the jar. - examples/ant-task : demonstrates how the [primitive] ant task works, getting jars and dependencies. 2) SOURCE Source is of course in src/java. I am doing a bit of refactoring - so lets talk about any changes so we don't screw each other up. The biggest is making more sense out of ClasspathUtil (some stuff in there has nothing to do with classpath) and taking stuff I learned in JJAR.java and making it reusable. enjoy - geir 1.1 jakarta-commons-sandbox/jjar/build.xml Index: build.xml =================================================================== <project name="Jakarta Jar Archive Respository" default="jar" basedir="."> <!-- $Id: build.xml,v 1.1 2001/05/07 22:26:08 geirm Exp $ --> <!-- ========== Initialize Properties ===================================== --> <property file="build.properties"/> <!-- Component local --> <property file="../build.properties"/> <!-- Commons local --> <property file="${user.home}/build.properties"/> <!-- User local --> <!-- ========== External Dependencies ===================================== --> <property name="minml2.jar" value="lib/MinML2.jar" /> <!-- ========== Derived Values ============================================ --> <!-- ========== Component Declarations ==================================== --> <!-- The name of this component --> <property name="component.name" value="jjar"/> <!-- The title of this component --> <property name="component.title" value="Jakarta Java Archive Repository"/> <!-- The current version number of this component --> <property name="component.version" value="0.1-dev"/> <!-- The base directory for compilation targets --> <property name="build.home" value="target"/> <!-- The base directory for component configuration files --> <property name="conf.home" value="src/conf"/> <!-- The base directory for distribution targets --> <property name="dist.home" value="dist"/> <!-- The base directory for component sources --> <property name="source.home" value="src"/> <!-- The base directory for unit test sources --> <property name="test.home" value="src/test"/> <!-- ========== Compiler Defaults ========================================= --> <!-- Should Java compilations set the 'debug' compiler option? --> <property name="compile.debug" value="false"/> <!-- Should Java compilations set the 'deprecation' compiler option? --> <property name="compile.deprecation" value="true"/> <!-- Should Java compilations set the 'optimize' compiler option? --> <property name="compile.optimize" value="true"/> <!-- Construct compile classpath --> <path id="compile.classpath"> <pathelement location="${build.home}/classes"/> <pathelement location="${minml2.jar}" /> </path> <!-- ========== Test Execution Defaults =================================== --> <!-- Construct unit test classpath --> <path id="test.classpath"> <pathelement location="${build.home}/classes"/> <pathelement location="${build.home}/tests"/> <pathelement location="${junit.jar}"/> </path> <!-- Should all tests fail if one does? --> <property name="test.failonerror" value="true"/> <!-- The test runner to execute --> <property name="test.runner" value="junit.textui.TestRunner"/> <!-- ========== Executable Targets ======================================== --> <target name="init" description="Initialize and evaluate conditionals"> <echo message="-------- ${component.name} ${component.version} --------"/> <filter token="name" value="${component.name}"/> <filter token="version" value="${component.version}"/> </target> <target name="prepare" depends="init" description="Prepare build directory"> <mkdir dir="${build.home}"/> <mkdir dir="${build.home}/classes"/> <mkdir dir="${build.home}/conf"/> <mkdir dir="${build.home}/tests"/> </target> <target name="static" depends="prepare" description="Copy static files to build directory"> <tstamp/> </target> <target name="compile" depends="static" description="Compile shareable components"> <javac srcdir="${source.home}/java" destdir="${build.home}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}"> <classpath refid="compile.classpath"/> </javac> </target> <target name="clean" description="Clean build and distribution directories"> <delete dir="${build.home}"/> <delete dir="${dist.home}"/> </target> <target name="all" depends="clean,compile" description="Clean and compile all components"/> <target name="javadoc" depends="compile" description="Create component Javadoc documentation"> <mkdir dir="${dist.home}"/> <mkdir dir="${dist.home}/docs"/> <mkdir dir="${dist.home}/docs/api"/> <javadoc sourcepath="${source.home}/java" destdir="${dist.home}/docs/api" packagenames="org.apache.commons.*" author="true" private="true" version="true" doctitle="<h1>${component.title}</h1>" windowtitle="${component.title} (Version ${component.version})" bottom="Copyright (c) 2001 - Apache Software Foundation"/> </target> <target name="jar" depends="compile" description="Build jar"> <!-- make a complete jar w/ the MinML2 SAX stuff --> <unzip src="${minml2.jar}" dest="${build.home}/classes"/> <delete dir="${build.home}/classes/META-INF" quiet="true"/> <jar jarfile="${component.name}.jar" basedir="${build.home}/classes" manifest="${source.home}/conf/MANIFEST.MF" /> </target> <target name="dist" depends="compile,javadoc" description="Create binary distribution"> <mkdir dir="${dist.home}"/> <copy file="LICENSE" todir="${dist.home}"/> <!-- make a complete jar w/ the MinML2 SAX stuff --> <unzip src="${minml2.jar}" dest="${build.home}/classes"/> <delete dir="${build.home}/classes/META-INF" quiet="true"/> <jar jarfile="${dist.home}/${component.name}.jar" basedir="${build.home}/classes" manifest="${source.home}/conf/MANIFEST.MF"/> </target> <!-- ========== Unit Test Targets ========================================= --> </project> 1.1 jakarta-commons-sandbox/jjar/jjar_notes.txt Index: jjar_notes.txt =================================================================== JJAR : Jakarta Jar Archive Repository ===================================== Since about the end of March, I have been thinking about how I wanted to make building easy for compoenent consumers, and make maintenance easy for developers. Some of the things I thought are important are : * minimal dependencies - shouldn't rely on any other jars to get things because one of the design goals is to help new users get started, to help avoid much of the easter-egg hunting that we require to get things going. * embeddable in applications : as just another API, it allows any app to embed the API in apps * ANT support : once the basic API is in place, it's just a wrapper :) * command line tool : to allow maintenance of a developers local repository as well as one-off 'go fetch' needs * etc So I have put together a basic repository version. It doesn't hope for the power of a CJAN - the whole CPAN-ish upload server, multiplexed mirrors, etc can come later. What it can do now : * command line tool can list the repository for all items or singles packages * command line tool can fetch packages by request, and supports dependency trees, fetching all dependencies connected to the requested package * command line tool can verify package and version information * ant task to do fetching Todo ---- - make 'modify classpath' flag work - what do we do about names for jars for ant? dependencies? - put -rr flag for 'remote repository' - add 'synch' verb to synch - maybe change language from 'local repo' to dest because The following is my scratchpad.... don't believe anything you read... 1) jjar : tool to test, get, fetch -p | --pgk : package, optionally package/ver -v | --ver : version -j | --jar : jar -c | --cp : classpath flag jjar mark -p package -v version -j jarfile - marks a jar with the package and version jjar verify [ -cp | -j jarfile] [-p package [-v version ]] [-flr <rep>] - verifies that a jar is of the package and version - verifies that the package/ver is in the classpath - w/o parameters, lists all packages/ver - -flr : fetch into local repository if you don't have it jjar list [-p pkg [-v ver ]] [-r repository] - lists the packages or package info in a given repository or default jjar fetch [-c] [-jar <outputfilename>] [-rep <repository>] package version - simply fetches the given package/ver from the repository (or default) and puts in jar or local rep and optionally adds to classpath jjar repadd -jar file -info file -r - adds a jar to the repository 2) Zero dependencies outside of the JDK To keep things simple, we want to keep JJAR at jdk 1.2 level (earlier?) and not depend upon any packages. This is critical as we want to be able to use JJAR as a boostrap utility to do things like fetch ant, for example. So no XML. 2) respository information - we want in a Properties format <package>.<major>.<minor>.desc = string <package>.<major>.<minor>.jar = <jarname> <package>.<major>.<minor>.href = string 3) version we want to regularize the versions : major number : integer minor number : integer version modifier : string <major>.<minor>-<modifier> 1.0 1.0-dev 1.0-rc1
