Subversion Repositories DevTools

Rev

Rev 7296 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7296 dpurdie 1
########################################################################
2
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
3
#
4
# Module name   : antBuildInfo.pl
5
# Module type   : JATS Utility
6
# Compiler(s)   : Perl
7
# Environment(s): jats
8
#
9
# Description   : This utity is used by the buld system
10
#                 Its fuction is to mirror the 'jats build buildinfo' operation
11
#                 for the (old) ANT based build system.
12
#
13
# Usage         : See POD at the end of this file
14
#
15
#......................................................................#
16
 
17
require 5.008_002;
18
use strict;
19
use warnings;
20
 
21
use Pod::Usage;
22
use Getopt::Long;
23
 
24
use JatsError;
25
use JatsEnv;
26
use ConfigurationFile;
27
 
28
my $VERSION = '1.0';
29
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
30
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
31
my $opt_help = 0;
32
my $opt_manual = 0;
33
my $opt_buildInfoFile = 'BuildInfo.properties';
34
my $opt_java = '1.4';
35
 
36
 
37
 
38
#-------------------------------------------------------------------------------
39
# Function        : Mainline Entry Point
40
#
41
# Description     :
42
#
43
# Inputs          :
44
#
45
my $result = GetOptions (
46
                "help+"         => \$opt_help,              # flag, multiple use allowed
47
                "manual|man"    => \$opt_manual,            # flag
48
                "verbose:+"     => \$opt_verbose,           # flag, multiple use allowed
49
                "java=s"        => \$opt_java,
50
                "buildinfo:s"   => \$opt_buildInfoFile,
51
                );
52
 
53
                #
54
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
55
                #
56
 
57
#
58
#   Process help and manual options
59
#
60
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
61
pod2usage(-verbose => 1) if ($opt_help == 2 );
62
pod2usage(-verbose => 2) if ($opt_manual || ($opt_help > 2));
63
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ( $#ARGV >= 0 );
64
 
65
#
66
#   Configure the error reporting process now that we have the user options
67
#
68
ErrorConfig( 'name'    =>'ANTBUILDINFO',
69
             'verbose' => $opt_verbose,
70
            );
71
 
72
EnvImportOptional ( 'GBE_BUILDFILTER' );            # optional BUILD filter       
73
generateBuildInfo();
74
exit 0;
75
 
76
 
77
#-------------------------------------------------------------------------------
78
# Function        : generateBuildInfo 
79
#
80
# Description     : Using in BuildInfo mode to save the required information
81
#                   See function of the same name in buildlib.pl
82
#
83
#                   In BuildInfo mode we have all the data that we need
84
#                   Save it into a file for the build system and then exit the build process
85
#                   We do not need to do any further work at this point in time
86
#
87
# Inputs          : Globals 
88
#
89
# Returns         : This function does not return
90
#                   It will exit as there is no more work to be done
91
#                   
92
#                   Will generate a JAVA properties file with BuildInfo required by the
93
#                   Build System.
94
#
95
sub generateBuildInfo
96
{
97
    Message ("Generate BuildInfo Data: ". $opt_buildInfoFile);
98
    my @propLines = ();
99
 
100
    my $fh = ConfigurationFile::New( $opt_buildInfoFile, '--Type=Properties' );
101
    $fh->HeaderSimple( "antBuildinfo (Version $VERSION)", "BuildInfo properties" );
102
 
103
    # Build style
7326 dpurdie 104
    push @propLines, "buildstyle = ANTS";
7296 dpurdie 105
 
106
    # Current Build Filter
107
    push @propLines, "buildfilter = " . join(',', sort split(' ', $::GBE_BUILDFILTER));
108
 
109
    # All platforms that the package can be built for.
110
    #   Limited to JAVA
111
    push @propLines, "platforms = " . 'JAVA';
112
 
113
    # All platforms that the package will be built for with the current build filter
114
    #   Will be set to JAVA.
115
    #   The ANT builds will build on a specified machine architecture independently of where
116
    #   the existence of a JAVA entry in the BUILDFILTER
117
    push @propLines, "build.platforms = " . 'JAVA';
118
 
119
    # Platforms that have been specifically excluded from the build
120
    push @propLines, "excluded.platforms = ";
121
 
122
    # Platforms not known to JATS
123
    # Only works in ABT mode. Errors will be detected before this
124
    push @propLines, "unknown.platforms = ";
125
 
126
    # Toolset build information
127
    # NONE
128
 
129
    # Indication of production and debug builds
7326 dpurdie 130
    # JAVA - Assume a production build
131
    push @propLines, "prod.platforms = " . 'JAVA';
7296 dpurdie 132
    push @propLines, "debug.platforms = ";
133
 
134
    # JAVA version specified
135
    push @propLines, "java.version = " . $opt_java;
136
 
137
    $fh->WriteLn(@propLines);
138
    $fh->Close();
139
 
140
    # Display for user gratification (and build system logging)
141
    Information($opt_buildInfoFile,@propLines);
142
    exit 0;
143
}
144
 
145
#-------------------------------------------------------------------------------
146
#   Documentation
147
#
148
 
149
=pod
150
 
151
=for htmltoc    SYSUTIL::
152
 
153
=head1 NAME
154
 
155
antBuildinfo - Generate a BuildInfo file for ant builds
156
 
157
=head1 SYNOPSIS
158
 
159
jats etool antBuildInfo [options]
160
 
161
 Options:
162
    -help              - brief help message
163
    -help -help        - Detailed help message
164
    -man               - Full documentation
165
    -verbose[=n]       - Verbose operation
166
    -java=version      - Alters java version used (1.4, 1.5, 1.6)
167
    -buildinfo=path    - Specify name of the buildinfo file
168
 
169
=head1 OPTIONS
170
 
171
=over 8
172
 
173
=item B<-help>
174
 
175
Print a brief help message and exits.
176
 
177
=item B<-help -help>
178
 
179
Print a detailed help message with an explanation for each option.
180
 
181
=item B<-man>
182
 
183
Prints the manual page and exits.
184
 
185
=item B<-verbose[=n]>
186
 
187
This option will increase the level of verbosity of the command.
188
 
189
If an argument is provided, then it will be used to set the level, otherwise the
190
existing level will be incremented. This option may be specified multiple times.
191
 
192
=item B<-java=version>
193
 
194
This option will override the default java version used by the ant builds and
195
passed to the underlying programs.
196
 
197
=item B<-buildinfo>
198
 
199
This option will specify the path of a file to write the build information. 
200
The dafault value is 'BuildInfo.properties'.
201
 
202
=back
203
 
204
=head1 DESCRIPTION
205
 
206
This program will a BuildInfi.properties file as used by the build system. It is only used when 
207
building JANTs style builds and should produce a file similar t that created by 
208
the 'jats build buildinfo' command.
209
 
210
=head1 EXAMPLE
211
 
212
=head2 Generation
213
 
214
 jats etool antBuildInfo.pl -java=1.5
215
 
216
This command will generate a BuildInfo.properties file.
217
 
218
=cut
219