geirm 01/08/08 04:00:23
Modified: jjar/src/java/org/apache/commons/jjar JJAR.java
JJARTask.java
Log:
Added support for 'dependency only' fetches. On the command line,
specify -od such that only the dependencies of a package/version are
fetched and not the jar itself.
For ant, there is a 'onlydependencies' attribute. ex :
<jjar package = "ant" onlydependencies="true" localrepository="${rep}" />
The idea here is that when using jjar in a build scenario, you might want
to fetch the known dependencies of a project, and then build the project...
Revision Changes Path
1.2 +17 -3
jakarta-commons-sandbox/jjar/src/java/org/apache/commons/jjar/JJAR.java
Index: JJAR.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jjar/src/java/org/apache/commons/jjar/JJAR.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JJAR.java 2001/05/07 22:47:45 1.1
+++ JJAR.java 2001/08/08 11:00:23 1.2
@@ -64,7 +64,7 @@
* JJAR command line program
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: JJAR.java,v 1.1 2001/05/07 22:47:45 geirm Exp $
+ * @version $Id: JJAR.java,v 1.2 2001/08/08 11:00:23 geirm Exp $
*/
public class JJAR
{
@@ -121,12 +121,13 @@
String version = null;
boolean verifyignore = false;
boolean getdeps = true;
+ boolean onlydeps = false;
String dir = ".";
if ( args.length < 3 )
{
- System.out.println("Usage : fetch [-v] -j jarname -p package -v
version ");
+ System.out.println("Usage : fetch [-v] [-od] -j jarname -p package -v
version ");
return;
}
@@ -168,6 +169,10 @@
{
getdeps = false;
}
+ else if( arg.equals("-od"))
+ {
+ onlydeps = true;
+ }
}
}
@@ -178,7 +183,6 @@
return;
}
-
/*
* now go get
*/
@@ -191,6 +195,7 @@
Repository rep = new RepositoryXML();
rep.load( new URL( defaultRepository + "repository.xml") );
+
/*
* get the fetch target
*/
@@ -281,6 +286,15 @@
Transport.fetchJar( uconn, dir + "/" + deptarget );
}
+ }
+
+ /*
+ * now the actual jar. If we are told to ignore the deps, so be it
+ */
+
+ if ( onlydeps )
+ {
+ return;
}
/*
1.2 +16 -2
jakarta-commons-sandbox/jjar/src/java/org/apache/commons/jjar/JJARTask.java
Index: JJARTask.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jjar/src/java/org/apache/commons/jjar/JJARTask.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JJARTask.java 2001/05/07 22:47:45 1.1
+++ JJARTask.java 2001/08/08 11:00:23 1.2
@@ -66,7 +66,7 @@
/**
* An ant task for doing JJAR stuff
*
- * @version $Id: JJARTask.java,v 1.1 2001/05/07 22:47:45 geirm Exp $
+ * @version $Id: JJARTask.java,v 1.2 2001/08/08 11:00:23 geirm Exp $
*/
public class JJARTask extends Task
{
@@ -75,6 +75,7 @@
private String ver = null;
private String localrep = ".";
private boolean verifyignore = true;
+ private boolean onlydependencies = false;
private String classpath = null;
/**
@@ -101,6 +102,11 @@
this.verifyignore = b;
}
+ public void setOnlyDependencies( boolean b )
+ {
+ this.onlydependencies = b;
+ }
+
public void setRepository( String rep )
{
this.defaultRepository = rep;
@@ -196,8 +202,16 @@
}
/*
- * now get the actual package
+ * now get the actual package. If all we want were the dependencies
+ * for something (example : we are building something...) then
+ * bail, because we are done.
*/
+
+ if( onlydependencies )
+ {
+ log(" Dependency-only mode : not fetching target " + pkg );
+ return;
+ }
/*
* if we don't have a version, we need to get it from the repository