-
Notifications
You must be signed in to change notification settings - Fork 3
/
revert-to-1.3.sh
executable file
·134 lines (112 loc) · 4.9 KB
/
revert-to-1.3.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
126
127
128
129
130
131
132
133
134
#!/bin/csh -f
# also !/bin/tcsh -f works
#
# revert-to-1.3.sh
#
# directories to be processed
setenv DIRS "src examples test"
if ($#argv == 0) then
echo ""
echo ""
echo " This script can revert orbital sources for Java 1.4 back to Java 1.3 version."
echo " To work, the following requirements must be fulfilled:"
echo ""
echo " 1. orbital sources must be in subdirectories of the current directory"
echo " called $DIRS"
echo ""
echo " 2. special modified java.util.logging sources must be in a directory"
echo " called resources/java/util/logging"
echo ""
echo " 3. the sed-script revert-to-1.3.sed must be in the current directory"
echo ""
echo " 4. the javac.source=1.3 option should be put into build.properties"
echo ""
echo " If these requirements are met, just call this script and it will"
echo " generate Java 1.3 compatible source code in the directories called"
echo " $DIRS"
echo " After that, call 'ant' to compile the new sources, and if "
echo " compilation is successful, call 'ant jar' to create the orbital.jar"
echo " file in the dist/ directory."
echo ""
echo " To run the script, pass a parameter to indicte your acceptance."
echo ""
echo ""
exit(-1)
endif
foreach SOURCE ($DIRS)
# $SOURCE is "where are the files to be converted"
# where to put the "old" files during conversion
# (the old files are moved, and the new, converted files are put
# into the tempdir)
setenv TEMPDIR j4-$SOURCE
# remove old versions:
if ( -e $TEMPDIR ) then
echo removing old $SOURCE directory keeping only $TEMPDIR ...
rm -rf $SOURCE
else
echo moving sources $SOURCE to $TEMPDIR
mv $SOURCE $TEMPDIR
endif
echo create new $SOURCE directory...
echo "and copy the nontransformed files (or simply all files)"
cp -r $TEMPDIR $SOURCE
## create the directory tree structure:
#echo creating new $SOURCE directory...
#mkdir $SOURCE
## of the orbital library
#echo creating directory structure for orbital library...
cd $TEMPDIR
#find -type d -exec mkdir ../{$SOURCE}/\{\} \;
# determine names of java files ot be modified and
# write them into a file which can then be executed
# to make the modification and copying:
echo preparing to sed orbital source files...
rm -f t
find -name "*.jj" -exec echo sed -f ../revert-to-1.3.sed \{\} \> ../{$SOURCE}/\{\} >> t \;
find -name "*.java" -exec echo sed -f ../revert-to-1.3.sed \{\} \> ../{$SOURCE}/\{\} >> t \;
# execute the file:
echo making replacements...
source t
rm -f t
#do the same for jdk1.4 files:
cd ..
if ($SOURCE == src) then
#directory structure for necessary java source files
mkdir {$SOURCE}/orbital/util/logging
echo preparing replacements for jkd1.4 sources...
cd resources/java/util/logging
rm -f t
find -name "*.jj" -exec echo sed -f ../../../../revert-to-1.3.sed \{\} \> ../../../../{$SOURCE}/orbital/util/logging/\{\} >> t \;
find -name "*.java" -exec echo sed -f ../../../../revert-to-1.3.sed \{\} \> ../../../../{$SOURCE}/orbital/util/logging/\{\} >> t \;
# execute the file:
echo making replacements...
source t
#back to orbital project directory:
cd ../../../../
# remove aspects, which cannot be compiled:
# (they are not needed)
echo removing aspects...
rm -rf {$SOURCE}/orbital/moon/aspects/*
# remove deprecated files:
# first rescue used files
echo rescuing deprecated-used...
mv {$SOURCE}/orbital/moon/deprecated/used/* {$SOURCE}/orbital/
echo removing deprecated...
rm -rf {$SOURCE}/orbital/moon/deprecated/*
# remove unwanted constructor call in InnerCheckedException:
sed -e 's/super(message, cause)/super(message)/' {$SOURCE}/orbital/util/InnerCheckedException.java > t
mv -f t {$SOURCE}/orbital/util/InnerCheckedException.java
# remove unwanted constructor call in orbital.logic.sign.ParseException:
sed -e 's/super(message, cause)/super(message)/' {$SOURCE}/orbital/logic/sign/ParseException.java > t
mv -f t {$SOURCE}/orbital/logic/sign/ParseException.java
# remove unwanted instantiation of InternalError:
sed -e 's/throw new InternalError(asserted)/throw new InternalError(asserted.toString())/' {$SOURCE}/orbital/algorithm/evolutionary/Gene.java > t
mv -f t {$SOURCE}/orbital/algorithm/evolutionary/Gene.java
endif
if ($SOURCE == test) then
# remove unwanted catch AssertionError:
sed -e 's/catch (AssertionError/catch (InternalError/' {$SOURCE}/orbital/math/functional/FunctionTest.java > t
mv -f t {$SOURCE}/orbital/math/functional/FunctionTest.java
endif
end
#