-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlib.sh
58 lines (53 loc) · 2.21 KB
/
lib.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
#!/usr/bin/env bash
set -e
get_build_number() {
echo "$1" | cut -d '_' -f 2
}
set_build_number() {
BUILD=$(git tag --sort=-taggerdate --merged | grep ^build_ | head -n 1)
_BUILD_NUMBER=$(get_build_number "$BUILD")
export BUILD_NUMBER="$_BUILD_NUMBER"
echo "Build: $BUILD_NUMBER"
}
clone() {
local ROOT_DIR="$1"
local PROJECT="$2"
local ORG="willp-bl"
cd "$ROOT_DIR"
echo "----> Cloning/updating $PROJECT"
mkdir -p output/git/
if [ ! -d "output/git/$PROJECT.git" ]; then
git clone --mirror "https://github.com/$ORG/$PROJECT.git" "output/git/$PROJECT.git"
else
cd "output/git/$PROJECT.git"
git fetch --tags
fi
cd "$ROOT_DIR"
if [ ! -d "$PROJECT" ]; then
git clone "output/git/$PROJECT.git" "$PROJECT"
else
cd "$PROJECT"
git pull
fi
}
fixup_repos() {
local PROJECT="$1"
perl -i -0pe 's/maven[\s\{]+[^\}]+whitelisted-repos[^\{\}]*\}/maven { url \"https:\/\/build.shibboleth.net\/nexus\/content\/groups\/public\" \n url \"https:\/\/repo1.maven.org\/maven2\" \n jcenter() \n mavenLocal() }/gms' build.gradle
if [ "$PROJECT" = "verify-matching-service-adapter" ]; then
perl -i -0pe 's/maven[^\}]*\}/maven { url \"https:\/\/build.shibboleth.net\/nexus\/content\/groups\/public\" \n url \"https:\/\/repo1.maven.org\/maven2\" \n jcenter() \n mavenLocal() }/gms' verify-matching-service-test-tool/build.gradle
fi
# should change the gradle files to use the correct version, but hey this whole thing is a massive hack anyway
local HUB_SAML_FIXUP="s/-15583/-15584/g"
sed -i "$HUB_SAML_FIXUP" build.gradle
if [ "$PROJECT" = "verify-eidas-trust-anchor" ]; then
# there is definitely a better way
local VETA_FIXUP="s/classpath 'org.gradle.plugins:gradle-compass:1.0.7',//g"
sed -i "$VETA_FIXUP" build.gradle
local VETA_FIXUP="s/'uk.gov.ida:ida-gradle:1.1.0-..',//g"
sed -i "$VETA_FIXUP" build.gradle
local VETA_FIXUP="s/'com.github.ben-manes:gradle-versions-plugin/classpath 'com.github.ben-manes:gradle-versions-plugin/g"
sed -i "$VETA_FIXUP" build.gradle
local VETA_FIXUP="s/apply plugin: 'idaJar'//g"
sed -i "$VETA_FIXUP" build.gradle
fi
}