| 1532 |
dpurdie |
1 |
#! perl
|
|
|
2 |
########################################################################
|
|
|
3 |
# Copyright ( C ) 2005 ERG Limited, All rights reserved
|
|
|
4 |
#
|
|
|
5 |
# Module name : jats.sh
|
|
|
6 |
# Module type : Makefile system
|
|
|
7 |
# Compiler(s) : n/a
|
|
|
8 |
# Environment(s): jats
|
|
|
9 |
#
|
|
|
10 |
# Description : Build an Install Shield project for deployment
|
|
|
11 |
# This script isolates the IS build from the rest of
|
|
|
12 |
# the deployment process.
|
|
|
13 |
#
|
|
|
14 |
# Assumes that:
|
|
|
15 |
# IS 11.5 Standalone builder has been installed
|
|
|
16 |
# Merge Modules have been installed / updated
|
|
|
17 |
# to subdirs with the SA installation of:
|
|
|
18 |
# Modules\i386
|
|
|
19 |
# Objects
|
|
|
20 |
#
|
|
|
21 |
# Note: IS SA builder can be copied and registered
|
|
|
22 |
# The installation is very simple.
|
|
|
23 |
# Registartion: regsvr32.exe
|
|
|
24 |
#
|
|
|
25 |
# Currently this script will register the required
|
|
|
26 |
# DLL anyway.
|
|
|
27 |
#
|
|
|
28 |
# Usage : Refer to POD within this script
|
|
|
29 |
#
|
|
|
30 |
#......................................................................#
|
|
|
31 |
|
| 1556 |
lkelly |
32 |
require 5.008_006;
|
|
|
33 |
|
| 1532 |
dpurdie |
34 |
use strict;
|
|
|
35 |
use warnings;
|
|
|
36 |
use JatsError; # Error reporting
|
| 1534 |
dpurdie |
37 |
use JatsSystem; # System interface
|
| 1532 |
dpurdie |
38 |
use Win32::OLE; # load the Win32::OLE module
|
|
|
39 |
use Pod::Usage; # required for help support
|
|
|
40 |
use Getopt::Long; # Parse input options
|
|
|
41 |
use Cwd; # Where am I
|
|
|
42 |
use File::Copy; # Transfer files
|
|
|
43 |
use File::Path;
|
|
|
44 |
use File::Find; # Ony for kludge copy
|
|
|
45 |
use FileUtils;
|
|
|
46 |
|
|
|
47 |
my $VERSION = "1.0.0"; # Update this
|
|
|
48 |
|
|
|
49 |
#
|
|
|
50 |
# Globals
|
|
|
51 |
#
|
|
|
52 |
my $opt_debug = $ENV{'GBE_DEBUG'}; # Allow global debug
|
|
|
53 |
my $opt_verbose = $ENV{'GBE_VERBOSE'}; # Allow global verbose
|
|
|
54 |
my $opt_help = 0;
|
|
|
55 |
my $opt_manual;
|
|
|
56 |
|
|
|
57 |
my $opt_read_only = 1;
|
|
|
58 |
my $opt_use_sa = 1;
|
|
|
59 |
my $opt_build = 1;
|
|
|
60 |
my $opt_project;
|
|
|
61 |
my $opt_new_codes;
|
|
|
62 |
my $opt_name;
|
|
|
63 |
my $opt_version;
|
|
|
64 |
my $opt_suffix;
|
|
|
65 |
my $opt_outpath;
|
|
|
66 |
my @opt_mergemodule;
|
|
|
67 |
my $opt_workdir;
|
| 1538 |
dpurdie |
68 |
my $opt_name_version = 1;
|
| 1564 |
dpurdie |
69 |
my $opt_multi_prod = 0;
|
|
|
70 |
my $opt_multi_rel = 0;
|
| 1532 |
dpurdie |
71 |
|
|
|
72 |
#
|
|
|
73 |
# Kludgy values
|
|
|
74 |
# May need to be configured
|
|
|
75 |
# These are current IS 11.5 install locations
|
|
|
76 |
#
|
|
|
77 |
my $AutoBuilder = 'C:\Program Files\Macrovision\IS 11.5 StandaloneBuild';
|
|
|
78 |
my $result_code = 0;
|
|
|
79 |
|
|
|
80 |
#-------------------------------------------------------------------------------
|
|
|
81 |
# Function : Mainline Entry Point
|
|
|
82 |
#
|
|
|
83 |
# Description :
|
|
|
84 |
#
|
|
|
85 |
# Inputs :
|
|
|
86 |
#
|
|
|
87 |
my $result = GetOptions (
|
|
|
88 |
"help+" => \$opt_help, # flag, multiple use allowed
|
|
|
89 |
"manual" => \$opt_manual, # flag
|
|
|
90 |
"verbose+" => \$opt_verbose, # flag, multiple use allowed
|
|
|
91 |
"readonly!" => \$opt_read_only, # [no]flag
|
|
|
92 |
"standalone!" => \$opt_use_sa, # [no]flag
|
|
|
93 |
"build!" => \$opt_build, # [no]flag
|
|
|
94 |
"project=s" => \$opt_project, # string
|
|
|
95 |
"codes!" => \$opt_new_codes, # [no]flag
|
|
|
96 |
"version=s" => \$opt_version, # string
|
|
|
97 |
"out=s" => \$opt_outpath, # string
|
|
|
98 |
"mergemodule=s" => \@opt_mergemodule, # string
|
|
|
99 |
"workdir=s" => \$opt_workdir, # string
|
| 1538 |
dpurdie |
100 |
"nameversion!" => \$opt_name_version, # [no]flag
|
| 1564 |
dpurdie |
101 |
"multiprod!" => \$opt_multi_prod, # [no]flag no by default
|
|
|
102 |
"multirel!" => \$opt_multi_rel # [no]flag no by default
|
| 1532 |
dpurdie |
103 |
);
|
|
|
104 |
|
|
|
105 |
#
|
|
|
106 |
# UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
|
|
|
107 |
#
|
|
|
108 |
|
|
|
109 |
#
|
|
|
110 |
# Process help and manual options
|
|
|
111 |
#
|
|
|
112 |
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
|
|
|
113 |
pod2usage(-verbose => 1) if ($opt_help == 2 );
|
|
|
114 |
pod2usage(-verbose => 2) if ($opt_manual || ($opt_help > 2));
|
|
|
115 |
#pod2usage(-verbose => 0, -message => "Version: $VERSION") if ( $#ARGV < 0 );
|
|
|
116 |
|
|
|
117 |
#
|
|
|
118 |
# Configure the error reporting process now that we have the user options
|
|
|
119 |
#
|
|
|
120 |
ErrorConfig( 'name' =>'ISBUILD',
|
|
|
121 |
'verbose' => $opt_verbose,
|
|
|
122 |
);
|
|
|
123 |
|
|
|
124 |
#
|
|
|
125 |
# User must specify a project or we will attempt to locate one
|
|
|
126 |
#
|
|
|
127 |
Verbose ("Current directory: " . getcwd );
|
|
|
128 |
unless ( $opt_project )
|
|
|
129 |
{
|
|
|
130 |
my @projects = glob ('*.ism' );
|
|
|
131 |
Error ("No InstallShield projects found in current directory") unless ( $#projects >= 0 );
|
|
|
132 |
Error ( "Multiple Install Shield projects located. Use -project option") if ( $#projects > 0 );
|
|
|
133 |
$opt_project = $projects[0];
|
|
|
134 |
}
|
|
|
135 |
else
|
|
|
136 |
{
|
|
|
137 |
Error ("Project file not found: $opt_project") unless ( -f $opt_project );
|
|
|
138 |
}
|
|
|
139 |
#
|
|
|
140 |
# Determine project name from the project file name
|
|
|
141 |
# - remove any path information
|
|
|
142 |
# - remove .ism extension
|
|
|
143 |
#
|
|
|
144 |
$opt_name = $opt_project;
|
|
|
145 |
$opt_name =~ s~\\~/~g;
|
|
|
146 |
$opt_name =~ s~.*/~~;
|
|
|
147 |
$opt_name =~ s~\.ism$~~i;
|
|
|
148 |
|
|
|
149 |
#
|
|
|
150 |
# User must specify a version
|
|
|
151 |
# This will be processed and used within the build
|
|
|
152 |
#
|
|
|
153 |
Error ("Version must be specified") unless ( $opt_version );
|
|
|
154 |
Error ("Bad format for version: $opt_version") unless ( $opt_version =~ m~(\d+\.\d+\.\d+)\.(\w+)$~ );
|
|
|
155 |
$opt_version = $1;
|
|
|
156 |
$opt_suffix = $2;
|
|
|
157 |
Error ("Project suffix not found in version") unless ( $opt_suffix );
|
|
|
158 |
Message( "Package: $opt_name, Version: $opt_version, Project: $opt_suffix");
|
|
|
159 |
|
|
|
160 |
#
|
|
|
161 |
# Output path must exist
|
|
|
162 |
#
|
|
|
163 |
if ( $opt_outpath )
|
|
|
164 |
{
|
|
|
165 |
Error("Output path does not exist: $opt_outpath") unless ( -e $opt_outpath );
|
|
|
166 |
Error("Output path is not a directory: $opt_outpath") unless ( -d $opt_outpath );
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
#
|
|
|
170 |
# Workdir path must exist
|
|
|
171 |
#
|
|
|
172 |
$opt_workdir = getcwd unless( $opt_workdir );
|
|
|
173 |
Error("Workdir path does not exist: $opt_outpath") unless ( -e $opt_workdir );
|
|
|
174 |
Error("Workdir path is not a directory: $opt_outpath") unless ( -d $opt_workdir );
|
|
|
175 |
|
|
|
176 |
#
|
|
|
177 |
# Process Merge Module paths
|
|
|
178 |
#
|
|
|
179 |
if ( @opt_mergemodule )
|
|
|
180 |
{
|
|
|
181 |
#
|
|
|
182 |
# User may have entered a comma seperated list
|
|
|
183 |
# Convert into a full array
|
|
|
184 |
#
|
|
|
185 |
@opt_mergemodule = split(/,/,join(',',@opt_mergemodule));
|
|
|
186 |
|
|
|
187 |
#
|
|
|
188 |
# Ensure that each path exists
|
|
|
189 |
# Clean up paths
|
|
|
190 |
#
|
|
|
191 |
foreach my $path ( @opt_mergemodule )
|
|
|
192 |
{
|
|
|
193 |
Warning ("MergeModule path not found: $path" ) unless ( -d $path );
|
|
|
194 |
$path =~ s~/~\\~g;
|
|
|
195 |
}
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
#
|
|
|
200 |
# Instantiate the Developer Automation interface
|
|
|
201 |
# Use the StandAlone interface if it can be found
|
|
|
202 |
#
|
|
|
203 |
my $dev;
|
|
|
204 |
if ( $opt_use_sa )
|
|
|
205 |
{
|
|
|
206 |
Message "Using StandAlone OLE";
|
|
|
207 |
|
|
|
208 |
#
|
|
|
209 |
# Ensure the interface is registered
|
|
|
210 |
# This allows a simple 'copy' of the SA build environment to a build
|
|
|
211 |
# machine.
|
|
|
212 |
#
|
|
|
213 |
my $regdll = $AutoBuilder . '\SAAuto1150.dll' ;
|
|
|
214 |
Error ("Cannot find SA OLE DLL: $regdll") unless ( -f $regdll );
|
|
|
215 |
|
|
|
216 |
my $rv = System( 'regsvr32.exe', '/s', $regdll);
|
|
|
217 |
Error ("Failed to register $regdll: $rv" ) if ( $rv );
|
|
|
218 |
|
|
|
219 |
$dev = Win32::OLE->new("SAAuto1150.ISWiProject");
|
|
|
220 |
|
|
|
221 |
} else {
|
|
|
222 |
Message "Using InstallShield OLE";
|
|
|
223 |
$dev = Win32::OLE->new("IswiAuto1150.ISWiProject");
|
|
|
224 |
|
|
|
225 |
}
|
|
|
226 |
Error( "Cannot open Automation interface") unless ( $dev );
|
|
|
227 |
|
|
|
228 |
#
|
|
|
229 |
# Open a project as read-write
|
|
|
230 |
# The second argument ( if true ) will open as read only
|
|
|
231 |
#
|
|
|
232 |
Verbose ("Opening project: $opt_project, ReadOnly: $opt_read_only" );
|
|
|
233 |
$dev->OpenProject( $opt_project, $opt_read_only );
|
|
|
234 |
my $estring = Win32::OLE->LastError();
|
|
|
235 |
Error( $estring ) if ( $estring );
|
|
|
236 |
Verbose ("Project Open");
|
|
|
237 |
|
|
|
238 |
#DebugDumpData("Dev", $dev );
|
|
|
239 |
|
|
|
240 |
#
|
| 1538 |
dpurdie |
241 |
# Massage the ProductName [ if required ]
|
| 1532 |
dpurdie |
242 |
# Should contain a comma<space><version>
|
|
|
243 |
#
|
| 1538 |
dpurdie |
244 |
if ( $opt_name_version )
|
| 1532 |
dpurdie |
245 |
{
|
| 1538 |
dpurdie |
246 |
Verbose( "Update ProductName" );
|
|
|
247 |
Verbose( "Originial ProductName :" . $dev->ProductName);
|
|
|
248 |
my $product_name = $dev->ProductName;
|
|
|
249 |
if ( $product_name =~ m/^(.*),/ )
|
|
|
250 |
{
|
|
|
251 |
$product_name = $1;
|
|
|
252 |
}
|
|
|
253 |
$product_name .= ', ' . $opt_version . '.' . $opt_suffix;
|
|
|
254 |
$dev->SetProperty('ProductName', $product_name );
|
| 1532 |
dpurdie |
255 |
}
|
|
|
256 |
Message( "ProductName :" . $dev->ProductName);
|
|
|
257 |
|
|
|
258 |
#
|
|
|
259 |
# Massage the ProjectVersion
|
|
|
260 |
# This will not have the project suffix on it
|
|
|
261 |
#
|
|
|
262 |
Verbose( "Update ProductVersion" );
|
|
|
263 |
Verbose( "Original ProductVersion:" . $dev->ProductVersion);
|
|
|
264 |
$dev->SetProperty('ProductVersion', $opt_version );
|
|
|
265 |
Message ("ProductVersion:" . $dev->ProductVersion);
|
|
|
266 |
|
|
|
267 |
#
|
|
|
268 |
# If we need to generate new codes
|
|
|
269 |
#
|
|
|
270 |
if ( $opt_new_codes )
|
|
|
271 |
{
|
|
|
272 |
Message ("Update GUIDs");
|
|
|
273 |
$dev->SetProperty('PackageCode', $dev->GenerateGUID() );
|
|
|
274 |
$dev->SetProperty('ProductCode', $dev->GenerateGUID() );
|
|
|
275 |
$dev->SetProperty('UpgradeCode', $dev->GenerateGUID() );
|
|
|
276 |
}
|
|
|
277 |
Message ("PackageCode :" . $dev->PackageCode );
|
|
|
278 |
Message ("ProductCode :" . $dev->ProductCode );
|
|
|
279 |
Message ("UpgradeCode :" . $dev->UpgradeCode );
|
|
|
280 |
|
|
|
281 |
#
|
|
|
282 |
# Examine all components and display the files within each
|
|
|
283 |
# The files are a collection and need to be processed in a special manner
|
|
|
284 |
#
|
|
|
285 |
if ( $opt_verbose )
|
|
|
286 |
{
|
|
|
287 |
Verbose ("InstallShield Components");
|
|
|
288 |
my $mycomps = $dev->ISWiComponents;
|
|
|
289 |
foreach my $comp (in $mycomps)
|
|
|
290 |
{
|
|
|
291 |
Verbose ("Component: " . $comp->Name, ": ", $comp->Destination );
|
|
|
292 |
|
|
|
293 |
my $files = $comp->ISWiFiles;
|
|
|
294 |
my $fileCount = $files->Count;
|
|
|
295 |
Verbose ("Number of Files: $fileCount");
|
|
|
296 |
|
|
|
297 |
foreach my $index ( 1 .. $fileCount )
|
|
|
298 |
{
|
|
|
299 |
Verbose (" Name: " . $files->Item($index)->Name );
|
|
|
300 |
Verbose (" DisplayName: " . $files->Item($index)->DisplayName );
|
|
|
301 |
Verbose (" FullPath: " . $files->Item($index)->FullPath );
|
|
|
302 |
}
|
|
|
303 |
}
|
|
|
304 |
}
|
|
|
305 |
|
|
|
306 |
#
|
|
|
307 |
# Examine all the Features
|
|
|
308 |
#
|
|
|
309 |
if ( $opt_verbose )
|
|
|
310 |
{
|
|
|
311 |
Verbose ("InstallShield Features");
|
|
|
312 |
my $myfeature = $dev->ISWiFeatures;
|
|
|
313 |
foreach my $feat (in $myfeature)
|
|
|
314 |
{
|
|
|
315 |
Verbose ("Feature: " . $feat->Name, ": ", $feat->Description );
|
|
|
316 |
}
|
|
|
317 |
}
|
|
|
318 |
|
|
|
319 |
#
|
|
|
320 |
# Display Releases
|
|
|
321 |
# These are found within the product config
|
|
|
322 |
# We need to locate the Release in order to build it
|
|
|
323 |
#
|
|
|
324 |
Verbose ("InstallShield Products");
|
|
|
325 |
my $products = $dev->ISWiProductConfigs;
|
| 1564 |
dpurdie |
326 |
|
|
|
327 |
# if we are building check to make sure -multiprod is enabled if more than 1 product configuration is configured
|
|
|
328 |
# and/or more than 1 release per product configuration
|
|
|
329 |
if ( $opt_build )
|
|
|
330 |
{
|
|
|
331 |
Error("Multiple Product Configurations found, -multiprod must be specified to build them all")
|
|
|
332 |
if ( $products->Count > 1 && !$opt_multi_prod );
|
|
|
333 |
|
|
|
334 |
foreach my $p ( 1 .. $products->Count )
|
|
|
335 |
{
|
|
|
336 |
Error("Multiple Releases found for a Product Configuration, -multirel must be specified to build them all")
|
|
|
337 |
if ( $products->Item($p)->ISWiReleases->Count > 1 && !$opt_multi_rel );
|
|
|
338 |
}
|
|
|
339 |
}
|
|
|
340 |
|
|
|
341 |
|
| 1532 |
dpurdie |
342 |
foreach my $index ( 1 .. $products->Count )
|
|
|
343 |
{
|
|
|
344 |
my $product = $products->Item($index);
|
|
|
345 |
|
|
|
346 |
Verbose ("Product Index : " . $index );
|
|
|
347 |
Verbose (" Product Name : " . $product->Name );
|
|
|
348 |
Verbose (" SetupFileName: " . $product->SetupFileName );
|
|
|
349 |
|
|
|
350 |
my $releases = $product->ISWiReleases;
|
|
|
351 |
foreach my $index ( 1 .. $releases->Count )
|
|
|
352 |
{
|
|
|
353 |
my $release = $releases->Item($index);
|
|
|
354 |
|
|
|
355 |
Verbose ("Release Index : " . $index );
|
|
|
356 |
Verbose (" Name : " . $release->Name );
|
|
|
357 |
Verbose (" BuildLocation : " . $release->BuildLocation );
|
|
|
358 |
Verbose (" SingleEXEFileName: " . ( $release->SingleEXEFileName || 'None Specified' ) );
|
|
|
359 |
|
|
|
360 |
#
|
|
|
361 |
# Build the Project
|
|
|
362 |
# Not working at the moment !!!!
|
|
|
363 |
#
|
|
|
364 |
if ( $opt_build )
|
|
|
365 |
{
|
|
|
366 |
Message ("Building...");
|
|
|
367 |
|
|
|
368 |
#
|
|
|
369 |
# Set build location
|
|
|
370 |
#
|
|
|
371 |
my $location = $opt_workdir . '/Media';
|
|
|
372 |
$location =~ s~/~\\~g;
|
|
|
373 |
$release->SetProperty('BuildLocation', $location );
|
| 1564 |
dpurdie |
374 |
Message ("New BuildLocation: " . $release->BuildLocation );
|
| 1532 |
dpurdie |
375 |
|
| 1564 |
dpurdie |
376 |
#
|
|
|
377 |
# Massage the ProductName [ if required ]
|
|
|
378 |
# Only update ProductName for this product Configuration if nameversion is supplied and the
|
|
|
379 |
# product Configuration has a product Name.
|
|
|
380 |
# This overrides the default project product name for this product Configuration.
|
|
|
381 |
# Should contain a comma<space><version>
|
|
|
382 |
#
|
|
|
383 |
if ( $opt_name_version && $product->ProductName ne "" )
|
|
|
384 |
{
|
|
|
385 |
Verbose( "Update ProductName for this Product Configuration" );
|
|
|
386 |
Verbose( "Originial ProductName :" . $product->ProductName);
|
|
|
387 |
my $product_name = $product->ProductName;
|
|
|
388 |
if ( $product_name =~ m/^(.*),/ )
|
|
|
389 |
{
|
|
|
390 |
$product_name = $1;
|
|
|
391 |
}
|
|
|
392 |
$product_name .= ', ' . $opt_version . '.' . $opt_suffix;
|
|
|
393 |
$product->SetProperty('ProductName', $product_name );
|
|
|
394 |
Message( "New ProductName :" . $product->ProductName);
|
|
|
395 |
}
|
| 1532 |
dpurdie |
396 |
|
|
|
397 |
#
|
| 1564 |
dpurdie |
398 |
# Update the Product version [ if required ]
|
|
|
399 |
# Only update Product Version for this Product Configuration if the current Product
|
|
|
400 |
# Version has a value.
|
|
|
401 |
# This overrides the default project version for this product Configuration.
|
|
|
402 |
#
|
|
|
403 |
if ( $product->ProductVersion ne "" )
|
|
|
404 |
{
|
|
|
405 |
Verbose( "Update ProductVersion for this Product Configuration" );
|
|
|
406 |
Verbose( "Original ProductVersion:" . $product->ProductVersion);
|
|
|
407 |
$product->SetProperty('ProductVersion', $opt_version );
|
|
|
408 |
Message ("New ProductVersion:" . $product->ProductVersion);
|
|
|
409 |
}
|
|
|
410 |
|
|
|
411 |
#
|
| 1532 |
dpurdie |
412 |
# If building with the Standalone interface will need to set
|
|
|
413 |
# up the merge module paths
|
|
|
414 |
#
|
|
|
415 |
if ( $opt_use_sa )
|
|
|
416 |
{
|
|
|
417 |
foreach my $dir ( @opt_mergemodule )
|
|
|
418 |
{
|
|
|
419 |
Error ("MergeModule Directory not found: $dir") unless ( -d $dir );
|
|
|
420 |
Verbose( "Merge Module Search Path:", $dir );
|
|
|
421 |
}
|
|
|
422 |
$dev->SetProperty('MergeModuleSearchPath', join (',', @opt_mergemodule));
|
|
|
423 |
Verbose2 ( "MergeModulePath: " . $dev->MergeModuleSearchPath );
|
|
|
424 |
|
|
|
425 |
#
|
|
|
426 |
# See comments in this function
|
|
|
427 |
#
|
|
|
428 |
kludge_merge_module_stuff(@opt_mergemodule);
|
|
|
429 |
}
|
|
|
430 |
|
|
|
431 |
#
|
|
|
432 |
# Set thename of the setup file
|
|
|
433 |
# This contains the build name and number
|
|
|
434 |
#
|
|
|
435 |
Verbose ("Setting Setup Filename");
|
|
|
436 |
Verbose2 ( "Initial SetupFileName: " . $product->SetupFileName );
|
| 1564 |
dpurdie |
437 |
my $setup_name = $opt_name . '-';
|
|
|
438 |
$setup_name .= $product->Name . '-' if ($opt_multi_prod);
|
|
|
439 |
$setup_name .= $release->Name . '-' if ($opt_multi_rel);
|
|
|
440 |
$setup_name .= $dev->ProductVersion
|
|
|
441 |
. '.'
|
|
|
442 |
. $opt_suffix
|
|
|
443 |
. '-WIN32';
|
| 1532 |
dpurdie |
444 |
|
|
|
445 |
$product->SetProperty('SetupFileName', $setup_name );
|
|
|
446 |
Message( "SetupFileName: " . $product->SetupFileName );
|
|
|
447 |
|
|
|
448 |
#
|
| 1566 |
dpurdie |
449 |
# Determine the directory IS will use for logging
|
|
|
450 |
# Note: $logdir has spaces in the name and requires special care
|
|
|
451 |
#
|
|
|
452 |
my $logdir = $release->BuildLocation . "/ishield package/Release/LogFiles";
|
|
|
453 |
$logdir =~ tr~\\/~/~s;
|
|
|
454 |
|
|
|
455 |
#
|
|
|
456 |
# Delete old log files
|
|
|
457 |
#
|
|
|
458 |
if ( opendir (my $ld, $logdir) )
|
|
|
459 |
{
|
|
|
460 |
my @dirlist = readdir $ld;
|
|
|
461 |
closedir $ld;
|
|
|
462 |
|
|
|
463 |
foreach my $logfile ( @dirlist )
|
|
|
464 |
{
|
|
|
465 |
next unless ( $logfile =~ m~\.txt$~i );
|
|
|
466 |
unlink $logdir . '/' . $logfile;
|
|
|
467 |
}
|
|
|
468 |
}
|
|
|
469 |
|
|
|
470 |
#
|
| 1532 |
dpurdie |
471 |
# Perform the build and report errors and warnings
|
|
|
472 |
#
|
|
|
473 |
$release->Build;
|
|
|
474 |
$result_code = $release->BuildErrorCount;
|
|
|
475 |
Message ("Build Error Count : " . $release->BuildErrorCount );
|
|
|
476 |
Message ("Build Warning Count: " . $release->BuildWarningCount );
|
|
|
477 |
|
|
|
478 |
#
|
| 1566 |
dpurdie |
479 |
# Display log file ( if an error has been seen )
|
|
|
480 |
# There should be only ONE log file
|
|
|
481 |
# Reconfigure error reporting system to simplify logging
|
|
|
482 |
#
|
|
|
483 |
if ( $result_code || IsVerbose(1) )
|
|
|
484 |
{
|
|
|
485 |
if ( opendir (my $ld, $logdir) )
|
|
|
486 |
{
|
|
|
487 |
my @dirlist = readdir $ld;
|
|
|
488 |
closedir $ld;
|
|
|
489 |
|
|
|
490 |
foreach my $logfile ( @dirlist )
|
|
|
491 |
{
|
|
|
492 |
next unless ( $logfile =~ m~\.txt$~i );
|
|
|
493 |
Message ("Dumping InstallShield Log File: $logfile");
|
|
|
494 |
my $estate = ErrorReConfig ('name' => 'ISLOG');
|
|
|
495 |
if ( open (my $lf, "<", $logdir . '/' . $logfile) )
|
|
|
496 |
{
|
|
|
497 |
while ( <$lf> )
|
|
|
498 |
{
|
|
|
499 |
$_ =~ s~\s+$~~;
|
|
|
500 |
Message ( $_ );
|
|
|
501 |
}
|
|
|
502 |
close $lf;
|
|
|
503 |
}
|
|
|
504 |
else
|
|
|
505 |
{
|
|
|
506 |
Warning ("Can't open file: $logfile", "Reason: $!" );
|
|
|
507 |
}
|
|
|
508 |
}
|
|
|
509 |
}
|
|
|
510 |
else
|
|
|
511 |
{
|
|
|
512 |
Warning( "InstallShield Log dir not found: $logdir")
|
|
|
513 |
}
|
|
|
514 |
}
|
|
|
515 |
|
|
|
516 |
#
|
| 1532 |
dpurdie |
517 |
# Transfer the result file to the user
|
|
|
518 |
#
|
|
|
519 |
if ( $result_code == 0 && $opt_outpath )
|
|
|
520 |
{
|
|
|
521 |
Message("Transfer output file: $opt_outpath");
|
| 1564 |
dpurdie |
522 |
my $ofile = $location . "/" . $product->Name . "/" . $release->Name . "/DiskImages/DISK1/" . $setup_name . '.exe';
|
| 1532 |
dpurdie |
523 |
Error ("Build output file not found", "Expected: $ofile" ) unless ( -f $ofile );
|
|
|
524 |
|
|
|
525 |
File::Copy::copy( $ofile, $opt_outpath) ||
|
|
|
526 |
Error ("Did not transfer InstallShield output file", $ofile, $opt_outpath);
|
|
|
527 |
}
|
|
|
528 |
}
|
|
|
529 |
}
|
|
|
530 |
}
|
|
|
531 |
|
|
|
532 |
#
|
|
|
533 |
# Save and Close the project
|
|
|
534 |
# Release the OLE data
|
|
|
535 |
#
|
|
|
536 |
$dev->SaveProject( ) unless ($opt_read_only);
|
|
|
537 |
$dev->CloseProject( );
|
|
|
538 |
undef $dev;
|
|
|
539 |
|
|
|
540 |
#
|
|
|
541 |
# Return build result to the user
|
|
|
542 |
#
|
|
|
543 |
exit $result_code;
|
|
|
544 |
|
|
|
545 |
#-------------------------------------------------------------------------------
|
|
|
546 |
# Function : kludge_merge_module_stuff
|
|
|
547 |
#
|
|
|
548 |
# Description : Handle BUG in the SA builder
|
|
|
549 |
#
|
|
|
550 |
# The current version of InstallShield StandAlone Builder has a bug associated
|
|
|
551 |
# with the processing of Merge Modules
|
|
|
552 |
#
|
|
|
553 |
# It would appear that the search path is not fully used
|
|
|
554 |
# There is a interaction between the ObjectGallery directory and
|
|
|
555 |
# the processing of Merge modules.
|
|
|
556 |
#
|
|
|
557 |
# The problem (that I see) is solved by deleting the ObjectGallery
|
|
|
558 |
# but InstallShield do not recomment this solution.
|
|
|
559 |
#
|
|
|
560 |
# They recommend that the Object and Modules be copied into the
|
|
|
561 |
# 'C:\Program Files\Macrovision\IS 11.5 StandaloneBuild' directory
|
|
|
562 |
# There are a few bug reports out for this one.
|
|
|
563 |
# With luck this problem will be solved and this code can be removed
|
|
|
564 |
#
|
|
|
565 |
# The solution that I have taken is to transfer the Object and
|
|
|
566 |
# Modules directories as suggseted. This is UGLY:
|
|
|
567 |
# Makes the build single user
|
|
|
568 |
# Modifies the build environment
|
|
|
569 |
# Time consuming
|
|
|
570 |
#
|
|
|
571 |
#
|
|
|
572 |
#
|
|
|
573 |
# Inputs : List of Merge Module paths
|
|
|
574 |
#
|
|
|
575 |
# Returns : Nothing
|
|
|
576 |
#
|
|
|
577 |
my $kludge_copy_dir_len;
|
|
|
578 |
my $kludge_copy_dir;
|
|
|
579 |
|
|
|
580 |
sub kludge_merge_module_stuff
|
|
|
581 |
{
|
|
|
582 |
my (@mergemodules) = @_;
|
|
|
583 |
foreach my $dir ( @mergemodules )
|
|
|
584 |
{
|
|
|
585 |
next if ( $dir =~ m/Merge Modules$/ );
|
|
|
586 |
Message("KLUDGE copy: [$dir] to [$AutoBuilder]");
|
|
|
587 |
$kludge_copy_dir = $dir;
|
|
|
588 |
$kludge_copy_dir =~ s~\\+~/~g;
|
|
|
589 |
$kludge_copy_dir =~ s~/$~~;
|
| 1556 |
lkelly |
590 |
$kludge_copy_dir =~ m~(.+/MergeModules)/~;
|
|
|
591 |
$kludge_copy_dir_len = length($1);
|
| 1532 |
dpurdie |
592 |
|
|
|
593 |
File::Find::find( \&kludge_copy, $dir);
|
|
|
594 |
}
|
|
|
595 |
}
|
|
|
596 |
|
|
|
597 |
sub kludge_copy
|
|
|
598 |
{
|
|
|
599 |
my $item = $File::Find::name;
|
|
|
600 |
my $base = $_;
|
|
|
601 |
my $tpath = $AutoBuilder . substr( $item, $kludge_copy_dir_len );
|
|
|
602 |
|
|
|
603 |
if ( -d $item )
|
|
|
604 |
{
|
|
|
605 |
unless ( -d $tpath )
|
|
|
606 |
{
|
|
|
607 |
Verbose( "Create Directory: $tpath");
|
|
|
608 |
mkpath("$tpath", 1, 0775) || Error ("Cannot mkdir: $tpath");
|
|
|
609 |
}
|
|
|
610 |
}
|
|
|
611 |
else
|
|
|
612 |
{
|
|
|
613 |
if ( FileIsNewer( $item, $tpath ) )
|
|
|
614 |
{
|
|
|
615 |
Verbose ("Copy File: tpath");
|
|
|
616 |
File::Copy::copy($item, $tpath) || Error("Copying: $tpath");
|
|
|
617 |
}
|
|
|
618 |
}
|
|
|
619 |
}
|
|
|
620 |
|
|
|
621 |
#-------------------------------------------------------------------------------
|
|
|
622 |
# Documentation
|
|
|
623 |
#
|
|
|
624 |
|
|
|
625 |
=pod
|
|
|
626 |
|
|
|
627 |
=head1 NAME
|
|
|
628 |
|
|
|
629 |
isbuild - Build an Install Shield Project
|
|
|
630 |
|
|
|
631 |
=head1 SYNOPSIS
|
|
|
632 |
|
|
|
633 |
jats eprog isbuild.pl [options]
|
|
|
634 |
|
|
|
635 |
Options:
|
|
|
636 |
-help - brief help message
|
|
|
637 |
-help -help - Detailed help message
|
|
|
638 |
-man - Full documentation
|
|
|
639 |
-version=version - Specify build version
|
|
|
640 |
-project=name - Specifies the project to process
|
|
|
641 |
-out=path - Output directory (optional)
|
|
|
642 |
-mergemodule=path - Path to one or more merge modules
|
|
|
643 |
-workdir=path - Path to working directory base
|
|
|
644 |
-[no]readonly - Open project in readonly mode
|
|
|
645 |
-[no]standalone - Use SA or IS automation interface
|
|
|
646 |
-[no]build - Build project
|
|
|
647 |
-[no]codes - Modify GUID codes in release
|
| 1538 |
dpurdie |
648 |
-[no]nameversion - Add Version info to ProductName (default)
|
| 1564 |
dpurdie |
649 |
-[no]multiprod - Builds multiple product configurations (off by default)
|
|
|
650 |
-[no]multirel - Builds multiple releases per product configuration (off by default)
|
| 1532 |
dpurdie |
651 |
|
|
|
652 |
=head1 OPTIONS
|
|
|
653 |
|
|
|
654 |
=over 8
|
|
|
655 |
|
|
|
656 |
=item B<-help>
|
|
|
657 |
|
|
|
658 |
Print a brief help message and exits.
|
|
|
659 |
|
|
|
660 |
=item B<-help -help>
|
|
|
661 |
|
|
|
662 |
Print a detailed help message with an explanation for each option.
|
|
|
663 |
|
|
|
664 |
=item B<-man>
|
|
|
665 |
|
|
|
666 |
Prints the manual page and exits.
|
|
|
667 |
|
|
|
668 |
=item B<-version=version>
|
|
|
669 |
|
|
|
670 |
This option is essential. It is used to specify the output package version.
|
|
|
671 |
The version information will be inserted in the InstallShield project before
|
|
|
672 |
it is compiled.
|
|
|
673 |
|
|
|
674 |
=item B<-project=name>
|
|
|
675 |
|
|
|
676 |
This option specifies the InstallShield project to be processed. If not project
|
|
|
677 |
name is specified then this script will locate an '.ism' file in the current
|
|
|
678 |
directory and use it. Multiple '.ism' files are not supported.
|
|
|
679 |
|
|
|
680 |
=item B<-out=path>
|
|
|
681 |
|
|
|
682 |
Specifies the output path. If specified the InstallShield project will by
|
|
|
683 |
moved to this directory, if it is build successfully.
|
|
|
684 |
|
|
|
685 |
The path must exist and it must be a directory.
|
|
|
686 |
|
|
|
687 |
=item B<-mergemodule=path>
|
|
|
688 |
|
|
|
689 |
This option specifies one or more merge module paths to be used by the Install
|
|
|
690 |
Shield compiler. Multiple paths may be specified with multiple directives or
|
|
|
691 |
as a comma seperated list.
|
|
|
692 |
|
|
|
693 |
=item B<-workdir=path>
|
|
|
694 |
|
|
|
695 |
This option specifies the path of a directory in which this program will create
|
|
|
696 |
its working directory. If not specified then the current directory will be
|
|
|
697 |
used.
|
|
|
698 |
|
|
|
699 |
=item B<-readony>
|
|
|
700 |
|
|
|
701 |
Open the project in readonly mode. This is the default
|
|
|
702 |
Changes to the project are not written back.
|
|
|
703 |
|
|
|
704 |
=item B<-standalone>
|
|
|
705 |
|
|
|
706 |
Invoke the StandAlone Install Shield builder. This is the default.
|
|
|
707 |
|
|
|
708 |
If B<-nostandalone> is specified then the InstallShield IDE Automation interface
|
|
|
709 |
is used. This may not be the same as that on the build machine.
|
|
|
710 |
|
|
|
711 |
=item B<-build>
|
|
|
712 |
|
|
|
713 |
Build the project. This is the default mode of operation.
|
|
|
714 |
|
|
|
715 |
If B<-nobuild> is specified then the project will not be built. All other
|
|
|
716 |
operations will be performed.
|
|
|
717 |
|
|
|
718 |
|
|
|
719 |
=item B<-codes>
|
|
|
720 |
|
|
|
721 |
If specified then the following GUID elements are rolled:
|
|
|
722 |
|
|
|
723 |
=over 8
|
|
|
724 |
|
|
|
725 |
=item * PackageCode
|
|
|
726 |
|
|
|
727 |
=item * ProductCode
|
|
|
728 |
|
|
|
729 |
=item * UpgradeCode
|
|
|
730 |
|
|
|
731 |
=back
|
|
|
732 |
|
|
|
733 |
The default operation is to NOT roll the specified GUID elements.
|
|
|
734 |
|
| 1538 |
dpurdie |
735 |
=item B<-nameversion>
|
|
|
736 |
|
|
|
737 |
This option Add Version information to the Product Name.
|
|
|
738 |
|
| 1564 |
dpurdie |
739 |
Additionally now if there are any Product Configurations in the Release view
|
|
|
740 |
of the project that have a value in the Product Name for that configuration then
|
|
|
741 |
they to will be modified in the same way.
|
|
|
742 |
|
| 1538 |
dpurdie |
743 |
The default operation will add Version Information. Use -nonameversion to disable
|
|
|
744 |
this operation.
|
|
|
745 |
|
| 1564 |
dpurdie |
746 |
=item B<-multiprod>
|
|
|
747 |
|
|
|
748 |
This option builds multiple product configurations from the single IS project.
|
|
|
749 |
|
|
|
750 |
The Releases view in Installshield allows multiple Product Configurations to
|
|
|
751 |
be configured and built. This must be specified if the project contains more
|
|
|
752 |
than 1 Product Configuration, but can also be used with a single configuration.
|
|
|
753 |
If there are multiple release for any Product Configuration then -multirel must
|
|
|
754 |
be specified as well.
|
|
|
755 |
|
|
|
756 |
This uses the Product Configuration Name, that is the name given to this Product
|
|
|
757 |
Configuration that appears in the Releases tree view of Installshield.
|
|
|
758 |
|
|
|
759 |
This name is used to modify the name to the final setup executable and is
|
|
|
760 |
appended to the Project Name. For example each product configuration will
|
|
|
761 |
have a setup exe named
|
|
|
762 |
<ProjectName>-<ProductConfigName>-<Version>.<Suffix>-WIN32
|
|
|
763 |
|
|
|
764 |
Additionally if nameversion is active and a product configuration has a Product Name
|
|
|
765 |
then it to will be updated as per -nameversion option.
|
|
|
766 |
|
|
|
767 |
=item B<-multirel>
|
|
|
768 |
|
|
|
769 |
This option builds multiple releases per product configuration from the single
|
|
|
770 |
IS project.
|
|
|
771 |
|
|
|
772 |
The Releases view in Installshield allows multiple releases per product
|
|
|
773 |
configuration to be configured and built. This must be specified if the project
|
|
|
774 |
contains more than 1 release per product configuration, but can also be used
|
|
|
775 |
with a single release per product configuration.
|
|
|
776 |
|
|
|
777 |
This uses the Release Name, that is the name given to this Release for this Product
|
|
|
778 |
Configuration and appears under the Product Configuration in the Releases tree view
|
|
|
779 |
of Installshield.
|
|
|
780 |
|
|
|
781 |
This name is used to modify the name to the final setup executable and is appended to
|
|
|
782 |
the Project Name or Product Configuration name if -multiprod is enabled. For example
|
|
|
783 |
If -multiprod is specified as well, each release of each product configuration
|
|
|
784 |
will have a setup exe named
|
|
|
785 |
<ProjectName>-<ProductConfigName>-<ReleaseName>-<Version>.<Suffix>-WIN32
|
|
|
786 |
If -multiprod is Not specified, each release of the single product configuration
|
|
|
787 |
will have a setup exe named
|
|
|
788 |
<ProjectName>-<ReleaseName>-<Version>.<Suffix>-WIN32
|
|
|
789 |
|
| 1532 |
dpurdie |
790 |
=back
|
|
|
791 |
|
|
|
792 |
=head1 DESCRIPTION
|
|
|
793 |
|
|
|
794 |
This program is used within the ERG deployment process to build up an Install
|
|
|
795 |
Shield project.
|
|
|
796 |
|
|
|
797 |
=head1 EXAMPLE
|
|
|
798 |
|
|
|
799 |
|
|
|
800 |
=cut
|
|
|
801 |
|