-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
131 lines (111 loc) · 3.43 KB
/
Makefile
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
name='rails-portlet'
jarlib=WEB-INF/lib
classes=WEB-INF/classes
version=`awk -F\" /String\ PORTLET_VERSION/{'print $$2'} WEB-INF/src/com/celamanzi/liferay/portlets/rails286/PortletVersion.java`
liferay_v=`grep 'LIFERAY_VERSION' WEB-INF/src/com/celamanzi/liferay/portlets/rails286/PortletVersion.java | grep -o .,. | tr ',' '.'`
pkgdir=..
hotdeploydir=/usr/local/liferay/tomcat/webapps/ROOT/WEB-INF/classes
# version of Liferay's portal-service jar
#liferay=5.1.1
liferay=5.2.3
.PHONY: list deploy test help
all: compile list
clean:
-find $(classes) -name *.class -exec rm -f {} \;
if [ -e test/classes ]; then rm -rf test/classes/* ; fi
if [ -e build ]; then rm -rf build; fi
compile: clean
ant compile
compile_old: clean
if [ ! -e $(classes) ]; then mkdir $(classes); fi
#
###################### compiling all Java classes
#
# careful here, as the CLASSPATH easily falls out of the javac namespace,
# see the ';\' between the export and the for loop, it is required.
# portal-service and servlet-api are included to satisfy Liferay classes.
export CLASSPATH="\
$(jarlib)/portlet-2.0.jar:\
$(jarlib)/commons-logging.jar:\
$(jarlib)/commons-fileupload-1.2.1.jar:\
$(jarlib)/commons-httpclient-3.1.jar:\
$(jarlib)/portal-kernel.jar:\
$(jarlib)/portal-service-$(liferay).jar:\
$(jarlib)/servlet-api-2.4.jar:\
$(jarlib)/java-util.jar:\
$(jarlib)/htmlparser-1.6.jar" ;\
javac WEB-INF/src/com/celamanzi/liferay/portlets/rails286/*.java -target jsr14 -Xlint:unchecked -Xlint:deprecation -d $(classes)
#xargs javac -target jsr14 -d classes/ <<< `find src/ -name *.java`
list:
#
###################### bytecode classes
#
tree $(classes)
test:
ant -f build_test.xml
test_old: compile
#
###################### running tests
#
if [ -e test/classes ]; then rm -rf test/classes/* ; fi
mkdir -p test/classes
export CLASSPATH="\
$(classes):\
test/classes:\
$(jarlib)/portlet-2.0.jar:\
$(jarlib)/commons-logging.jar:\
$(jarlib)/commons-httpclient-3.1.jar:\
$(jarlib)/commons-codec-1.3.jar:\
$(jarlib)/commons-fileupload-1.2.1.jar:\
$(jarlib)/portal-service-$(liferay).jar:\
$(jarlib)/servlet-api-2.4.jar:\
$(jarlib)/htmlparser-1.6.jar:\
$(jarlib)/log4j-1.2.15.jar:\
$(jarlib)/junit-4.6.jar:\
$(jarlib)/spring-test-2.5.6.jar:\
$(jarlib)/spring-core-2.5.6.jar:\
$(jarlib)/spring-webmvc-2.5.6.jar:\
$(jarlib)/spring-webmvc-portlet-2.5.6.jar:\
test" ;\
javac test/*.java -Xlint:unchecked -Xlint:deprecation -d test/classes && \
time java -ea org.junit.runner.JUnitCore com.celamanzi.liferay.portlets.rails286.TestLoader
hotdeploy: compile
rm -rf $(hotdeploydir)/com/celamanzi/liferay/portlets/rails286/
cp -r build/com $(hotdeploydir)
help:
@echo "To compile classes:"
@echo " make all"
@echo
@echo "To run the test suite:"
@echo " make test (or ant test)"
@echo
@echo "To build the JAR"
@echo " make jar"
prepare: clean
#
###################### preparing
#
mkdir build
rsync * --exclude-from=.exclude -r build/
cd build && make
jar: prepare
#
###################### creating JAR file
#
pkgdir=`pwd` && \
version=$(version) && \
pkg=$(name)-$$version.jar && \
cd build/WEB-INF && \
mv ../README.md classes && \
cd classes && \
echo $$version > VERSION && \
jar cf "$$pkgdir/$$pkg" . && \
echo " * done" && \
cd $$pkgdir && ls -lh $$pkg && jar tf $$pkg
release: jar
pkg=$(name)-$(version).jar && \
mv $$pkg caterpillar/lib/java/
#
###################### JAR is located in caterpillar/lib/java/
#
ls -lh caterpillar/lib/java/