Merge lp:~zorba-coders/zorba/bug955040 into lp:zorba/data-formatting-module

Proposed by Rodolfo Ochoa on 2012-03-22
Status: Merged
Approved by: Matthias Brantner on 2012-03-28
Approved revision: 31
Merged at revision: 30
Proposed branch: lp:~zorba-coders/zorba/bug955040
Merge into: lp:zorba/data-formatting-module
Diff against target: 205 lines (+79/-81)
2 files modified
CMakeLists.txt (+4/-0)
src/com/zorba-xquery/www/modules/CMakeLists.txt (+75/-81)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug955040
Reviewer Review Type Date Requested Status
Matthias Brantner 2012-03-22 Approve on 2012-03-28
Chris Hillery Approve on 2012-03-28
Cezar Andrei 2012-03-22 Approve on 2012-03-28
Review via email: mp+98891@code.launchpad.net

Commit message

Fixes on CMakeList to avoid submitting a test when module is not active.
Also added functionality to avoid testing for Java if module is not active.

Description of the change

Fixes on CMakeList to avoid submitting a test when module is not active.
Also added functionality to avoid testing for Java if module is not active.

To post a comment you must log in.
Cezar Andrei (cezar-andrei) wrote :

1. ZORBA_WITH_FOP means I really want FOP. Ie if there is anything missing it's an error.
So if ZORBA_WITH_FOP and ZORBA_SUPPRESS_JAVA are both true should be an error.

2. Why did you replace 1 IF with AND condition with 8 nested IF's ?

review: Needs Fixing
Chris Hillery (ceejatec) wrote :

I don't understand what ZORBA_WITH_FOP means at all. I'm not really a fan of having flags to enable functionality anyway, at least not in non-core module packages - if the user took the time to download the package, presumably they want the contents, so why force them to add another CMake flag to enable it?

But with this change, ZORBA_WITH_FOP is completely meaningless, because it's now SET(ON FORCE). It will always be ON. So the IF(ZORBA_WITH_FOP) is pointless.

I would suggest eliminating the flag entirely. If we really think we need a way to build the data-formatting module without FOP, have a ZORBA_SUPPRESS_FOP flag instead that skips the whole file.

Cezar: Rodolfo had a comment about the nested IF thing - apparently IF(EXISTS a AND EXISTS b...) doesn't work, possibly a CMake bug. I haven't verified that bug myself, but it wouldn't surprise me; I've certainly seen other situations where IF(... AND ...) doesn't do what I'd expect in CMake.

review: Needs Fixing
Cezar Andrei (cezar-andrei) wrote :

Sounds fine with me. So remove the ZORBA_WITH_FOP all together and work around cmake bugs.

Rodolfo Ochoa (rodolfo-ochoa) wrote :

ZORBA_WITH_FOP flag has been eliminated...

Cezar Andrei (cezar-andrei) wrote :

Looks good.

review: Approve
Chris Hillery (ceejatec) wrote :

Yay for removing unnecessary CMake flags! Looks good.

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug955040-2012-03-28T15-46-14.833Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Approve, 1 Pending.

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug955040-2012-03-28T16-53-23.343Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2012-03-14 14:23:36 +0000
3+++ CMakeLists.txt 2012-03-28 00:43:18 +0000
4@@ -12,6 +12,8 @@
5 # See the License for the specific language governing permissions and
6 # limitations under the License.
7
8+MESSAGE (STATUS "******** BEGIN Configuring module Data-Formatting ********")
9+
10 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
11
12 PROJECT (zorba_data-formatting_module)
13@@ -28,3 +30,5 @@
14
15
16 DONE_DECLARING_ZORBA_URIS ()
17+
18+MESSAGE (STATUS "******** END Configuring module Data-Formatting ********")
19
20=== modified file 'src/com/zorba-xquery/www/modules/CMakeLists.txt'
21--- src/com/zorba-xquery/www/modules/CMakeLists.txt 2012-03-14 14:23:36 +0000
22+++ src/com/zorba-xquery/www/modules/CMakeLists.txt 2012-03-28 00:43:18 +0000
23@@ -12,107 +12,101 @@
24 # See the License for the specific language governing permissions and
25 # limitations under the License.
26
27-#
28-# JNI JAVA
29-#
30-IF (ZORBA_SUPPRESS_JAVA)
31- MESSAGE (STATUS "ZORBA_SUPPRESS_JNI is true - not searching for Java")
32-ELSE (ZORBA_SUPPRESS_JAVA)
33- IF (NOT ZORBA_WITH_FOP)
34- MESSAGE (STATUS "Looking for Java")
35+ IF (ZORBA_SUPPRESS_JAVA)
36+ MESSAGE (STATUS "ZORBA_SUPPRESS_JNI is true - not searching for Java")
37+ MESSAGE (STATUS "Building Zorba without XSL-FO support.")
38+ ELSE (ZORBA_SUPPRESS_JAVA)
39+
40 FIND_PACKAGE(Java)
41-
42- MESSAGE (STATUS "Looking for JNI")
43 FIND_PACKAGE(JNI)
44
45 IF (JNI_FOUND)
46- IF (NOT DEFINED XSL_FOP_HOME)
47- IF (WIN32)
48- MESSAGE (STATUS "Variable XSL_FOP_HOME not defined, trying defaults: " ${Java_LIBRARIES})
49- SET (XSL_FOP_HOME ${Java_LIBRARIES})
50- ELSE (WIN32)
51- MESSAGE (STATUS "Variable XSL_FOP_HOME not defined, trying defaults: " ${Java_LIBRARIES} " /usr/share/java/ /usr/share/java/fop/")
52- SET (XSL_FOP_HOME /usr/share/java/ /usr/share/java/fop/ ${Java_LIBRARIES})
53- ENDIF (WIN32)
54- ENDIF (NOT DEFINED XSL_FOP_HOME)
55-
56- MESSAGE (STATUS "XSL-FOP HOME :" ${XSL_FOP_HOME} )
57-
58+
59+ IF (NOT DEFINED XSL_FOP_HOME)
60+ IF (DEFINED ENV{XSL_FOP_HOME})
61+ SET(XSL_FOP_HOME $ENV{XSL_FOP_HOME})
62+ ENDIF (DEFINED ENV{XSL_FOP_HOME})
63+ ENDIF (NOT DEFINED XSL_FOP_HOME)
64+
65+ IF (NOT DEFINED XSL_FOP_HOME)
66+ IF (WIN32)
67+ MESSAGE (STATUS "Environment variable XSL_FOP_HOME not defined, trying default: C:\\dev\\libraries\\fop-1.0")
68+ SET (XSL_FOP_HOME "C:\\dev\\libraries\\fop-1.0")
69+ ELSE (WIN32)
70+ MESSAGE (STATUS "Environment variable XSL_FOP_HOME not defined, trying defaults: " ${Java_LIBRARIES} " /usr/share/java/ /usr/share/java/fop/")
71+ SET (XSL_FOP_HOME "/usr/share/java/ /usr/share/java/fop/ ${Java_LIBRARIES}")
72+ ENDIF (WIN32)
73+ ENDIF (NOT DEFINED XSL_FOP_HOME)
74+
75+ STRING(REGEX REPLACE "\\\\" "/" XSL_FOP_HOME "${XSL_FOP_HOME}")
76+
77+ MESSAGE (STATUS "XSL-FOP HOME: " ${XSL_FOP_HOME} )
78 FIND_FILE( FOP_JAR NAMES fop.jar
79 PATHS ${XSL_FOP_HOME} ${XSL_FOP_HOME}/build )
80-
81 FIND_FILE( FOP_D1_JAR NAMES avalon-framework.jar
82 PATHS ${XSL_FOP_HOME} ${XSL_FOP_HOME}/lib )
83-
84 FIND_FILE( FOP_D2_JAR NAMES batik-all.jar
85 PATHS ${XSL_FOP_HOME} ${XSL_FOP_HOME}/lib )
86-
87 FIND_FILE( FOP_D3_JAR NAMES commons-io.jar
88 PATHS ${XSL_FOP_HOME} ${XSL_FOP_HOME}/lib )
89-
90 FIND_FILE( FOP_D4_JAR NAMES commons-logging.jar
91 PATHS ${XSL_FOP_HOME} ${XSL_FOP_HOME}/lib )
92-
93 FIND_FILE( FOP_D5_JAR NAMES serializer.jar
94 PATHS ${XSL_FOP_HOME} ${XSL_FOP_HOME}/lib )
95-
96 FIND_FILE( FOP_D6_JAR NAMES xalan.jar xalan2.jar
97 PATHS ${XSL_FOP_HOME} ${XSL_FOP_HOME}/lib )
98-
99 FIND_FILE( FOP_D7_JAR NAMES xmlgraphics-commons.jar
100 PATHS ${XSL_FOP_HOME} ${XSL_FOP_HOME}/lib )
101
102- IF( EXISTS ${FOP_JAR} AND EXISTS ${FOP_D1_JAR} AND EXISTS ${FOP_D2_JAR} AND
103- EXISTS ${FOP_D3_JAR} AND EXISTS ${FOP_D4_JAR} AND EXISTS ${FOP_D5_JAR} AND
104- EXISTS ${FOP_D6_JAR} AND EXISTS ${FOP_D7_JAR})
105-
106- #SET (ZORBA_WITH_FOP ON CACHE BOOL "Compile Zorba with XSL-FO support" FORCE)
107- #IF (ZORBA_WITH_FOP)
108- INCLUDE (CMakeJavaInformation )
109- MESSAGE(STATUS "Generating Java API")
110- EXECUTE_PROCESS (
111- COMMAND ${JAVA_RUNTIME} -version
112- RESULT_VARIABLE JAVA_VERSION
113- OUTPUT_QUIET
114- ERROR_QUIET
115- )
116- #MESSAGE (STATUS "JNI found at :${JAVA_INCLUDE_PATH}")
117- #MESSAGE (STATUS "Java Library at :${JAVA_JVM_LIBRARY}")
118- MESSAGE (STATUS "Building Zorba with XSL-FO support.")
119-
120- INCLUDE_DIRECTORIES (${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
121- INCLUDE_DIRECTORIES (${JAVA_INCLUDE_PATH})
122- DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/xsl-fo" VERSION 1.0 FILE "xsl-fo.xq" LINK_LIBRARIES "${JAVA_JVM_LIBRARY}")
123-
124- DECLARE_ZORBA_JAR(FILE ${FOP_JAR} EXTERNAL)
125- DECLARE_ZORBA_JAR(FILE ${FOP_D1_JAR} EXTERNAL)
126- DECLARE_ZORBA_JAR(FILE ${FOP_D2_JAR} EXTERNAL)
127- DECLARE_ZORBA_JAR(FILE ${FOP_D3_JAR} EXTERNAL)
128- DECLARE_ZORBA_JAR(FILE ${FOP_D4_JAR} EXTERNAL)
129- DECLARE_ZORBA_JAR(FILE ${FOP_D5_JAR} EXTERNAL)
130- DECLARE_ZORBA_JAR(FILE ${FOP_D6_JAR} EXTERNAL)
131- DECLARE_ZORBA_JAR(FILE ${FOP_D7_JAR} EXTERNAL)
132-
133- ADD_TEST_DIRECTORY("${PROJECT_SOURCE_DIR}/test")
134- #ENDIF (ZORBA_WITH_FOP)
135- ELSE( EXISTS ${FOP_JAR} AND EXISTS ${FOP_D1_JAR} AND EXISTS ${FOP_D2_JAR} AND
136- EXISTS ${FOP_D3_JAR} AND EXISTS ${FOP_D4_JAR} AND EXISTS ${FOP_D5_JAR} AND
137- EXISTS ${FOP_D6_JAR} AND EXISTS ${FOP_D7_JAR} )
138- MESSAGE (STATUS "fop.jar and all its dependecies not found skiping data-formating module")
139- ENDIF( EXISTS ${FOP_JAR} AND EXISTS ${FOP_D1_JAR} AND EXISTS ${FOP_D2_JAR} AND
140- EXISTS ${FOP_D3_JAR} AND EXISTS ${FOP_D4_JAR} AND EXISTS ${FOP_D5_JAR} AND
141- EXISTS ${FOP_D6_JAR} AND EXISTS ${FOP_D7_JAR} )
142-
143- ELSE (JNI_FOUND)
144- IF (ZORBA_WITH_FOP)
145- MESSAGE(FATAL_ERROR "Could not find Java and/or JNI. Please install a JDK or compile Zorba with XSL-FO support by setting ZORBA_WITH_FOP to false.")
146- ENDIF (ZORBA_WITH_FOP)
147- MESSAGE ( STATUS "Not generating XSL-FO support: jni headers not found.")
148+ #MULTIPLE EXISTS CAN'T BE USED IN AN *IF* COMMAND, LOOKS LIKE A BUG ON CMAKE
149+ SET(ALL_FOP FALSE)
150+ IF ( EXISTS ${FOP_JAR} )
151+ IF ( EXISTS ${FOP_D1_JAR} )
152+ IF ( EXISTS ${FOP_D2_JAR} )
153+ IF ( EXISTS ${FOP_D3_JAR} )
154+ IF ( EXISTS ${FOP_D4_JAR} )
155+ IF ( EXISTS ${FOP_D5_JAR} )
156+ IF ( EXISTS ${FOP_D6_JAR} )
157+ IF ( EXISTS ${FOP_D7_JAR} )
158+ SET(ALL_FOP TRUE)
159+ ENDIF ( EXISTS ${FOP_D7_JAR} )
160+ ENDIF ( EXISTS ${FOP_D6_JAR} )
161+ ENDIF ( EXISTS ${FOP_D5_JAR} )
162+ ENDIF ( EXISTS ${FOP_D4_JAR} )
163+ ENDIF ( EXISTS ${FOP_D3_JAR} )
164+ ENDIF ( EXISTS ${FOP_D2_JAR} )
165+ ENDIF ( EXISTS ${FOP_D1_JAR} )
166+ ENDIF ( EXISTS ${FOP_JAR} )
167+ MESSAGE(STATUS "ALL_FOP:" ${ALL_FOP})
168+
169+ IF ( ALL_FOP )
170+ MESSAGE(STATUS "FOP Libraries Found.")
171+ INCLUDE (CMakeJavaInformation )
172+ EXECUTE_PROCESS (
173+ COMMAND ${JAVA_RUNTIME} -version
174+ RESULT_VARIABLE JAVA_VERSION
175+ OUTPUT_QUIET
176+ ERROR_QUIET
177+ )
178+
179+ INCLUDE_DIRECTORIES (${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
180+ INCLUDE_DIRECTORIES (${JAVA_INCLUDE_PATH})
181+ DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/xsl-fo" VERSION 1.0 FILE "xsl-fo.xq" LINK_LIBRARIES "${JAVA_JVM_LIBRARY}")
182+
183+ DECLARE_ZORBA_JAR(FILE ${FOP_JAR} EXTERNAL)
184+ DECLARE_ZORBA_JAR(FILE ${FOP_D1_JAR} EXTERNAL)
185+ DECLARE_ZORBA_JAR(FILE ${FOP_D2_JAR} EXTERNAL)
186+ DECLARE_ZORBA_JAR(FILE ${FOP_D3_JAR} EXTERNAL)
187+ DECLARE_ZORBA_JAR(FILE ${FOP_D4_JAR} EXTERNAL)
188+ DECLARE_ZORBA_JAR(FILE ${FOP_D5_JAR} EXTERNAL)
189+ DECLARE_ZORBA_JAR(FILE ${FOP_D6_JAR} EXTERNAL)
190+ DECLARE_ZORBA_JAR(FILE ${FOP_D7_JAR} EXTERNAL)
191+ ADD_TEST_DIRECTORY("${PROJECT_SOURCE_DIR}/test")
192+
193+ ELSE ( ALL_FOP )
194+ MESSAGE (STATUS "fop.jar and all its dependecies were not found skiping data-formating module")
195+ ENDIF ( ALL_FOP )
196+
197 ENDIF(JNI_FOUND)
198- ELSE (NOT ZORBA_WITH_FOP)
199- #SET(ZORBA_WITH_FOP OFF CACHE BOOL "Compile Zorba with XSL-FO support." FORCE)
200- MESSAGE(STATUS "Building Zorba without XSL-FO support.")
201- ENDIF (NOT ZORBA_WITH_FOP)
202
203-ENDIF(ZORBA_SUPPRESS_JAVA)
204-MESSAGE(STATUS "")
205+ ENDIF(ZORBA_SUPPRESS_JAVA)

Subscribers

People subscribed via source and target branches

to all changes: