Rev 4344 | Rev 4949 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
######################################################################### Copyright (c) VIX TECHNOLOGY (AUST) LTD## Module name : ANDROID.PL# Module type : Makefile system# Compiler(s) : Perl# Environment(s): jats## Description:# This file provides Toolset initialisation and plugin functions# to makelib.pl2## Contents: Basic (very basic) Android support##............................................................................#use strict;use warnings;## Globals#my $androidBuilder;############################################################################### ToolsetInit()# Runtime initialisation###############################################################################ToolsetInit();sub ToolsetInit{#.. Toolset configuration#$::ScmToolsetVersion = "1.0.0"; # our version$::ScmToolsetGenerate = 0; # generate optional#.. Standard.rul requirements#$::s = 'java'; # Assembler source file$::o = ''; # Object file$::a = 'class'; # Library file$::so = 'jar'; # Shared library$::exe = '.apk'; # Linked binary images#.. Toolset specific definitions#Init( "android_sdk" );ToolsetDefines( 'ANDROID.DEF' );##.. Locate the AndroidBuilder.pl script# This will be delivered by a package#my $program = 'AndroidBuilder.pl';Verbose("Locate extension Program: $program");$androidBuilder = ToolExtensionProgram( $program );Error( "Tool program(s) required by toolset not found:", $program)unless ($androidBuilder);ToolsetDefine ('# Android Builder Support Tool');ToolsetDefine ('ANDROIDBUILDER=' . $androidBuilder);}########################################################################## Generate a project from the provided build.xml## Arguments : $name - Base name of the project# $androidxml - Path to the AndroidManifest.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 = 'android';sub ToolsetPROJECT{my( $name, $androidxml ,$pArgs, $auto_test, $unit_test, $pGenerated ) = @_;## Populate the project for the user#ToolsetPROJECTPreBuild (@_);## Generate the recipe to create the project# Add names of co-generated targets.#my $me = MakeEntry::New (*MAKEFILE, 'Project_'.$name );$me->AddComment ("Build Android Project: $name" );$me->AddDependancy ( $androidxml );$me->AddDependancy ( '$(SCM_MAKEFILE)' );$me->AddDependancy ( @{$pGenerated} );$me->AddRecipe ( "\$(XX_PRE)\$(call ProjectDefine_$name,)" );$me->Print();## Generate the recipe to clean the project#$me = MakeEntry::New (*MAKEFILE, 'ProjectClean_'.$name );$me->AddComment ("Clean Android Project: $name" );$me->AddRecipe ( "\$(XX_PRE)\$(call ProjectDefine_$name,-clean)" );$me->Print();## Generate the recipe to run unit tests on the project# This is optional#if ( $auto_test ){$me = MakeEntry::New (*MAKEFILE, 'ProjectATest_'.$name );$me->AddComment ("Auto Test project: $name" );$me->AddDependancy ( $androidxml );$me->AddRecipe ( "\$(XX_PRE)\$(call ProjectDefine_$name,$auto_test)" );$me->Print();}if ( $unit_test ){$me = MakeEntry::New (*MAKEFILE, 'ProjectUTest_'.$name );$me->AddComment ("Unit Test project: $name" );$me->AddDependancy ( $androidxml );$me->AddRecipe ( "\$(XX_PRE)\$(call ProjectDefine_$name,$unit_test)" );$me->Print();}## Generate macro to contain the project invocation# The first argument will be a 'build target' argument#my @cmdargs;push @cmdargs, '$(GBE_PERL)','$(ANDROIDBUILDER)';push @cmdargs, '-f', $androidxml;push @cmdargs, '-i=$(PWD)/$(INTERFACEDIR)';push @cmdargs, '-t=$(GBE_TYPE)';push @cmdargs, '-pn=$(GBE_PBASE) -pv=$(BUILDVER)';push @cmdargs, @{$pArgs}, '$1';$me = MakeEntry::New (*MAKEFILE, 'ProjectDefine_'.$name, '--Define' );$me->AddComment ("Macro to invoke project: $name" );$me->AddRecipe ( join(' ', @cmdargs) );$me->Print();}#-------------------------------------------------------------------------------# Function : ToolsetPROJECTPreBuild## Description : This ANDROID Specific operation is used to perform some of the# build opertaions at 'build' time. These include:# - Verify that required packages are available# - Populate the targets 'libs' directory so that the user can# develop with the external dependencies in place## Inputs : $name - Base name of the project# $androidxml - Path to the AndroidManifest.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)## Returns : Nothing#sub ToolsetPROJECTPreBuild{my( $name, $androidxml ,$pArgs, $auto_test, $unit_test, $pGenerated ) = @_;## Invoke the androidBuilder in a mode so that it will populate the Eclipse project# in a suitable manner.## In the build phase there is no 'debug' or 'production' phase# Assume debug - if it needs to be determined#EnvImport( "GBE_PERL" );System ( '--NoShell', '--Exit', $::GBE_PERL, $androidBuilder,'-f', $androidxml,'-i', catdir( $::ScmRoot, $::ScmInterface),'-t', 'D','-pn', $::Pbase,'-pv', $::ScmBuildVersionFull,'-populate',@{$pArgs});}1;