Rev 261 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#..# Copyright (C) 1998-2005 ERG Transit Systems, All rights reserved## Module name : JAVA# Module type : Makefile system# Compiler(s) : None# Environment(s): All## Description:# This file provides Toolset initialisation and plugin functions# to makelib.pl2## Contents: Basic (very basic) Java support## Revision History:# 15-Jul-05 DDP Created#............................................................................################################################################################ ToolsetInit()# Runtime initialisation###############################################################################ToolsetInit();sub ToolsetInit{my( @args ) = @ScmToolsetArgs; # Toolset argumentsmy( $version, $product, @defines, @dirs, @flags );## If the user doesn't specify a version, then force a known version# 1.4 may not be the current flavor, but it was when this was done!#$version = 1.4;#.. Parse arguments#Debug( "JAVA(@args)\n" );foreach $_ ( @args ) {if (/^--Version=(.*)/) { # Compiler version$version = "$1";} else {Message( "JAVA: unknown toolset argument $_ -- ignored\n" );}}#.. Parse Platform Arguments#my( @args ) = @ScmPlatformArgs; # Platform argumentsforeach $_ ( @args ) {if (/^--product=(.*)/) { # GBE product$product = $1;} elsif (/^--Version=(.*)/) {$version = $1;} else {Message( "JAVA: unknown platform argument $_ -- ignored\n" );}}#.. Toolset configuration#$::ScmToolsetVersion = "1.0.0"; # our version$::ScmToolsetGenerate = 0; # generate optional$::ScmToolsetIFLAG3 = 1; # supports IFLAG3#.. Standard.rul requirements#$s = 'java'; # Assembler source file$o = ''; # Object file$a = 'class'; # Library file$so = ''; # Shared library$exe = '.jar'; # Linked binary images#.. Pass version information in#Error ("Java Version has not been set") unless $version;my $nice_ver = $version;$nice_ver =~ s~\.~_~g;ToolsetDefine ( "\n#.. Specify the version of JAVA to use and the EnvVar that specifies it" );ToolsetDefine ( "#" );ToolsetDefine ( "JAVA_VER = $version" );ToolsetDefine ( "JAVA_HOME_VAR = JAVA_HOME_$nice_ver" );ToolsetDefine ( "\n" );#.. Toolset specific definitions#Init( "java_sdk" );ToolsetDefines( 'JAVA.DEF' );}########################################################################## Generate a project from the provided build.xml# This is aimed at Java## Arguments : $name - Base name of the project# $buildxml - Path to the build.xml file# $pArgs - Project specific options# $auto_test - Unit Test Target (optional)# $unit_test - Unit Test Target (optional)# $pGenerated - Ref to an array of Generated Files (optional)#########################################################################our $ToolsetPROJECT_type = 'ant';sub ToolsetPROJECT{my( $name, $buildxml ,$pArgs, $auto_test, $unit_test, $pGenerated ) = @_;my $cmd = '$(ANT)';my $io = ToolsetPrinter::New();## Generate the recipe to create the project# Add names of co-generated targets.#$io->Label( "Build project", $name );$io->Entry( "Project_$name",": $buildxml\n", " \\\n", "" , @{$pGenerated} );$io->PrtLn( "\t\$(XX_PRE)grep \'includeAntRuntime[ \t]*=[ \t]*\"off\"\' $buildxml || (echo ANT build file MUST specify includeAntRuntime=\"off\" with each javac command; exit 1)" );$io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,)" );$io->Newline();## Generate the recipe to clean the project#$io->Label( "Clean project", $name );$io->PrtLn( "ProjectClean_$name: $buildxml" );$io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,clean)" );$io->Newline();## Generate the recipe to run unit tests on the project# This is optional#if ( $auto_test ){$io->Label( "Auto Test project", $name );$io->PrtLn( "ProjectATest_$name: $buildxml" );$io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,$auto_test)" );$io->Newline();}if ( $unit_test ){$io->Label( "Unit Test project", $name );$io->PrtLn( "ProjectUTest_$name: $buildxml" );$io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,$unit_test)" );$io->Newline();}## Generate macro to contain the project invocation# The first argument will be a 'build target' argument#$io->Label( "Macro to invoke project", $name );$io->PrtLn( "define ProjectDefine_$name" );$io->PrtLn( "\t$cmd -f $buildxml -DINTERFACEDIR=\$(PWD)/\$(INTERFACEDIR) -DGBE_TYPE=\$(GBE_TYPE) @{$pArgs} \$1" );$io->PrtLn( "endef");$io->Newline();}1;