forked from imagej/ImageJA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
compile-js.sh
101 lines (84 loc) · 3.99 KB
/
compile-js.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
# This script compiles imagej into image.js
# It requires CHEERPJ_DIR and IJ_DIR
set -e
# compile from scratch
if [ -z ${CHEERPJ_DIR+x} ]
then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
curl https://d3415aa6bfa4.leaningtech.com/cheerpj_linux_2.1.tar.gz -LO
tar -xvf cheerpj_linux_2.1.tar.gz
export CHEERPJ_DIR=$(pwd)/cheerpj_2.1
else
echo "Please download cheerpj from https://www.leaningtech.com/pages/cheerpj.html#Download and set the CHEERPJ_DIR env variable "
exit 1
fi
fi
# compile imagej
mvn install:install-file -Dfile=${CHEERPJ_DIR}/cheerpj-dom.jar -DgroupId=com.learningtech -DartifactId=cheerpj-dom -Dversion=1.0 -Dpackaging=jar
mvn package
mkdir -p imagej-js-dist
cd imagej-js-dist
# download ij153 from imagej.net
export IJ1_VERSION=ij153
export IJ_JAR=ij-1.53m.jar
curl http://wsr.imagej.net/distros/cross-platform/${IJ1_VERSION}.zip -LO
unzip -q -o ${IJ1_VERSION}.zip
rm ${IJ1_VERSION}.zip
rm -rf ${IJ1_VERSION}
mv ImageJ ${IJ1_VERSION}
# Remove the command finder tool
awk '!/Command Finder Built-in Tool/' ${IJ1_VERSION}/macros/StartupMacros.txt > temp && mv temp ${IJ1_VERSION}/macros/StartupMacros.txt
cp ../target/${IJ_JAR} ${IJ1_VERSION}/
cd ${IJ1_VERSION}
# remove all the plugins except Filters
mkdir useful_plugins
mv plugins/Filters useful_plugins/Filters
rm -rf plugins
mv useful_plugins plugins
# compile cheerpj dom
cp ${CHEERPJ_DIR}/cheerpj-dom.jar cheerpj-dom-1.0.jar
${CHEERPJ_DIR}/cheerpjfy.py -j 4 cheerpj-dom-1.0.jar
# compile ij.jar and we should get
${CHEERPJ_DIR}/cheerpjfy.py -j 4 --pack-jar=${IJ_JAR}.packed.jar ${IJ_JAR}
rm ${IJ_JAR}
mv ${IJ_JAR}.packed.jar ${IJ_JAR}
# download and compile MorphoLibJ
curl https://github.com/ijpb/MorphoLibJ/releases/download/v1.4.2.1/MorphoLibJ_-1.4.2.1.jar -LO
mv MorphoLibJ_-1.4.2.1.jar plugins/MorphoLibJ_-1.4.2.1.jar
${CHEERPJ_DIR}/cheerpjfy.py -j 4 --deps=${IJ_JAR} --pack-jar=plugins/MorphoLibJ_-1.4.2.1-packed.jar plugins/MorphoLibJ_-1.4.2.1.jar
# extract plugins.config
jar xf plugins/MorphoLibJ_-1.4.2.1.jar plugins.config
mv plugins.config plugins/MorphoLibJ_-1.4.2.1.jar.config
rm plugins/MorphoLibJ_-1.4.2.1.jar
mv plugins/MorphoLibJ_-1.4.2.1-packed.jar plugins/MorphoLibJ_-1.4.2.1.jar
# download and compile Thunder_STORM
curl https://github.com/zitmen/thunderstorm/releases/download/v1.3/Thunder_STORM.jar -LO
mv Thunder_STORM.jar plugins/Thunder_STORM.jar
${CHEERPJ_DIR}/cheerpjfy.py -j 4 --deps=${IJ_JAR} --pack-jar=plugins/Thunder_STORM-packed.jar plugins/Thunder_STORM.jar
# extract plugins.config
jar xf plugins/Thunder_STORM.jar plugins.config
mv plugins.config plugins/Thunder_STORM.jar.config
rm plugins/Thunder_STORM.jar
mv plugins/Thunder_STORM-packed.jar plugins/Thunder_STORM.jar
# download and compile deepimagej.js
curl https://github.com/deepimagej/deepimagej.js/releases/download/v2.0.1/DeepImageJ_JS_-2.0.1-SNAPSHOT.jar -LO
mv DeepImageJ_JS_-2.0.1-SNAPSHOT.jar plugins/DeepImageJ_JS_-2.0.1-SNAPSHOT.jar
${CHEERPJ_DIR}/cheerpjfy.py -j 4 --deps=${IJ_JAR} --pack-jar=plugins/DeepImageJ_JS_-2.0.1-SNAPSHOT-packed.jar plugins/DeepImageJ_JS_-2.0.1-SNAPSHOT.jar
# extract plugins.config
jar xf plugins/DeepImageJ_JS_-2.0.1-SNAPSHOT.jar plugins.config
mv plugins.config plugins/DeepImageJ_JS_-2.0.1-SNAPSHOT.jar.config
rm plugins/DeepImageJ_JS_-2.0.1-SNAPSHOT.jar
mv plugins/DeepImageJ_JS_-2.0.1-SNAPSHOT-packed.jar plugins/DeepImageJ_JS_-2.0.1-SNAPSHOT.jar
# compile action bar
curl https://sites.imagej.net/Mutterer/plugins/action_bar.jar-20210614214121 -LO
mv action_bar.jar-20210614214121 plugins/action_bar20210614214121.jar
${CHEERPJ_DIR}/cheerpjfy.py -j 4 --deps=${IJ_JAR} --pack-jar=plugins/action_bar20210614214121-packed.jar plugins/action_bar20210614214121.jar
# extract plugins.config
jar xf plugins/action_bar20210614214121.jar plugins.config
mv plugins.config plugins/action_bar20210614214121.jar.config
rm plugins/action_bar20210614214121.jar
mv plugins/action_bar20210614214121-packed.jar plugins/action_bar20210614214121.jar
rm ImageJ.exe
rm run
rm -rf ImageJ.app
python ../../build-plugins.py