Search in sources :

Example 31 with Macro

use of aQute.bnd.osgi.Macro in project bnd by bndtools.

the class MacroTest method testLiteral.

public static void testLiteral() {
    Processor p = new Processor();
    p.setProperty("a", "aaaa");
    Macro m = new Macro(p);
    assertEquals("${aaaa}", m.process("${literal;$<a>}"));
}
Also used : Processor(aQute.bnd.osgi.Processor) Macro(aQute.bnd.osgi.Macro)

Example 32 with Macro

use of aQute.bnd.osgi.Macro in project bnd by bndtools.

the class Project method replace.

boolean replace(File f, String pattern, String replacement) throws IOException {
    final Macro macro = getReplacer();
    Sed sed = new Sed(new Replacer() {

        public String process(String line) {
            return macro.process(line);
        }
    }, f);
    sed.replace(pattern, replacement);
    return sed.doIt() > 0;
}
Also used : Sed(aQute.libg.sed.Sed) Macro(aQute.bnd.osgi.Macro) Replacer(aQute.libg.sed.Replacer)

Aggregations

Macro (aQute.bnd.osgi.Macro)32 Processor (aQute.bnd.osgi.Processor)29 Project (aQute.bnd.build.Project)1 VersionedClause (aQute.bnd.build.model.clauses.VersionedClause)1 Attrs (aQute.bnd.header.Attrs)1 Analyzer (aQute.bnd.osgi.Analyzer)1 Version (aQute.bnd.version.Version)1 Description (aQute.lib.getopt.Description)1 Replacer (aQute.libg.sed.Replacer)1 Sed (aQute.libg.sed.Sed)1 File (java.io.File)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Reader (java.io.Reader)1 Field (java.lang.reflect.Field)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 Proxy (java.lang.reflect.Proxy)1 URL (java.net.URL)1