• Intro Headers Instructions Macros Commands
  • Fork me on GitHub
    • Introduction
    • How to install bnd
    • Guided Tour
    • Guided Tour Workspace & Projects
    • Concepts
    • Best practices
    • Build
    • Generating JARs
    • Versioning
    • Baselining
    • Service Components
    • Metatype
    • Contracts
    • Manifest Annotations
    • Resolving Dependencies
    • Launching
    • Plain JUnit Testing with OSGi (PRELIMENARY)
    • Testing
    • Packaging Applications
    • Wrapping Libraries to OSGi Bundles
    • Commands
    • For Developers
    • Tools bound to bnd
    • Headers
    • Instruction Reference
    • Instruction Index
    • Macro Reference
    • Macro Index
    • Plugins
    • Settings
    • Errors
    • Warnings
    • Frequently Asked Questions
  • -require-bnd (FILTER ( ',' FILTER )* )?

    /**
     * Ensure that we are running on the correct bnd.
     */
    void doRequireBnd() {
    	Attrs require = OSGiHeader.parseProperties(getProperty(REQUIRE_BND));
    	if (require == null || require.isEmpty())
    		return;
    
    	Hashtable<String,String> map = new Hashtable<String,String>();
    	map.put(Constants.VERSION_FILTER, getBndVersion());
    
    	for (String filter : require.keySet()) {
    		try {
    			Filter f = new Filter(filter);
    			if (f.match(map))
    				continue;
    			error("%s fails %s", REQUIRE_BND, require.get(filter));
    		}
    		catch (Exception t) {
    			error("%s with value %s throws exception", t, REQUIRE_BND, require);
    		}
    	}
    }
    
    • GitHub