Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4324 dpurdie 1
########################################################################
2
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
3
#
4
# Module name   : ANDROID.PL
5
# Module type   : Makefile system
6
# Compiler(s)   : Perl
7
# Environment(s): jats
8
#
9
# Description:
10
#       This file provides Toolset initialisation and plugin functions
11
#       to makelib.pl2
12
#
13
# Contents:     Basic (very basic) Android support
14
#
15
#............................................................................#
16
 
17
#
18
#   Globals
19
#
20
my $androidBuilder;
21
 
22
##############################################################################
23
#   ToolsetInit()
24
#       Runtime initialisation
25
#
26
##############################################################################
27
 
28
ToolsetInit();
29
 
30
sub ToolsetInit
31
{
32
 
33
#.. Toolset configuration
34
#
35
    $::ScmToolsetVersion = "1.0.0";               # our version
36
    $::ScmToolsetGenerate = 0;                    # generate optional
37
 
38
#.. Standard.rul requirements
39
#
40
    $s =   'java';          # Assembler source file
41
    $o =   '';              # Object file
42
    $a =   'class';         # Library file
43
    $so =  'jar';           # Shared library
44
    $exe = '.apk';          # Linked binary images
45
 
46
#.. Toolset specific definitions
47
#
48
    Init( "android_sdk" );
49
    ToolsetDefines( 'ANDROID.DEF' );
50
#
51
#.. Locate the AndroidBuilder.pl script
52
#   This will be delivered by a package
53
#
54
    my $program = 'androidBuilder.pl';
55
    Verbose("Locate extension Program: $program");
56
    $androidBuilder = ToolExtensionProgram( $program );
57
    Error( "Tool program(s) required by toolset not found:", $program)
58
        unless ($androidBuilder);
59
 
60
    ToolsetDefine ('#   Android Builder Support Tool');
61
    ToolsetDefine ('ANDROIDBUILDER=' . $androidBuilder);
62
 
63
}
64
 
65
########################################################################
66
#
67
#   Generate a project from the provided build.xml
68
#
69
#   Arguments   : $name             - Base name of the project
70
#                 $androidxml       - Path to the AndroidManifest.xml file
71
#                 $pArgs            - Project specific options
72
#                 $auto_test        - Unit Test Target (optional)
73
#                 $unit_test        - Unit Test Target (optional)
74
#                 $pGenerated       - Ref to an array of Generated Files (optional)
75
#
76
########################################################################
77
 
78
our $ToolsetPROJECT_type = 'android';
79
sub ToolsetPROJECT
80
{
81
    my( $name, $androidxml ,$pArgs, $auto_test, $unit_test, $pGenerated ) = @_;
82
    my $io = ToolsetPrinter::New();
83
 
84
    #
85
    #   Generate the recipe to create the project
86
    #   Add names of co-generated targets.
87
    #
88
    $io->Label( "Build project", $name );
89
    $io->Entry( "Project_$name",": $androidxml\n", " \\\n", "" , @{$pGenerated} );
90
    $io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,)" );
91
    $io->Newline();
92
 
93
    #
94
    #   Generate the recipe to clean the project
95
    #
96
    $io->Label( "Clean project", $name );
97
    $io->PrtLn( "ProjectClean_$name: $androidxml" );
98
    $io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,-clean)" );
99
    $io->Newline();
100
 
101
    #
102
    #   Generate the recipe to run unit tests on the project
103
    #   This is optional
104
    #
105
    if ( $auto_test )
106
    {
107
        $io->Label( "Auto Test project", $name );
108
        $io->PrtLn( "ProjectATest_$name: $androidxml" );
109
        $io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,$auto_test)" );
110
        $io->Newline();
111
    }
112
 
113
    if ( $unit_test )
114
    {
115
        $io->Label( "Unit Test project", $name );
116
        $io->PrtLn( "ProjectUTest_$name: $androidxml" );
117
        $io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,$unit_test)" );
118
        $io->Newline();
119
    }
120
 
121
    #
122
    #   Generate macro to contain the project invocation
123
    #   The first argument will be a 'build target' argument
124
    #
125
    $io->Label( "Macro to invoke project", $name );
126
    $io->PrtLn( "define ProjectDefine_$name" );
127
    $io->PrtLn( "\t\$(GBE_PERL) \$(ANDROIDBUILDER) -f $androidxml -i=\$(PWD)/\$(INTERFACEDIR) -t=\$(GBE_TYPE) -pn=\$(GBE_PBASE) -pv=\$(BUILDVER) @{$pArgs} \$1" );
128
    $io->PrtLn( "endef");
129
    $io->Newline();
130
}
131
 
132
1;
133