aQute.bnd.build
Class Project

java.lang.Object
  extended by aQute.lib.osgi.Processor
      extended by aQute.bnd.build.Project
All Implemented Interfaces:
Constants, Reporter, Closeable

public class Project
extends Processor

This class is NOT threadsafe

Author:
aqute

Field Summary
static String BNDCNF
           
static String BNDFILE
           
 
Fields inherited from class aQute.lib.osgi.Processor
DEFAULT_PLUGINS, LIST_SPLITTER
 
Fields inherited from interface aQute.lib.osgi.Constants
BLUEPRINT_TIMEOUT_ATTRIBUTE, BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE, BND_LASTMODIFIED, BUILDFILES, BUILDPATH, BUMPPOLICY, BUNDLE_ACTIVATIONPOLICY, BUNDLE_ACTIVATOR, BUNDLE_BLUEPRINT, BUNDLE_CATEGORY, BUNDLE_CLASSPATH, BUNDLE_CONTACTADDRESS, BUNDLE_COPYRIGHT, BUNDLE_DESCRIPTION, BUNDLE_DOCURL, BUNDLE_ICON, BUNDLE_LICENSE, BUNDLE_LOCALIZATION, BUNDLE_MANIFESTVERSION, BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SPECIFIC_HEADERS, BUNDLE_SYMBOLIC_NAME_ATTRIBUTE, BUNDLE_SYMBOLICNAME, BUNDLE_UPDATELOCATION, BUNDLE_VENDOR, BUNDLE_VERSION, BUNDLE_VERSION_ATTRIBUTE, CLASSPATH, COMMAND_DIRECTIVE, CONDITIONAL_PACKAGE, CONDUIT, CREATED_BY, CURRENT_PACKAGE, CURRENT_USES, CURRENT_VERSION, DEBUG, DEFAULT_BAR_EXTENSION, DEFAULT_BND_EXTENSION, DEFAULT_JAR_EXTENSION, DEPENDSON, DEPLOYREPO, DESCRIPTION_ATTRIBUTE, directives, DONOTCOPY, DUPLICATE_MARKER, DYNAMICIMPORT_PACKAGE, EXCLUDE_DIRECTIVE, EXPORT_CONTENTS, EXPORT_PACKAGE, EXPORT_SERVICE, EXTENSION_DIRECTIVE, FAIL_OK, FRAGMENT_ATTACHMENT_DIRECTIVE, FRAGMENT_HOST, headers, IGNORE_PACKAGE, IMPORT_DIRECTIVE, IMPORT_PACKAGE, IMPORT_PRIVATE, IMPORT_REFERENCE, IMPORT_SERVICE, importDirectives, INCLUDE, INCLUDE_DIRECTIVE, INCLUDE_RESOURCE, INCLUDERESOURCE, KEYSTORE_LOCATION_DIRECTIVE, KEYSTORE_PASSWORD_DIRECTIVE, KEYSTORE_PROVIDER_DIRECTIVE, LANGUAGE_ATTRIBUTE, LINK_ATTRIBUTE, MAKE, MANDATORY_DIRECTIVE, MANIFEST, METAPACKAGES, NAME_ATTRIBUTE, NO_IMPORT_DIRECTIVE, NOEXTRAHEADERS, NOMANIFEST, NONE, NOPE, NOUSES, options, OSNAME_ATTRIBUTE, OSVERSION_ATTRIBUTE, PATH_DIRECTIVE, PEDANTIC, PLUGIN, POM, PRESENCE_DIRECTIVE, PRIVATE_PACKAGE, PROCESSOR_ATTRIBUTE, RELEASEREPO, REMOVE_ATTRIBUTE_DIRECTIVE, REMOVE_HEADERS, REPORTNEWER, REQUIRE_BUNDLE, RESOLUTION_DIRECTIVE, RESOURCEONLY, RUNBUNDLES, RUNPATH, RUNPROPERTIES, RUNSYSTEMPACKAGES, RUNVM, SELECTION_FILTER_ATTRIBUTE, SERVICE_COMPONENT, SIGN, SIGN_PASSWORD_DIRECTIVE, SIGNATURE_TEST, SINGLETON_DIRECTIVE, SIZE_ATTRIBUTE, SOURCEPATH, SOURCES, SPLIT_PACKAGE_DIRECTIVE, STRATEGY_HIGHEST, STRATEGY_LOWEST, SUB, TESTBUNDLES, TESTCASES, TESTPACKAGES, TESTREPORT, TOOL, UNDERTEST, USES_DIRECTIVE, USES_USES, VALID_PROPERTY_TYPES, VERBOSE, VERSION_ATTRIBUTE, VERSIONPOLICY, VISIBILITY_DIRECTIVE
 
Constructor Summary
Project(Workspace workspace, File buildDir)
           
Project(Workspace workspace, File projectDir, File buildFile)
           
 
Method Summary
 String _findfile(String[] args)
           
 String _help(String[] args)
           
 String _p_allsourcepath(String[] args)
           
 String _p_bootclasspath(String[] args)
           
 String _p_buildpath(String[] args)
           
 String _p_dependson(String[] args)
           
 String _p_output(String[] args)
           
 String _p_sourcepath(String[] args)
           
 String _p_testpath(String[] args)
           
 String _project(String[] args)
           
 String _repo(String[] args)
          Macro access to the repository ${repo;[;[;]]}
 String _repos(String[] args)
           
 void action(String command)
           
 File[] build()
           
 File[] build(boolean underTest)
          This is the external method that will pre-build any dependencies if it is out of date.
 File[] buildLocal(boolean underTest)
          Build without doing any dependency checking.
 void bump()
           
 void bump(String mask)
           
 void clean()
           
 void deploy(File file)
          Deploy the file (which must be a bundle) into the repository.
 void deploy(String name, File file)
          Deploy the file (which must be a bundle) into the repository.
 void fillActions(Map<String,Action> all)
           
 Map<String,Action> getActions()
           
 Collection<File> getAllsourcepath()
           
 Collection<Container> getBootclasspath()
           
 ProjectBuilder getBuilder(ProjectBuilder parent)
          Return a new builder that is nicely setup for this project.
 File[] getBuildFiles()
          This method must only be called when it is sure that the project has been build before in the same session.
 Collection<Container> getBuildpath()
           
 Container getBundle(String bsn, String range, int strategy, Map<String,String> attrs)
          Get a bundle from one of the plugin repositories.
 List<Container> getBundles(int strategy, String spec)
          Analyze the header and return a list of files that should be on the build, test or some other path.
 int getChanged()
           
 Collection<Project> getDependson()
           
protected  Object[] getMacroDomains()
          This should be overridden by subclasses to add extra macro command domains on the search list.
 String getName()
           
 File getOutput()
           
 Collection<Container> getRunbundles()
           
 Collection<Container> getRunpath()
           
 Collection<File> getSourcepath()
           
 File getSrc()
           
 File getTarget()
           
static Project getUnparented(File propertiesFile)
           
 Jar getValidJar(File f)
          This methods attempts to turn any jar into a valid jar.
 Workspace getWorkspace()
           
 boolean isCnf()
           
 boolean isValid()
           
 void prepare()
          Set up all the paths
 void propertiesChanged()
           
 boolean refresh()
          Refresh if we are based on stale data.
 void refreshAll()
           
 void release()
           
 void release(boolean test)
           
 File release(Jar jar)
           
 void release(String name)
          Release.
 void release(String name, boolean test)
          Release
 File release(String name, Jar jar)
          Release
 void script(String type, String script)
           
 void setChanged()
           
 boolean test()
           
 boolean test(File f)
           
 String toString()
           
 
Methods inherited from class aQute.lib.osgi.Processor
_basedir, addClose, addIncluded, addProperties, appendPath, begin, clear, close, error, error, exists, getBase, getErrors, getFile, getFile, getFlattenedProperties, getInfo, getInfo, getManifestAsProperties, getParent, getPlugins, getPlugins, getProperties, getPropertiesFile, getProperty, getProperty, getReplacer, getTop, getWarnings, isDuplicate, isExceptions, isFailOk, isMissingPlugin, isOk, isPedantic, isPerfect, isTrue, join, join, join, lastModified, loadProperties, merge, mergeProperties, mergeProperties, newHashMap, newList, newList, newMap, newMap, newSet, newSet, normalize, normalize, parseHeader, parseHeader, printClause, printClauses, printClauses, progress, read, removeDuplicateMarker, replaceAll, replaceWitInstruction, setBase, setExceptions, setFileMustExist, setForceLocal, setParent, setPedantic, setProperties, setProperties, setProperties, setProperty, setTrace, split, split, split, trace, unsetProperty, updateModified, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BNDFILE

public static final String BNDFILE
See Also:
Constant Field Values

BNDCNF

public static final String BNDCNF
See Also:
Constant Field Values
Constructor Detail

Project

public Project(Workspace workspace,
               File projectDir,
               File buildFile)
        throws Exception
Throws:
Exception

Project

public Project(Workspace workspace,
               File buildDir)
        throws Exception
Throws:
Exception
Method Detail

getUnparented

public static Project getUnparented(File propertiesFile)
                             throws Exception
Throws:
Exception

isValid

public boolean isValid()

getBuilder

public ProjectBuilder getBuilder(ProjectBuilder parent)
                          throws Exception
Return a new builder that is nicely setup for this project. Please close this builder after use.

Parameters:
parent - The project builder to use as parent, use this project if null
Returns:
Throws:
Exception

getChanged

public int getChanged()

setChanged

public void setChanged()

getWorkspace

public Workspace getWorkspace()

toString

public String toString()
Overrides:
toString in class Object

prepare

public void prepare()
             throws Exception
Set up all the paths

Throws:
Exception

getSrc

public File getSrc()

getBundles

public List<Container> getBundles(int strategy,
                                  String spec)
                           throws Exception
Analyze the header and return a list of files that should be on the build, test or some other path. The list is assumed to be a list of bsns with a version specification. The special case of version=project indicates there is a project in the same workspace. The path to the output directory is calculated. The default directory ${bin} can be overridden with the output attribute.

Parameters:
strategy - STRATEGY_LOWEST or STRATEGY_HIGHEST
spec - The header
Returns:
Throws:
Exception

getDependson

public Collection<Project> getDependson()
                                 throws Exception
Throws:
Exception

getBuildpath

public Collection<Container> getBuildpath()
                                   throws Exception
Throws:
Exception

getRunpath

public Collection<Container> getRunpath()
                                 throws Exception
Throws:
Exception

getRunbundles

public Collection<Container> getRunbundles()
                                    throws Exception
Throws:
Exception

getSourcepath

public Collection<File> getSourcepath()
                               throws Exception
Throws:
Exception

getAllsourcepath

public Collection<File> getAllsourcepath()
                                  throws Exception
Throws:
Exception

getBootclasspath

public Collection<Container> getBootclasspath()
                                       throws Exception
Throws:
Exception

getOutput

public File getOutput()
               throws Exception
Throws:
Exception

_p_dependson

public String _p_dependson(String[] args)
                    throws Exception
Throws:
Exception

_p_buildpath

public String _p_buildpath(String[] args)
                    throws Exception
Throws:
Exception

_p_testpath

public String _p_testpath(String[] args)
                   throws Exception
Throws:
Exception

_p_sourcepath

public String _p_sourcepath(String[] args)
                     throws Exception
Throws:
Exception

_p_allsourcepath

public String _p_allsourcepath(String[] args)
                        throws Exception
Throws:
Exception

_p_bootclasspath

public String _p_bootclasspath(String[] args)
                        throws Exception
Throws:
Exception

_p_output

public String _p_output(String[] args)
                 throws Exception
Throws:
Exception

getMacroDomains

protected Object[] getMacroDomains()
Description copied from class: Processor
This should be overridden by subclasses to add extra macro command domains on the search list.

Overrides:
getMacroDomains in class Processor
Returns:

release

public File release(Jar jar)
             throws Exception
Throws:
Exception

release

public File release(String name,
                    Jar jar)
             throws Exception
Release

Parameters:
name - The repository name
jar -
Returns:
Throws:
Exception

release

public void release(boolean test)
             throws Exception
Throws:
Exception

release

public void release(String name,
                    boolean test)
             throws Exception
Release

Parameters:
name - The respository name
test - Run testcases
Throws:
Exception

getBundle

public Container getBundle(String bsn,
                           String range,
                           int strategy,
                           Map<String,String> attrs)
                    throws Exception
Get a bundle from one of the plugin repositories.

Parameters:
bsn - The bundle symbolic name
range - The version range
lowest - set to LOWEST or HIGHEST
Returns:
the file object that points to the bundle or null if not found
Throws:
Exception - when something goes wrong

deploy

public void deploy(String name,
                   File file)
            throws Exception
Deploy the file (which must be a bundle) into the repository.

Parameters:
name - The repository name
file - bundle
Throws:
Exception

deploy

public void deploy(File file)
            throws Exception
Deploy the file (which must be a bundle) into the repository.

Parameters:
file - bundle
Throws:
Exception

_repo

public String _repo(String[] args)
             throws Exception
Macro access to the repository ${repo;[;[;]]}

Throws:
Exception

getTarget

public File getTarget()
               throws Exception
Throws:
Exception

build

public File[] build(boolean underTest)
             throws Exception
This is the external method that will pre-build any dependencies if it is out of date.

Parameters:
underTest -
Returns:
Throws:
Exception

getBuildFiles

public File[] getBuildFiles()
                     throws Exception
This method must only be called when it is sure that the project has been build before in the same session. It is a bit yucky, but ant creates different class spaces which makes it hard to detect we already build it.

Returns:
Throws:
Exception

buildLocal

public File[] buildLocal(boolean underTest)
                  throws Exception
Build without doing any dependency checking. Make sure any dependent projects are built first.

Parameters:
underTest -
Returns:
Throws:
Exception

refresh

public boolean refresh()
Refresh if we are based on stale data. This also implies our workspace.

Overrides:
refresh in class Processor

isCnf

public boolean isCnf()

propertiesChanged

public void propertiesChanged()
Overrides:
propertiesChanged in class Processor

getName

public String getName()

getActions

public Map<String,Action> getActions()

fillActions

public void fillActions(Map<String,Action> all)

release

public void release()
             throws Exception
Throws:
Exception

release

public void release(String name)
             throws Exception
Release.

Parameters:
name - The repository name
Throws:
Exception

clean

public void clean()
           throws Exception
Throws:
Exception

build

public File[] build()
             throws Exception
Throws:
Exception

test

public boolean test()
             throws Exception
Throws:
Exception

test

public boolean test(File f)
             throws Exception
Throws:
Exception

getValidJar

public Jar getValidJar(File f)
                throws Exception
This methods attempts to turn any jar into a valid jar. If this is a bundle with manifest, a manifest is added based on defaults. If it is a bundle, but not r4, we try to add the r4 headers.

Parameters:
name -
in -
Returns:
Throws:
Exception

_project

public String _project(String[] args)

bump

public void bump(String mask)
          throws IOException
Throws:
IOException

bump

public void bump()
          throws IOException
Throws:
IOException

action

public void action(String command)
            throws Exception
Throws:
Exception

_findfile

public String _findfile(String[] args)

refreshAll

public void refreshAll()

script

public void script(String type,
                   String script)
            throws Exception
Throws:
Exception

_repos

public String _repos(String[] args)
              throws Exception
Throws:
Exception

_help

public String _help(String[] args)
             throws Exception
Throws:
Exception


Copyright © 2010 aQute SARL. All Rights Reserved.