Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: bac1317942f3ae5d3c6b1e33e3082d42d079e0bb (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/usr/bin/env bash
#*******************************************************************************
# Copyright (c) 2017 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#     David Williams - initial API and implementation
#*******************************************************************************
#
# this localBuildProperties.shsource file is to ease local builds to override some variables.
# It should not be used for production builds.
source localBuildProperties.shsource 2>/dev/null

export BUILD_HOME=${BUILD_HOME:-/shared/eclipse/builds}

if [ $# -ne 1 ]; then
  echo USAGE: $0 env_file
  exit 1
fi

if [ ! -r "$1" ]; then
  echo "$1" cannot be read
  echo USAGE: $0 env_file
  exit 1
fi

source "$1"

export SCRIPT_PATH=${SCRIPT_PATH:-$(pwd)}

source $SCRIPT_PATH/build-functions.shsource

# USAGE: fn-eq-build-dir ROOT BUILD_ID STREAM
#   ROOT: /shared/eclipse/builds
#   BUILD_ID: M20121119-1900
#   STREAM: 4.3.0
fn-eq-build-dir ()
{
  ROOT="$1"; shift
  BUILD_ID="$1"; shift
  STREAM="$1"; shift
  eclipseStreamMajor=${STREAM:0:1}
  buildType=${BUILD_ID:0:1}
  dropDirSegment=${eclipseStreamMajor}${buildType}/siteDir/equinox/drops3
  if (( $eclipseStreamMajor > 3 ))
  then
    dropDirSegment=${eclipseStreamMajor}${buildType}/siteDir/equinox/drops
  fi
  echo $ROOT/$dropDirSegment/$BUILD_ID
}

# USAGE: fn-eq-gather-starterkit BUILD_ID REPO_DIR BUILD_DIR
#   BUILD_ID: I20121116-0700
#   REPO_DIR: /shared/eclipse/builds/R4_2_maintenance/gitCache/eclipse.platform.releng.aggregator
#   BUILD_DIR: /shared/eclipse/builds/R4_2_maintenance/dirs/M20121120-1747
fn-eq-gather-starterkit ()
{
  if [[ $# != 3 ]]
  then
    echo "PROGRAM ERROR: this function, fn-eq-gather-starterkit, requires 3 arguments"
    return 1
  fi
  BUILD_ID="$1"; shift
  REPO_DIR="$1"; shift
  DROP_DIR="$1"; shift
  TARGET_PRODUCTS="$REPO_DIR"/eclipse.platform.releng.tychoeclipsebuilder/equinox.starterkit.product/target/products
  echo "Starting fn-eq-gather-starterkit"
  echo "BUILD_ID: $BUILD_ID"
  echo "REPO_DIR: $REPO_DIR"
  echo "DROP_DIR: $DROP_DIR"
  if [[ ! -d $DROP_DIR ]]
  then
    echo "Making DROP_DIR at $DROP_DIR"
    mkdir -p $DROP_DIR
  fi
  if [[ -d "$TARGET_PRODUCTS" ]]
  then
    pushd "$TARGET_PRODUCTS"

    cp -v org.eclipse.rt.osgistarterkit.product-linux.gtk.x86_64.tar.gz "$DROP_DIR"/EclipseRT-OSGi-StarterKit-${BUILD_ID}-linux-gtk-x86_64.tar.gz
    cp -v org.eclipse.rt.osgistarterkit.product-linux.gtk.x86.tar.gz "$DROP_DIR"/EclipseRT-OSGi-StarterKit-${BUILD_ID}-linux-gtk-x86.tar.gz

    cp -v org.eclipse.rt.osgistarterkit.product-macosx.cocoa.x86_64.tar.gz "$DROP_DIR"/EclipseRT-OSGi-StarterKit-${BUILD_ID}-macosx-cocoa-x86_64.tar.gz
    cp -v org.eclipse.rt.osgistarterkit.product-macosx.cocoa.x86_64.dmg "$DROP_DIR"/EclipseRT-OSGi-StarterKit-${BUILD_ID}-macosx-cocoa-x86_64.dmg


    cp -v org.eclipse.rt.osgistarterkit.product-win32.win32.x86_64.zip "$DROP_DIR"/EclipseRT-OSGi-StarterKit-${BUILD_ID}-win32-win32-x86_64.zip
    cp -v org.eclipse.rt.osgistarterkit.product-win32.win32.x86.zip "$DROP_DIR"/EclipseRT-OSGi-StarterKit-${BUILD_ID}-win32-win32-x86.zip

    popd
  else
    echo "   ERROR: $TARGET_PRODUCTS did not exist in fn-eq-gather-starterkit"
    return 1
  fi
  echo "Ending fn-eq-gather-starterkit"
  return 0
}



# USAGE: fn-publish-equinox BUILD_TYPE BUILD_STREAM BUILD_ID REPO_DIR BUILD_DIR BASEBUILDER_LAUNCHER
#   BUILD_TYPE: I
#   BUILD_STREAM: 4.2.2
#   BUILD_ID: I20121116-0700
#   REPO_DIR: /shared/eclipse/builds/R4_2_maintenance/gitCache/eclipse.platform.releng.aggregator
#   BUILD_DIR: /shared/eclipse/builds/R4_2_maintenance/dirs/M20121120-1747
#   BASEBUILDER_LAUNCHER: /shared/eclipse/builds/R4_2_maintenance/org.eclipse.releng.basebuilder_R3_7/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
fn-publish-equinox ()
{
  BUILD_TYPE="$1"; shift
  BUILD_STREAM="$1"; shift
  BUILD_ID="$1"; shift
  REPO_DIR="$1"; shift
  BUILD_DIR="$1"; shift
  BASEBUILDER_LAUNCHER="$1"; shift
  BUILD_MACHINE_ROOT=${BUILD_HOME}
  BUILD_MACHINE_DROP_DIR=$(fn-eq-build-dir "$BUILD_MACHINE_ROOT" "$BUILD_ID" "$BUILD_STREAM")
  BUILD_MACHINE_DROP_DIR_PARENT=$(dirname $BUILD_MACHINE_DROP_DIR)
  EBuilderDir="$BUILD_DIR"/eclipse.platform.releng.aggregator/eclipse.platform.releng.tychoeclipsebuilder
  fn-eq-gather-starterkit $BUILD_ID $REPO_DIR $BUILD_MACHINE_DROP_DIR

  TARGET_PRODUCTS="$REPO_DIR"/eclipse.platform.releng.tychoeclipsebuilder/equinox-sdk/target
  if [[ -d "$TARGET_PRODUCTS" ]]
  then
    pushd "$TARGET_PRODUCTS"
    # The glob '*' here, is to match (and hence remove) "version number" in built version, such as 3.10.0, 4.4.0, etc.
    # And leave only BUILD_ID.
    cp -v equinox-sdk-*-SNAPSHOT.zip "${BUILD_MACHINE_DROP_DIR}/equinox-SDK-${BUILD_ID}.zip"
    RC=$?
    if [[ $RC != 0 ]]
    then
      TODO: change 'cp' above to rsync .. it gives better error messages and logging?
      echo "ERROR: cp command could not copy equinox-sdk-*-SNAPSHOT.zip. RC: $RC"
    fi
    # following used to be done in "build-configs", based on "master-equinox" feature,
    # but that has now "gone away".
    pushd "${BUILD_MACHINE_DROP_DIR}"
    unzip -o -j equinox-SDK-${BUILD_ID}.zip plugins/*.jar -x plugins/*.source_*
    popd
  else
    echo "   ERROR: $TARGET_PRODUCTS did not exist in fn-gather-sdks"
  fi
  popd

  pushd "$BUILD_DIR"
  java -Djava.io.tmpdir=$TMP_DIR -jar "$BASEBUILDER_LAUNCHER" \
    -data ${BUILD_DIR}/workspace-publishEquinox \
    -application org.eclipse.ant.core.antRunner \
    -v \
    -buildfile "$EBuilderDir"/equinox/helper.xml \
    -Dequinox.build.configs="$EBuilderDir"/equinox/buildConfigs \
    -DbuildId="$BUILD_ID" \
    -DbuildRepo="$REPO_DIR"/eclipse.platform.releng.tychoeclipsebuilder/eclipse.platform.repository/target/repository \
    -DpostingDirectory=$BUILD_DIR \
    -DequinoxPostingDirectory=$BUILD_MACHINE_DROP_DIR_PARENT \
    -DeqpublishingContent="$EBuilderDir"/equinox/publishingFiles \
    -DdropTemplateFileName="$EBuilderDir/eclipse/publishingFiles/templateFiles/index.template_${PATCH_OR_BRANCH_LABEL}.php" \
    -DindexFileName="index.php" \
    -DbuildDir="$EQ_BUILD_DIR_SEG" \
    -DEBuilderDir="$EBuilderDir" \
    -DeclipseStream=$BUILD_STREAM \
    -DbuildType="$BUILD_TYPE" \
    -Dbase.builder=$(dirname $(dirname "$BASEBUILDER_LAUNCHER" ) ) \
    -DbuildDirectory=$BUILD_MACHINE_DROP_DIR_PARENT \
    -Djava.io.tmpdir=$TMP_DIR \
    publish
  popd
}

cd $BUILD_ROOT

# derived values
gitCache=$( fn-git-cache "$BUILD_ROOT")
aggDir=$( fn-git-dir "$gitCache" "$AGGREGATOR_REPO" )

if [ -z "$BUILD_ID" ]; then
  BUILD_ID=$(fn-build-id "$BUILD_TYPE" )
fi

buildDirectory=$( fn-build-dir "$BUILD_ROOT" "$BUILD_ID" "$STREAM" )
basebuilderDir=$( fn-basebuilder-dir "$BUILD_ROOT" "$BUILD_ID" "$STREAM" )

$SCRIPT_PATH/getEBuilderForDropDir.sh $buildDirectory $EBUILDER_HASH

fn-checkout-basebuilder "$basebuilderDir"

launcherJar=$( fn-basebuilder-launcher "$basebuilderDir" )

fn-publish-equinox "$BUILD_TYPE" "$STREAM" "$BUILD_ID" "$aggDir" "$buildDirectory" "$launcherJar"
RC=$?
if [[ $RC != 0 ]]
then
  echo "ERROR: Somethign went wrong publishing Equinox. RC: $RC"
  exit $RC
fi

Back to the top