Subversion Repositories DevTools

Rev

Rev 4324 | Rev 4362 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4324 Rev 4344
Line 12... Line 12...
12
#
12
#
13
# Contents:     Basic (very basic) Android support
13
# Contents:     Basic (very basic) Android support
14
#
14
#
15
#............................................................................#
15
#............................................................................#
16
 
16
 
-
 
17
use strict;
-
 
18
use warnings;
-
 
19
 
17
#
20
#
18
#   Globals
21
#   Globals
19
#
22
#
20
my $androidBuilder;
23
my $androidBuilder;
21
 
24
 
Line 35... Line 38...
35
    $::ScmToolsetVersion = "1.0.0";               # our version
38
    $::ScmToolsetVersion = "1.0.0";               # our version
36
    $::ScmToolsetGenerate = 0;                    # generate optional
39
    $::ScmToolsetGenerate = 0;                    # generate optional
37
 
40
 
38
#.. Standard.rul requirements
41
#.. Standard.rul requirements
39
#
42
#
40
    $s =   'java';          # Assembler source file
43
    $::s =   'java';          # Assembler source file
41
    $o =   '';              # Object file
44
    $::o =   '';              # Object file
42
    $a =   'class';         # Library file
45
    $::a =   'class';         # Library file
43
    $so =  'jar';           # Shared library
46
    $::so =  'jar';           # Shared library
44
    $exe = '.apk';          # Linked binary images
47
    $::exe = '.apk';          # Linked binary images
45
 
48
 
46
#.. Toolset specific definitions
49
#.. Toolset specific definitions
47
#
50
#
48
    Init( "android_sdk" );
51
    Init( "android_sdk" );
49
    ToolsetDefines( 'ANDROID.DEF' );
52
    ToolsetDefines( 'ANDROID.DEF' );
Line 77... Line 80...
77
 
80
 
78
our $ToolsetPROJECT_type = 'android';
81
our $ToolsetPROJECT_type = 'android';
79
sub ToolsetPROJECT
82
sub ToolsetPROJECT
80
{
83
{
81
    my( $name, $androidxml ,$pArgs, $auto_test, $unit_test, $pGenerated ) = @_;
84
    my( $name, $androidxml ,$pArgs, $auto_test, $unit_test, $pGenerated ) = @_;
-
 
85
 
-
 
86
    #
-
 
87
    #   Populate the project for the user
-
 
88
    #
82
    my $io = ToolsetPrinter::New();
89
    ToolsetPROJECTPreBuild (@_);
83
 
90
 
84
    #
91
    #
85
    #   Generate the recipe to create the project
92
    #   Generate the recipe to create the project
86
    #   Add names of co-generated targets.
93
    #   Add names of co-generated targets.
87
    #
94
    #
-
 
95
    my $me = MakeEntry::New (*MAKEFILE, 'Project_'.$name );
88
    $io->Label( "Build project", $name );
96
    $me->AddComment ("Build Android Project: $name" );
-
 
97
    $me->AddDependancy ( $androidxml );
-
 
98
    $me->AddDependancy ( '$(SCM_MAKEFILE)' );
89
    $io->Entry( "Project_$name",": $androidxml\n", " \\\n", "" , @{$pGenerated} );
99
    $me->AddDependancy ( @{$pGenerated} );
90
    $io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,)" );
100
    $me->AddRecipe ( "\$(XX_PRE)\$(call ProjectDefine_$name,)"  );
91
    $io->Newline();
101
    $me->Print();
92
 
102
 
93
    #
103
    #
94
    #   Generate the recipe to clean the project
104
    #   Generate the recipe to clean the project
95
    #
105
    #
96
    $io->Label( "Clean project", $name );
106
    $me = MakeEntry::New (*MAKEFILE, 'ProjectClean_'.$name );
97
    $io->PrtLn( "ProjectClean_$name: $androidxml" );
107
    $me->AddComment ("Clean Android Project: $name" );
98
    $io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,-clean)" );
108
    $me->AddRecipe ( "\$(XX_PRE)\$(call ProjectDefine_$name,-clean)"  );
99
    $io->Newline();
109
    $me->Print();
100
 
110
 
101
    #
111
    #
102
    #   Generate the recipe to run unit tests on the project
112
    #   Generate the recipe to run unit tests on the project
103
    #   This is optional
113
    #   This is optional
104
    #
114
    #
105
    if ( $auto_test )
115
    if ( $auto_test )
106
    {
116
    {
-
 
117
        $me = MakeEntry::New (*MAKEFILE, 'ProjectATest_'.$name );
107
        $io->Label( "Auto Test project", $name );
118
        $me->AddComment ("Auto Test project: $name" );
108
        $io->PrtLn( "ProjectATest_$name: $androidxml" );
119
        $me->AddDependancy ( $androidxml );
109
        $io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,$auto_test)" );
120
        $me->AddRecipe ( "\$(XX_PRE)\$(call ProjectDefine_$name,$auto_test)"  );
110
        $io->Newline();
121
        $me->Print();
111
    }
122
    }
112
 
123
 
113
    if ( $unit_test )
124
    if ( $unit_test )
114
    {
125
    {
-
 
126
        $me = MakeEntry::New (*MAKEFILE, 'ProjectUTest_'.$name );
115
        $io->Label( "Unit Test project", $name );
127
        $me->AddComment ("Unit Test project: $name" );
116
        $io->PrtLn( "ProjectUTest_$name: $androidxml" );
128
        $me->AddDependancy ( $androidxml );
117
        $io->PrtLn( "\t\$(XX_PRE)\$(call ProjectDefine_$name,$unit_test)" );
129
        $me->AddRecipe ( "\$(XX_PRE)\$(call ProjectDefine_$name,$unit_test)"  );
118
        $io->Newline();
130
        $me->Print();
119
    }
131
    }
120
 
132
 
121
    #
133
    #
122
    #   Generate macro to contain the project invocation
134
    #   Generate macro to contain the project invocation
123
    #   The first argument will be a 'build target' argument
135
    #   The first argument will be a 'build target' argument
124
    #
136
    #
-
 
137
    my @cmdargs;
-
 
138
    push @cmdargs, '$(GBE_PERL)','$(ANDROIDBUILDER)';
-
 
139
    push @cmdargs, '-f', $androidxml;
-
 
140
    push @cmdargs, '-i=$(PWD)/$(INTERFACEDIR)';
-
 
141
    push @cmdargs, '-t=$(GBE_TYPE)';
-
 
142
    push @cmdargs, '-pn=$(GBE_PBASE) -pv=$(BUILDVER)';
-
 
143
    push @cmdargs, @{$pArgs}, '$1';
-
 
144
 
-
 
145
    $me = MakeEntry::New (*MAKEFILE, 'ProjectDefine_'.$name, '--Define' );
125
    $io->Label( "Macro to invoke project", $name );
146
    $me->AddComment ("Macro to invoke project: $name" );
126
    $io->PrtLn( "define ProjectDefine_$name" );
147
    $me->AddRecipe ( join(' ', @cmdargs)  );
-
 
148
    $me->Print();
-
 
149
}
-
 
150
 
-
 
151
#-------------------------------------------------------------------------------
-
 
152
# Function        : ToolsetPROJECTPreBuild 
-
 
153
#
-
 
154
# Description     : This ANDROID Specific operation is used to perform some of the 
-
 
155
#                   build opertaions at 'build' time. These include:
-
 
156
#                       - Verify that required packages are available
-
 
157
#                       - Populate the targets 'libs' directory so that the user can
-
 
158
#                         develop with the external dependencies in place 
-
 
159
#
-
 
160
# Inputs          : $name             - Base name of the project
-
 
161
#                   $androidxml       - Path to the AndroidManifest.xml file
-
 
162
#                   $pArgs            - Project specific options
-
 
163
#                   $auto_test        - Unit Test Target (optional)
-
 
164
#                   $unit_test        - Unit Test Target (optional)
-
 
165
#                   $pGenerated       - Ref to an array of Generated Files (optional)
-
 
166
#
-
 
167
# Returns         : Nothing
-
 
168
#
-
 
169
sub ToolsetPROJECTPreBuild
-
 
170
{
127
    $io->PrtLn( "\t\$(GBE_PERL) \$(ANDROIDBUILDER) -f $androidxml -i=\$(PWD)/\$(INTERFACEDIR) -t=\$(GBE_TYPE) -pn=\$(GBE_PBASE) -pv=\$(BUILDVER) @{$pArgs} \$1" );
171
    my( $name, $androidxml ,$pArgs, $auto_test, $unit_test, $pGenerated ) = @_;
-
 
172
 
-
 
173
    #
-
 
174
    #   Invoke the androidBuilder in a mode so that it will populate the Eclipse project
-
 
175
    #   in a suitable manner.
-
 
176
    #
-
 
177
    #   In the build phase there is no 'debug' or 'production' phase
-
 
178
    #   Assume debug - if it needs to be determined
-
 
179
    #
128
    $io->PrtLn( "endef");
180
    EnvImport( "GBE_PERL" );
-
 
181
    System ( '--NoShell', '--Exit', $::GBE_PERL, $androidBuilder, 
-
 
182
             '-f', $androidxml,
-
 
183
             '-i', catdir( $::ScmRoot, $::ScmInterface),
-
 
184
             '-t', 'D',
-
 
185
             '-pn', $::Pbase,
-
 
186
             '-pv', $::ScmBuildVersionFull,
-
 
187
             '-populate'
129
    $io->Newline();
188
           );
130
}
189
}
131
 
190
 
-
 
191
 
132
1;
192
1;
133
 
193