Skip to content

Commit 76d9640

Browse files
authored
Merge pull request #185 from lrytz/ivy-cache
clear ivy cache
2 parents c84a568 + 96ac267 commit 76d9640

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

admin/build.ps1

+23-8
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ Function checkExit() {
77
}
88
}
99

10-
# oh boy. i don't (want to) fully understand, but executing commands and redirecting is difficult.
11-
# - https://mnaoumov.wordpress.com/2015/01/11/execution-of-external-commands-in-powershell-done-right/
12-
# - https://stackoverflow.com/a/35980675/248998
13-
# letting cmd do the redirect avoids confusing powershell.
14-
& cmd /c 'java -version' '2>&1'
15-
checkExit
16-
1710
Function ensureVersion() {
1811
$verPat="^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?$"
1912
if ($env:version -notmatch $verPat) {
@@ -22,8 +15,28 @@ Function ensureVersion() {
2215
}
2316
}
2417

18+
Function clearIvyCache() {
19+
if (test-path C:\Users\appveyor\.ivy2\cache\org.scala-lang) {
20+
remove-item -force -recurse C:\Users\appveyor\.ivy2\cache\org.scala-lang
21+
}
22+
if (test-path C:\Users\appveyor\.ivy2) {
23+
get-childitem -path C:\Users\appveyor\.ivy2 -recurse -include "*compiler-interface*$env:version*" | remove-item -force -recurse
24+
}
25+
if (test-path C:\Users\appveyor\.sbt) {
26+
get-childitem -path C:\Users\appveyor\.sbt -recurse -include "*compiler-interface*$env:version*" | remove-item -force -recurse
27+
}
28+
}
29+
30+
# oh boy. i don't (want to) fully understand, but executing commands and redirecting is difficult.
31+
# - https://mnaoumov.wordpress.com/2015/01/11/execution-of-external-commands-in-powershell-done-right/
32+
# - https://stackoverflow.com/a/35980675/248998
33+
# letting cmd do the redirect avoids confusing powershell.
34+
& cmd /c 'java -version' '2>&1'
35+
checkExit
36+
2537
if ($env:APPVEYOR_FORCED_BUILD -eq 'true') {
2638
ensureVersion
39+
clearIvyCache
2740
if ($env:mode -eq 'release') {
2841
echo "Running a release for $env:version"
2942
$repositoriesFile="$env:APPVEYOR_BUILD_FOLDER\conf\repositories"
@@ -34,8 +47,10 @@ if ($env:APPVEYOR_FORCED_BUILD -eq 'true') {
3447
Exit 1
3548
}
3649
} else {
50+
$env:version="2.12.4"
51+
clearIvyCache
3752
# By default, test building the packages (but don't uplaod)
3853
# Need to redirect stderr, otherwise any error output (like jvm warning) fails the build (ErrorActionPreference)
39-
& cmd /c 'sbt "-Dproject.version=2.12.4" "show s3Upload::mappings"' '2>&1'
54+
& cmd /c "sbt ""-Dproject.version=$env:version"" ""show s3Upload::mappings""" '2>&1'
4055
checkExit
4156
}

admin/build.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,15 @@ function triggerSmoketest() {
7070
}
7171
}
7272

73+
clearIvyCache() {
74+
rm -rf $HOME/.ivy2/cache/org.scala-lang
75+
if [ -d $HOME/.ivy2 ]; then find $HOME/.ivy2 -name "*compiler-interface*$version*" | xargs rm -rf; fi
76+
if [ -d $HOME/.sbt ]; then find $HOME/.sbt -name "*compiler-interface*$version*" | xargs rm -rf; fi
77+
}
78+
7379
if [[ "$TRAVIS_EVENT_TYPE" == "api" ]]; then
7480
ensureVersion
81+
clearIvyCache
7582
if [[ "$mode" == "archives" ]]; then
7683
echo "Running 'archives' for $version"
7784
setupSSH
@@ -95,6 +102,8 @@ if [[ "$TRAVIS_EVENT_TYPE" == "api" ]]; then
95102
exit 1
96103
fi
97104
else
105+
version="2.12.4"
106+
clearIvyCache
98107
# By default, test building the packages (but don't uplaod)
99-
sbt -Dproject.version=2.12.4 "show s3Upload::mappings"
108+
sbt -Dproject.version=$version "show s3Upload::mappings"
100109
fi

appveyor.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ on_failure:
3333
- ps: postCommitStatus "failure"
3434

3535
cache:
36-
- C:\sbt\
37-
- C:\Users\appveyor\.m2
36+
- C:\sbt
37+
- C:\Users\appveyor\.sbt
3838
- C:\Users\appveyor\.ivy2

0 commit comments

Comments
 (0)