--- a/nbbuild/antsrc/org/netbeans/nbbuild/AutoUpdate.java Tue Mar 08 07:32:11 2011 +0100 +++ a/nbbuild/antsrc/org/netbeans/nbbuild/AutoUpdate.java Tue Mar 08 09:31:55 2011 +0100 @@ -88,6 +88,7 @@ public class AutoUpdate extends Task { private List modules = new ArrayList(); private FileSet nbmSet; + private File download; private File dir; private File cluster; private URL catalog; @@ -112,6 +113,10 @@ public void setToDir(File dir) { this.cluster = dir; } + + public void setDownloadDir(File dir) { + this.download = dir; + } /** Forces rewrite even the version of a module is not newer */ public void setForce(boolean force) { @@ -126,8 +131,14 @@ @Override public void execute() throws BuildException { + boolean downloadOnly = false; if ((dir != null) == (cluster != null)) { - throw new BuildException("Specify either todir or installdir"); + if (dir == null && cluster == null && download != null) { + log("Going to download NBMs only to " + download); + downloadOnly = true; + } else { + throw new BuildException("Specify either todir or installdir"); + } } Map units; if (catalog != null) { @@ -194,7 +205,7 @@ boolean delete = false; File lastM = null; try { - if (uu.getURL().getProtocol().equals("file")) { + if (download == null && uu.getURL().getProtocol().equals("file")) { try { tmp = new File(uu.getURL().toURI()); } catch (URISyntaxException ex) { @@ -206,9 +217,13 @@ } final String dash = uu.getCodeName().replace('.', '-'); if (tmp == null) { - tmp = File.createTempFile(dash, ".nbm"); - tmp.deleteOnExit(); - delete = true; + if (download != null) { + tmp = new File(download, dash + ".nbm"); + } else { + tmp = File.createTempFile(dash, ".nbm"); + tmp.deleteOnExit(); + delete = true; + } Get get = new Get(); get.setProject(getProject()); get.setTaskName("get:" + uu.getCodeName()); @@ -217,6 +232,9 @@ get.setVerbose(true); get.execute(); } + if (downloadOnly) { + continue; + } File whereTo = dir != null ? new File(dir, uu.targetcluster) : cluster; whereTo.mkdirs(); --- a/nbbuild/test/unit/src/org/netbeans/nbbuild/AutoUpdateTest.java Tue Mar 08 07:32:11 2011 +0100 +++ a/nbbuild/test/unit/src/org/netbeans/nbbuild/AutoUpdateTest.java Tue Mar 08 09:31:55 2011 +0100 @@ -67,6 +67,27 @@ super(name); } + public void testJustDownloadNBMs() throws Exception { + File nbm = generateNBM("org-netbeans-api-annotations-common.nbm", + "netbeans/config/Modules/org-netbeans-api-annotations-common.xml", + "netbeans/modules/org-netbeans-api-annotations-common.jar"); + assertTrue("NBM file created", nbm.isFile()); + + File target = new File(getWorkDir(), "target"); + target.mkdirs(); + + execute( + "autoupdate.xml", "-verbose", "-Ddir=" + nbm.getParent(), + "-Dincludes=org.netbeans.api.annotations.common", + "-Dtarget=" + target, + "mirror" + ); + + File[] arr = target.listFiles(); + assertEquals("One item in the array:\n" + getStdOut(), 1, arr.length); + assertEquals("It is the NBM file", nbm.getName(), arr[0].getName()); + assertEquals("Length is the same", nbm.length(), arr[0].length()); + } public void testDirectlySpecifiedNBMs() throws Exception { File nbm = generateNBM("org-netbeans-api-annotations-common.nbm", "netbeans/config/Modules/org-netbeans-api-annotations-common.xml", --- a/nbbuild/test/unit/src/org/netbeans/nbbuild/autoupdate.xml Tue Mar 08 07:32:11 2011 +0100 +++ a/nbbuild/test/unit/src/org/netbeans/nbbuild/autoupdate.xml Tue Mar 08 09:31:55 2011 +0100 @@ -59,4 +59,17 @@ + + + + + + + + + + + + +