|
a/tool/run/plugins/spdx/create.java |
|
b/tool/run/plugins/spdx/create.java |
|
... |
|
... |
184 |
@Override
|
184 |
@Override
|
185 |
public void doTask(){
|
185 |
public void doTask(){
|
186 |
setTitle("Creating SPDX from source folder");
|
186 |
setTitle("Creating SPDX from source folder");
|
187 |
|
187 |
|
188 |
|
188 |
|
|
|
189 |
// start the SPDX class
|
|
|
190 |
final DocumentCreate newSPDX = new DocumentCreate();
|
|
|
191 |
|
|
|
192 |
// launch a small thread to keep the progress updated
|
|
|
193 |
Thread thread = new Thread(){
|
|
|
194 |
@Override
|
|
|
195 |
public void run(){
|
|
|
196 |
// wait a little bit for things to start
|
|
|
197 |
utils.time.wait(4);
|
|
|
198 |
// keep repearing while things are being processed
|
|
|
199 |
while(newSPDX.isProcessing){
|
|
|
200 |
utils.time.wait(4);
|
|
|
201 |
setStatus("%1 files processed out of %1",
|
|
|
202 |
"" + newSPDX.filesProcessed,
|
|
|
203 |
"" + newSPDX.files.size());
|
|
|
204 |
}
|
|
|
205 |
}
|
|
|
206 |
};
|
|
|
207 |
thread.start();
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
189 |
// third step, create the SPDX document from the extracted files
|
212 |
// third step, create the SPDX document from the extracted files
|
190 |
String result = createDocument(source, this);
|
213 |
String result = createDocument(source, this, newSPDX);
|
191 |
|
214 |
|
192 |
// all done here, explain where the SPDX document can be found
|
215 |
// all done here, explain where the SPDX document can be found
|
193 |
nextStep =
|
216 |
nextStep =
|
194 |
html.link("SPDX summary",
|
217 |
html.link("SPDX summary",
|
195 |
"/spdx/show?x=summary&"
|
218 |
"/spdx/show?x=summary&"
|
|
... |
|
... |
202 |
|
225 |
|
203 |
}
|
226 |
}
|
204 |
};
|
227 |
};
|
205 |
task.launch();
|
228 |
task.launch();
|
206 |
|
229 |
|
207 |
|
|
|
208 |
//request.setAnswer("Process launched as " + task.getUID());
|
230 |
//request.setAnswer("Process launched as " + task.getUID());
|
209 |
request.setAnswer(utils.html.redirect("/basic/status"
|
231 |
request.setAnswer(utils.html.redirect("/basic/status"
|
210 |
+ "?ID=" + task.getUID(), 0, ""));
|
232 |
+ "?ID=" + task.getUID(), 0, ""));
|
211 |
|
233 |
|
212 |
}
|
234 |
}
|
|
... |
|
... |
268 |
File extractedFolder = extractFile(downloadedFile, this);
|
290 |
File extractedFolder = extractFile(downloadedFile, this);
|
269 |
if(extractedFolder == null){
|
291 |
if(extractedFolder == null){
|
270 |
return;
|
292 |
return;
|
271 |
}
|
293 |
}
|
272 |
|
294 |
|
|
|
295 |
|
|
|
296 |
final DocumentCreate newSPDX = new DocumentCreate();
|
|
|
297 |
|
273 |
// third step, create the SPDX document from the extracted files
|
298 |
// third step, create the SPDX document from the extracted files
|
274 |
String result = createDocument(extractedFolder, this);
|
299 |
String result = createDocument(extractedFolder, this, newSPDX);
|
275 |
|
300 |
|
276 |
}
|
301 |
}
|
277 |
};
|
302 |
};
|
278 |
task.launch();
|
303 |
task.launch();
|
279 |
|
304 |
|
|
... |
|
... |
287 |
/**
|
312 |
/**
|
288 |
* Creates the SPDX document from the folder of extracted source code files
|
313 |
* Creates the SPDX document from the folder of extracted source code files
|
289 |
* @param extractedFolder The folder where source code files are located
|
314 |
* @param extractedFolder The folder where source code files are located
|
290 |
* @param task the running task that will hold the status update
|
315 |
* @param task the running task that will hold the status update
|
291 |
*/
|
316 |
*/
|
292 |
private String createDocument(File extractedFolder, RunningTask task){
|
317 |
private String createDocument(File extractedFolder, RunningTask task,
|
|
|
318 |
DocumentCreate newSPDX){
|
293 |
task.setStatus("Creating the SPDX document");
|
319 |
task.setStatus("Creating the SPDX document");
|
294 |
// start the SPDX class
|
320 |
|
295 |
DocumentCreate newSPDX = new DocumentCreate();
|
321 |
|
296 |
// do all the heavy work
|
322 |
// do all the heavy work
|
297 |
String result = newSPDX.create(extractedFolder);
|
323 |
String result = newSPDX.create(extractedFolder);
|
298 |
// count the time it took to run this task
|
324 |
// count the time it took to run this task
|
299 |
long time = System.currentTimeMillis() - task.getUID();
|
325 |
long time = System.currentTimeMillis() - task.getUID();
|
300 |
String timeCount = utils.time.timeNumberToHumanReadable(time) + " were "
|
326 |
String timeCount = utils.time.timeNumberToHumanReadable(time) + " were "
|