Lines 88-93
Link Here
|
88 |
public class AutoUpdate extends Task { |
88 |
public class AutoUpdate extends Task { |
89 |
private List<Modules> modules = new ArrayList<Modules>(); |
89 |
private List<Modules> modules = new ArrayList<Modules>(); |
90 |
private FileSet nbmSet; |
90 |
private FileSet nbmSet; |
|
|
91 |
private File download; |
91 |
private File dir; |
92 |
private File dir; |
92 |
private File cluster; |
93 |
private File cluster; |
93 |
private URL catalog; |
94 |
private URL catalog; |
Lines 112-117
Link Here
|
112 |
public void setToDir(File dir) { |
113 |
public void setToDir(File dir) { |
113 |
this.cluster = dir; |
114 |
this.cluster = dir; |
114 |
} |
115 |
} |
|
|
116 |
|
117 |
public void setDownloadDir(File dir) { |
118 |
this.download = dir; |
119 |
} |
115 |
|
120 |
|
116 |
/** Forces rewrite even the version of a module is not newer */ |
121 |
/** Forces rewrite even the version of a module is not newer */ |
117 |
public void setForce(boolean force) { |
122 |
public void setForce(boolean force) { |
Lines 126-133
Link Here
|
126 |
|
131 |
|
127 |
@Override |
132 |
@Override |
128 |
public void execute() throws BuildException { |
133 |
public void execute() throws BuildException { |
|
|
134 |
boolean downloadOnly = false; |
129 |
if ((dir != null) == (cluster != null)) { |
135 |
if ((dir != null) == (cluster != null)) { |
130 |
throw new BuildException("Specify either todir or installdir"); |
136 |
if (dir == null && cluster == null && download != null) { |
|
|
137 |
log("Going to download NBMs only to " + download); |
138 |
downloadOnly = true; |
139 |
} else { |
140 |
throw new BuildException("Specify either todir or installdir"); |
141 |
} |
131 |
} |
142 |
} |
132 |
Map<String, ModuleItem> units; |
143 |
Map<String, ModuleItem> units; |
133 |
if (catalog != null) { |
144 |
if (catalog != null) { |
Lines 194-200
Link Here
|
194 |
boolean delete = false; |
205 |
boolean delete = false; |
195 |
File lastM = null; |
206 |
File lastM = null; |
196 |
try { |
207 |
try { |
197 |
if (uu.getURL().getProtocol().equals("file")) { |
208 |
if (download == null && uu.getURL().getProtocol().equals("file")) { |
198 |
try { |
209 |
try { |
199 |
tmp = new File(uu.getURL().toURI()); |
210 |
tmp = new File(uu.getURL().toURI()); |
200 |
} catch (URISyntaxException ex) { |
211 |
} catch (URISyntaxException ex) { |
Lines 206-214
Link Here
|
206 |
} |
217 |
} |
207 |
final String dash = uu.getCodeName().replace('.', '-'); |
218 |
final String dash = uu.getCodeName().replace('.', '-'); |
208 |
if (tmp == null) { |
219 |
if (tmp == null) { |
209 |
tmp = File.createTempFile(dash, ".nbm"); |
220 |
if (download != null) { |
210 |
tmp.deleteOnExit(); |
221 |
tmp = new File(download, dash + ".nbm"); |
211 |
delete = true; |
222 |
} else { |
|
|
223 |
tmp = File.createTempFile(dash, ".nbm"); |
224 |
tmp.deleteOnExit(); |
225 |
delete = true; |
226 |
} |
212 |
Get get = new Get(); |
227 |
Get get = new Get(); |
213 |
get.setProject(getProject()); |
228 |
get.setProject(getProject()); |
214 |
get.setTaskName("get:" + uu.getCodeName()); |
229 |
get.setTaskName("get:" + uu.getCodeName()); |
Lines 217-222
Link Here
|
217 |
get.setVerbose(true); |
232 |
get.setVerbose(true); |
218 |
get.execute(); |
233 |
get.execute(); |
219 |
} |
234 |
} |
|
|
235 |
if (downloadOnly) { |
236 |
continue; |
237 |
} |
220 |
|
238 |
|
221 |
File whereTo = dir != null ? new File(dir, uu.targetcluster) : cluster; |
239 |
File whereTo = dir != null ? new File(dir, uu.targetcluster) : cluster; |
222 |
whereTo.mkdirs(); |
240 |
whereTo.mkdirs(); |