Java Code Examples for aQute.bnd.osgi.Analyzer#setClasspath()

The following examples show how to use aQute.bnd.osgi.Analyzer#setClasspath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultOsgiManifest.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setAnalyzerProperties(Analyzer analyzer) throws IOException {
    for (Map.Entry<String, Object> attribute : getAttributes().entrySet()) {
        String key = attribute.getKey();
        if (!"Manifest-Version".equals(key)) {
            analyzer.setProperty(key, attribute.getValue().toString());
        }
    }


    Map<String, List<String>> instructions = getInstructions();
    Set<String> instructionNames = instructions.keySet();
    if (!instructionNames.contains(Analyzer.IMPORT_PACKAGE)) {
        analyzer.setProperty(Analyzer.IMPORT_PACKAGE,
                "*, !org.apache.ant.*, !org.junit.*, !org.jmock.*, !org.easymock.*, !org.mockito.*");
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_VERSION)){
        analyzer.setProperty(Analyzer.BUNDLE_VERSION, getVersion());
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_NAME)){
        analyzer.setProperty(Analyzer.BUNDLE_NAME, getName());
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_SYMBOLICNAME)){
        analyzer.setProperty(Analyzer.BUNDLE_SYMBOLICNAME, getSymbolicName());
    }
    if (!instructionNames.contains(Analyzer.EXPORT_PACKAGE)) {
        analyzer.setProperty(Analyzer.EXPORT_PACKAGE, "*;-noimport:=false;version=" + getVersion());
    }
    for (String instructionName : instructionNames) {
        String list = createPropertyStringFromList(instructionValue(instructionName));
        if (list != null && list.length() > 0) {
            analyzer.setProperty(instructionName, list);
        }
    }

    analyzer.setJar(getClassesDir());

    analyzer.setClasspath(getClasspath().getFiles().toArray(new File[getClasspath().getFiles().size()]));
}
 
Example 2
Source File: DefaultOsgiManifest.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setAnalyzerProperties(Analyzer analyzer) throws IOException {
    for (Map.Entry<String, Object> attribute : getAttributes().entrySet()) {
        String key = attribute.getKey();
        if (!"Manifest-Version".equals(key)) {
            analyzer.setProperty(key, attribute.getValue().toString());
        }
    }


    Map<String, List<String>> instructions = getInstructions();
    Set<String> instructionNames = instructions.keySet();
    if (!instructionNames.contains(Analyzer.IMPORT_PACKAGE)) {
        analyzer.setProperty(Analyzer.IMPORT_PACKAGE,
                "*, !org.apache.ant.*, !org.junit.*, !org.jmock.*, !org.easymock.*, !org.mockito.*");
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_VERSION)){
        analyzer.setProperty(Analyzer.BUNDLE_VERSION, getVersion());
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_NAME)){
        analyzer.setProperty(Analyzer.BUNDLE_NAME, getName());
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_SYMBOLICNAME)){
        analyzer.setProperty(Analyzer.BUNDLE_SYMBOLICNAME, getSymbolicName());
    }
    if (!instructionNames.contains(Analyzer.EXPORT_PACKAGE)) {
        analyzer.setProperty(Analyzer.EXPORT_PACKAGE, "*;-noimport:=false;version=" + getVersion());
    }
    for (String instructionName : instructionNames) {
        String list = createPropertyStringFromList(instructionValue(instructionName));
        if (list != null && list.length() > 0) {
            analyzer.setProperty(instructionName, list);
        }
    }

    analyzer.setJar(getClassesDir());

    analyzer.setClasspath(getClasspath().getFiles().toArray(new File[getClasspath().getFiles().size()]));
}
 
Example 3
Source File: DefaultOsgiManifest.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setAnalyzerProperties(Analyzer analyzer) throws IOException {
    for (Map.Entry<String, Object> attribute : getAttributes().entrySet()) {
        String key = attribute.getKey();
        if (!"Manifest-Version".equals(key)) {
            analyzer.setProperty(key, attribute.getValue().toString());
        }
    }


    Map<String, List<String>> instructions = getInstructions();
    Set<String> instructionNames = instructions.keySet();
    if (!instructionNames.contains(Analyzer.IMPORT_PACKAGE)) {
        analyzer.setProperty(Analyzer.IMPORT_PACKAGE,
                "*, !org.apache.ant.*, !org.junit.*, !org.jmock.*, !org.easymock.*, !org.mockito.*");
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_VERSION)){
        analyzer.setProperty(Analyzer.BUNDLE_VERSION, getVersion());
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_NAME)){
        analyzer.setProperty(Analyzer.BUNDLE_NAME, getName());
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_SYMBOLICNAME)){
        analyzer.setProperty(Analyzer.BUNDLE_SYMBOLICNAME, getSymbolicName());
    }
    if (!instructionNames.contains(Analyzer.EXPORT_PACKAGE)) {
        analyzer.setProperty(Analyzer.EXPORT_PACKAGE, "*;-noimport:=false;version=" + getVersion());
    }
    for (String instructionName : instructionNames) {
        String list = createPropertyStringFromList(instructionValue(instructionName));
        if (list != null && list.length() > 0) {
            analyzer.setProperty(instructionName, list);
        }
    }

    analyzer.setJar(getClassesDir());

    analyzer.setClasspath(getClasspath().getFiles().toArray(new File[getClasspath().getFiles().size()]));
}
 
Example 4
Source File: DefaultOsgiManifest.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setAnalyzerProperties(Analyzer analyzer) throws IOException {
    for (Map.Entry<String, Object> attribute : getAttributes().entrySet()) {
        String key = attribute.getKey();
        if (!"Manifest-Version".equals(key)) {
            analyzer.setProperty(key, attribute.getValue().toString());
        }
    }


    Map<String, List<String>> instructions = getInstructions();
    Set<String> instructionNames = instructions.keySet();
    if (!instructionNames.contains(Analyzer.IMPORT_PACKAGE)) {
        analyzer.setProperty(Analyzer.IMPORT_PACKAGE,
                "*, !org.apache.ant.*, !org.junit.*, !org.jmock.*, !org.easymock.*, !org.mockito.*");
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_VERSION)){
        analyzer.setProperty(Analyzer.BUNDLE_VERSION, getVersion());
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_NAME)){
        analyzer.setProperty(Analyzer.BUNDLE_NAME, getName());
    }
    if(!instructionNames.contains(Analyzer.BUNDLE_SYMBOLICNAME)){
        analyzer.setProperty(Analyzer.BUNDLE_SYMBOLICNAME, getSymbolicName());
    }
    if (!instructionNames.contains(Analyzer.EXPORT_PACKAGE)) {
        analyzer.setProperty(Analyzer.EXPORT_PACKAGE, "*;-noimport:=false;version=" + getVersion());
    }
    for (String instructionName : instructionNames) {
        String list = createPropertyStringFromList(instructionValue(instructionName));
        if (list != null && list.length() > 0) {
            analyzer.setProperty(instructionName, list);
        }
    }

    analyzer.setJar(getClassesDir());

    analyzer.setClasspath(getClasspath().getFiles().toArray(new File[getClasspath().getFiles().size()]));
}
 
Example 5
Source File: ImportedPackageRangeFixerTest.java    From wisdom with Apache License 2.0 5 votes vote down vote up
@Test
public void testWithoutReferred() throws Exception {
    ImportedPackageRangeFixer fixer = new ImportedPackageRangeFixer();
    Reporter reporter = mock(Reporter.class);
    fixer.setReporter(reporter);
    fixer.setProperties(Collections.<String, String>emptyMap());

    Analyzer analyzer = new Analyzer();
    analyzer.setClasspath(new Jar[] {
            new Jar("foo")
    });
    fixer.analyzeJar(analyzer);
}