forked from microsoft/azure-tools-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildProduct.sh
executable file
·125 lines (100 loc) · 5.3 KB
/
BuildProduct.sh
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
#!/bin/bash
set -e
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
cd "$SCRIPTPATH"
# Utils
VERSION="3.24.0"
MAVEN_QUIET=""
# Eclipse
BUILD_ECLIPSE=true
# IntelliJ
BUILD_INTELLIJ=true
INJECT_INTELLIJ_VERSION=false
IJ_VERSION_LATEST=2019.1
IJ_DISPLAY_VERSION_LATEST=2019.1
IJ_SCALA_VERSION_LATEST=2019.1.6
IJ_VERSION_FALLBACK=2018.3
IJ_DISPLAY_VERSION_FALLBACK=2018.3
IJ_SCALA_VERSION_FALLBACK=2018.3.2
while getopts "hqve:" option; do
case $option in
h) echo "usage: $0 [-h] [-q] [-v] [-e eclipse/intellij]"; exit ;;
q) MAVEN_QUIET="-q" ;;
v) INJECT_INTELLIJ_VERSION=true ;;
e)
shopt -s nocasematch
case $OPTARG in
eclipse) BUILD_ECLIPSE=false ;;
intellij) BUILD_INTELLIJ=false ;;
esac ;;
?) echo "error: option -$OPTARG is not implemented"; exit ;;
esac
done
ECLIPSE_KEY=${ECLIPSE_TELKEY}
INTELLIJ_KEY=${INTELLIJ_TELKEY}
ARTIFACTS_DIR="artifacts"
TOSIGNPATH="/c/Signing/ToSign"
SIGNEDPATH="/c/Signing/Signed"
ECLIPSE_TOSIGN="/c/jenkins/toSignPackage/eclipse"
INTELLIJ_TOSIGN="/c/jenkins/toSignPackage/intelliJ"
# check dir exists
if [ ! -d "$ARTIFACTS_DIR" ]; then
echo "Creating artifacts directory $ARTIFACTS_DIR"
mkdir -p $ARTIFACTS_DIR
fi
# echo shell commands when they are executed.
set -x
# Build Utils
echo "Building Utils ..."
mvn install -f ./Utils/pom.xml -Dmaven.repo.local=./.repository $MAVEN_QUIET
rm -rf ${TOSIGNPATH}/*
cp ./Utils/azuretools-core/target/azuretools-core-${VERSION}.jar ${TOSIGNPATH}/
cp ./Utils/azure-explorer-common/target/azure-explorer-common-${VERSION}.jar ${TOSIGNPATH}/
cp ./Utils/hdinsight-node-common/target/hdinsight-node-common-${VERSION}.jar ${TOSIGNPATH}/
if node /c/Signing/ESRP/signScript/index.js
then
echo jar signed successfully
else
echo ERROR: sign task failed
exit 1
fi
# Continue building Utils with signed jars
cp ${SIGNEDPATH}/azuretools-core-${VERSION}.jar ./Utils/azuretools-core/target/azuretools-core-${VERSION}.jar
cp ${SIGNEDPATH}/azure-explorer-common-${VERSION}.jar ./Utils/azure-explorer-common/target/azure-explorer-common-${VERSION}.jar
cp ${SIGNEDPATH}/hdinsight-node-common-${VERSION}.jar ./Utils/hdinsight-node-common/target/hdinsight-node-common-${VERSION}.jar
mvn install:install-file -Dfile=./Utils/azuretools-core/target/azuretools-core-${VERSION}.jar -DgroupId=com.microsoft.azuretools -DartifactId=azuretools-core -Dversion=${VERSION} -Dpackaging=jar -Dmaven.repo.local=./.repository
mvn install:install-file -Dfile=./Utils/azure-explorer-common/target/azure-explorer-common-${VERSION}.jar -DgroupId=com.microsoft.azuretools -DartifactId=azure-explorer-common -Dversion=${VERSION} -Dpackaging=jar -Dmaven.repo.local=./.repository
mvn install:install-file -Dfile=./Utils/hdinsight-node-common/target/hdinsight-node-common-${VERSION}.jar -DgroupId=com.microsoft.azuretools -DartifactId=hdinsight-node-common -Dversion=${VERSION} -Dpackaging=jar -Dmaven.repo.local=./.repository
mvn install -f ./PluginsAndFeatures/AddLibrary/AzureLibraries/pom.xml -Dmaven.repo.local=./.repository $MAVEN_QUIET
# Build Eclipse plugin
if $BUILD_ECLIPSE; then
echo "Building Eclipse plugin ..."
mvn clean install -f ./PluginsAndFeatures/azure-toolkit-for-eclipse/pom.xml -Dinstrkey=${ECLIPSE_KEY} $MAVEN_QUIET
cp ./PluginsAndFeatures/azure-toolkit-for-eclipse/WindowsAzurePlugin4EJ/target/WindowsAzurePlugin4EJ*.zip ./$ARTIFACTS_DIR/WindowsAzurePlugin4EJ.zip
# Extract jars to sign
rm -rf ${ECLIPSE_TOSIGN}/*
unzip -j artifacts/WindowsAzurePlugin4EJ.zip "**/*.jar" "*.jar" -d ${ECLIPSE_TOSIGN}
fi
# Build IntelliJ plugin
if $BUILD_INTELLIJ; then
echo "Building IntelliJ plugin ..."
chmod +x ./tools/IntellijVersionHelper
# Build intellij plugin for latest version
if [ $INJECT_INTELLIJ_VERSION == "true" ] ; then
./tools/IntellijVersionHelper $IJ_DISPLAY_VERSION_LATEST
fi
(cd PluginsAndFeatures/azure-toolkit-for-intellij && ./gradlew clean buildPlugin -s -Papplicationinsights.key=${INTELLIJ_KEY} -Pintellij_version=IC-$IJ_VERSION_LATEST -Pdep_plugins=org.intellij.scala:$IJ_SCALA_VERSION_LATEST)
cp ./PluginsAndFeatures/azure-toolkit-for-intellij/build/distributions/azure-toolkit-for-intellij.zip ./$ARTIFACTS_DIR/azure-toolkit-for-intellij-$IJ_DISPLAY_VERSION_LATEST.zip
# Build intellij plugin for fallback version
if [ $INJECT_INTELLIJ_VERSION == "true" ] ; then
./tools/IntellijVersionHelper $IJ_DISPLAY_VERSION_FALLBACK
fi
(cd PluginsAndFeatures/azure-toolkit-for-intellij && ./gradlew clean buildPlugin -s -Papplicationinsights.key=${INTELLIJ_KEY} -Pintellij_version=IC-$IJ_VERSION_FALLBACK -Pdep_plugins=org.intellij.scala:$IJ_SCALA_VERSION_FALLBACK)
cp ./PluginsAndFeatures/azure-toolkit-for-intellij/build/distributions/azure-toolkit-for-intellij.zip ./$ARTIFACTS_DIR/azure-toolkit-for-intellij-$IJ_DISPLAY_VERSION_FALLBACK.zip
# Extract jars to sign
rm -rf ${INTELLIJ_TOSIGN}/*
unzip -p ./artifacts/azure-toolkit-for-intellij-$IJ_DISPLAY_VERSION_LATEST.zip azure-toolkit-for-intellij/lib/azure-toolkit-for-intellij.jar > ${INTELLIJ_TOSIGN}/azure-toolkit-for-intellij_$IJ_DISPLAY_VERSION_LATEST.jar
unzip -p ./artifacts/azure-toolkit-for-intellij-$IJ_DISPLAY_VERSION_FALLBACK.zip azure-toolkit-for-intellij/lib/azure-toolkit-for-intellij.jar > ${INTELLIJ_TOSIGN}/azure-toolkit-for-intellij_$IJ_DISPLAY_VERSION_FALLBACK.jar
fi
echo "ALL BUILD SUCCESSFUL"