Subversion Repositories DevTools

Rev

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

Rev 5307 Rev 5412
Line 36... Line 36...
36
#                -t=[P|D]"                  - Build Type. Production or Debug
36
#                -t=[P|D]"                  - Build Type. Production or Debug
37
#                -pn=PackageName            - Package Name
37
#                -pn=PackageName            - Package Name
38
#                -pv=PackageVersion         - Package Version
38
#                -pv=PackageVersion         - Package Version
39
#                -clean                     - Will clean the build
39
#                -clean                     - Will clean the build
40
#                -populate                  - Test Env and Populate 'libs'
40
#                -populate                  - Test Env and Populate 'libs'
-
 
41
#                -autotest                  - Run Unit Tests
41
#               Aguments that can be provided by the user
42
#               Aguments that can be provided by the user
42
#                -Jar=name                  - Name of a Jar to include
43
#                -Jar=name                  - Name of a Jar to include
43
#                -Aar=name                  - Name of an Aar to include
44
#                -Aar=name                  - Name of an Aar to include
44
#                -lname                     - Name of a Jats library to include
45
#                -lname                     - Name of a Jats library to include
45
#                -Lname                     - Name of a 3rd party library to include
46
#                -Lname                     - Name of a 3rd party library to include
Line 79... Line 80...
79
my $opt_clean;
80
my $opt_clean;
80
my $opt_pkgname;
81
my $opt_pkgname;
81
my $opt_pkgversion;
82
my $opt_pkgversion;
82
my $opt_platform;
83
my $opt_platform;
83
my $opt_populate;
84
my $opt_populate;
-
 
85
my $opt_autotest;
84
my @opt_jlibs;                  # List of Jats Libraries
86
my @opt_jlibs;                  # List of Jats Libraries
85
my @opt_elibs;                  # List of 3rd party libraries
87
my @opt_elibs;                  # List of 3rd party libraries
86
my @opt_jars;                   # List of JARs
88
my @opt_jars;                   # List of JARs
87
my @opt_aars;                   # List of AARs
89
my @opt_aars;                   # List of AARs
88
 
90
 
Line 134... Line 136...
134
                "pn=s"          => \$opt_pkgname,       # string
136
                "pn=s"          => \$opt_pkgname,       # string
135
                "pv=s"          => \$opt_pkgversion,    # string
137
                "pv=s"          => \$opt_pkgversion,    # string
136
                "pf=s"          => \$opt_platform,      # string
138
                "pf=s"          => \$opt_platform,      # string
137
                "clean"         => \$opt_clean,         # flag
139
                "clean"         => \$opt_clean,         # flag
138
                "populate"      => \$opt_populate,      # flag
140
                "populate"      => \$opt_populate,      # flag
-
 
141
                "autotest"      => \$opt_autotest,      # flag
139
                "Jar=s"         => \@opt_jars,
142
                "Jar=s"         => \@opt_jars,
140
                "Aar=s"         => \@opt_aars,
143
                "Aar=s"         => \@opt_aars,
141
                );
144
                );
142
 
145
 
143
#
146
#
Line 307... Line 310...
307
}
310
}
308
 
311
 
309
#
312
#
310
#   Build the Android project through gradle
313
#   Build the Android project through gradle
311
#
314
#
-
 
315
my $rv = 0;
-
 
316
if ( ! $opt_autotest )
-
 
317
{
-
 
318
    #
-
 
319
    #   Build the project - does not run unit tests
-
 
320
    #       assemble all the code
-
 
321
    #       assemble code for unit tests -  does not run unit tests 
-
 
322
    #
312
Message ("Build the android project: $androidBuildSuffix");
323
    Message ("Build the android project: $androidBuildSuffix");
313
my $rv = runGradle( 'assemble' . $androidBuildSuffix);
324
    $rv = runGradle('assemble'. $androidBuildSuffix , 'assemble' . $androidBuildSuffix . 'UnitTest');
314
Error("Cannot build AndroidStudio project") if $rv;
325
    Error("Cannot build AndroidStudio project") if $rv;
-
 
326
}
-
 
327
else
-
 
328
{
-
 
329
    #
-
 
330
    #   Run unit tests - does not build the project, although it 
-
 
331
    #   will build the unit tests, but these have been buitl before
-
 
332
    #   
-
 
333
    #   If the gradle run fails, then its because one or more of the unit tests failed
-
 
334
    #   This is not a build failure as we want to process the test results and feed
-
 
335
    #   them up the chain
-
 
336
    #   
-
 
337
    #   Post processing MUST detect and report errors
-
 
338
    #
-
 
339
    Message ("Run Unit Tests within the android project: $androidBuildSuffix");
-
 
340
    $rv = runGradle('test'. $androidBuildSuffix);
-
 
341
    Message ("Unit Test reports: $rv");
-
 
342
}
315
exit(0);
343
exit(0);
316
 
344
 
317
#-------------------------------------------------------------------------------
345
#-------------------------------------------------------------------------------
318
# Function        : runGradle 
346
# Function        : runGradle 
319
#
347
#
Line 328... Line 356...
328
#
356
#
329
# Returns         : Returns the error code of the build
357
# Returns         : Returns the error code of the build
330
#
358
#
331
sub runGradle
359
sub runGradle
332
{
360
{
333
    my ($task) = @_;
361
    my (@tasks) = @_;
334
    Verbose ("runGradle: $task");
362
    Verbose ("runGradle: @tasks");
335
 
363
 
336
    #   The Windows batch file can run in debug mode
364
    #   The Windows batch file can run in debug mode
337
    #   Make sure that it doesn't by default
365
    #   Make sure that it doesn't by default
338
    $ENV{DEBUG} = "" unless $opt_verbose;
366
    $ENV{DEBUG} = "" unless $opt_verbose;
339
 
367
 
Line 356... Line 384...
356
#    push (@gradleArgs, '--debug');
384
#    push (@gradleArgs, '--debug');
357
#    push (@gradleArgs, '--stacktrace');
385
#    push (@gradleArgs, '--stacktrace');
358
    push (@gradleArgs, '--info') if $opt_verbose;
386
    push (@gradleArgs, '--info') if $opt_verbose;
359
    push (@gradleArgs, '--debug') if ($opt_verbose > 2);
387
    push (@gradleArgs, '--debug') if ($opt_verbose > 2);
360
    push (@gradleArgs, '--stacktrace') if ($opt_verbose > 3);
388
    push (@gradleArgs, '--stacktrace') if ($opt_verbose > 3);
361
    push (@gradleArgs, '-I', $initScript) unless ($task =~ m/clean/); 
389
    push (@gradleArgs, '-I', $initScript) unless ($tasks[0] =~ m/clean/); 
362
    push (@gradleArgs, '-p', $project_root);
390
    push (@gradleArgs, '-p', $project_root);
363
 
391
 
364
    my $rv = System('--NoShell', '--NoExit', $gradleProg, @gradleArgs, $task);
392
    my $rv = System('--NoShell', '--NoExit', $gradleProg, @gradleArgs, @tasks);
365
    return $rv;
393
    return $rv;
366
}
394
}
367
 
395
 
368
#-------------------------------------------------------------------------------
396
#-------------------------------------------------------------------------------
369
# Function        : createGradleFiles 
397
# Function        : createGradleFiles 
Line 415... Line 443...
415
    $data->setProperty('GBE_JARLIBS'        , NicePath($androidJars));
443
    $data->setProperty('GBE_JARLIBS'        , NicePath($androidJars));
416
    $data->setProperty('GBE_JNI_RELEASE'    , NicePath($androidJniProd));
444
    $data->setProperty('GBE_JNI_RELEASE'    , NicePath($androidJniProd));
417
    $data->setProperty('GBE_JNI_DEBUG'      , NicePath($androidJniDebug));
445
    $data->setProperty('GBE_JNI_DEBUG'      , NicePath($androidJniDebug));
418
    $data->setProperty('GBE_GRADLE_REPO'    , NicePath($gradleMavenRepo));
446
    $data->setProperty('GBE_GRADLE_REPO'    , NicePath($gradleMavenRepo));
419
 
447
 
-
 
448
    #
-
 
449
    #   Create properties for JAVA Stores
-
 
450
    #   Name of variable is based on the package name and prject suffix
-
 
451
    #       Forced to uppercase
-
 
452
    #       '-' replaced with '_'
-
 
453
    #
-
 
454
    foreach my $pkg (getPackageList())
-
 
455
    {
-
 
456
        my $base = $pkg->getBase(3);
-
 
457
        if ($base)
-
 
458
        {
-
 
459
            my $jarDir = catdir($base, 'jar');
-
 
460
            if (-d $jarDir )
-
 
461
            {
-
 
462
                $data->setProperty( $pkg->getUnifiedName('GBE_REPO_') , NicePath($jarDir));
-
 
463
            }
-
 
464
        }
-
 
465
    }
-
 
466
 
420
    $data->store( $gradleProperies );
467
    $data->store( $gradleProperies );
421
 
468
 
422
    #
469
    #
423
    #   Create the local.properties file
470
    #   Create the local.properties file
424
    #       It needs to be in the projects root directory
471
    #       It needs to be in the projects root directory