forked from microsoft/azure-tools-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildProduct.sh
100 lines (77 loc) · 4.31 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
#!/bin/bash
set -e
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
cd $SCRIPTPATH
VERSION="3.0.9"
MAVEN_QUIET=""
INTELLIJ_VERSION=false
while getopts ":hqv" option; do
case $option in
h) echo "usage: $0 [-h] [-q] [-v]"; exit ;;
q) MAVEN_QUIET="-q" ;;
v) INTELLIJ_VERSION=true ;;
?) 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"
CSU_PATH="/c/Signing/CodeSignUtility"
# 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
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 ${CSU_PATH}/csu.exe -c1=170
then
echo jar signed successfully
else
echo ERROR: sign task failed
exit 1
fi
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
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
chmod +x ./gradlew
chmod +x ./tools/IntellijVersionHelper
# Build intellij 2017.1 plugin
if [ $INTELLIJ_VERSION == "true" ] ; then
./tools/IntellijVersionHelper 2017.1
fi
./gradlew clean buildPlugin --project-dir ./PluginsAndFeatures/azure-toolkit-for-intellij -s -Papplicationinsights.key=${INTELLIJ_KEY} -Pintellij_version=IC-2017.1 -Pdep_plugins=org.intellij.scala:2017.1.15
cp ./PluginsAndFeatures/azure-toolkit-for-intellij/build/distributions/azure-toolkit-for-intellij.zip ./$ARTIFACTS_DIR/azure-toolkit-for-intellij-2017.1.zip
# Build intellij 2017.2 plugin
if [ $INTELLIJ_VERSION == "true" ] ; then
./tools/IntellijVersionHelper 2017.2
fi
./gradlew clean buildPlugin --project-dir ./PluginsAndFeatures/azure-toolkit-for-intellij -s -Papplicationinsights.key=${INTELLIJ_KEY}
cp ./PluginsAndFeatures/azure-toolkit-for-intellij/build/distributions/azure-toolkit-for-intellij.zip ./$ARTIFACTS_DIR/azure-toolkit-for-intellij-2017.2.zip
# Extract jars to sign
# intelliJ
rm -rf ${INTELLIJ_TOSIGN}/*
unzip -p ./artifacts/azure-toolkit-for-intellij-2017.1.zip azure-toolkit-for-intellij/lib/azure-toolkit-for-intellij.jar > ${INTELLIJ_TOSIGN}/azure-toolkit-for-intellij_2017.1.jar
unzip -p ./artifacts/azure-toolkit-for-intellij-2017.2.zip azure-toolkit-for-intellij/lib/azure-toolkit-for-intellij.jar > ${INTELLIJ_TOSIGN}/azure-toolkit-for-intellij_2017.2.jar
# Eclipse
rm -rf ${ECLIPSE_TOSIGN}/*
unzip -j artifacts/WindowsAzurePlugin4EJ.zip "**/*.jar" "*.jar" -d ${ECLIPSE_TOSIGN}
echo "ALL BUILD SUCCESSFUL"