Search in sources :

Example 6 with ExtList

use of aQute.lib.collections.ExtList in project bnd by bndtools.

the class Main method run.

/**
	 * Main entry for the command line
	 * 
	 * @param args
	 * @throws Exception
	 */
public void run(String[] args) throws Exception {
    CommandLine cl = new CommandLine(this);
    ExtList<String> list = new ExtList<String>(args);
    String help = cl.execute(this, "jpm", list);
    check();
    if (help != null)
        err.println(help);
}
Also used : CommandLine(aQute.lib.getopt.CommandLine) ExtList(aQute.lib.collections.ExtList)

Example 7 with ExtList

use of aQute.lib.collections.ExtList in project bnd by bndtools.

the class JustAnotherPackageManager method getVMs.

public SortedSet<JVM> getVMs() throws Exception {
    TreeSet<JVM> set = new TreeSet<JVM>(JVM.comparator);
    String list = settings.get(JPM_VMS_EXTRA);
    if (list != null) {
        ExtList<String> elist = new ExtList<String>(list.split("\\s*,\\s*"));
        for (String dir : elist) {
            File f = new File(dir);
            JVM jvm = getPlatform().getJVM(f);
            if (jvm == null) {
                jvm = new JVM();
                jvm.path = f.getCanonicalPath();
                jvm.name = "Not a valid VM";
                jvm.platformVersion = jvm.vendor = jvm.version = "";
            }
            set.add(jvm);
        }
    }
    getPlatform().getVMs(set);
    return set;
}
Also used : ExtList(aQute.lib.collections.ExtList) TreeSet(java.util.TreeSet) JarFile(java.util.jar.JarFile) IO.createTempFile(aQute.lib.io.IO.createTempFile) File(java.io.File)

Example 8 with ExtList

use of aQute.lib.collections.ExtList in project bnd by bndtools.

the class Processor method getHeader0.

private FileLine getHeader0(Pattern header, Pattern clause) throws Exception {
    FileLine fl;
    File f = getPropertiesFile();
    if (f != null) {
        // Find in "our" local file
        fl = findHeader(f, header, clause);
        if (fl != null)
            return fl;
        // Get the includes (actually should parse the header
        // to see if they override or only provide defaults?
        List<File> result = getIncluded();
        if (result != null) {
            ExtList<File> reversed = new ExtList<File>(result);
            Collections.reverse(reversed);
            for (File included : reversed) {
                fl = findHeader(included, header);
                if (fl != null)
                    return fl;
            }
        }
    }
    // Ok, not on this level ...
    if (getParent() != null) {
        fl = getParent().getHeader(header, clause);
        if (fl != null)
            return fl;
    }
    // Sometimes we do not have a file ...
    if (f == null && parent != null)
        f = parent.getPropertiesFile();
    if (f == null)
        return null;
    return new FileLine(f, 0, 0);
}
Also used : ExtList(aQute.lib.collections.ExtList) JarFile(java.util.jar.JarFile) File(java.io.File)

Example 9 with ExtList

use of aQute.lib.collections.ExtList in project bnd by bndtools.

the class AbstractConsoleApp method run.

/**
	 * Main entry
	 * 
	 * @throws Exception
	 */
public void run(String[] args) throws Exception {
    try {
        CommandLine cl = new CommandLine(this);
        ExtList<String> list = new ExtList<String>(args);
        String help = cl.execute(target, "_main", list);
        check();
        if (help != null)
            err.println(help);
    } finally {
        err.flush();
        out.flush();
    }
}
Also used : CommandLine(aQute.lib.getopt.CommandLine) ExtList(aQute.lib.collections.ExtList)

Example 10 with ExtList

use of aQute.lib.collections.ExtList in project bnd by bndtools.

the class ReplacerAdapter method ls.

String ls(String[] args, boolean relative) {
    if (args.length < 2)
        throw new IllegalArgumentException("the ${ls} macro must at least have a directory as parameter");
    File dir = IO.getFile(base, args[1]);
    if (!dir.isAbsolute())
        throw new IllegalArgumentException("the ${ls} macro directory parameter is not absolute: " + dir);
    if (!dir.exists())
        throw new IllegalArgumentException("the ${ls} macro directory parameter does not exist: " + dir);
    if (!dir.isDirectory())
        throw new IllegalArgumentException("the ${ls} macro directory parameter points to a file instead of a directory: " + dir);
    List<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
    for (int i = 2; i < args.length; i++) {
        Glob filters = new Glob(args[i]);
        filters.select(files);
    }
    ExtList<String> result = new ExtList<String>();
    for (File file : files) result.add(relative ? file.getName() : file.getAbsolutePath().replace(File.separatorChar, '/'));
    return result.join(",");
}
Also used : ExtList(aQute.lib.collections.ExtList) ArrayList(java.util.ArrayList) Glob(aQute.libg.glob.Glob) File(java.io.File)

Aggregations

ExtList (aQute.lib.collections.ExtList)10 File (java.io.File)5 Map (java.util.Map)3 Attrs (aQute.bnd.header.Attrs)2 Parameters (aQute.bnd.header.Parameters)2 CommandLine (aQute.lib.getopt.CommandLine)2 Glob (aQute.libg.glob.Glob)2 ArrayList (java.util.ArrayList)2 JarFile (java.util.jar.JarFile)2 Version (aQute.bnd.version.Version)1 ArtifactData (aQute.jpm.lib.ArtifactData)1 IO.createTempFile (aQute.lib.io.IO.createTempFile)1 Sed (aQute.libg.sed.Sed)1 SetLocation (aQute.service.reporter.Reporter.SetLocation)1 Field (java.lang.reflect.Field)1 HashMap (java.util.HashMap)1 TreeSet (java.util.TreeSet)1 IProject (org.eclipse.core.resources.IProject)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 IWorkbench (org.eclipse.ui.IWorkbench)1