Knopflerfish 6.1.5
Contents
Release Notes
License
Getting Started
Installing
Running
Building
Programming
Testing
Developer's Doc
Tutorials
Java API docs
Framework and Bundle docs
Bundle jar docs
www.knopflerfish.org
Bug tracker
Bundle repository
Source (git)
Eclipse plugin
Maintained by Makewave
Knopflerfish Pro
Professional Services
Training

OSGi for Business Use

Building Knopflerfish

Knopflerfish includes an ant based build system for building a complete Knopflerfish distribution as well as building individual bundles. Ant 1.9.3 or later is required, available from ant.apache.org

Knopflerfish can be built either by checking out the entire source code , or by (re)building an installed distribution.

The top level build file is located in the osgi directory. The default target is to build the framework and all bundles in the bundles directory.

Invoking ant with the -p option will display the possible targets.

$ ant -p
Buildfile: build.xml

Main targets:

 all                  Builds the framework and all bundles including optional and test bundles
 bundle_doc           Builds bundle specific docs
 bundle_tasks         Builds and defines the Knopflerfish bundle tasks
 clean                Removes all generated files and directories.
 clean_local          Remove all bundles built by this build-file but keep all other bundles
                      in the jars sub-directory.
 default              Builds the framework and bundles in bundles-directory
 define_bundle_tasks  Defines the Knopflerfish bundle tasks
 javadoc              Create javadoc for all exported packages
 rebuild              Cleans then build build all
 run                  (Re)start the framework.
 run-init             Initial start with default set of bundles.
 run-kf-tests         Builds then executes the KF testsuite.
 run-kf-tests-secure  Builds then executes the KF testsuite with security enabled.
 run-secure           (Re)start framework with security enabled.
 run-secure-init      Initial start with security enabled and default set of bundles.
Default target: default
$ 

To add and build additional bundles see the programming section.

Building a compact Knopflerfish framework

You can build a compact version of the framework called framework_compact.jar. To build this you need to download Proguard 5.2. Install the proguard.jar file into ${KF_ROOT}/ant/lib and build the framework with the property compact set to true.

This a version with a reduced memory footprint. This version has no security and certificate support compiled into it. This is only supposed to be used for running and not to compile against. So you also need to compile the normal framework.jar to be able to build bundles.

$ ant -Dcompact=true -f framework/build.xml 
Buildfile: /Users/jan/workspace_osgi/kf_osgi/osgi/framework/build.xml

compile:

compile_full:

compile_compact:

chkBundleTaskSrc:

chkBundleTasksBuild:

build_bundle_tasks:

define_bundle_tasks:

bundle_tasks:

genexports:
   [delete] Deleting: /Users/jan/workspace_osgi/kf_osgi/osgi/framework/resources/exports

jar:
   [delete] Deleting: /Users/jan/workspace_osgi/kf_osgi/osgi/framework/resources/version
   [delete] Deleting: /Users/jan/workspace_osgi/kf_osgi/osgi/framework/resources/tstamp

writerelease:

jar_file_full:

jar_file_compact:
      [jar] Building jar: /Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar

proguard_compact:
     [move] Moving 1 file to /Users/jan/workspace_osgi/kf_osgi/osgi
 [proguard] ProGuard, version 5.2
 [proguard] Reading program jar [/Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar.tmp.jar]
 [proguard] Reading library jar [/Users/jan/workspace_osgi/kf_osgi/osgi/ee/ee.minimum.jar]
 [proguard] Preparing output jar [/Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar]
 [proguard]   Copying resources from program jar [/Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar.tmp.jar]
   [delete] Deleting: /Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar.tmp.jar

add_dex:

source.jar:

save_javadoc_data:

javadoc.jar:

all:

BUILD SUCCESSFUL
Total time: 14 seconds
$ ls -l framework*jar
-rw-r--r--  1 jan  staff  617250 16 Okt 10:44 framework.jar
-rw-r--r--  1 jan  staff  323070 16 Okt 10:44 framework_compact.jar
$