1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 21:15:23 +02:00
cdt/releng/org.eclipse.rse.build/build.pl

99 lines
3.2 KiB
Perl
Raw Normal View History

2006-06-06 22:31:37 +00:00
#!/usr/bin/perl
# Build script for Remote System Explorer
# Authors: Dave Dykstal, Kushal Munir
# java and cvs have to be in the path
use warnings;
use File::Spec;
sub ask($$) {
my ($question, $default, $message, $ans);
($question, $default) = @_;
$message = "${question} (default is ${default}): ";
print STDERR $message;
$ans = <STDIN>;
chomp $ans;
$ans = $ans ? $ans : $default;
return $ans;
}
sub makeAbsolute($) {
my $path = File::Spec->canonpath($_[0]);
if (!File::Spec->file_name_is_absolute($path)) {
$current = `pwd`;
chomp($current);
$path = File::Spec->catdir($current, $path);
$path = File::Spec->canonpath($path);
}
return $path;
}
2006-06-06 22:31:37 +00:00
# $eclipse is the location of the basic PDE and plugins to compile against
# This should include the org.eclipse.pde.build project
$eclipse = "../eclipse";
# $basebuilder" is the location of the Eclipse Releng basebuilder
# This can also be set to ${eclipse}
$basebuilder = "../org.eclipse.releng.basebuilder";
2006-06-06 22:31:37 +00:00
# $builder is the location of the custom build scripts customTargets.xml and build.properties
# (i.e. the contents of org.eclipse.rse.build)
$builder = ".";
# $working is where the build is actually done, does not need to exist
$working = "../working";
# make these absolute paths
$eclipse = makeAbsolute($eclipse);
$basebuilder = makeAbsolute($basebuilder);
$builder = makeAbsolute($builder);
$working = makeAbsolute($working);
$plugins = File::Spec->catdir($basebuilder, "plugins");
$pdeBuildGlob = File::Spec->catdir($plugins, "org.eclipse.pde.build*");
2006-06-06 22:31:37 +00:00
# Find the base build scripts: genericTargets.xml and build.xml
@candidates = glob($pdeBuildGlob);
2006-06-06 22:31:37 +00:00
$n = @candidates;
if ($n == 0) {
die("PDE Build was not found.");
}
if ($n > 1) {
die("Too many versions of PDE Build were found.");
}
$pdeBuild = $candidates[0];
2006-06-06 22:31:37 +00:00
$buildDirectory = "$working/build";
$packageDirectory = "$working/package";
$publishDirectory = "$working/publish";
$tag = ask("Enter tag to fetch from CVS", "HEAD");
$buildType = ask("Enter build type (P=Personal, N=Nightly, I=Integration, S=Stable)", "P");
($sec, $minute, $hour, $mday, $mon, $year) = localtime();
$mydstamp = sprintf("%4.4d%2.2d%2.2d", $year + 1900, ($mon + 1), $mday);
$mytstamp = sprintf("%2.2d%2.2d", $hour, $minute, $sec);
$timeStamp = "${mydstamp}-${mytstamp}";
2006-06-06 22:31:37 +00:00
$buildId = $buildType . $timeStamp;
$buildId = ask("Enter the build id", $buildType . $timeStamp);
$incantation = "java -cp ${basebuilder}/plugins/org.eclipse.equinox.launcher.jar org.eclipse.core.launcher.Main ";
2006-06-06 22:31:37 +00:00
$incantation .= "-application org.eclipse.ant.core.antRunner ";
$incantation .= "-buildfile ${pdeBuild}/scripts/build.xml ";
2006-06-06 22:31:37 +00:00
$incantation .= "-DbuildDirectory=${buildDirectory} ";
$incantation .= "-DpackageDirectory=${packageDirectory} ";
$incantation .= "-DpublishDirectory=${publishDirectory} ";
$incantation .= "-Dbuilder=${builder} ";
$incantation .= "-DbaseLocation=${eclipse} ";
$incantation .= "-DbuildType=${buildType} ";
$incantation .= "-DbuildId=${buildId} ";
$incantation .= "-DmapVersionTag=${tag} ";
$incantation .= "-Dmydstamp=${mydstamp} ";
$incantation .= "-Dmytstamp=${mytstamp} ";
2006-08-11 14:31:25 +00:00
if ($buildType =~ "N") {
$incantation .= "-DforceContextQualifier=${buildId} ";
$incantation .= "-DfetchTag=HEAD ";
}
2006-06-06 22:31:37 +00:00
print("${incantation}\n");
2006-06-06 22:31:37 +00:00
system($incantation);