Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 149071 | Differences between
and this patch

Collapse All | Expand All

(-)nbbuild/antsrc/org/netbeans/nbbuild/MakeUpdateDesc.java (-10 / +33 lines)
 Lines 51-56    Link Here 
51
import org.apache.tools.ant.DirectoryScanner;
51
import org.apache.tools.ant.DirectoryScanner;
52
import java.io.File;
52
import java.io.File;
53
import java.io.FileOutputStream;
53
import java.io.FileOutputStream;
54
import java.io.FileWriter;
54
import java.io.IOException;
55
import java.io.IOException;
55
import java.io.InputStream;
56
import java.io.InputStream;
56
import java.io.OutputStream;
57
import java.io.OutputStream;
 Lines 317-323    Link Here 
317
                pw.println ();
318
                pw.println ();
318
		Map<String,Element> licenses = new HashMap<String,Element>();
319
		Map<String,Element> licenses = new HashMap<String,Element>();
319
                Set<String> licenseNames = new HashSet<String>();
320
                Set<String> licenseNames = new HashSet<String>();
320
                
321
322
                String prefix = null;
323
                if (dist_base != null) {
324
                    // fix/enforce distribution URL base
325
                    if (dist_base.equals(".")) {
326
                        prefix = "";
327
                    } else {
328
                        prefix = dist_base + "/";
329
                    }
330
                }
331
                final File licensesDir = new File(desc.getParentFile(), "licenses");
332
                if(licensesDir.exists()) {
333
                    for(File f : licensesDir.listFiles()) {
334
                        f.delete();
335
                    }
336
                } else {
337
                    licensesDir.mkdir();
338
                }
339
321
                for (Map.Entry<String,Collection<Module>> entry : modulesByGroup.entrySet()) {
340
                for (Map.Entry<String,Collection<Module>> entry : modulesByGroup.entrySet()) {
322
                    String groupName = entry.getKey();
341
                    String groupName = entry.getKey();
323
                    // Don't indent; embedded descriptions would get indented otherwise.
342
                    // Don't indent; embedded descriptions would get indented otherwise.
 Lines 335-354    Link Here 
335
                        String name = manifest.getAttribute("OpenIDE-Module-Name");
354
                        String name = manifest.getAttribute("OpenIDE-Module-Name");
336
                        if (name.length() > 0) {
355
                        if (name.length() > 0) {
337
                            log(" Adding module " + name + " (" + m.nbm.getAbsolutePath() + ")");
356
                            log(" Adding module " + name + " (" + m.nbm.getAbsolutePath() + ")");
338
                        }
357
                        }                        
339
                        if (dist_base != null) {
358
                        if(prefix!=null) {
340
                            // fix/enforce distribution URL base
341
                            String prefix;
342
                            if (dist_base.equals(".")) {
343
                                prefix = "";
344
                            } else {
345
                                prefix = dist_base + "/";
346
                            }
347
                            module.setAttribute("distribution", prefix + m.relativePath);
359
                            module.setAttribute("distribution", prefix + m.relativePath);
348
                        }
360
                        }
349
                        NodeList licenseList = module.getElementsByTagName("license");
361
                        NodeList licenseList = module.getElementsByTagName("license");
350
                        if (licenseList.getLength() > 0) {
362
                        if (licenseList.getLength() > 0) {
351
                            Element license = (Element) licenseList.item(0);
363
                            Element license = (Element) licenseList.item(0);
364
                            String relativePath = "licenses/" + license.getAttribute("name") + ".license";
365
                            String path = relativePath;
366
                            if(prefix!=null) {
367
                                path = prefix + relativePath;
368
                            }
369
                            license.setAttribute("url", path);
370
                            String licenseText = license.getTextContent();
371
                            license.setTextContent("");                            
372
                            FileWriter fw = new FileWriter(new File(desc.getParentFile(), relativePath));
373
                            fw.write(licenseText);
374
                            fw.close();
352
                            // XXX ideally would compare the license texts to make sure they actually match up
375
                            // XXX ideally would compare the license texts to make sure they actually match up
353
                            licenses.put(license.getAttribute("name"), license);
376
                            licenses.put(license.getAttribute("name"), license);
354
                            module.removeChild(license);
377
                            module.removeChild(license);

Return to bug 149071
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo