You are not logged in. Click here to log in.

Application Lifecycle Management

Search In Project

Search inClear

Tags:  not added yet

Build/Project Management

An OMS project is a generated directory structure. In OMS there is a Project explorer which allows the creation of such project folder. Projects are hosting al resources created in a modeling effort such as sources, data, intermediate files and executables.

A Project is self-contained. It can be transferred to another computer or folder and will work the same way. It contains all files for managing all the project resources.

A project can be managed from within OMS and externally from the command line using the Ant tool.

Related Tools

Build management using Ant ANT build tool
An Ant Task for different C/C++ and FORTRAN compiler CC Task
Some extentions to standard Ant. ANT contrib

Project Directory structure

  • src Folder containg all sources
  • conf Build configuration and management directory

Optional:

  • data Model data directory
  • test Component test directory
  • lib Additional libraries (jar files) to use
  • doc Documentation (generated)
  • models Models being developed in this project

Build Files

Each generated project contains three files that are managing the build process:

<project_dir>/build.xml
This is the public build file a developer should invoke.
<project_dir>/build.properties
This is the public build setting file which can be adjusted.
<project_dir>/conf/build_impl.xml
This is the private build file which gets invoked from the bublic build file.

The build files are realizing build tasks such as:

  • compiling java sources into class fils
  • compiling native components into object files
  • compiling Native bridges into object files
  • linking object files into dynamic loadable libraries.
  • meta data generation
  • ( other )

The build files are consumed by the build tool called "Ant". Ant is built into the OMS Platform and also exists standalone. There is a manual at the Ant web site which describes the syntax and semantics of build files.

Build Process Adaptation.

The Build process can be adapted in several ways to adjust for example compiler flags, used compiler, etc. The following rules apply:
  • Do not edit the file build_impl.xml! The files in the conf folder should not be edited at all. Edit the files build.xml or build.propertiesinstead.
  • If you want to change settings represented as properties in build.properties just edit this file. You can change compiler names, compiler flags, file extensions, target architectures, etc.
  • If you need to change the compilation task (for example using a new compiler which is not covered in the <cc> task) you need to overwrite the macro by redefining it. There are several macros which can be overwritten.
  • If you want to use common compiler flags for multiple projects, copy the file build.properties into your {$HOME directory. Any property which is set in here will have predence over project properties.

There are the following macros which can be redefined Macrodef :

JC-comp
compile a single java component
FC-comp
compile a singe FORTRAN component
CC-comp
compile a single C/C++ component
CC-bridge
compile a generated C++ bridge
LINK-dll
link a shared library

build.xml

This the is build.xml file as generated in the project folder. It imports the file build_impl.xml and proxies the tasks
  • make compile/link only required files
  • build compile/link all files
  • clean clean all temporary files
to their implementations in build_impl.xml.

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all">
    <description>
      Build all the project resources.
    </description>

    <import file="conf/build_impl.xml"/>
    <!-- The following targets proxy to the conf/build_impl.xml targets with the
         same name. Since NB3.6 does not show imported targets, they are exposed
         here to avoid confusion. 
      -->

    <target depends="build_impl.build" description="build the product" name="build"/>
    <target depends="build_impl.make"  description="make the products" name="make"/>
    <target depends="build_impl.clean" description="clean up the project" name="clean"/>
 
</project>

build.properties

# Adjustable build settings.

# javac flags
javac.deprecation = false
javac.debug       = true
javac.source      = 1.4
javac.target      = 1.4
javac.verbose     = false

# native compiler and options
# Fortran compiler
FTN               = g77
# Fortran compiler flags
FTN.flags         = -Wimplicit -fno-automatic -fcase-preserve -fno-underscoring
# Fortran extentions
FTN.ext           = for

# CC compiler
CC                = gcc
# CC compiler flags
CC.flags          =  
# Defines
CC.define         = 
# CC file extension
CC.ext            = C

# CC bridge compiler flags
CC.bridge.flags   = 
# architecture to run on (architecture folder in $JAVA_HOME/include, such as win32, linux, solaris,...
CC.java.include   = win32
# Bridge defines (FAST | DEBUG | <NONE>); default is no define
CC.bridge.define  = 

# Linker 
LINK              = g++
LINK.flags        = -mno-cygwin -Wl,--add-stdcall-alias 
OBJ.ext           = o
DLL.ext           = so

# misc options
delete.fail       = false

build_imp.xml


<?xml version="1.0" encoding="UTF-8"?>
<!-- GENERATED FILE, DO NOT EDIT  
     EDIT ../build.xml INSTEAD     
  -->

<project basedir=".." default="all" name="build_impl">

 <macrodef name="JC-comp"> 
   <sequential>
     <javac debug="${javac.debug}" 
                deprecation="${javac.deprecation}" 
                  destdir="${build.dir}" srcdir="${src.dir}" 
                verbose="${javac.verbose}">
        <classpath>
            <pathelement location="${omsapi}"/>
            <fileset dir="${oms.lib.dir}">
                <include name="omsapi.jar"/>
                <include name="units.jar"/>
            </fileset>
            <fileset dir="${lib.dir}">
                <include name="**/*.jar"/>
            </fileset>
        </classpath>
    </javac>       
   </sequential>
 </macrodef>
 
 <macrodef name="FC-comp"> 
   <sequential>
     <cc name="${FTN}" objdir="${build.dir}">
        <fileset dir="${src.dir}" includes="**/*.${FTN.ext}"/>
        <compilerarg line="true" value="${FTN.flags}"/>
     </cc>
   </sequential>
 </macrodef>

 <macrodef name="CC-comp"> 
   <sequential>
     <cc name="${CC}" objdir="${build.dir}">
        <fileset dir="${src.dir}" includes="**/*.${CC.ext}" excludes="**/*_Bridge.C"/>
        <compilerarg line="true" value="${CC.flags}"/>
        <defineset define="${CC.define}"/>
    </cc> 
   </sequential>
 </macrodef>

 <macrodef name="CC-bridge"> 
   <sequential>
     <cc name="${CC}" objdir="${build.dir}">
        <fileset dir="${src.dir}" includes="**/*_Bridge.C"/>
        <compilerarg line="true" value="${CC.bridge.flags}"/>
        <defineset define="${CC.bridge.define}"/>
        <includepath location="${java.home}/../include"/>
        <includepath location="${java.home}/../include/${CC.java.include}"/>
        <includepath location="${project.home}/conf"/>
    </cc> 
   </sequential>
 </macrodef>

 <macrodef name="LINK-dll"> 
   <sequential>
    <cc name="${LINK}" outfile="${build.dir}/${project.name}" outtype="shared">
        <fileset dir="${build.dir}">
            <include name="**/*.o"/>
            <include name="**/*.obj"/>
        </fileset>
        <compilerarg line="true" value="${LINK.flags}"/>
        <libset if="is-gcc" libs="g2c"/>
    </cc>
   </sequential>
 </macrodef>
 
 <!-- Do it all.  -->
 <target depends="build" name="all"/>

 <!-- Compile target   -->
 <target depends="compile-java, compile-native" name="make"/>
 <target depends="clean, make" name="build"/>

 <!-- Init all -->
 <target name="init"> 
 
    <!-- Include external property files to allow adaptation
         1. in project directory 
         2. in users home directory
      -->
    
    <property file="conf/build.properties"/>
    <property file="${user.home}/build.properties"/>

    <property name="src.dir" value="src"/>
    <property name="build.dir" value="src"/>
    <property name="dist.dir" value="dist"/>
    <property name="doc.dir" value="doc"/>
    <property name="lib.dir" value="lib"/>
    <property name="oms.lib.dir" value="${netbeans.home}/modules/ext"/>
    <fail message="Set the property: 'netbeans.home' to your OMS installation." unless="netbeans.home"/>

    <taskdef classpath="${oms.lib.dir}/cpptasks.jar" resource="cpptasks.tasks"/>
    <typedef classpath="${oms.lib.dir}/cpptasks.jar" resource="cpptasks.types"/>
    <taskdef classpath="${oms.lib.dir}/ant-contrib-1.0b1.jar" resource="net/sf/antcontrib/antlib.xml"/>

    <propertyregex input="${basedir}" property="project.name" regexp="[.]*(\\|/)([\w]+)$" select="\2"/>
    <property name="project.home" value="${basedir}"/>

    <condition property="is-gcc">
        <or>
            <equals arg1="${CC}" arg2="gcc"/>
            <equals arg1="${CC}" arg2="g++"/>
        </or>
    </condition>
 </target>

 <!-- Java compile  -->        
 <target depends="init" name="compile-java">
    <JC-comp/>
 </target>


 <!-- Native compile  --> 
 <target depends="init" name="compile-native">  
    <FC-comp/>
    <CC-bridge/>
    <LINK-dll/>
 </target>

 <!-- clean  -->
 <target depends="init" name="clean">
    <delete failonerror="${delete.fail}" includeEmptyDirs="true">
        <fileset dir="${build.dir}">
            <include name="**/*.${OBJ.ext}"/>
            <include name="**/*.${DLL.ext}"/>
            <include name="**/*.class"/> 
            <include name="history.xml"/> 
            <include name="dependencies.xml"/> 
        </fileset>
        <fileset dir="${dist.dir}" includes="**/*"/>
        <fileset/>
    </delete>
 </target>

</project>

Typical Compiler Settings in build.properties

GCC/G77 on Cygwin

FTN               = g77
FTN.flags         = -Wimplicit -fno-automatic -fcase-preserve -fno-underscoring
FTN.ext           = for

CC                = gcc
CC.bridge.flags   = 
CC.java.include   = win32
CC.bridge.define  = 

LINK              = g++
LINK.flags        = -mno-cygwin -Wl,--add-stdcall-alias 
OBJ.ext           = o
DLL.ext           = so