Skip to main content
summaryrefslogtreecommitdiffstats
blob: e54e492d448bb14f9f6cc25b31c5b5c4f1c48422 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/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;
}

# $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";

# $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*");

# Find the base build scripts: genericTargets.xml and build.xml
@candidates = glob($pdeBuildGlob);
$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];

$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}";
$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 ";
$incantation .= "-application org.eclipse.ant.core.antRunner ";
$incantation .= "-buildfile ${pdeBuild}/scripts/build.xml ";
$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} ";
if ($buildType =~ "N") {
	$incantation .= "-DforceContextQualifier=${buildId} ";
	$incantation .= "-DfetchTag=HEAD ";
}

print("${incantation}\n");

system($incantation);

Back to the top