-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch.sh
More file actions
executable file
·51 lines (47 loc) · 1.92 KB
/
patch.sh
File metadata and controls
executable file
·51 lines (47 loc) · 1.92 KB
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
#!/usr/bin/env bash
# This is very hacky remedy to following error people using sbt
# and 2.10.0-M1 release of Scala are going to see:
#
# API.scala:261: error: type mismatch;
# found : API.this.global.tpnme.NameType
# (which expands to) API.this.global.TypeName
# required: String
# sym.isLocalClass || sym.isAnonymousClass || sym.fullName.endsWith(LocalChild)
#
# This script fixes sbt's compiler interface so error presented above disappears.
# I believe it should be fairly safe to use because sbt ships binary
# interfaces for 2.9.x compiler so this patch wouldn't affect them.
# Author: Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com>
set -e
curr=`pwd`
# patching in the home if the default cache is there
for i in $(find $HOME/.sbt/boot/scala-2.9.1/org.scala-tools.sbt/sbt/0.11.*/compiler-interface-src -name 'compiler-interface-src-0.11.*.jar'); do
t="${i%.jar}-tmp"
echo $t
unzip $i -d $t
cd $t
#apply the patch only if it's not applied yet
(set +e; grep -q 'sym\.isLocalClass || sym\.isAnonymousClass || sym\.fullName\.endsWith(LocalChild\.toString)' API.scala;
if [ "$?" -ne 0 ]; then perl -pi -e 's/sym\.fullName\.endsWith\(LocalChild\)/sym\.fullName\.endsWith\(LocalChild\.toString\)/g' API.scala ; fi; set -e)
rm $i
zip -r $i .
cd ..
rm -rf $t
done
cd "$curr"
# patching in the project/
for i in $(find project/boot/scala-2.9.1/org.scala-tools.sbt/sbt/0.11.*/compiler-interface-src -name 'compiler-interface-src-0.11.*.jar'); do
t="${i%.jar}-tmp"
echo $t
unzip $i -d $t
cd $t
#apply the patch only if it's not applied yet
(set +e; grep -q 'sym\.isLocalClass || sym\.isAnonymousClass || sym\.fullName\.endsWith(LocalChild\.toString)' API.scala;
if [ "$?" -ne 0 ]; then perl -pi -e 's/sym\.fullName\.endsWith\(LocalChild\)/sym\.fullName\.endsWith\(LocalChild\.toString\)/g' API.scala ; fi; set -e)
cd ..
rm `basename $i`
cd `basename $t`
zip -r "../`basename $i`" .
cd ..
rm -rf `basename $t`
done