Skip to main content
summaryrefslogtreecommitdiffstats
blob: 65cf9c50246ea1720328879f6d71bcb1ccc1b128 (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
#!/usr/bin/env bash

export JAVA_HOME=/shared/common/jdk1.7.0-latest
export JAVA_EXEC_DIR=${JAVA_HOME}/bin
export JAVA_CMD=${JAVA_EXEC_DIR}/java

function findEclipseExe ()
{

  BUILD_ID=$1

  if [[ -z "${BUILD_ID}" ]]
  then
    echo "ERROR: this script, $BASH_SOURCE, requires BUILD_ID" 2>>${TRACE_LOG}
    return 1
  fi

  if [[ -z "${BUILD_ROOT}" ]]
  then
     echo -e "\n\tERROR: BUILT_ROOT not defined, as it should be."
  fi
  basebuilderParent=${BUILD_ROOT}/siteDir/eclipse/downloads/drops4/${BUILD_ID}
  if [[ ! -d "${basebuilderParent}" ]]
  then
    echo "ERROR: The directory did not exist. Must name existing directory where basebuilder is, or will be installed." 2>>${TRACE_LOG}
    echo "    basebuilderParent: ${basebuilderParent}" 2>>${TRACE_LOG}
    return 1
  fi

  baseBuilderDir=${basebuilderParent}/org.eclipse.releng.basebuilder
  if [[ ! -d "${baseBuilderDir}" ]]
  then
    echo -e "\n\tWARNING: The basebuilder directory " 2>>${TRACE_LOG}
    echo -e "\t${baseBuilderDir}" 2>>${TRACE_LOG}
    echo -e "\tdid not exist as expected. Will re-create.\n" 2>>${TRACE_LOG}

    EBuilder="${BUILD_ROOT}/gitCache/eclipse.platform.releng.aggregator/eclipse.platform.releng.tychoeclipsebuilder"
    # make sure that build repo still exists
    if [[ ! -d ${EBuilder} ]]
    then
      echo "ERROR: the EBuilder directory no longer exists. Can no re-create automatically" 2>>${TRACE_LOG}
      return 1
    fi

    # BUILD_ROOT should exist, by now, and have some value such as 
    # export BUILD_ROOT=/shared/eclipse/builds/4M
    # but, in case not, we'll assume a more generic location.
    export BUILD_ROOT=${BUILD_ROOT:-/shared/eclipse}
    export TMP_DIR=${TMP_DIR:-${BUILD_ROOT}/tmp} 
    mkdir -p "${TMP_DIR}"
    # assume suitable ant in on path
    ant -f ${EBuilder}/eclipse/getBaseBuilderAndTools.xml -DWORKSPACE=${basebuilderParent}
    if [[ "$?" != 0 ]]
    then
      echo "ERROR: Ant failed while executing getBaseBuilderAndTools.xml" 2>>${TRACE_LOG}
      return 1
    fi
    if [[ ! -d "${baseBuilderDir}" ]]
    then
      echo -e "\n\tERROR: The basebuilder directory, "   2>>${TRACE_LOG}
      echo -e "\t${baseBuilderDir}"  2>>${TRACE_LOG}
      echo -e "\twas not re-created.\n" 2>>${TRACE_LOG}
      return 1
    fi
  fi

  export ECLIPSE_EXE=$baseBuilderDir/eclipse
  echo "DEBUG: ECLIPSE_EXE: ${ECLIPSE_EXE}" 2>>${TRACE_LOG}

  if [[ -n ${ECLIPSE_EXE} && -x ${ECLIPSE_EXE} ]]
  then
    echo "Found Eclipse executable: ${ECLIPSE_EXE}" 2>>${TRACE_LOG}
  else
    echo "ERROR: ECLIPSE_EXE is not defined to an executable eclipse" 2>>${TRACE_LOG}
    # bit of a hack to make executable, when it should be already!?
    chmod -c +x ${ECLIPSE_EXE}
    # may have in include *.so?
  fi

  return 0
}

Back to the top