Merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba

Proposed by Cezar Andrei
Status: Merged
Approved by: Chris Hillery
Approved revision: 10663
Merged at revision: 10777
Proposed branch: lp:~zorba-coders/zorba/module-schema-tools
Merge into: lp:zorba
Diff against target: 2449 lines (+1366/-217)
36 files modified
ChangeLog (+2/-0)
NOTICE.txt (+18/-0)
NOTICE.xml (+16/-0)
bin/path_util.cpp (+19/-2)
bin/path_util.h (+6/-0)
bin/zorbacmd.cpp (+8/-0)
bin/zorbacmdproperties.cpp (+5/-0)
bin/zorbacmdproperties.h (+3/-0)
bin/zorbacmdproperties.txt (+1/-0)
bin/zorbacmdproperties_base.h (+133/-72)
cmake_modules/ZorbaModule.cmake (+132/-44)
config/ExternalModuleConfig.cmake.in (+26/-9)
config/ZorbaUse.cmake (+0/-4)
include/zorba/properties_base.h (+37/-1)
include/zorba/util/file.h (+2/-0)
include/zorba/zorba.h (+15/-5)
modules/CMakeLists.txt (+113/-30)
modules/ExternalModules.conf (+2/-0)
scripts/CMakeLists.txt (+4/-2)
src/api/zorbaimpl.cpp (+10/-0)
src/api/zorbaimpl.h (+2/-0)
src/context/dynamic_loader.cpp (+41/-26)
src/context/dynamic_loader.h (+10/-5)
src/system/properties.h (+21/-0)
src/system/zorba_properties.h (+67/-17)
src/system/zorba_properties.txt (+1/-0)
src/util/file.cpp (+12/-0)
src/util/fs_util.cpp (+24/-0)
src/util/fs_util.h (+28/-0)
src/util/win32/dirent.h (+372/-0)
swig/java/CMakeLists.txt (+1/-0)
swig/various.i (+184/-0)
swig/zorba_api.i (+2/-0)
test/rbkt/modules/CMakeLists.txt (+2/-0)
test/rbkt/modules/java/CMakeLists.txt (+40/-0)
test/rbkt/modules/java/Test.java (+7/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/module-schema-tools
Reviewer Review Type Date Requested Status
Chris Hillery Approve
Matthias Brantner Approve
Cezar Andrei Approve
Review via email: mp+102377@code.launchpad.net

This proposal supersedes a proposal from 2012-04-14.

Commit message

Add java classpath to zorbacmd and to Zorba API.
Fix dynamic libraries loading.
Tested it works on Windows with both xsl-fo and xmlbeans modules. All tests are passing.

Fixed ExternalModule integration, fixed comment and indentation of previously property generated files: src/system/zorba_properties.h and bin/zorbacmdproperties_base.h.

Description of the change

Add java classpath to zorbacmd and to Zorba API.
Fix dynamic libraries loading.
Tested it works on Windows with both xsl-fo and xmlbeans modules. All tests are passing.

Fixed ExternalModule integration, fixed comment and indentation of previously property generated files: src/system/zorba_properties.h and bin/zorbacmdproperties_base.h.

Removed swig IStream class and references.

Added util-jvm module which implements the link to the jvm.

Solved merge conflict.

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in modules/ExternalModules.conf

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

- In DynamicLoader::loadModule the code to create the Module is redundant and should be factorized
- Why is DECLARE_ZORBA_JAR in cmake_modules/ZorbaModule.cmake commented out? Should it be removed?
- Why did the file src/store/naive/store_properties.h change? I think Markos has disabled the generation in the trunk. We have to be careful that nothing is removed by this merge (same for all properties).
  For example,
88 -"--no-copy-optim\napply the no-copy optimization (1=enabled (default), 0=off)\n\n"
1089 -"--serialize-only-query\nserialize-only-query (<0=unknown (default), 1=enabled, 0=off)\n\n"
1090 +"--no-copy-optim\nno copy optim (1=enabled (default), 0=off)\n\n"
1091 +"--serialize-only-query\nserialize-only query (1=true, 0=false (default))\n\n"

causes the unknown option for the serialize-only-query param to disappear

- commit of src/util/win32/dirent.h should be mentioned in NOTICE.xml
- I don't really like the name serializeToOutputStream. Why can't it just be serialize with one parameter?
- there is a todo left "# todo cezar compile and jar it up"
- I didn't find a test for the new serializeToOutputStream or getStream functions? I think it would be good to have some tests.

review: Needs Fixing
Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

Agreed with Matthias's comments.

Regarding DECLARE_ZORBA_JAR(), it looks like the commented-out macro is an older version, and the newer version is not commented-out. The older one should just be deleted.

Couple more comments:

- Do we also need to mention the addition of swig/various.i in NOTICE.xml? It has a comment saying it's from the SWIG package directly.

- Wasn't the class name "IStream" causing a build conflict on Windows?

- The call to init_val() in zorbacmdproperties_base.h should be on a separate line. (I know it was cut-and-pasted from above, but ugh.)

- Why is the method for retrieving the PropertiesGlobal* called "getProperties()"? Shouldn't that be getProperiesGlobal()? (Or, IMHO, getGlobalProperties() and rename the class to GlobalProperties.)

- Similarly, why is the factory method for PropertiesGlobal "Properties::instance()"? (The Zorba Properties stuff has always seemed like a mishmash to me; this isn't helping.)

- Need to fix the conflict in ExternalModules.conf.

- Typo: "singelton" in zorba.h.

review: Needs Fixing
Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

I fixed all of the comments, execept:
- the ones related to swig:
    - the changes are not required, right now but they required for optimizing XQJ, to make swig play nice with streams it's quite a chlange, would be a petty to loose them
    - I don't think various.i should be specified in NOTICE.xml since we already have swig and various.i is part of swig.
- about Properties it's not really the most intuitive way of representing it but I do think PropertiesGlobal is a good name, many projects use kind after the base to explain what it is. I call Properties::instance() because that is the private instantiable implementation class that extends ZorbaProperties which is based on PropertiesGlobal.

Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

See my prevoius comment for fixes in this proposal.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue job module-schema-tools-2012-03-16T20-15-10.551Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

- I think you reverted the changes that have been made in modules/ExternalModules.conf.
- The file src/system/zorba_properties.h also contains changes that have been reverted. For example,

1058 -"--no-copy-optim\napply the no-copy optimization (1=enabled (default), 0=off)\n\n"
1059 -"--serialize-only-query\nserialize-only-query (<0=unknown (default), 1=enabled, 0=off)\n\n"
1060 +"--no-copy-optim\nno copy optim (1=enabled (default), 0=off)\n\n"
1061 +"--serialize-only-query\nserialize-only query (1=true, 0=false (default))\n\n"

review: Needs Fixing
Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

It looks like you didn't fix the indentation of calls to init_val() in zorbacmdproperties_base.h, and in fact it looks like you moved a number of other instances of calls to that method onto the ends of earlier lines of code in zorba_properties.h. It's just not good readability. To be clear, I'm talking about lines like this:

   if (*argv == NULL) { result = "No value given for --classpath option"; break; } init_val (*argv, theClasspath, d);

There's no reason to have that call to init_val() hanging out over there. I count 9 places where this is done, most of which were put that way with this change.

You also didn't rename the class "IStream". Rodolfo reported that that class name conflicted with a Windows class, making the code not compile on Windows. It's not clear to me if this is one of the changes for "optimizing XQJ" you mentioned, but if it actually causes a compilation failure it must be changed.

review: Needs Fixing
Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

> It looks like you didn't fix the indentation of calls to init_val() in
> zorbacmdproperties_base.h, and in fact it looks like you moved a number of
> other instances of calls to that method onto the ends of earlier lines of code
> in zorba_properties.h. It's just not good readability. To be clear, I'm
> talking about lines like this:
>
> if (*argv == NULL) { result = "No value given for --classpath option";
> break; } init_val (*argv, theClasspath, d);
>
> There's no reason to have that call to init_val() hanging out over there. I
> count 9 places where this is done, most of which were put that way with this
> change.

If you take a look at the file there are many places where this strange indentation occurs. Check out the top of the file: THIS IS A GENERATED FILE. DO NOT EDIT!

>
>
> You also didn't rename the class "IStream". Rodolfo reported that that class
> name conflicted with a Windows class, making the code not compile on Windows.
> It's not clear to me if this is one of the changes for "optimizing XQJ" you
> mentioned, but if it actually causes a compilation failure it must be changed.

Rodolfo, checked out the full build and tests on windows, there is no problem with it. I sent an email to clarify it.

Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

> If you take a look at the file there are many places where this strange
> indentation occurs. Check out the top of the file: THIS IS A GENERATED FILE.
> DO NOT EDIT!

My understanding is that this isn't true anymore, though. Markos removed the script to generate this file, and said that in future changes should be made directly to it. If that's correct, clearly he should have removed the above comment as well.

Did you run a script to generate these files, Cezar? If so, that would explain Matthias's problem as well (about changes to the property descriptions that seem to have been reverted by you).

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

I didn't know Markos removed the scripts after I made the changes. But I removed the comment and I fixed the indentation of init_val lines.

I also fixed the ExternalModules.config wrong merge, and checked src/system/zorba_properties.h contains changes only related to CLASSPATH and indentation.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue job module-schema-tools-2012-03-19T16-20-06.136Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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

Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

Removed IStream swig class and references.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue job module-schema-tools-2012-03-20T19-01-23.283Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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

Revision history for this message
Cezar Andrei (cezar-andrei) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Chris Hillery (ceejatec) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Cezar Andrei (cezar-andrei) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Chris Hillery (ceejatec) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

Should the classpath in the static context be serialized? I forgot our decision, is this member needed at all?

review: Needs Information
Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

It looks like the classpath in static_context is orphaned; nothing sets it or references it. I'll take that out.

Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

Removed. Matthias, if that was your only comment, go ahead and vote Approve.

Revision history for this message
Matthias Brantner (matthias-brantner) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

I'll need Cezar to set the commit message; I'm not sure if he just copied
the Description or not. Unfortunately if you go back to the previous
revision of the Proposal it doesn't show the commit message from that
version...

Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

I've set the commit message, but build is not triggered, do I need to resubmit the proposal?

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in ChangeLog
text conflict in src/api/staticcontextimpl.h
text conflict in src/precompiled/stdafx.h

Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

I merged from the trunk, but I wasn't totally sure that I did the right thing with stdafx.h. So I re-submitted the proposal so Matthias and Cezar could have a chance to re-review.

As far as I can tell, stdafx.h was never explicitly changed on the module-schema-tools branch; the only commits which affected it were merges from the trunk. So I don't know why there were merge conflicts now. But I just made it identical to the current trunk. If that's OK, then you two should go ahead and re-approve.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job module-schema-tools-2012-04-14T07-27-03.74Z is
  finished. The final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

There is a feature in CMake that DECLARE_ZORBA_JAR(..TARGET..) depends on which, it turns out, was only implemented correctly as of CMake 2.8.4. (See http://public.kitware.com/Bug/view.php?id=11332 .) The remote queue was running CMake 2.8.2, which is why the build failed.

I have upgraded the queue to run CMake 2.8.7, so hopefully it'll work this time.

I note that there doesn't appear to be any documentation for this new Java stuff as yet, but wherever it ends up, it should be noted that CMake >= 2.8.4 is required.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job module-schema-tools-2012-04-14T08-25-03.504Z is
  finished. The final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job module-schema-tools-2012-04-14T08-42-58.716Z is
  finished. The final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

Grumble. Sometimes I hate CMake. This stuff works just fine on my machine, but for whatever reason the dependencies just aren't working out right on the remote queue machine. I've spent the last hour trying to make it work right and have so far failed. I'll have to take another crack at it either over the weekend or on Monday; sorry.

By the by, if I manually run "make" again, it gets past this point. However, then it gets a bunch of SWIG errors:

In file included from /home/ceej/zo/testing/zorbatest/tester/remotequeue/module-schema-tools-2012-04-14T08-42-58.716Z/bzr/zorba/build/swig/python/zorba_apiPYTHON_wrap.cxx:3478:
/home/ceej/zo/testing/zorbatest/tester/remotequeue/module-schema-tools-2012-04-14T08-42-58.716Z/bzr/zorba/build/swig/python/StaticContext.h:115: error: ‘TypeIdentifier’ does not name a type
/home/ceej/zo/testing/zorbatest/tester/remotequeue/module-schema-tools-2012-04-14T08-42-58.716Z/bzr/zorba/build/swig/python/StaticContext.h:116: error: ‘TypeIdentifier’ does not name a type
/home/ceej/zo/testing/zorbatest/tester/remotequeue/module-schema-tools-2012-04-14T08-42-58.716Z/bzr/zorba/build/swig/python/StaticContext.h:117: error: ‘TypeIdentifier’ does not name a type
/home/ceej/zo/testing/zorbatest/tester/remotequeue/module-schema-tools-2012-04-14T08-42-58.716Z/bzr/zorba/build/swig/python/StaticContext.h:119: error: expected ‘,’ or ‘...’ before ‘&’ token
/home/ceej/zo/testing/zorbatest/tester/remotequeue/module-schema-tools-2012-04-14T08-42-58.716Z/bzr/zorba/build/swig/python/StaticContext.h:119: error: ISO C++ forbids declaration of ‘TypeIdentifier’ with no type

and a bunch more like that. That doesn't have anything to do with my CMake changes, and will have to be solved as well. Any ideas?

Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

Unless when you updated cmake you updated swig too, no other idea comes to mind.

I have cmake 2.8.5 and swig 1.3.40 on my box and works fine.

> That doesn't have anything to do with my CMake
> changes, and will have to be solved as well. Any ideas?

Revision history for this message
Matthias Brantner (matthias-brantner) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Cezar Andrei (cezar-andrei) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job module-schema-tools-2012-04-17T15-15-59.439Z is
  finished. The final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

Chris, can you check the cmake build dependencies for util-jvm module. I see the same error on my box when I use make -j12.

[ 95%] Built target modlib69_xqxq.xq
[ 95%] Built target modlib56_hmac.xq
Scanning dependencies of target modlib70_util-jvm.xq
[ 95%] Scanning dependencies of target modlib71_schema-tools.xq
.Building CXX object zorba_modules/zorba_util-jvm_module/src/CMakeFiles/modlib70_util-jvm.xq.dir/util-jvm.xq.src/util-jvm.cpp.o
make[2]: *** No rule to make target `LIB_PATH/com/zorba-xquery/www/modules/libutil-jvm_1.0.so', needed by `LIB_PATH/com/zorba-xquery/www/modules/libschema-tools_1.0.so'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 95%] Building CXX object zorba_modules/zorba_schema-tools_module/src/CMakeFiles/modlib71_schema-tools.xq.dir/schema-tools.xq.src/schema-tools.cpp.o
[ 95%] Building CXX object zorba_modules/zorba_util-jvm_module/src/CMakeFiles/modlib70_util-jvm.xq.dir/util-jvm.xq.src/JavaVMSingleton.cpp.o
Linking CXX shared library ../../../LIB_PATH/com/zorba-xquery/www/modules/libutil-jvm_1.0.so
make[1]: *** [zorba_modules/zorba_schema-tools_module/src/CMakeFiles/modlib71_schema-tools.xq.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

Fixed erroneous merging of swig files.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job module-schema-tools-2012-04-17T19-20-05.192Z is
  finished. The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in cmake_modules/ZorbaModule.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job module-schema-tools-2012-04-18T07-13-04.737Z is
  finished. The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job module-schema-tools-2012-04-18T08-39-07.752Z is
  finished. The final status was:

  3 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job module-schema-tools-2012-04-18T09-15-58.572Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

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

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Chris Hillery (ceejatec) wrote :

Think I finally got the dependency tracking working. It's ugly but at least works.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

contents conflict in NOTICE.txt

Revision history for this message
Chris Hillery (ceejatec) wrote :

Aie... it's the merge proposal that will never die!

I'm doing a trunk merge now.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job module-schema-tools-2012-04-18T15-58-07.886Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Chris Hillery (ceejatec) wrote :

Hooray!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-04-18 11:34:17 +0000
3+++ ChangeLog 2012-04-18 15:53:24 +0000
4@@ -9,6 +9,7 @@
5 * fn:unparsed-text
6 * fn:unparsed-text-available
7 * Extended API for Python, Java, PHP and Ruby.
8+ * Add jvm classpath to zorbacmd and to Zorba API. Tracked by #931816
9 * Added support for NO_ICU (to not use ICU for unicode processing)
10
11 Optimization:
12@@ -30,6 +31,7 @@
13 * Fixed bug #921458 (file:read-text-lines() blocking)
14 * Fixed bug #980526 (no-copy rule bug due to global var being set in "distant" udf)
15 * Fixed bug #949910 (has-children may be invoked on all nodes). Internally, zorba::store::Item::getChildren() now returns NULL on node classes without offspring (instead of raising an error).
16+ * Fixed Bug #933490: Error ItemFactoryImpl::createBase64Binary with istream
17
18
19 version 2.2
20
21=== modified file 'NOTICE.txt'
22--- NOTICE.txt 2012-04-12 18:14:55 +0000
23+++ NOTICE.txt 2012-04-18 15:53:24 +0000
24@@ -459,6 +459,24 @@
25 suitability of this software for any purpose. It is provided "as is"
26 without express or implied warranty.
27
28+----------------------------------------------------
29+
30+src/util/win32/dirent.h
31+
32+Copyright: 2006 Toni Ronkko
33+
34+
35+ Permission is hereby granted, free of charge, to any person obtaining
36+ a copy of this software and associated documentation files (the
37+ ``Software''), to deal in the Software without restriction, including
38+ without limitation the rights to use, copy, modify, merge, publish,
39+ distribute, sublicense, and/or sell copies of the Software, and to
40+ permit persons to whom the Software is furnished to do so, subject to
41+ the following conditions:
42+
43+ The above copyright notice and this permission notice shall be included
44+ in all copies or substantial portions of the Software.
45+
46
47 External libraries used by this project:
48 ----------------------------------------------------
49
50=== modified file 'NOTICE.xml'
51--- NOTICE.xml 2012-04-16 20:56:43 +0000
52+++ NOTICE.xml 2012-04-18 15:53:24 +0000
53@@ -423,6 +423,22 @@
54 without express or implied warranty.
55 </foreign-notice>
56 </foreign-files>
57+ <foreign-files>
58+ <file>src/util/win32/dirent.h</file>
59+ <copyright>2006 Toni Ronkko</copyright>
60+ <foreign-notice>
61+ Permission is hereby granted, free of charge, to any person obtaining
62+ a copy of this software and associated documentation files (the
63+ ``Software''), to deal in the Software without restriction, including
64+ without limitation the rights to use, copy, modify, merge, publish,
65+ distribute, sublicense, and/or sell copies of the Software, and to
66+ permit persons to whom the Software is furnished to do so, subject to
67+ the following conditions:
68+
69+ The above copyright notice and this permission notice shall be included
70+ in all copies or substantial portions of the Software.
71+ </foreign-notice>
72+ </foreign-files>
73
74 <external-lib mandatory="true">
75 <name>LIBXML2</name>
76
77=== modified file 'bin/path_util.cpp'
78--- bin/path_util.cpp 2012-04-16 20:56:43 +0000
79+++ bin/path_util.cpp 2012-04-18 15:53:24 +0000
80@@ -49,7 +49,7 @@
81 }
82
83
84-static void
85+void
86 tokenizePath(
87 const std::string& aPathStr,
88 std::vector<String>& aResult)
89@@ -66,6 +66,23 @@
90 }
91 }
92
93+
94+String
95+concatenatePaths( const std::vector<String>& aPathList)
96+{
97+ String delimiter(filesystem_path::get_path_separator());
98+
99+ String lResult;
100+ for (std::vector<String>::const_iterator lIter = aPathList.begin();
101+ lIter != aPathList.end(); ++lIter)
102+ {
103+ lResult += delimiter + *lIter;
104+ }
105+
106+ return lResult;
107+}
108+
109+
110 void
111 setPathsOnContext(
112 const ZorbaCMDProperties& aProperties,
113@@ -101,8 +118,8 @@
114 // Compute and set lib path
115 aProperties.getLibPath(lPathStr);
116 tokenizePath(lPathStr, lPath);
117+ lPath.push_back(lCWD.get_path());
118 lEnvStr = getPathFromEnvironment("ZORBA_LIB_PATH");
119- lPath.push_back(lCWD.get_path());
120 tokenizePath(lEnvStr, lPath);
121 aStaticCtx->setLibPath(lPath);
122 }
123
124=== modified file 'bin/path_util.h'
125--- bin/path_util.h 2012-04-16 20:56:43 +0000
126+++ bin/path_util.h 2012-04-18 15:53:24 +0000
127@@ -32,6 +32,12 @@
128 setPathsOnContext(const ZorbaCMDProperties& aProperties,
129 zorba::StaticContext_t& aStaticCtx);
130
131+ void
132+ tokenizePath(const std::string& aPathStr, std::vector<String>& aResult);
133+
134+
135+ String
136+ concatenatePaths( const std::vector<String>& aPathList);
137
138 }
139 } /* namespace zorba */
140
141=== modified file 'bin/zorbacmd.cpp'
142--- bin/zorbacmd.cpp 2012-04-16 20:56:43 +0000
143+++ bin/zorbacmd.cpp 2012-04-18 15:53:24 +0000
144@@ -787,6 +787,14 @@
145 return 3;
146 }
147
148+ // Add command line --classpath option in front of config/env CLASSPATH
149+ Properties* globalProperties = Properties::instance();
150+ std::string cmdJvmClassPath;
151+ lProperties.getJVMClassPath(cmdJvmClassPath);
152+ std::string configJvmClassPath;
153+ globalProperties->getJVMClassPath(configJvmClassPath);
154+ globalProperties->setJVMClassPath(cmdJvmClassPath +
155+ filesystem_path::get_path_separator() + configJvmClassPath);
156
157 // Start the engine
158
159
160=== modified file 'bin/zorbacmdproperties.cpp'
161--- bin/zorbacmdproperties.cpp 2012-04-16 20:56:43 +0000
162+++ bin/zorbacmdproperties.cpp 2012-04-18 15:53:24 +0000
163@@ -181,6 +181,11 @@
164 aPath = theLibPath;
165 }
166
167+void ZorbaCMDProperties::getJVMClassPath(std::string& aPath) const
168+{
169+ aPath = theClasspath;
170+}
171+
172 std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const
173 {
174 std::vector<std::pair<std::string,std::string> > lResult;
175
176=== modified file 'bin/zorbacmdproperties.h'
177--- bin/zorbacmdproperties.h 2012-04-16 20:56:43 +0000
178+++ bin/zorbacmdproperties.h 2012-04-18 15:53:24 +0000
179@@ -92,6 +92,9 @@
180 void
181 getLibPath(std::string&) const;
182
183+ void
184+ getJVMClassPath(std::string&) const;
185+
186 bool isDebug(){ return theDebug; }
187
188 bool hasNoLogo(){ return theNoLogo; }
189
190=== modified file 'bin/zorbacmdproperties.txt'
191--- bin/zorbacmdproperties.txt 2012-04-16 20:56:43 +0000
192+++ bin/zorbacmdproperties.txt 2012-04-18 15:53:24 +0000
193@@ -31,6 +31,7 @@
194 ("uri-path", po::value<std::string>(), "URI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.")
195 ("lib-path", po::value<std::string>(), "Library path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.")
196 ("module-path", po::value<std::string>(), "Path (list of directories) to add to both the URI and Library paths.")
197+("classpath", po::value<std::string>(), "JVM classpath to be used by modules using Java implementations")
198 ("option", po::value<std::vector<std::string> >(), "Set an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value").
199 ("trailing-nl", "Output a trailing newline after the result of the query.")
200 ("stop-words", po::value<std::vector<std::string> >(), "Mapping specifying a stop-words URI to another.")
201
202=== modified file 'bin/zorbacmdproperties_base.h'
203--- bin/zorbacmdproperties_base.h 2012-04-16 20:56:43 +0000
204+++ bin/zorbacmdproperties_base.h 2012-04-18 15:53:24 +0000
205@@ -15,13 +15,6 @@
206 */
207 /* vim:set et sw=2 ts=2: */
208
209-// ******************************************
210-// * *
211-// * THIS IS A GENERATED FILE. DO NOT EDIT! *
212-// * SEE .txt FILE WITH SAME NAME *
213-// * *
214-// ******************************************
215-
216 #include <string>
217 #include <sstream>
218 #include <zorba/config.h>
219@@ -30,13 +23,29 @@
220
221 #ifndef ZORBACMD_ZORBACMDPROPERTIESBASE
222 #define ZORBACMD_ZORBACMDPROPERTIESBASE
223-namespace zorbacmd {
224-class ZorbaCMDPropertiesBase : public ::zorba::PropertiesBase {
225+namespace zorbacmd
226+{
227+
228+class ZorbaCMDPropertiesBase : public ::zorba::PropertiesBase
229+{
230 protected:
231- const char **get_all_options () const {
232- static const char *result [] = { "--timing", "--output-file", "--serialization-parameter", "--serialize-html", "--serialize-text", "--indent", "--print-query", "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration", "--base-uri", "--boundary-space", "--default-collation", "--construction-mode", "--ordering-mode", "--multiple", "--query", "--as-files", "--external-variable", "--context-item", "--optimization-level", "--lib-module", "--parse-only", "--compile-only", "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo", "--timeout", "--uri-path", "--lib-path", "--module-path", "--option", "--trailing-nl", "--stop-words", "--thesaurus", "--compile-plan", "--execute-plan", NULL };
233+ const char **get_all_options () const
234+ {
235+ static const char *result [] = {
236+ "--timing", "--output-file", "--serialization-parameter",
237+ "--serialize-html", "--serialize-text", "--indent", "--print-query",
238+ "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration",
239+ "--base-uri", "--boundary-space", "--default-collation",
240+ "--construction-mode", "--ordering-mode", "--multiple", "--query",
241+ "--as-files", "--external-variable", "--context-item",
242+ "--optimization-level", "--lib-module", "--parse-only", "--compile-only",
243+ "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo",
244+ "--timeout", "--uri-path", "--lib-path", "--module-path", "--classpath",
245+ "--option", "--trailing-nl", "--stop-words", "--thesaurus",
246+ "--compile-plan", "--execute-plan", NULL };
247 return result;
248 }
249+
250 bool theTiming;
251 std::string theOutputFile;
252 std::vector<std::string> theSerializationParameter;
253@@ -70,6 +79,7 @@
254 std::string theUriPath;
255 std::string theLibPath;
256 std::string theModulePath;
257+ std::string theClasspath;
258 std::vector<std::string> theOption;
259 bool theTrailingNl;
260 std::vector<std::string> theStopWords;
261@@ -136,6 +146,7 @@
262 const std::string &uriPath () const { return theUriPath; }
263 const std::string &libPath () const { return theLibPath; }
264 const std::string &modulePath () const { return theModulePath; }
265+ const std::string &classpath () const { return theClasspath; }
266 const std::vector<std::string> &option () const { return theOption; }
267 const bool &trailingNl () const { return theTrailingNl; }
268 const std::vector<std::string> &stopWords () const { return theStopWords; }
269@@ -158,12 +169,16 @@
270 else if (strcmp (*argv, "--output-file") == 0 || strncmp (*argv, "-o", 2) == 0) {
271 int d = 2;
272 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
273- if (*argv == NULL) { result = "No value given for --output-file option"; break; } init_val (*argv, theOutputFile, d);
274+ if (*argv == NULL) { result = "No value given for --output-file option"; break; }
275+
276+ init_val (*argv, theOutputFile, d);
277 }
278 else if (strcmp (*argv, "--serialization-parameter") == 0 || strncmp (*argv, "-z", 2) == 0) {
279 int d = 2;
280 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
281- if (*argv == NULL) { result = "No value given for --serialization-parameter option"; break; } init_val (*argv, theSerializationParameter, d);
282+ if (*argv == NULL) { result = "No value given for --serialization-parameter option"; break; }
283+
284+ init_val (*argv, theSerializationParameter, d);
285 }
286 else if (strcmp (*argv, "--serialize-html") == 0) {
287 theSerializeHtml = true;
288@@ -189,37 +204,51 @@
289 else if (strcmp (*argv, "--base-uri") == 0) {
290 int d = 2;
291 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
292- if (*argv == NULL) { result = "No value given for --base-uri option"; break; } init_val (*argv, theBaseUri, d);
293+ if (*argv == NULL) { result = "No value given for --base-uri option"; break; }
294+
295+ init_val (*argv, theBaseUri, d);
296 }
297 else if (strcmp (*argv, "--boundary-space") == 0) {
298 int d = 2;
299 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
300- if (*argv == NULL) { result = "No value given for --boundary-space option"; break; } init_val (*argv, theBoundarySpace, d);
301+ if (*argv == NULL) { result = "No value given for --boundary-space option"; break; }
302+
303+ init_val (*argv, theBoundarySpace, d);
304 }
305 else if (strcmp (*argv, "--default-collation") == 0) {
306 int d = 2;
307 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
308- if (*argv == NULL) { result = "No value given for --default-collation option"; break; } init_val (*argv, theDefaultCollation, d);
309+ if (*argv == NULL) { result = "No value given for --default-collation option"; break; }
310+
311+ init_val (*argv, theDefaultCollation, d);
312 }
313 else if (strcmp (*argv, "--construction-mode") == 0) {
314 int d = 2;
315 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
316- if (*argv == NULL) { result = "No value given for --construction-mode option"; break; } init_val (*argv, theConstructionMode, d);
317+ if (*argv == NULL) { result = "No value given for --construction-mode option"; break; }
318+
319+ init_val (*argv, theConstructionMode, d);
320 }
321 else if (strcmp (*argv, "--ordering-mode") == 0) {
322 int d = 2;
323 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
324- if (*argv == NULL) { result = "No value given for --ordering-mode option"; break; } init_val (*argv, theOrderingMode, d);
325+ if (*argv == NULL) { result = "No value given for --ordering-mode option"; break; }
326+
327+ init_val (*argv, theOrderingMode, d);
328 }
329 else if (strcmp (*argv, "--multiple") == 0 || strncmp (*argv, "-m", 2) == 0) {
330 int d = 2;
331 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
332- if (*argv == NULL) { result = "No value given for --multiple option"; break; } init_val (*argv, theMultiple, d);
333+ if (*argv == NULL) { result = "No value given for --multiple option"; break; }
334+
335+ init_val (*argv, theMultiple, d);
336 }
337 else if (strcmp (*argv, "--query") == 0 || strncmp (*argv, "-q", 2) == 0) {
338 int d = 2;
339 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
340- if (*argv == NULL) { result = "No value given for --query option"; break; } init_val (*argv, theQueriesOrFiles, d);
341+ if (*argv == NULL) { result = "No value given for --query option"; break; }
342+
343+ init_val (*argv, theQueriesOrFiles, d);
344 }
345 else if (strcmp (*argv, "--as-files") == 0 || strncmp (*argv, "-f", 2) == 0) {
346 theAsFiles = true;
347@@ -227,17 +256,23 @@
348 else if (strcmp (*argv, "--external-variable") == 0 || strncmp (*argv, "-e", 2) == 0) {
349 int d = 2;
350 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
351- if (*argv == NULL) { result = "No value given for --external-variable option"; break; } init_val (*argv, theExternalVariable, d);
352+ if (*argv == NULL) { result = "No value given for --external-variable option"; break; }
353+
354+ init_val (*argv, theExternalVariable, d);
355 }
356 else if (strcmp (*argv, "--context-item") == 0) {
357 int d = 2;
358 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
359- if (*argv == NULL) { result = "No value given for --context-item option"; break; } init_val (*argv, theContextItem, d);
360+ if (*argv == NULL) { result = "No value given for --context-item option"; break; }
361+
362+ init_val (*argv, theContextItem, d);
363 }
364 else if (strcmp (*argv, "--optimization-level") == 0) {
365 int d = 2;
366 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
367- if (*argv == NULL) { result = "No value given for --optimization-level option"; break; } init_val (*argv, theOptimizationLevel, d);
368+ if (*argv == NULL) { result = "No value given for --optimization-level option"; break; }
369+
370+ init_val (*argv, theOptimizationLevel, d);
371 }
372 else if (strcmp (*argv, "--lib-module") == 0 || strncmp (*argv, "-l", 2) == 0) {
373 theLibModule = true;
374@@ -257,12 +292,16 @@
375 else if (strcmp (*argv, "--debug-host") == 0 || strncmp (*argv, "-h", 2) == 0) {
376 int d = 2;
377 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
378- if (*argv == NULL) { result = "No value given for --debug-host option"; break; } init_val (*argv, theDebugHost, d);
379+ if (*argv == NULL) { result = "No value given for --debug-host option"; break; }
380+
381+ init_val (*argv, theDebugHost, d);
382 }
383 else if (strcmp (*argv, "--debug-port") == 0 || strncmp (*argv, "-p", 2) == 0) {
384 int d = 2;
385 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
386- if (*argv == NULL) { result = "No value given for --debug-port option"; break; } init_val (*argv, theDebugPort, d);
387+ if (*argv == NULL) { result = "No value given for --debug-port option"; break; }
388+
389+ init_val (*argv, theDebugPort, d);
390 }
391 else if (strcmp (*argv, "--no-logo") == 0) {
392 theNoLogo = true;
393@@ -270,27 +309,44 @@
394 else if (strcmp (*argv, "--timeout") == 0) {
395 int d = 2;
396 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
397- if (*argv == NULL) { result = "No value given for --timeout option"; break; } init_val (*argv, theTimeout, d);
398+ if (*argv == NULL) { result = "No value given for --timeout option"; break; }
399+
400+ init_val (*argv, theTimeout, d);
401 }
402 else if (strcmp (*argv, "--uri-path") == 0) {
403 int d = 2;
404 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
405- if (*argv == NULL) { result = "No value given for --uri-path option"; break; } init_val (*argv, theUriPath, d);
406+ if (*argv == NULL) { result = "No value given for --uri-path option"; break; }
407+
408+ init_val (*argv, theUriPath, d);
409 }
410 else if (strcmp (*argv, "--lib-path") == 0) {
411 int d = 2;
412 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
413- if (*argv == NULL) { result = "No value given for --lib-path option"; break; } init_val (*argv, theLibPath, d);
414+ if (*argv == NULL) { result = "No value given for --lib-path option"; break; }
415+
416+ init_val (*argv, theLibPath, d);
417 }
418 else if (strcmp (*argv, "--module-path") == 0) {
419 int d = 2;
420 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
421- if (*argv == NULL) { result = "No value given for --module-path option"; break; } init_val (*argv, theModulePath, d);
422+ if (*argv == NULL) { result = "No value given for --module-path option"; break; }
423+
424+ init_val (*argv, theModulePath, d);
425+ }
426+ else if (strcmp (*argv, "--classpath") == 0) {
427+ int d = 2;
428+ if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
429+ if (*argv == NULL) { result = "No value given for --classpath option"; break; }
430+
431+ init_val (*argv, theClasspath, d);
432 }
433 else if (strcmp (*argv, "--option") == 0) {
434 int d = 2;
435 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
436- if (*argv == NULL) { result = "No value given for --option option"; break; } init_val (*argv, theOption, d);
437+ if (*argv == NULL) { result = "No value given for --option option"; break; }
438+
439+ init_val (*argv, theOption, d);
440 }
441 else if (strcmp (*argv, "--trailing-nl") == 0) {
442 theTrailingNl = true;
443@@ -298,12 +354,16 @@
444 else if (strcmp (*argv, "--stop-words") == 0) {
445 int d = 2;
446 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
447- if (*argv == NULL) { result = "No value given for --stop-words option"; break; } init_val (*argv, theStopWords, d);
448+ if (*argv == NULL) { result = "No value given for --stop-words option"; break; }
449+
450+ init_val (*argv, theStopWords, d);
451 }
452 else if (strcmp (*argv, "--thesaurus") == 0) {
453 int d = 2;
454 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
455- if (*argv == NULL) { result = "No value given for --thesaurus option"; break; } init_val (*argv, theThesaurus, d);
456+ if (*argv == NULL) { result = "No value given for --thesaurus option"; break; }
457+
458+ init_val (*argv, theThesaurus, d);
459 }
460 else if (strcmp (*argv, "--compile-plan") == 0 || strncmp (*argv, "-c", 2) == 0) {
461 theCompilePlan = true;
462@@ -327,46 +387,47 @@
463
464 const char *get_help_msg () const {
465 return
466-"--timing, -t\nPrint timing information. In case of multiple queries the timing information is provided per each query. Both wallclock time and user time (which excludes I/O, network delays and other kernel waits) are shown.\n\n"
467-"--output-file, -o\nWrite the result to the given file.\n\n"
468-"--serialization-parameter, -z\nSet serialization parameter in the form of a parameter=value pair (see http://www.w3.org/TR/xslt-xquery-serialization/#serparam, e.g.: -z method=xhtml -z doctype-system=DTD/xhtml1-strict.dtd -z indent=yes).\n\n"
469-"--serialize-html\nSerialize the result as HTML.\n\n"
470-"--serialize-text\nSerialize the result as Text.\n\n"
471-"--indent, -i\nIndent output.\n\n"
472-"--print-query\nPrint the queries.\n\n"
473-"--print-errors-as-xml, -x\nPrint the errors as XML.\n\n"
474-"--byte-order-mark\nSet the byte-order-mark for the serializer.\n\n"
475-"--omit-xml-declaration, -r\nOmit the XML declaration from the result.\n\n"
476-"--base-uri\nSet the base URI property of the static context.\n\n"
477-"--boundary-space\nSet the boundary-space policy ('strip' or 'preserve') in the static context.\n\n"
478-"--default-collation\nAdd the given collation and set the value of the default collation in the static context to the given collation.\n\n"
479-"--construction-mode\nSet the construction mode ('strip' or 'preserve') in the static context.\n\n"
480-"--ordering-mode\nSet the ordering mode ('ordered' or 'unordered') in the static context.\n\n"
481-"--multiple, -m\nExecute the given queries multiple times.\n\n"
482-"--query, -q\nQuery test or file URI (file://...)\n\n"
483-"--as-files, -f\nTreat all -q arguments as file paths instead of URIs or inline queries.\n\n"
484-"--external-variable, -e\nProvide the value for a variable given a file (name=file) or a value (name:=value)\n\n"
485-"--context-item\nSet the context item to the XML document in a given file.\n\n"
486-"--optimization-level\nOptimization level for the query compiler (O0, O1 or O2 - default: O1)\n\n"
487-"--lib-module, -l\nQuery compiler option to treat the query as a library module. If this is set --compile-only option is also set to true.\n\n"
488-"--parse-only\nStop after parsing the query.\n\n"
489-"--compile-only\nOnly compile (don't execute)\n\n"
490-"--no-serializer\nDo not serialize (discard) result.\n\n"
491-"--debug, -d\nLaunch the Zorba debugger server and connect to a DBGP-enabled debugger client.\n\n"
492-"--debug-host, -h\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n"
493-"--debug-port, -p\nThe port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028\n\n"
494-"--no-logo\nPrint no logo when starting.\n\n"
495-"--timeout\nSpecify a timeout in seconds. After the specified time, the execution of the query will be aborted.\n\n"
496-"--uri-path\nURI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.\n\n"
497-"--lib-path\nLibrary path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.\n\n"
498-"--module-path\nPath (list of directories) to add to both the URI and Library paths.\n\n"
499-"--option\nSet an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value\n\n"
500-"--trailing-nl\nOutput a trailing newline after the result of the query.\n\n"
501-"--stop-words\nMapping specifying a stop-words URI to another.\n\n"
502-"--thesaurus\nMapping specifying a thesaurus URI to another.\n\n"
503-"--compile-plan, -c\nOutput the query plan as binary.\n\n"
504-"--execute-plan\nTake a query plan as binary and execute it. Binary query plans can be generated using the --compile-plan option.\n\n"
505-;
506+ "--timing, -t\nPrint timing information. In case of multiple queries the timing information is provided per each query. Both wallclock time and user time (which excludes I/O, network delays and other kernel waits) are shown.\n\n"
507+ "--output-file, -o\nWrite the result to the given file.\n\n"
508+ "--serialization-parameter, -z\nSet serialization parameter in the form of a parameter=value pair (see http://www.w3.org/TR/xslt-xquery-serialization/#serparam, e.g.: -z method=xhtml -z doctype-system=DTD/xhtml1-strict.dtd -z indent=yes).\n\n"
509+ "--serialize-html\nSerialize the result as HTML.\n\n"
510+ "--serialize-text\nSerialize the result as Text.\n\n"
511+ "--indent, -i\nIndent output.\n\n"
512+ "--print-query\nPrint the queries.\n\n"
513+ "--print-errors-as-xml, -x\nPrint the errors as XML.\n\n"
514+ "--byte-order-mark\nSet the byte-order-mark for the serializer.\n\n"
515+ "--omit-xml-declaration, -r\nOmit the XML declaration from the result.\n\n"
516+ "--base-uri\nSet the base URI property of the static context.\n\n"
517+ "--boundary-space\nSet the boundary-space policy ('strip' or 'preserve') in the static context.\n\n"
518+ "--default-collation\nAdd the given collation and set the value of the default collation in the static context to the given collation.\n\n"
519+ "--construction-mode\nSet the construction mode ('strip' or 'preserve') in the static context.\n\n"
520+ "--ordering-mode\nSet the ordering mode ('ordered' or 'unordered') in the static context.\n\n"
521+ "--multiple, -m\nExecute the given queries multiple times.\n\n"
522+ "--query, -q\nQuery test or file URI (file://...)\n\n"
523+ "--as-files, -f\nTreat all -q arguments as file paths instead of URIs or inline queries.\n\n"
524+ "--external-variable, -e\nProvide the value for a variable given a file (name=file) or a value (name:=value)\n\n"
525+ "--context-item\nSet the context item to the XML document in a given file.\n\n"
526+ "--optimization-level\nOptimization level for the query compiler (O0, O1 or O2 - default: O1)\n\n"
527+ "--lib-module, -l\nQuery compiler option to treat the query as a library module. If this is set --compile-only option is also set to true.\n\n"
528+ "--parse-only\nStop after parsing the query.\n\n"
529+ "--compile-only\nOnly compile (don't execute)\n\n"
530+ "--no-serializer\nDo not serialize (discard) result.\n\n"
531+ "--debug, -d\nLaunch the Zorba debugger server and connect to a DBGP-enabled debugger client.\n\n"
532+ "--debug-host, -h\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n"
533+ "--debug-port, -p\nThe port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028\n\n"
534+ "--no-logo\nPrint no logo when starting.\n\n"
535+ "--timeout\nSpecify a timeout in seconds. After the specified time, the execution of the query will be aborted.\n\n"
536+ "--uri-path\nURI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.\n\n"
537+ "--lib-path\nLibrary path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.\n\n"
538+ "--module-path\nPath (list of directories) to add to both the URI and Library paths.\n\n"
539+ "--classpath\nJVM classpath to be used by modules using Java implementations\n\n"
540+ "--option\nSet an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value\n\n"
541+ "--trailing-nl\nOutput a trailing newline after the result of the query.\n\n"
542+ "--stop-words\nMapping specifying a stop-words URI to another.\n\n"
543+ "--thesaurus\nMapping specifying a thesaurus URI to another.\n\n"
544+ "--compile-plan, -c\nOutput the query plan as binary.\n\n"
545+ "--execute-plan\nTake a query plan as binary and execute it. Binary query plans can be generated using the --compile-plan option.\n\n"
546+ ;
547 }
548
549 static const ZorbaCMDPropertiesBase *instance () {
550
551=== modified file 'cmake_modules/ZorbaModule.cmake'
552--- cmake_modules/ZorbaModule.cmake 2012-04-17 22:40:48 +0000
553+++ cmake_modules/ZorbaModule.cmake 2012-04-18 15:53:24 +0000
554@@ -140,7 +140,6 @@
555 ENDIF (NOT IS_ABSOLUTE "${MODULE_FILE}")
556 GET_FILENAME_COMPONENT (module_name "${MODULE_FILE}" NAME)
557
558-
559 MANGLE_URI (${MODULE_URI} ".xq" module_path module_filename)
560
561 # Compute a CMake-symbol-safe version of the target URI, for storing
562@@ -267,6 +266,14 @@
563 SET (module_filewe "${module_filewe}_${MODULE_VERSION}")
564 ENDIF (MODULE_VERSION)
565
566+ # Compute the output path for the library. Note: This is copied
567+ # from ADD_COPY_RULE(); probably should refactor this logic.
568+ IF (${MODULE_TEST_ONLY} EQUAL 1)
569+ SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_LIB_PATH")
570+ ELSE (${MODULE_TEST_ONLY} EQUAL 1)
571+ SET (_output_basedir "${CMAKE_BINARY_DIR}/LIB_PATH")
572+ ENDIF (${MODULE_TEST_ONLY} EQUAL 1)
573+
574 # It seems like it would be nice to set the VERSION and/or
575 # SOVERSION target properties here. However: On Windows, it
576 # doesn't seem to do anything (the .rc file configured above
577@@ -278,12 +285,44 @@
578 # FOLDER is to group IDE projects into folders.
579 SET_TARGET_PROPERTIES (${module_lib_target} PROPERTIES
580 OUTPUT_NAME "${module_filewe}${SUFFIX}"
581- ${target_type}_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.src"
582+ ${target_type}_OUTPUT_DIRECTORY "${_output_basedir}/${module_path}"
583 FOLDER "Modules"
584- )
585- TARGET_LINK_LIBRARIES(${module_lib_target}
586- zorba_${ZORBA_STORE_NAME} ${MODULE_LINK_LIBRARIES})
587-
588+ )
589+ TARGET_LINK_LIBRARIES(${module_lib_target} zorba_${ZORBA_STORE_NAME})
590+
591+ # Ridiculous hack: CMake doesn't seem to (reliably) set up
592+ # dependencies if you specify a library to TARGET_LINK_LIBRARIES()
593+ # which is the output of some other ADD_LIBRARY(). We can't solve
594+ # this problem in the general case. We can work around it,
595+ # however, in the specific case where the target library was
596+ # generated by an earlier call to DECLARE_ZORBA_MODULE() - by
597+ # remembering that output library's path and its corresponding
598+ # target in a global property.
599+ FOREACH (_lib ${MODULE_LINK_LIBRARIES})
600+ GET_PROPERTY (_targetname GLOBAL PROPERTY "${_lib}_TARGET")
601+ IF ("${_targetname}" STREQUAL "")
602+ TARGET_LINK_LIBRARIES(${module_lib_target} "${_lib}")
603+ ELSE ("${_targetname}" STREQUAL "")
604+ TARGET_LINK_LIBRARIES(${module_lib_target} "${_targetname}")
605+ ENDIF ("${_targetname}" STREQUAL "")
606+ ENDFOREACH (_lib)
607+
608+ # Remember this library for the auto-generated module Config.cmake
609+ # file. Also remember the target name for the hack mentioned
610+ # above. QQQ and what about the installed version?
611+ GET_TARGET_PROPERTY (_lib_location "${module_lib_target}" LOCATION)
612+ SET_PROPERTY (GLOBAL APPEND PROPERTY "${PROJECT_NAME}_LIBRARIES"
613+ "${_lib_location}")
614+ SET_PROPERTY (GLOBAL PROPERTY "${_lib_location}_TARGET"
615+ "${module_lib_target}")
616+
617+ # If this is a core module, remember the target that builds the
618+ # library so zorbacmd can depend on it.
619+ IF (${PROJECT_NAME} STREQUAL "zorba")
620+ SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_CORE_MODULE_LIB_TARGETS
621+ "${module_lib_target}")
622+ ENDIF (${PROJECT_NAME} STREQUAL "zorba")
623+
624 # Install the library, if it's not a TEST_ONLY module
625 IF (NOT MODULE_TEST_ONLY)
626 IF(NOT ${PROJECT_NAME} STREQUAL "zorba")
627@@ -314,17 +353,9 @@
628 ENDIF (MODULE_VERSION)
629 FOREACH (version_infix "" ${version_infixes})
630 ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${module_path}/${module_filename}"
631- "${version_infix}" "" "${MODULE_TEST_ONLY}")
632+ "${version_infix}" "" 1 "${MODULE_TEST_ONLY}")
633 ENDFOREACH (version_infix)
634
635- # Also copy the dynamic library from the location it was built.
636- IF (module_lib_target)
637- GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION)
638- GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME)
639- ADD_COPY_RULE ("LIB" "${lib_location}" "${module_path}/${lib_filename}"
640- "" "${module_lib_target}" "${MODULE_TEST_ONLY}")
641- ENDIF (module_lib_target)
642-
643 # Last but not least, whip up a test case that ensures the module
644 # can at least be compiled. Don't bother for test-only modules
645 # (presumably they're there to be tested!).
646@@ -375,7 +406,7 @@
647 ENDIF (NOT SCHEMA_TEST_ONLY)
648
649 ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${schema_path}/${schema_filename}"
650- "" "" "${SCHEMA_TEST_ONLY}")
651+ "" "" 1 "${SCHEMA_TEST_ONLY}")
652
653 ENDMACRO (DECLARE_ZORBA_SCHEMA)
654
655@@ -407,25 +438,74 @@
656 MANGLE_URI (${URI_FILE_URI} "" uri_file_path uri_file_filename)
657
658 ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${uri_file_path}/${uri_file_filename}"
659- "" "" "${URI_FILE_TEST_ONLY}")
660+ "" "" 1 "${URI_FILE_TEST_ONLY}")
661
662 ENDMACRO (DECLARE_ZORBA_URI_FILE)
663
664+
665+# Inform Zorba of a .jar file that should be made available on the CLASSPATH
666+# of the JVM, should the JVM be started. QQQ more doc needed
667+#
668+# Args: FILE - path to file(s) (must be absolute)
669+# TARGET - (optional) a CMake target that must be executed in order
670+# for FILEs to be generated
671+# EXTERNAL - (optional) FILE specifies a path that should be added
672+# to CLASSPATH as-is
673+# TEST_ONLY - (optional) Jar file is for testcases only and should not
674+# be installed
675+#
676+# Must supply at least one value to FILE or TARGET.
677+MACRO (DECLARE_ZORBA_JAR)
678+ PARSE_ARGUMENTS (JAR "FILE;TARGET" "TARGET" "TEST_ONLY;EXTERNAL" ${ARGN})
679+ IF (NOT JAR_FILE)
680+ MESSAGE (FATAL_ERROR "'FILE' argument is required for DECLARE_ZORBA_JAR")
681+ ENDIF (NOT JAR_FILE)
682+
683+ # Initialize classpath file and set up copy rule (once per project)
684+ SET (_CP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-classpath.txt")
685+ GET_PROPERTY (_known_project GLOBAL PROPERTY "${PROJECT_NAME}-jars")
686+ IF (NOT _known_project)
687+ FILE (REMOVE "${_CP_FILE}")
688+ SET_PROPERTY (GLOBAL PROPERTY "${PROJECT_NAME}-jars" 1)
689+ ADD_COPY_RULE ("LIB" "${_CP_FILE}" "jars/${PROJECT_NAME}-classpath.txt"
690+ "" "" 1 "${JAR_TEST_ONLY}")
691+ ENDIF (NOT _known_project)
692+
693+ # Iterate over all supplied jar files
694+ FOREACH (_jar_file ${JAR_FILE})
695+
696+ IF (JAR_EXTERNAL)
697+ # Put absolute path into classpath file
698+ FILE (APPEND "${_CP_FILE}" "${_jar_file}\n")
699+ ELSE (JAR_EXTERNAL)
700+ # Copy jar to jars/ directory and add relative path to classpath file
701+ GET_FILENAME_COMPONENT (_output_filename "${_jar_file}" NAME)
702+ ADD_COPY_RULE ("LIB" "${_jar_file}" "jars/${_output_filename}" ""
703+ "${JAR_TARGET}" 1 "${JAR_TEST_ONLY}")
704+ FILE (APPEND "${_CP_FILE}" "${_output_filename}\n")
705+ ENDIF (JAR_EXTERNAL)
706+
707+ ENDFOREACH (_jar_file)
708+ENDMACRO (DECLARE_ZORBA_JAR)
709+
710+
711 # Utility macro for setting up a build rule to copy a file to a
712-# particular (possibly versioned) file in a shared directory if such a file has
713-# not already been output.
714+# particular (possibly versioned) file in a shared directory if such a
715+# file has not already been output.
716+#
717 # FILE_TYPE: Either "URI" or "LIB"; will be used to determine which shared
718-# directory to place output in (URI_PATH or LIB_PATH). Also, "URI" files
719-# will have an INSTALL() directive to put them in the install image.
720+# directory to place output in (URI_PATH or LIB_PATH).
721 # INPUT_FILE: Absolute path to file to copy.
722 # OUTPUT_FILE: Relative path to output file (relative to URI_PATH).
723 # VERSION_ARG: Version; may be "" for non-versioned files.
724 # DEPEND_TARGET: A CMake target name upon which the copy rule should depend;
725 # may be "".
726+# INSTALL: If 1, an INSTALL() directive will be executed to put the
727+# file into the install image.
728 # TEST_ONLY: If 1, file is for testcases only; will be copied into
729-# TEST_URI_PATH/TEST_LIB_PATH and will not be installed
730+# TEST_URI_PATH/TEST_LIB_PATH and will not be installed.
731 MACRO (ADD_COPY_RULE FILE_TYPE INPUT_FILE OUTPUT_FILE VERSION_ARG
732- DEPEND_TARGET TEST_ONLY)
733+ DEPEND_TARGET INSTALL TEST_ONLY)
734 # Choose output base directory
735 IF (${TEST_ONLY} EQUAL 1)
736 SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_${FILE_TYPE}_PATH")
737@@ -470,13 +550,13 @@
738 SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_URI_FILES
739 "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}" "${_is_core}")
740
741- # Also set up an INSTALL rule (unless TEST_ONLY or LIB).
742- IF ( (NOT "${FILE_TYPE}" STREQUAL "LIB") AND (NOT ${TEST_ONLY} EQUAL 1) )
743+ # Also set up an INSTALL rule (unless TEST_ONLY).
744+ IF ( (${INSTALL} EQUAL 1) AND (NOT ${TEST_ONLY} EQUAL 1) )
745
746 IF(NOT _is_core)
747 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
748 INSTALL (FILES "${INPUT_FILE}"
749- DESTINATION "${ZORBA_NONCORE_URI_DIR}/${_output_path}"
750+ DESTINATION "${ZORBA_NONCORE_${FILE_TYPE}_DIR}/${_output_path}"
751 RENAME "${_output_filename}"
752 COMPONENT "${component_name}")
753
754@@ -496,11 +576,11 @@
755
756 ELSE(NOT _is_core)
757 INSTALL (FILES "${INPUT_FILE}"
758- DESTINATION "${ZORBA_CORE_URI_DIR}/${_output_path}"
759+ DESTINATION "${ZORBA_CORE_${FILE_TYPE}_DIR}/${_output_path}"
760 RENAME "${_output_filename}")
761 ENDIF(NOT _is_core)
762
763- ENDIF ( (NOT "${FILE_TYPE}" STREQUAL "LIB") AND (NOT ${TEST_ONLY} EQUAL 1) )
764+ ENDIF ( (${INSTALL} EQUAL 1) AND (NOT ${TEST_ONLY} EQUAL 1) )
765 ENDIF (file_found EQUAL -1)
766 ENDMACRO (ADD_COPY_RULE)
767
768@@ -535,6 +615,8 @@
769 # files to their corresponding output directories, with appropriate
770 # dependencies. This macro will only have any effect when called by
771 # the top-level project in a build.
772+# Also, this function automatically generates a CMake projectConfig.cmake
773+# file for the project, based on config/ExternalModuleConfig.cmake.in.
774 MACRO (DONE_DECLARING_ZORBA_URIS)
775 IF (PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
776 # Close out the zorba modules and schemas manifests
777@@ -553,9 +635,10 @@
778 LIST (GET copy_rules 2 _depend_target)
779 LIST (GET copy_rules 3 _is_core)
780 LIST (REMOVE_AT copy_rules 0 1 2 3)
781- SET (_depends "${_input_file}")
782 IF (_depend_target)
783- LIST (APPEND _depends "${_depend_target}")
784+ SET (_depends "${_depend_target}")
785+ ELSE (_depend_target)
786+ SET (_depends "${_input_file}")
787 ENDIF (_depend_target)
788 ADD_CUSTOM_COMMAND (OUTPUT "${_output_file}"
789 COMMAND "${CMAKE_COMMAND}" -E copy
790@@ -571,7 +654,8 @@
791
792 # Targets and dependencies:
793 # ALL depends on check_uris; check_uris depends on check_core_uris;
794- # zorbacmd depends on check_core_uris.
795+ # zorbacmd depends on check_core_uris as well as all core module
796+ # library targets.
797 ADD_CUSTOM_TARGET (check_uris ALL
798 DEPENDS ${_noncore_output_files} VERBATIM)
799 SET_TARGET_PROPERTIES(check_uris PROPERTIES FOLDER "Modules")
800@@ -584,6 +668,8 @@
801 DEPENDS ${_core_output_files} VERBATIM)
802 ADD_DEPENDENCIES(check_uris check_core_uris)
803 ADD_DEPENDENCIES(zorbacmd check_core_uris)
804+ GET_PROPERTY (_corelibs GLOBAL PROPERTY ZORBA_CORE_MODULE_LIB_TARGETS)
805+ ADD_DEPENDENCIES(zorbacmd ${_corelibs})
806 SET_TARGET_PROPERTIES(check_core_uris PROPERTIES FOLDER "Modules")
807 ENDIF (_num_core GREATER 0)
808 SET_PROPERTY (GLOBAL PROPERTY ZORBA_URI_FILES)
809@@ -591,6 +677,18 @@
810 #add 'xqdoc' and 'xqdoc-xml' targets
811 ADD_XQDOC_TARGETS()
812 ENDIF (PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
813+
814+ # Now, do things that should be done at the end of *any* project, not
815+ # just the top-level project.
816+
817+ # Generate project's projectConfig.cmake file.
818+ # QQQ need to create an installable version of this too, once we know
819+ # how installing a module package should work.
820+ GET_PROPERTY (ZORBA_PROJECT_LIBRARIES
821+ GLOBAL PROPERTY "${PROJECT_NAME}_LIBRARIES")
822+ CONFIGURE_FILE("${Zorba_EXTERNALMODULECONFIG_FILE}"
823+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY)
824+
825 ENDMACRO (DONE_DECLARING_ZORBA_URIS)
826
827 # Initialize expected failures and zorba modules output files when
828@@ -696,10 +794,12 @@
829 IF (WIN32 AND (${_crash_idx} GREATER -1) )
830 MESSAGE (STATUS "WARNING: Skipping test case ${TESTNAME} which is expected to crash - bug ${_crash_bugid}")
831 ELSE (WIN32 AND (${_crash_idx} GREATER -1) )
832+ # DEPENDENCY_MODULE_PATH will always start with an appropriate
833+ # path separator
834 ADD_TEST(${TESTNAME} "${Zorba_TESTDRIVER}"
835 "--rbkt-src" "${TEST_DIR}"
836 "--module-path"
837- "${CMAKE_BINARY_DIR}/URI_PATH/${PATH_SEP}${SECONDARY_MODULE_PATHS}"
838+ "${CMAKE_BINARY_DIR}/URI_PATH/${PATH_SEP}${DEPENDENCY_MODULE_PATH}"
839 "${TESTFILE}")
840
841 # On non-Windows, call EXPECTED_FAILURE() for known crashes
842@@ -727,18 +827,6 @@
843 MESSAGE(STATUS "Added ${TESTCOUNTER} tests in ${TEST_DIR}")
844 ENDMACRO (ADD_TEST_DIRECTORY)
845
846-# Macro to install a basic CMake config file for a module. Provide a
847-# source and binary directory. Result will be installed in binary
848-# directory. This is a macro because it is called from two different
849-# places: ZorbaUse.cmake, and Zorba's modules/CMakeLists.txt.
850-MACRO(CREATE_MODULE_CONFIG name src_dir bin_dir)
851- # Set variables referenced in ExternalModuleConfig.cmake.in
852- SET(MODULE_SOURCE_DIR ${src_dir})
853- SET(MODULE_BINARY_DIR ${bin_dir})
854- CONFIGURE_FILE("${Zorba_EXTERNALMODULECONFIG_FILE}"
855- "${MODULE_BINARY_DIR}/${name}Config.cmake" @ONLY)
856-ENDMACRO(CREATE_MODULE_CONFIG)
857-
858 # This macro easies the process of adding test for store dependent
859 # executables. It has the same naming convection for the target as the
860 # macro that is used to generated store dependent executables (thus,
861
862=== modified file 'config/ExternalModuleConfig.cmake.in'
863--- config/ExternalModuleConfig.cmake.in 2012-04-16 20:56:43 +0000
864+++ config/ExternalModuleConfig.cmake.in 2012-04-18 15:53:24 +0000
865@@ -12,12 +12,29 @@
866 # See the License for the specific language governing permissions and
867 # limitations under the License.
868
869-IF(WIN32)
870- SET(PATH_SEP ",")
871-ELSE(WIN32)
872- SET(PATH_SEP ":")
873-ENDIF(WIN32)
874-
875-# QQQ When all the module versioning and external-module work is
876-# complete, this should contain ONLY MODULE_BINARY_DIR/modules.
877-SET(SECONDARY_MODULE_PATHS "${SECONDARY_MODULE_PATHS}${PATH_SEP}@MODULE_SOURCE_DIR@/src/${PATH_SEP}@MODULE_BINARY_DIR@/src/${PATH_SEP}@MODULE_BINARY_DIR@/modules/")
878+IF (WIN32)
879+ SET (PATH_SEP ",")
880+ELSE (WIN32)
881+ SET (PATH_SEP ":")
882+ENDIF (WIN32)
883+
884+# Probably should have separate URI and LIB paths here someday; will
885+# require testdriver to accept --uri-path and --lib-path args
886+# Note that this path is meaningless if the module is installed; see
887+# bug 966999.
888+SET (DEPENDENCY_MODULE_PATH
889+ "${DEPENDENCY_MODULE_PATH}${PATH_SEP}@PROJECT_BINARY_DIR@/URI_PATH/${PATH_SEP}${DEPENDENCY_LIB_PATH}${PATH_SEP}@PROJECT_BINARY_DIR@/LIB_PATH/")
890+
891+# Dynamic libraries created by this project to link against
892+SET (@PROJECT_NAME@_LIBRARIES @ZORBA_PROJECT_LIBRARIES@)
893+
894+# Include directories exported by this project
895+SET (@PROJECT_NAME@_INCLUDE_DIRS @ZORBA_PROJECT_INCLUDE_DIRS@)
896+
897+# Offer a "use file" to the user of this module. For most module
898+# packages, this is unnecessary. However it can be utilized by
899+# advanced packages which wish to, for example, export a C++ header
900+# file to dependent packages. As above, note that this currently is
901+# non-functional if this module package is installed; this will only
902+# work from a project build directory.
903+SET (@PROJECT_NAME@_USE_FILE "@ZORBA_PROJECT_USE_FILE@")
904
905=== modified file 'config/ZorbaUse.cmake'
906--- config/ZorbaUse.cmake 2012-04-16 20:56:43 +0000
907+++ config/ZorbaUse.cmake 2012-04-18 15:53:24 +0000
908@@ -31,7 +31,3 @@
909 # Load Zorba module support macros.
910 INCLUDE("${Zorba_CMAKE_MODULES_DIR}/Windows/ProxyFindModule.cmake")
911 ENDIF(WIN32)
912-
913-# Generate project's projectConfig.cmake file.
914-CREATE_MODULE_CONFIG(${PROJECT_NAME} "${PROJECT_SOURCE_DIR}"
915- "${PROJECT_BINARY_DIR}")
916
917=== modified file 'include/zorba/properties_base.h'
918--- include/zorba/properties_base.h 2012-04-16 20:56:43 +0000
919+++ include/zorba/properties_base.h 2012-04-18 15:53:24 +0000
920@@ -101,8 +101,44 @@
921 std::vector<std::string>& val,
922 unsigned delta);
923
924+/**
925+ * \brief This class provides access to global properties.
926+ *
927+ * This class provides access to global properties set for Zorba in environment
928+ * and configuration file.
929+ * It is available using Zorba.getProperties() method.
930+ * \see { Zorba::getProperties() }
931+ */
932+class ZORBA_DLL_PUBLIC PropertiesGlobal : public PropertiesBase
933+{
934+public:
935+ virtual ~PropertiesGlobal() {}
936+
937+ /**
938+ * \brief Get global JVM classpath property.
939+ *
940+ * Before the JVM is started this will return the classpath set by
941+ * command line option, the CLASSPATH environment variable and in Zorba
942+ * config file.
943+ *
944+ * After the JVM is started this will contain in addition the paths to jars
945+ * used by modules that make use of the JVM.
946+ */
947+ virtual void getJVMClassPath(std::string & jvmClasspath) {}
948+
949+ /**
950+ * \brief Set global JVM classpath property.
951+ *
952+ * This method should be used to set additional JVM classpath for modules
953+ * that make use of JVM. This will overide the classpath set by CLASSPATH
954+ * environment variable or Zorba config file.
955+ *
956+ * Once the JVM is started this method doesn't have any effect.
957+ */
958+ virtual void setJVMClassPath(const std::string & jvmClasspath) {}
959+};
960+
961 }
962-
963 #endif // ZORBA_PROPERTIES_BASE_H
964 /*
965 * Local variables:
966
967=== modified file 'include/zorba/util/file.h'
968--- include/zorba/util/file.h 2012-04-16 20:56:43 +0000
969+++ include/zorba/util/file.h 2012-04-18 15:53:24 +0000
970@@ -24,6 +24,7 @@
971 #include <cstdio>
972 #include <string>
973 #include <time.h>
974+#include <vector>
975
976 #include <zorba/config.h>
977 #include <zorba/file.h>
978@@ -84,6 +85,7 @@
979 void mkdir();
980 void deep_mkdir();
981 void rmdir(bool ignore = true);
982+ void lsdir(std::vector<std::string> &list);
983 #ifndef _WIN32_WCE
984 void chdir();
985 #endif
986
987=== modified file 'include/zorba/zorba.h'
988--- include/zorba/zorba.h 2012-04-16 20:56:43 +0000
989+++ include/zorba/zorba.h 2012-04-18 15:53:24 +0000
990@@ -34,14 +34,18 @@
991 #include <zorba/xquery.h>
992 #include <zorba/zorba_string.h>
993 #include <zorba/iterator.h>
994+#include <zorba/properties_base.h>
995
996 namespace zorba {
997
998 /**
999 * The Zorba class is the single point of access to the %Zorba engine.
1000 * There exists one instance of the Zorba class per process.
1001- * It can be used to (1) create and compile queries, (2) create static contexts,
1002- * (3) provides access to the XmlDataManager, and (4) provides access to the ItemFactory.
1003+ * It can be used to (1) create and compile queries,
1004+ * (2) create static contexts,
1005+ * (3) provides access to the XmlDataManager,
1006+ * (4) provides access to the ItemFactory, and
1007+ * (5) provides access to the PropertiesGlobal.
1008 */
1009 class ZORBA_DLL_PUBLIC Zorba
1010 {
1011@@ -301,7 +305,7 @@
1012 virtual StaticContext_t
1013 createStaticContext(DiagnosticHandler* aDiagnosticHandler = 0) = 0;
1014
1015- /** \brief Gets the singelton instance of the ItemFactory.
1016+ /** \brief Gets the singleton instance of the ItemFactory.
1017 *
1018 * @return ItemFactory the singleton instance of the ItemFactory.
1019 */
1020@@ -310,18 +314,24 @@
1021
1022 /** \brief Gets the singleton instance of the XmlDataManager object.
1023 *
1024- * @return XmlDataManager the singelton instance of the XmlDataManager.
1025+ * @return XmlDataManager the singleton instance of the XmlDataManager.
1026 */
1027 virtual XmlDataManager*
1028 getXmlDataManager() = 0;
1029
1030 /** \brief Gets the singleton instance of Zorba's audit provider object.
1031 *
1032- * @return audit::Provider the singelton instance of Zorba's audit provider.
1033+ * @return audit::Provider the singeleton instance of Zorba's audit provider.
1034 */
1035 virtual audit::Provider*
1036 getAuditProvider() = 0;
1037
1038+ /** \brief Gets the singleton instance of Zorba's properties object.
1039+ *
1040+ * @return zorba::Properties the singleton instance of Zorba's properties object.
1041+ */
1042+ virtual PropertiesGlobal* getPropertiesGlobal() = 0;
1043+
1044 }; /* class Zorba */
1045
1046
1047
1048=== modified file 'modules/CMakeLists.txt'
1049--- modules/CMakeLists.txt 2012-04-16 20:56:43 +0000
1050+++ modules/CMakeLists.txt 2012-04-18 15:53:24 +0000
1051@@ -21,13 +21,19 @@
1052 # named "zorba_modules" as a sibling to the main Zorba source
1053 # directory.
1054
1055-# First, configure the moduleConfig.cmake file for each module
1056-# project. We must do this "manually" before doing any
1057-# ADD_SUBDIRECTORY()s, so that all the config files are built and
1058-# ready for other modules' FIND_PACKAGE() calls. We also add all
1059-# module build dirs to CMAKE_PREFIX_PATH for the same reason.
1060-SET (project_regex "[Pp][Rr][Oo][Jj][Ee][Cc][Tt]")
1061-FILE (GLOB modules_dir_items RELATIVE "${ZORBA_MODULES_DIR}" "${ZORBA_MODULES_DIR}/[a-zA-Z0-9]*")
1062+# This is complicated and more than a little hacky. We need to add all
1063+# the module subdirectories, but some may depend on others so we can't
1064+# simply add them alphabetically. Here we determine their project
1065+# names and dependencies by manually reading their CMakeLists.txt
1066+# files (as text files). We form a directed graph (which isn't easy in
1067+# CMake) then produce a topological sort to load the modules in
1068+# order. Note that this will not work if there are cyclical
1069+# dependencies between modules; if we ever need that ability, this
1070+# will get more complicated.
1071+
1072+FILE (GLOB modules_dir_items
1073+ RELATIVE "${ZORBA_MODULES_DIR}"
1074+ "${ZORBA_MODULES_DIR}/[a-zA-Z0-9]*")
1075
1076 # Filter out non-directories
1077 SET (module_dirs)
1078@@ -37,19 +43,27 @@
1079 ENDIF (IS_DIRECTORY "${ZORBA_MODULES_DIR}/${module_dir}")
1080 ENDFOREACH (module_dir)
1081
1082+# First, form a simple list of all known module projects in the
1083+# variable "module_projects". Also, for each project, set a variable
1084+# named eg. "zorba-email-module_DIR" with the path to that project's
1085+# directory, relative to ZORBA_MODULES_DIR.
1086+SET (project_regex "[Pp][Rr][Oo][Jj][Ee][Cc][Tt] *\\( *([^ )]*)")
1087+SET (module_projects)
1088 FOREACH (module_dir ${module_dirs})
1089- # This is really kind of hacky, but I don't know a better solution without
1090- # introducing some sort of inter-module dependency tracking and requiring
1091- # consistent directory naming for external modules. What we do here is
1092- # read the module's CMakeLists.txt (as a text file), searching for the
1093- # PROJECT() declaration, so we can extract the name of the CMake project.
1094 SET (module_project)
1095- SET (cmakelists)
1096- FILE (STRINGS "${ZORBA_MODULES_DIR}/${module_dir}/CMakeLists.txt" cmakelists
1097- REGEX ${project_regex})
1098+ SET (cmakelists_file "${ZORBA_MODULES_DIR}/${module_dir}/CMakeLists.txt")
1099+ FILE (STRINGS "${cmakelists_file}" cmakelists REGEX "${project_regex}")
1100 FOREACH (line ${cmakelists})
1101- IF (line MATCHES "${project_regex} *\\(([^)]*)\\)")
1102- SET (module_project ${CMAKE_MATCH_1})
1103+
1104+ IF (line MATCHES "${project_regex}")
1105+ IF (NOT "${module_project}" STREQUAL "")
1106+ MESSAGE (FATAL_ERROR
1107+ "${cmakelists_file} contains duplicate PROJECT() statements - "
1108+ "cannot parse!")
1109+ ENDIF (NOT "${module_project}" STREQUAL "")
1110+ SET (module_project "${CMAKE_MATCH_1}")
1111+ LIST (APPEND module_projects "${module_project}")
1112+ SET ("${module_project}_DIR" "${module_dir}")
1113
1114 # Print the found module name
1115 SET (status "Found module project ${module_project}")
1116@@ -63,8 +77,7 @@
1117 MESSAGE (STATUS "${status}")
1118 MESSAGE (STATUS "${border}")
1119
1120- BREAK ()
1121- ENDIF (line MATCHES "${project_regex} *\\(([^)]*)\\)")
1122+ ENDIF (line MATCHES "${project_regex}")
1123 ENDFOREACH (line)
1124
1125 IF (NOT module_project)
1126@@ -72,14 +85,77 @@
1127 "does not contain a recognizable CMake project.")
1128 ENDIF (NOT module_project)
1129
1130- SET (module_builddir "${CMAKE_BINARY_DIR}/zorba_modules/${module_project}")
1131- FILE (MAKE_DIRECTORY "${module_builddir}")
1132- CREATE_MODULE_CONFIG (${module_project} "${ZORBA_MODULES_DIR}/${module_dir}"
1133- "${module_builddir}")
1134- LIST (APPEND CMAKE_PREFIX_PATH "${module_builddir}")
1135- #SET (ZORBA_EXTERNAL_MODULES_SRCS ${ZORBA_EXTERNAL_MODULES_SRCS} ${ZORBA_MODULES_DIR}/${module_dir}/src)
1136-ENDFOREACH (module_dir)
1137-#SET (ZORBA_EXTERNAL_MODULES_SRCS ${ZORBA_EXTERNAL_MODULES_SRCS} PARENT_SCOPE)
1138+ENDFOREACH (module_dir)
1139+
1140+# Next, form the DAG. This comprises one list containing only those
1141+# module projects that some other module project depends on
1142+# (dep_module_projects), and a series of CMake variables named
1143+# eg. "zorba-email-module_DEPS" containing the module projects that
1144+# the named project depends on. Doing this unfortunately requires us
1145+# to read through all CMakeLists.txt files again.
1146+SET (find_package_regex
1147+ "[Ff][Ii][Nn][Dd]_[Pp][Aa][Cc][Kk][Aa][Gg][Ee] *\\( *([^ )]*)")
1148+SET (dep_module_projects)
1149+FOREACH (module_dir ${module_dirs})
1150+ SET (module_project)
1151+ SET (cmakelists_file "${ZORBA_MODULES_DIR}/${module_dir}/CMakeLists.txt")
1152+ FILE (STRINGS "${cmakelists_file}" cmakelists
1153+ REGEX "${project_regex}|${find_package_regex}")
1154+ FOREACH (line ${cmakelists})
1155+ IF (line MATCHES "${project_regex}")
1156+ # Don't have to do error checking here; was done in last pass.
1157+ SET (module_project "${CMAKE_MATCH_1}")
1158+ ELSEIF (line MATCHES "${find_package_regex}")
1159+ SET (dependee ${CMAKE_MATCH_1})
1160+ # Ensure this dependency is a known module project, and not some
1161+ # other dependency like "Zorba" - don't want those in the DAG.
1162+ LIST (FIND module_projects "${dependee}" is_known)
1163+ IF (is_known GREATER -1)
1164+ message (STATUS "${module_project} depends on ${dependee}")
1165+ # Save the dependency in a variable based on the current project
1166+ LIST (APPEND "${module_project}_DEPS" ${dependee})
1167+ # Also add this dependee to dep_module_projects
1168+ LIST (APPEND dep_module_projects ${dependee})
1169+ ENDIF (is_known GREATER -1)
1170+ ENDIF (line MATCHES "${project_regex}")
1171+ ENDFOREACH (line)
1172+
1173+ENDFOREACH (module_dir)
1174+
1175+
1176+# Now, transform the DAG into a dependency-ordered list. See
1177+# http://en.wikipedia.org/wiki/Topological_sorting .
1178+SET (no_deps)
1179+SET (visited)
1180+SET (ordered_modules)
1181+MACRO (VISIT mod_name)
1182+ LIST (FIND visited "${mod_name}" is_visited)
1183+ IF (is_visited EQUAL -1)
1184+ # Haven't seen this module before; iterate through modules that depend on it
1185+ LIST (APPEND visited "${mod_name}")
1186+ FOREACH (depender ${${mod_name}_DEPS})
1187+ VISIT ("${depender}")
1188+ ENDFOREACH (depender)
1189+ # Now that all modules that depend on it have been added, add this one
1190+ LIST (APPEND ordered_modules "${mod_name}")
1191+ ELSE (is_visited EQUAL -1)
1192+ ENDIF (is_visited EQUAL -1)
1193+ENDMACRO (VISIT)
1194+# Annoying - LIST(REMOVE_DUPLICATES) dies if the list is empty.
1195+LIST (LENGTH dep_module_projects num_deps)
1196+IF (num_deps GREATER 0)
1197+ LIST (REMOVE_DUPLICATES dep_module_projects)
1198+ENDIF (num_deps GREATER 0)
1199+FOREACH (module_project ${module_projects})
1200+ # Only initially visit those modules projects that do NOT have any
1201+ # module projects depending on them; that is, only visit those module
1202+ # projects that are NOT in dep_module_projects.
1203+ LIST (FIND dep_module_projects "${module_project}" is_dep)
1204+ IF (is_dep EQUAL -1)
1205+ VISIT (${module_project})
1206+ ENDIF (is_dep EQUAL -1)
1207+
1208+ENDFOREACH (module_project)
1209
1210 # Each of these projects will also want to be able to
1211 # FIND_PACKAGE(Zorba), so add our own build dir to the CMake module
1212@@ -89,9 +165,16 @@
1213 # Now, iterate through all the module projects again and actually add
1214 # them to this Zorba project. Create a binary directory for them
1215 # inside our own.
1216-FOREACH (module_dir ${module_dirs})
1217+FOREACH (module_project ${ordered_modules})
1218+ # Create the module binary directory and add it to CMAKE_PREFIX_PATH
1219+ # so other modules can find it. Then, add the module project
1220+ # directory.
1221+ SET (module_dir "${${module_project}_DIR}")
1222+ SET (module_builddir "${CMAKE_BINARY_DIR}/zorba_modules/${module_project}")
1223+ FILE (MAKE_DIRECTORY "${module_builddir}")
1224+ LIST (APPEND CMAKE_PREFIX_PATH "${module_builddir}")
1225 ADD_SUBDIRECTORY("${ZORBA_MODULES_DIR}/${module_dir}"
1226- "${CMAKE_BINARY_DIR}/zorba_modules/zorba_${module_dir}_module")
1227-ENDFOREACH (module_dir)
1228+ "${CMAKE_BINARY_DIR}/zorba_modules/${module_project}")
1229+ENDFOREACH (module_project)
1230
1231 MESSAGE(STATUS "End modules")
1232
1233=== modified file 'modules/ExternalModules.conf'
1234--- modules/ExternalModules.conf 2012-04-17 22:40:48 +0000
1235+++ modules/ExternalModules.conf 2012-04-18 15:53:24 +0000
1236@@ -40,3 +40,5 @@
1237 system bzr lp:zorba/system-module zorba-2.2
1238 xqxq bzr lp:zorba/xqxq-module zorba-2.2
1239 email bzr lp:zorba/email-module zorba-2.2
1240+util-jvm bzr lp:zorba/util-jvm-module
1241+schema-tools bzr lp:zorba/schema-tools-module
1242
1243=== modified file 'scripts/CMakeLists.txt'
1244--- scripts/CMakeLists.txt 2012-04-16 20:56:43 +0000
1245+++ scripts/CMakeLists.txt 2012-04-18 15:53:24 +0000
1246@@ -52,9 +52,11 @@
1247 ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_SOURCE_DIR}/NOTICE.txt"
1248 COMMAND "${ZORBA_EXE}" "-q" "${CMAKE_CURRENT_BINARY_DIR}/notice-generator.xq" "-f" "--omit-xml-declaration"
1249 MAIN_DEPENDENCY "${CMAKE_CURRENT_BINARY_DIR}/notice-generator.xq"
1250- DEPENDS "${CMAKE_SOURCE_DIR}/NOTICE.xml" "${CMAKE_SOURCE_DIR}/CMakeLists.txt")
1251+ DEPENDS "${CMAKE_SOURCE_DIR}/NOTICE.xml"
1252+ "${CMAKE_SOURCE_DIR}/CMakeLists.txt"
1253+ zorbacmd)
1254 ADD_CUSTOM_TARGET(NOTICE ALL
1255- DEPENDS "${CMAKE_SOURCE_DIR}/NOTICE.txt" zorbacmd
1256+ DEPENDS "${CMAKE_SOURCE_DIR}/NOTICE.txt"
1257 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
1258 )
1259
1260
1261=== modified file 'src/api/zorbaimpl.cpp'
1262--- src/api/zorbaimpl.cpp 2012-04-16 20:56:43 +0000
1263+++ src/api/zorbaimpl.cpp 2012-04-18 15:53:24 +0000
1264@@ -35,6 +35,7 @@
1265 #include "diagnostics/xquery_diagnostics.h"
1266
1267 #include "system/globalenv.h"
1268+#include "system/properties.h"
1269
1270 #include "context/static_context.h"
1271
1272@@ -269,6 +270,15 @@
1273 }
1274
1275
1276+/*******************************************************************************
1277+
1278+********************************************************************************/
1279+PropertiesGlobal* ZorbaImpl::getPropertiesGlobal()
1280+{
1281+ return Properties::instance();
1282+}
1283+
1284+
1285 void ZorbaImpl::notifyError( DiagnosticHandler *eh, ZorbaException const &ze ) {
1286 eh->error( ze );
1287 }
1288
1289=== modified file 'src/api/zorbaimpl.h'
1290--- src/api/zorbaimpl.h 2012-04-16 20:56:43 +0000
1291+++ src/api/zorbaimpl.h 2012-04-18 15:53:24 +0000
1292@@ -134,6 +134,8 @@
1293
1294 audit::Provider* getAuditProvider();
1295
1296+ PropertiesGlobal* getPropertiesGlobal();
1297+
1298 protected:
1299 ZorbaImpl();
1300
1301
1302=== modified file 'src/context/dynamic_loader.cpp'
1303--- src/context/dynamic_loader.cpp 2012-04-16 20:56:43 +0000
1304+++ src/context/dynamic_loader.cpp 2012-04-18 15:53:24 +0000
1305@@ -132,8 +132,15 @@
1306 ExternalModule*
1307 DynamicLoader::loadModule(const zstring& aFile) const
1308 {
1309- // function pointer to create a module
1310- ExternalModule* (*createModule)() = NULL;
1311+ handle_t handle;
1312+ std::map<const zstring, handle_t>::const_iterator lIter;
1313+
1314+ lIter = theLibraries.find(aFile);
1315+ if (lIter != theLibraries.end())
1316+ {
1317+ handle = lIter->second;
1318+ return createModule(handle, aFile);
1319+ }
1320
1321 #ifdef WIN32
1322 WCHAR wpath_str[1024];
1323@@ -146,43 +153,51 @@
1324 0, aFile.c_str(), -1,
1325 wpath_str, sizeof(wpath_str)/sizeof(WCHAR));
1326 }
1327- HMODULE handle = LoadLibraryW(wpath_str);
1328+
1329+ handle = LoadLibraryW(wpath_str);
1330 if (!handle)
1331 throw ZORBA_EXCEPTION(
1332 zerr::ZOSE0005_DLL_LOAD_FAILED,
1333 ERROR_PARAMS( aFile, os_error::get_err_string() )
1334 );
1335-
1336+#else
1337+ handle = dlopen(aFile.c_str(), RTLD_NOW);
1338+ if (!handle)
1339+ throw ZORBA_EXCEPTION(
1340+ zerr::ZOSE0005_DLL_LOAD_FAILED, ERROR_PARAMS( aFile, zstring(dlerror()) )
1341+ );
1342+#endif
1343+
1344+ theLibraries[aFile] = handle;
1345+ return createModule(handle, aFile);
1346+}
1347+
1348+
1349+ExternalModule*
1350+DynamicLoader::createModule(handle_t handle, const zstring& aFile) const
1351+{
1352+ // function pointer to create a module
1353+ ExternalModule* (*createModuleFunction)() = NULL;
1354+
1355+#ifdef WIN32
1356 createModule = (ExternalModule* (*)())GetProcAddress(handle, "createModule");
1357- if (createModule == NULL)
1358+ if (createModuleFunction == NULL)
1359 throw ZORBA_EXCEPTION(
1360 zerr::ZAPI0015_CREATEMODULE_NOT_FOUND,
1361 ERROR_PARAMS( aFile, os_error::get_err_string() )
1362 );
1363-
1364 #else
1365- void* handle = dlopen(aFile.c_str(), RTLD_NOW);
1366- if (!handle)
1367- throw ZORBA_EXCEPTION(
1368- zerr::ZOSE0005_DLL_LOAD_FAILED, ERROR_PARAMS( aFile, zstring(dlerror()) )
1369- );
1370-
1371- createModule = (ExternalModule* (*)()) dlsym(handle, "createModule");
1372- if (createModule == NULL)
1373+ createModuleFunction = (ExternalModule* (*)()) dlsym(handle, "createModule");
1374+ if (createModuleFunction == NULL)
1375 {
1376 dlclose(handle);
1377 throw ZORBA_EXCEPTION(
1378- zerr::ZAPI0015_CREATEMODULE_NOT_FOUND,
1379- ERROR_PARAMS( aFile, dlerror() )
1380- );
1381+ zerr::ZAPI0015_CREATEMODULE_NOT_FOUND,
1382+ ERROR_PARAMS( aFile, dlerror() )
1383+ );
1384 }
1385 #endif
1386- if (theLibraries.find(handle) == theLibraries.end())
1387- {
1388- theLibraries.insert(handle);
1389- }
1390-
1391- return createModule();
1392+ return createModuleFunction();
1393 }
1394
1395
1396@@ -193,13 +208,13 @@
1397
1398 DynamicLoader::~DynamicLoader()
1399 {
1400- for (LibrarySet_t::const_iterator lIter = theLibraries.begin();
1401+ for (LibraryMap_t::const_iterator lIter = theLibraries.begin();
1402 lIter != theLibraries.end(); ++lIter)
1403 {
1404 #ifdef WIN32
1405- FreeLibrary(*lIter);
1406+ FreeLibrary(lIter->second);
1407 #else
1408- dlclose(*lIter);
1409+ dlclose(lIter->second);
1410 #endif
1411 }
1412 }
1413
1414=== modified file 'src/context/dynamic_loader.h'
1415--- src/context/dynamic_loader.h 2012-04-16 20:56:43 +0000
1416+++ src/context/dynamic_loader.h 2012-04-18 15:53:24 +0000
1417@@ -18,7 +18,7 @@
1418 #define ZORBA_DYNAMIC_LOADER_H
1419
1420 #include "common/common.h"
1421-#include <set>
1422+#include <map>
1423 #include "common/shared_types.h"
1424
1425 namespace zorba {
1426@@ -40,15 +40,20 @@
1427
1428 ~DynamicLoader();
1429
1430- ExternalModule* loadModule(const zstring& aFile) const;
1431
1432 #ifdef WIN32
1433- typedef std::set<HMODULE> LibrarySet_t;
1434+ typedef HMODULE handle_t;
1435 #else
1436- typedef std::set<void*> LibrarySet_t;
1437+ typedef void * handle_t;
1438 #endif
1439
1440- mutable LibrarySet_t theLibraries;
1441+ ExternalModule* loadModule(const zstring& aFile) const;
1442+ ExternalModule* createModule(handle_t handle, const zstring& aFile) const;
1443+
1444+
1445+ typedef std::map<const zstring, handle_t> LibraryMap_t;
1446+
1447+ mutable LibraryMap_t theLibraries;
1448 };
1449
1450 } /* namespace zorba */
1451
1452=== modified file 'src/system/properties.h'
1453--- src/system/properties.h 2012-04-16 20:56:43 +0000
1454+++ src/system/properties.h 2012-04-18 15:53:24 +0000
1455@@ -67,6 +67,27 @@
1456
1457 std::ostream& debug_out() { return *debug_stream; }
1458
1459+ /**
1460+ * Before the JVM is started this will return the classpath set by
1461+ * command line option, the CLASSPATH environment variable and in Zorba
1462+ * config file.
1463+ *
1464+ * After the JVM is started this will contain in addition the paths to jars
1465+ * used by modules that make use of the JVM.
1466+ */
1467+ void getJVMClassPath(std::string & jvmClasspath)
1468+ { jvmClasspath = theCLASSPATH ; }
1469+
1470+ /**
1471+ * This method should be used to set additional JVM classpath for modules
1472+ * that make use of JVM. This will overide the classpath set by CLASSPATH
1473+ * environment variable or Zorba config file.
1474+ *
1475+ * Once the JVM is started this method doesn't have any effect.
1476+ */
1477+ void setJVMClassPath(const std::string & jvmClasspath)
1478+ { theCLASSPATH = jvmClasspath; }
1479+
1480 protected:
1481 /**
1482 * Gets the Operation System folder where the properties of the current
1483
1484=== modified file 'src/system/zorba_properties.h'
1485--- src/system/zorba_properties.h 2012-04-16 20:56:43 +0000
1486+++ src/system/zorba_properties.h 2012-04-18 15:53:24 +0000
1487@@ -26,13 +26,25 @@
1488 namespace zorba
1489 {
1490
1491-class ZORBA_DLL_PUBLIC ZorbaProperties : public ::zorba::PropertiesBase
1492+class ZORBA_DLL_PUBLIC ZorbaProperties : public ::zorba::PropertiesGlobal
1493 {
1494 protected:
1495 const char** get_all_options() const
1496 {
1497- static const char* result [] =
1498- { "--trace-parsing", "--trace-scanning", "--use-serializer", "--optimizer", "--result-file", "--debug-file", "--abort", "--query", "--print-query", "--print-time", "--print-ast", "--print-xqdoc", "--print-translated", "--print-normalized", "--print-optimized", "--print-iterator-tree", "--print-item-flow", "--print-static-types", "--dump-lib", "--stable-iterator-ids", "--no-tree-ids", "--print-intermediate-opt", "--print-locations", "--force-gflwor", "--reorder-globals", "--specialize-num", "--specialize-cmp", "--inline-udf", "--loop-hoisting", "--infer-joins", "--no-copy-optim", "--serialize-only-query", "--trace-translator", "--trace-codegen", "--trace-fulltext", "--debug", "--compile-only", "--tz", "--external-var", "--serializer-param", "--iter-plan-test", "--dot-plan-file", "--max-udf-call-depth", NULL };
1499+ static const char* result [] = {
1500+ "--trace-parsing", "--trace-scanning", "--use-serializer", "--optimizer",
1501+ "--result-file", "--debug-file", "--abort", "--query", "--print-query",
1502+ "--print-time", "--print-ast", "--print-xqdoc", "--print-translated",
1503+ "--print-normalized", "--print-optimized", "--print-iterator-tree",
1504+ "--print-item-flow", "--print-static-types", "--dump-lib",
1505+ "--stable-iterator-ids", "--no-tree-ids", "--print-intermediate-opt",
1506+ "--print-locations", "--force-gflwor", "--reorder-globals",
1507+ "--specialize-num", "--specialize-cmp", "--inline-udf", "--loop-hoisting",
1508+ "--infer-joins", "--no-copy-optim", "--serialize-only-query",
1509+ "--trace-translator", "--trace-codegen", "--trace-fulltext", "--debug",
1510+ "--compile-only", "--tz", "--external-var", "--serializer-param",
1511+ "--iter-plan-test", "--dot-plan-file", "--max-udf-call-depth",
1512+ "--CLASSPATH", NULL };
1513
1514 return result;
1515 }
1516@@ -80,6 +92,7 @@
1517 bool theIterPlanTest;
1518 std::string theDotPlanFile;
1519 uint32_t theMaxUdfCallDepth;
1520+ std::string theCLASSPATH;
1521
1522 void initialize()
1523 {
1524@@ -165,6 +178,7 @@
1525 const bool &iterPlanTest () const { return theIterPlanTest; }
1526 const std::string &dotPlanFile () const { return theDotPlanFile; }
1527 const uint32_t &maxUdfCallDepth () const { return theMaxUdfCallDepth; }
1528+ const std::string &CLASSPATH () const { return theCLASSPATH; }
1529
1530 std::string load_argv (int argc, const char **argv)
1531 {
1532@@ -200,7 +214,9 @@
1533 else if (strcmp (*argv, "--debug-file") == 0) {
1534 int d = 2;
1535 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1536- if (*argv == NULL) { result = "No value given for --debug-file option"; break; } init_val (*argv, theDebugFile, d);
1537+ if (*argv == NULL) { result = "No value given for --debug-file option"; break; }
1538+
1539+ init_val (*argv, theDebugFile, d);
1540 }
1541 else if (strcmp (*argv, "--abort") == 0) {
1542 theAbort = true;
1543@@ -208,7 +224,9 @@
1544 else if (strcmp (*argv, "--query") == 0 || strncmp (*argv, "-e", 2) == 0) {
1545 int d = 2;
1546 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1547- if (*argv == NULL) { result = "No value given for --query option"; break; } init_val (*argv, theQuery, d);
1548+ if (*argv == NULL) { result = "No value given for --query option"; break; }
1549+
1550+ init_val (*argv, theQuery, d);
1551 }
1552 else if (strcmp (*argv, "--print-query") == 0 || strncmp (*argv, "-q", 2) == 0) {
1553 thePrintQuery = true;
1554@@ -240,7 +258,9 @@
1555 else if (strcmp (*argv, "--print-static-types") == 0) {
1556 int d = 2;
1557 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1558- if (*argv == NULL) { result = "No value given for --print-static-types option"; break; } init_val (*argv, thePrintStaticTypes, d);
1559+ if (*argv == NULL) { result = "No value given for --print-static-types option"; break; }
1560+
1561+ init_val (*argv, thePrintStaticTypes, d);
1562 }
1563 else if (strcmp (*argv, "--dump-lib") == 0) {
1564 theDumpLib = true;
1565@@ -263,32 +283,44 @@
1566 else if (strcmp (*argv, "--reorder-globals") == 0) {
1567 int d = 2;
1568 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1569- if (*argv == NULL) { result = "No value given for --reorder-globals option"; break; } init_val (*argv, theReorderGlobals, d);
1570+ if (*argv == NULL) { result = "No value given for --reorder-globals option"; break; }
1571+
1572+ init_val (*argv, theReorderGlobals, d);
1573 }
1574 else if (strcmp (*argv, "--specialize-num") == 0) {
1575 int d = 2;
1576 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1577- if (*argv == NULL) { result = "No value given for --specialize-num option"; break; } init_val (*argv, theSpecializeNum, d);
1578+ if (*argv == NULL) { result = "No value given for --specialize-num option"; break; }
1579+
1580+ init_val (*argv, theSpecializeNum, d);
1581 }
1582 else if (strcmp (*argv, "--specialize-cmp") == 0) {
1583 int d = 2;
1584 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1585- if (*argv == NULL) { result = "No value given for --specialize-cmp option"; break; } init_val (*argv, theSpecializeCmp, d);
1586+ if (*argv == NULL) { result = "No value given for --specialize-cmp option"; break; }
1587+
1588+ init_val (*argv, theSpecializeCmp, d);
1589 }
1590 else if (strcmp (*argv, "--inline-udf") == 0) {
1591 int d = 2;
1592 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1593- if (*argv == NULL) { result = "No value given for --inline-udf option"; break; } init_val (*argv, theInlineUdf, d);
1594+ if (*argv == NULL) { result = "No value given for --inline-udf option"; break; }
1595+
1596+ init_val (*argv, theInlineUdf, d);
1597 }
1598 else if (strcmp (*argv, "--loop-hoisting") == 0) {
1599 int d = 2;
1600 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1601- if (*argv == NULL) { result = "No value given for --loop-hoisting option"; break; } init_val (*argv, theLoopHoisting, d);
1602+ if (*argv == NULL) { result = "No value given for --loop-hoisting option"; break; }
1603+
1604+ init_val (*argv, theLoopHoisting, d);
1605 }
1606 else if (strcmp (*argv, "--infer-joins") == 0) {
1607 int d = 2;
1608 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1609- if (*argv == NULL) { result = "No value given for --infer-joins option"; break; } init_val (*argv, theInferJoins, d);
1610+ if (*argv == NULL) { result = "No value given for --infer-joins option"; break; }
1611+
1612+ init_val (*argv, theInferJoins, d);
1613 }
1614 else if (strcmp (*argv, "--no-copy-optim") == 0)
1615 {
1616@@ -325,17 +357,23 @@
1617 else if (strcmp (*argv, "--tz") == 0) {
1618 int d = 2;
1619 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1620- if (*argv == NULL) { result = "No value given for --tz option"; break; } init_val (*argv, theTz, d);
1621+ if (*argv == NULL) { result = "No value given for --tz option"; break; }
1622+
1623+ init_val (*argv, theTz, d);
1624 }
1625 else if (strcmp (*argv, "--external-var") == 0 || strncmp (*argv, "-x", 2) == 0) {
1626 int d = 2;
1627 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1628- if (*argv == NULL) { result = "No value given for --external-var option"; break; } init_val (*argv, theExternalVar, d);
1629+ if (*argv == NULL) { result = "No value given for --external-var option"; break; }
1630+
1631+ init_val (*argv, theExternalVar, d);
1632 }
1633 else if (strcmp (*argv, "--serializer-param") == 0 || strncmp (*argv, "-z", 2) == 0) {
1634 int d = 2;
1635 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1636- if (*argv == NULL) { result = "No value given for --serializer-param option"; break; } init_val (*argv, theSerializerParam, d);
1637+ if (*argv == NULL) { result = "No value given for --serializer-param option"; break; }
1638+
1639+ init_val (*argv, theSerializerParam, d);
1640 }
1641 else if (strcmp (*argv, "--iter-plan-test") == 0) {
1642 theIterPlanTest = true;
1643@@ -343,12 +381,23 @@
1644 else if (strcmp (*argv, "--dot-plan-file") == 0) {
1645 int d = 2;
1646 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1647- if (*argv == NULL) { result = "No value given for --dot-plan-file option"; break; } init_val (*argv, theDotPlanFile, d);
1648+ if (*argv == NULL) { result = "No value given for --dot-plan-file option"; break; }
1649+
1650+ init_val (*argv, theDotPlanFile, d);
1651 }
1652 else if (strcmp (*argv, "--max-udf-call-depth") == 0) {
1653 int d = 2;
1654 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1655- if (*argv == NULL) { result = "No value given for --max-udf-call-depth option"; break; } init_val (*argv, theMaxUdfCallDepth, d);
1656+ if (*argv == NULL) { result = "No value given for --max-udf-call-depth option"; break; }
1657+
1658+ init_val (*argv, theMaxUdfCallDepth, d);
1659+ }
1660+ else if (strcmp (*argv, "--CLASSPATH") == 0) {
1661+ int d = 2;
1662+ if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
1663+ if (*argv == NULL) { result = "No value given for --CLASSPATH option"; break; }
1664+
1665+ init_val (*argv, theCLASSPATH, d);
1666 }
1667 else if (strcmp (*argv, "--") == 0) {
1668 copy_args (++argv);
1669@@ -413,6 +462,7 @@
1670 "--iter-plan-test\nrun as iterator plan test\n\n"
1671 "--dot-plan-file\ngenerate the dot iterator plan\n\n"
1672 "--max-udf-call-depth\nmaximum stack depth of udf function calls\n\n"
1673+"--CLASSPATH\nJVM classpath to be used by modules using Java implementations\n\n"
1674 ;
1675 }
1676
1677
1678=== modified file 'src/system/zorba_properties.txt'
1679--- src/system/zorba_properties.txt 2012-04-16 20:56:43 +0000
1680+++ src/system/zorba_properties.txt 2012-04-18 15:53:24 +0000
1681@@ -43,3 +43,4 @@
1682 ("iter-plan-test", "run as iterator plan test")
1683 ("dot-plan-file", po::value<std::string>(), "generate the dot iterator plan")
1684 ("max-udf-call-depth", po::value<uint32_t>()->default_value(1024), "maximum stack depth of udf function calls")
1685+ ("CLASSPATH", po::value<std::string>(), "JVM classpath to be used by modules using Java implementations")
1686\ No newline at end of file
1687
1688=== modified file 'src/util/file.cpp'
1689--- src/util/file.cpp 2012-04-16 20:56:43 +0000
1690+++ src/util/file.cpp 2012-04-18 15:53:24 +0000
1691@@ -277,6 +277,18 @@
1692 #endif
1693 }
1694
1695+void file::lsdir(std::vector<std::string> &list) {
1696+#ifdef ZORBA_WITH_FILE_ACCESS
1697+ try {
1698+ fs::lsdir( c_str(), list );
1699+ set_filetype( type_directory );
1700+ }
1701+ catch ( fs::exception const &e ) {
1702+ throw ZORBA_IO_EXCEPTION( e.function(), e.path() );
1703+ }
1704+#endif
1705+}
1706+
1707 void file::deep_mkdir() {
1708 #ifdef ZORBA_WITH_FILE_ACCESS
1709 vector<file> files;
1710
1711=== modified file 'src/util/fs_util.cpp'
1712--- src/util/fs_util.cpp 2012-04-16 20:56:43 +0000
1713+++ src/util/fs_util.cpp 2012-04-18 15:53:24 +0000
1714@@ -277,6 +277,30 @@
1715 #endif
1716 }
1717
1718+void lsdir( char const *path, std::vector<std::string> &list )
1719+{
1720+ DIR *dir;
1721+ struct dirent *ent;
1722+
1723+ dir = opendir (path);
1724+ if (dir != NULL)
1725+ {
1726+ /* print all the files and directories within directory */
1727+ while ((ent = readdir (dir)) != NULL)
1728+ {
1729+ //printf ("%s\n", ent->d_name);
1730+ std::string item(ent->d_name);
1731+ list.push_back(item);
1732+ }
1733+ closedir (dir);
1734+ }
1735+ else
1736+ {
1737+ /* could not open directory */
1738+ throw fs::exception( "lsdir()", path );
1739+ }
1740+}
1741+
1742 bool remove( char const *path ) {
1743 #ifndef WIN32
1744 return ::remove( path ) == 0;
1745
1746=== modified file 'src/util/fs_util.h'
1747--- src/util/fs_util.h 2012-04-16 20:56:43 +0000
1748+++ src/util/fs_util.h 2012-04-18 15:53:24 +0000
1749@@ -17,6 +17,14 @@
1750 #ifndef ZORBA_FS_UTIL_H
1751 #define ZORBA_FS_UTIL_H
1752
1753+#include <vector>
1754+
1755+#ifdef WIN32
1756+# include "win32/dirent.h"
1757+#else
1758+# include <dirent.h> /* for implementing lsdir */
1759+#endif /* WIN32 */
1760+
1761 #include <zorba/config.h>
1762
1763 #include <stdexcept>
1764@@ -144,6 +152,26 @@
1765 mkdir( path.c_str() );
1766 }
1767
1768+/**
1769+ * List files in dir
1770+ *
1771+ * @param path The full path of the directory to list.
1772+ * @throws fs::exception if the list fails.
1773+ */
1774+void lsdir( char const *path, std::vector<std::string> & list );
1775+
1776+/**
1777+ * List files in dir
1778+ *
1779+ * @tparam PathStringType The \a path string type.
1780+ * @param path The full path of the directory to list.
1781+ * @throws fs::exception if the list fails.
1782+ */
1783+template<class PathStringType> inline
1784+void lsdir( PathStringType const &path, std::vector<std::string> & list ) {
1785+ lsdir( path.c_str(), list );
1786+}
1787+
1788 #endif /* ZORBA_WITH_FILE_ACCESS */
1789
1790 ////////// File creation //////////////////////////////////////////////////////
1791
1792=== added file 'src/util/win32/dirent.h'
1793--- src/util/win32/dirent.h 1970-01-01 00:00:00 +0000
1794+++ src/util/win32/dirent.h 2012-04-18 15:53:24 +0000
1795@@ -0,0 +1,372 @@
1796+/*****************************************************************************
1797+ * dirent.h - dirent API for Microsoft Visual Studio
1798+ *
1799+ * Copyright (C) 2006 Toni Ronkko
1800+ *
1801+ * Permission is hereby granted, free of charge, to any person obtaining
1802+ * a copy of this software and associated documentation files (the
1803+ * ``Software''), to deal in the Software without restriction, including
1804+ * without limitation the rights to use, copy, modify, merge, publish,
1805+ * distribute, sublicense, and/or sell copies of the Software, and to
1806+ * permit persons to whom the Software is furnished to do so, subject to
1807+ * the following conditions:
1808+ *
1809+ * The above copyright notice and this permission notice shall be included
1810+ * in all copies or substantial portions of the Software.
1811+ *
1812+ * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
1813+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1814+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1815+ * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
1816+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1817+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1818+ * OTHER DEALINGS IN THE SOFTWARE.
1819+ *
1820+ * Mar 15, 2011, Toni Ronkko
1821+ * Defined FILE_ATTRIBUTE_DEVICE for MSVC 6.0.
1822+ *
1823+ * Aug 11, 2010, Toni Ronkko
1824+ * Added d_type and d_namlen fields to dirent structure. The former is
1825+ * especially useful for determining whether directory entry represents a
1826+ * file or a directory. For more information, see
1827+ * http://www.delorie.com/gnu/docs/glibc/libc_270.html
1828+ *
1829+ * Aug 11, 2010, Toni Ronkko
1830+ * Improved conformance to the standards. For example, errno is now set
1831+ * properly on failure and assert() is never used. Thanks to Peter Brockam
1832+ * for suggestions.
1833+ *
1834+ * Aug 11, 2010, Toni Ronkko
1835+ * Fixed a bug in rewinddir(): when using relative directory names, change
1836+ * of working directory no longer causes rewinddir() to fail.
1837+ *
1838+ * Dec 15, 2009, John Cunningham
1839+ * Added rewinddir member function
1840+ *
1841+ * Jan 18, 2008, Toni Ronkko
1842+ * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string
1843+ * between multi-byte and unicode representations. This makes the
1844+ * code simpler and also allows the code to be compiled under MingW. Thanks
1845+ * to Azriel Fasten for the suggestion.
1846+ *
1847+ * Mar 4, 2007, Toni Ronkko
1848+ * Bug fix: due to the strncpy_s() function this file only compiled in
1849+ * Visual Studio 2005. Using the new string functions only when the
1850+ * compiler version allows.
1851+ *
1852+ * Nov 2, 2006, Toni Ronkko
1853+ * Major update: removed support for Watcom C, MS-DOS and Turbo C to
1854+ * simplify the file, updated the code to compile cleanly on Visual
1855+ * Studio 2005 with both unicode and multi-byte character strings,
1856+ * removed rewinddir() as it had a bug.
1857+ *
1858+ * Aug 20, 2006, Toni Ronkko
1859+ * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified
1860+ * comments by removing SGML tags.
1861+ *
1862+ * May 14 2002, Toni Ronkko
1863+ * Embedded the function definitions directly to the header so that no
1864+ * source modules need to be included in the Visual Studio project. Removed
1865+ * all the dependencies to other projects so that this very header can be
1866+ * used independently.
1867+ *
1868+ * May 28 1998, Toni Ronkko
1869+ * First version.
1870+ *****************************************************************************/
1871+#ifndef DIRENT_H
1872+#define DIRENT_H
1873+
1874+#define WIN32_LEAN_AND_MEAN
1875+#include <windows.h>
1876+#include <string.h>
1877+#include <stdlib.h>
1878+#include <sys/types.h>
1879+#include <sys/stat.h>
1880+#include <errno.h>
1881+
1882+/* Entries missing from MSVC 6.0 */
1883+#if !defined(FILE_ATTRIBUTE_DEVICE)
1884+# define FILE_ATTRIBUTE_DEVICE 0x40
1885+#endif
1886+
1887+/* File type and permission flags for stat() */
1888+#if defined(_MSC_VER) && !defined(S_IREAD)
1889+# define S_IFMT _S_IFMT /* file type mask */
1890+# define S_IFDIR _S_IFDIR /* directory */
1891+# define S_IFCHR _S_IFCHR /* character device */
1892+# define S_IFFIFO _S_IFFIFO /* pipe */
1893+# define S_IFREG _S_IFREG /* regular file */
1894+# define S_IREAD _S_IREAD /* read permission */
1895+# define S_IWRITE _S_IWRITE /* write permission */
1896+# define S_IEXEC _S_IEXEC /* execute permission */
1897+#endif
1898+#define S_IFBLK 0 /* block device */
1899+#define S_IFLNK 0 /* link */
1900+#define S_IFSOCK 0 /* socket */
1901+
1902+#if defined(_MSC_VER)
1903+# define S_IRUSR S_IREAD /* read, user */
1904+# define S_IWUSR S_IWRITE /* write, user */
1905+# define S_IXUSR 0 /* execute, user */
1906+# define S_IRGRP 0 /* read, group */
1907+# define S_IWGRP 0 /* write, group */
1908+# define S_IXGRP 0 /* execute, group */
1909+# define S_IROTH 0 /* read, others */
1910+# define S_IWOTH 0 /* write, others */
1911+# define S_IXOTH 0 /* execute, others */
1912+#endif
1913+
1914+/* Indicates that d_type field is available in dirent structure */
1915+#define _DIRENT_HAVE_D_TYPE
1916+
1917+/* File type flags for d_type */
1918+#define DT_UNKNOWN 0
1919+#define DT_REG S_IFREG
1920+#define DT_DIR S_IFDIR
1921+#define DT_FIFO S_IFFIFO
1922+#define DT_SOCK S_IFSOCK
1923+#define DT_CHR S_IFCHR
1924+#define DT_BLK S_IFBLK
1925+
1926+/* Macros for converting between st_mode and d_type */
1927+#define IFTODT(mode) ((mode) & S_IFMT)
1928+#define DTTOIF(type) (type)
1929+
1930+/*
1931+ * File type macros. Note that block devices, sockets and links cannot be
1932+ * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
1933+ * only defined for compatibility. These macros should always return false
1934+ * on Windows.
1935+ */
1936+#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO)
1937+#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
1938+#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
1939+#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
1940+#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
1941+#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
1942+#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
1943+
1944+#ifdef __cplusplus
1945+extern "C" {
1946+#endif
1947+
1948+
1949+typedef struct dirent
1950+{
1951+ char d_name[MAX_PATH + 1]; /* File name */
1952+ size_t d_namlen; /* Length of name without \0 */
1953+ int d_type; /* File type */
1954+} dirent;
1955+
1956+
1957+typedef struct DIR
1958+{
1959+ dirent curentry; /* Current directory entry */
1960+ WIN32_FIND_DATAA find_data; /* Private file data */
1961+ int cached; /* True if data is valid */
1962+ HANDLE search_handle; /* Win32 search handle */
1963+ char patt[MAX_PATH + 3]; /* Initial directory name */
1964+} DIR;
1965+
1966+
1967+/* Forward declarations */
1968+static DIR *opendir(const char *dirname);
1969+static struct dirent *readdir(DIR *dirp);
1970+static int closedir(DIR *dirp);
1971+static void rewinddir(DIR* dirp);
1972+
1973+
1974+/* Use the new safe string functions introduced in Visual Studio 2005 */
1975+#if defined(_MSC_VER) && _MSC_VER >= 1400
1976+# define DIRENT_STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE)
1977+#else
1978+# define DIRENT_STRNCPY(dest,src,size) strncpy((dest),(src),(size))
1979+#endif
1980+
1981+/* Set errno variable */
1982+#if defined(_MSC_VER)
1983+#define DIRENT_SET_ERRNO(x) _set_errno (x)
1984+#else
1985+#define DIRENT_SET_ERRNO(x) (errno = (x))
1986+#endif
1987+
1988+
1989+/*****************************************************************************
1990+ * Open directory stream DIRNAME for read and return a pointer to the
1991+ * internal working area that is used to retrieve individual directory
1992+ * entries.
1993+ */
1994+static DIR *opendir(const char *dirname)
1995+{
1996+ DIR *dirp;
1997+
1998+ /* ensure that the resulting search pattern will be a valid file name */
1999+ if (dirname == NULL) {
2000+ DIRENT_SET_ERRNO (ENOENT);
2001+ return NULL;
2002+ }
2003+ if (strlen (dirname) + 3 >= MAX_PATH) {
2004+ DIRENT_SET_ERRNO (ENAMETOOLONG);
2005+ return NULL;
2006+ }
2007+
2008+ /* construct new DIR structure */
2009+ dirp = (DIR*) malloc (sizeof (struct DIR));
2010+ if (dirp != NULL) {
2011+ int error;
2012+
2013+ /*
2014+ * Convert relative directory name to an absolute one. This
2015+ * allows rewinddir() to function correctly when the current working
2016+ * directory is changed between opendir() and rewinddir().
2017+ */
2018+ if (GetFullPathNameA (dirname, MAX_PATH, dirp->patt, NULL)) {
2019+ char *p;
2020+
2021+ /* append the search pattern "\\*\0" to the directory name */
2022+ p = strchr (dirp->patt, '\0');
2023+ if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') {
2024+ *p++ = '\\';
2025+ }
2026+ *p++ = '*';
2027+ *p = '\0';
2028+
2029+ /* open directory stream and retrieve the first entry */
2030+ dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->find_data);
2031+ if (dirp->search_handle != INVALID_HANDLE_VALUE) {
2032+ /* a directory entry is now waiting in memory */
2033+ dirp->cached = 1;
2034+ error = 0;
2035+ } else {
2036+ /* search pattern is not a directory name? */
2037+ DIRENT_SET_ERRNO (ENOENT);
2038+ error = 1;
2039+ }
2040+ } else {
2041+ /* buffer too small */
2042+ DIRENT_SET_ERRNO (ENOMEM);
2043+ error = 1;
2044+ }
2045+
2046+ if (error) {
2047+ free (dirp);
2048+ dirp = NULL;
2049+ }
2050+ }
2051+
2052+ return dirp;
2053+}
2054+
2055+
2056+/*****************************************************************************
2057+ * Read a directory entry, and return a pointer to a dirent structure
2058+ * containing the name of the entry in d_name field. Individual directory
2059+ * entries returned by this very function include regular files,
2060+ * sub-directories, pseudo-directories "." and "..", but also volume labels,
2061+ * hidden files and system files may be returned.
2062+ */
2063+static struct dirent *readdir(DIR *dirp)
2064+{
2065+ DWORD attr;
2066+ if (dirp == NULL) {
2067+ /* directory stream did not open */
2068+ DIRENT_SET_ERRNO (EBADF);
2069+ return NULL;
2070+ }
2071+
2072+ /* get next directory entry */
2073+ if (dirp->cached != 0) {
2074+ /* a valid directory entry already in memory */
2075+ dirp->cached = 0;
2076+ } else {
2077+ /* get the next directory entry from stream */
2078+ if (dirp->search_handle == INVALID_HANDLE_VALUE) {
2079+ return NULL;
2080+ }
2081+ if (FindNextFileA (dirp->search_handle, &dirp->find_data) == FALSE) {
2082+ /* the very last entry has been processed or an error occured */
2083+ FindClose (dirp->search_handle);
2084+ dirp->search_handle = INVALID_HANDLE_VALUE;
2085+ return NULL;
2086+ }
2087+ }
2088+
2089+ /* copy as a multibyte character string */
2090+ DIRENT_STRNCPY ( dirp->curentry.d_name,
2091+ dirp->find_data.cFileName,
2092+ sizeof(dirp->curentry.d_name) );
2093+ dirp->curentry.d_name[MAX_PATH] = '\0';
2094+
2095+ /* compute the length of name */
2096+ dirp->curentry.d_namlen = strlen (dirp->curentry.d_name);
2097+
2098+ /* determine file type */
2099+ attr = dirp->find_data.dwFileAttributes;
2100+ if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
2101+ dirp->curentry.d_type = DT_CHR;
2102+ } else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
2103+ dirp->curentry.d_type = DT_DIR;
2104+ } else {
2105+ dirp->curentry.d_type = DT_REG;
2106+ }
2107+ return &dirp->curentry;
2108+}
2109+
2110+
2111+/*****************************************************************************
2112+ * Close directory stream opened by opendir() function. Close of the
2113+ * directory stream invalidates the DIR structure as well as any previously
2114+ * read directory entry.
2115+ */
2116+static int closedir(DIR *dirp)
2117+{
2118+ if (dirp == NULL) {
2119+ /* invalid directory stream */
2120+ DIRENT_SET_ERRNO (EBADF);
2121+ return -1;
2122+ }
2123+
2124+ /* release search handle */
2125+ if (dirp->search_handle != INVALID_HANDLE_VALUE) {
2126+ FindClose (dirp->search_handle);
2127+ dirp->search_handle = INVALID_HANDLE_VALUE;
2128+ }
2129+
2130+ /* release directory structure */
2131+ free (dirp);
2132+ return 0;
2133+}
2134+
2135+
2136+/*****************************************************************************
2137+ * Resets the position of the directory stream to which dirp refers to the
2138+ * beginning of the directory. It also causes the directory stream to refer
2139+ * to the current state of the corresponding directory, as a call to opendir()
2140+ * would have done. If dirp does not refer to a directory stream, the effect
2141+ * is undefined.
2142+ */
2143+static void rewinddir(DIR* dirp)
2144+{
2145+ if (dirp != NULL) {
2146+ /* release search handle */
2147+ if (dirp->search_handle != INVALID_HANDLE_VALUE) {
2148+ FindClose (dirp->search_handle);
2149+ }
2150+
2151+ /* open new search handle and retrieve the first entry */
2152+ dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->find_data);
2153+ if (dirp->search_handle != INVALID_HANDLE_VALUE) {
2154+ /* a directory entry is now waiting in memory */
2155+ dirp->cached = 1;
2156+ } else {
2157+ /* failed to re-open directory: no directory entry in memory */
2158+ dirp->cached = 0;
2159+ }
2160+ }
2161+}
2162+
2163+
2164+#ifdef __cplusplus
2165+}
2166+#endif
2167+#endif /*DIRENT_H*/
2168
2169=== modified file 'swig/java/CMakeLists.txt'
2170--- swig/java/CMakeLists.txt 2012-04-16 20:56:43 +0000
2171+++ swig/java/CMakeLists.txt 2012-04-18 15:53:24 +0000
2172@@ -102,6 +102,7 @@
2173 ENDIF(NOT WIN32)
2174 ENDIF ( APPLE )
2175
2176+
2177 ELSE (JAVA_INCLUDE_PATH)
2178 MESSAGE ( STATUS "SWIG Java: not generating JAVA API because jni headers not found.")
2179 ENDIF (JAVA_INCLUDE_PATH)
2180
2181=== added file 'swig/various.i'
2182--- swig/various.i 1970-01-01 00:00:00 +0000
2183+++ swig/various.i 2012-04-18 15:53:24 +0000
2184@@ -0,0 +1,184 @@
2185+/* This is from http://www.opensource.apple.com/source/swig/swig-6/swig/Lib/java/various.i?txt */
2186+
2187+/* -----------------------------------------------------------------------------
2188+ * See the LICENSE file for information on copyright, usage and redistribution
2189+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
2190+ *
2191+ * various.i
2192+ *
2193+ * SWIG Typemap library for Java.
2194+ * Various useful typemaps.
2195+ * ----------------------------------------------------------------------------- */
2196+
2197+#ifdef SWIGJAVA
2198+
2199+/*
2200+ * char **STRING_ARRAY typemaps.
2201+ * These typemaps are for C String arrays which are NULL terminated.
2202+ * char *values[] = { "one", "two", "three", NULL }; // note NULL
2203+ * char ** is mapped to a Java String[].
2204+ *
2205+ * Example usage wrapping:
2206+ * %apply char **STRING_ARRAY { char **input };
2207+ * char ** foo(char **input);
2208+ *
2209+ * Java usage:
2210+ * String numbers[] = { "one", "two", "three" };
2211+ * String[] ret = modulename.foo( numbers };
2212+ */
2213+%typemap(jni) char **STRING_ARRAY "jobjectArray"
2214+%typemap(jtype) char **STRING_ARRAY "String[]"
2215+%typemap(jstype) char **STRING_ARRAY "String[]"
2216+%typemap(in) char **STRING_ARRAY (jint size) {
2217+ int i = 0;
2218+ size = JCALL1(GetArrayLength, jenv, $input);
2219+#ifdef __cplusplus
2220+ $1 = new char*[size+1];
2221+#else
2222+ $1 = (char **)calloc(size+1, sizeof(char *));
2223+#endif
2224+ for (i = 0; i<size; i++) {
2225+ jstring j_string = (jstring)JCALL2(GetObjectArrayElement, jenv, $input, i);
2226+ const char *c_string = JCALL2(GetStringUTFChars, jenv, j_string, 0);
2227+#ifdef __cplusplus
2228+ $1[i] = new char [strlen(c_string)+1];
2229+#else
2230+ $1[i] = (char *)calloc(strlen(c_string)+1, sizeof(const char *));
2231+#endif
2232+ strcpy($1[i], c_string);
2233+ JCALL2(ReleaseStringUTFChars, jenv, j_string, c_string);
2234+ JCALL1(DeleteLocalRef, jenv, j_string);
2235+ }
2236+ $1[i] = 0;
2237+}
2238+
2239+%typemap(freearg) char **STRING_ARRAY {
2240+ int i;
2241+ for (i=0; i<size$argnum-1; i++)
2242+#ifdef __cplusplus
2243+ delete[] $1[i];
2244+ delete[] $1;
2245+#else
2246+ free($1[i]);
2247+ free($1);
2248+#endif
2249+}
2250+
2251+%typemap(out) char **STRING_ARRAY {
2252+ int i;
2253+ int len=0;
2254+ jstring temp_string;
2255+ const jclass clazz = JCALL1(FindClass, jenv, "java/lang/String");
2256+
2257+ while ($1[len]) len++;
2258+ jresult = JCALL3(NewObjectArray, jenv, len, clazz, NULL);
2259+ /* exception checking omitted */
2260+
2261+ for (i=0; i<len; i++) {
2262+ temp_string = JCALL1(NewStringUTF, jenv, *result++);
2263+ JCALL3(SetObjectArrayElement, jenv, jresult, i, temp_string);
2264+ JCALL1(DeleteLocalRef, jenv, temp_string);
2265+ }
2266+}
2267+
2268+%typemap(javain) char **STRING_ARRAY "$javainput"
2269+%typemap(javaout) char **STRING_ARRAY {
2270+ return $jnicall;
2271+ }
2272+
2273+/*
2274+ * char **STRING_OUT typemaps.
2275+ * These are typemaps for returning strings when using a C char ** parameter type.
2276+ * The returned string appears in the 1st element of the passed in Java String array.
2277+ *
2278+ * Example usage wrapping:
2279+ * void foo(char **string_out);
2280+ *
2281+ * Java usage:
2282+ * String stringOutArray[] = { "" };
2283+ * modulename.foo(stringOutArray);
2284+ * System.out.println( stringOutArray[0] );
2285+ */
2286+%typemap(jni) char **STRING_OUT "jobjectArray"
2287+%typemap(jtype) char **STRING_OUT "String[]"
2288+%typemap(jstype) char **STRING_OUT "String[]"
2289+%typemap(javain) char **STRING_OUT "$javainput"
2290+
2291+%typemap(in) char **STRING_OUT($*1_ltype temp) {
2292+ if (!$input) {
2293+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
2294+ return $null;
2295+ }
2296+ if (JCALL1(GetArrayLength, jenv, $input) == 0) {
2297+ SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
2298+ return $null;
2299+ }
2300+ $1 = &temp;
2301+}
2302+
2303+%typemap(argout) char **STRING_OUT {
2304+ jstring jnewstring = NULL;
2305+ if($1) {
2306+ jnewstring = JCALL1(NewStringUTF, jenv, *$1);
2307+ }
2308+ JCALL3(SetObjectArrayElement, jenv, $input, 0, jnewstring);
2309+}
2310+
2311+/*
2312+ * char *BYTE typemaps.
2313+ * These are input typemaps for mapping a Java byte[] array to a C char array.
2314+ * Note that as a Java array is used and thus passeed by reference, the C routine
2315+ * can return data to Java via the parameter.
2316+ *
2317+ * Example usage wrapping:
2318+ * void foo(char *array);
2319+ *
2320+ * Java usage:
2321+ * byte b[] = new byte[20];
2322+ * modulename.foo(b);
2323+ */
2324+%typemap(jni) char *BYTE "jbyteArray"
2325+%typemap(jtype) char *BYTE "byte[]"
2326+%typemap(jstype) char *BYTE "byte[]"
2327+%typemap(in) char *BYTE {
2328+ $1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0);
2329+}
2330+
2331+%typemap(argout) char *BYTE {
2332+ JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *) $1, 0);
2333+}
2334+
2335+%typemap(javain) char *BYTE "$javainput"
2336+
2337+/* Prevent default freearg typemap from being used */
2338+%typemap(freearg) char *BYTE ""
2339+
2340+#else
2341+
2342+#endif
2343+
2344+
2345+/* %include "typemaps.i"
2346+
2347+#if defined(SWIGJAVA)
2348+
2349+%typemap(in) (char * BYTE, int LENGTH)
2350+{
2351+ // Functions from jni.h
2352+ $1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0);
2353+ $2 = (int) JCALL1(GetArrayLength, jenv, $input);
2354+}
2355+
2356+%typemap(jni) (char * BYTE, int LENGTH) "jbyteArray"
2357+%typemap(jtype) (char * BYTE, int LENGTH) "byte[]"
2358+%typemap(jstype) (char * BYTE, int LENGTH) "byte[]"
2359+%typemap(javain) (char * BYTE, int LENGTH) "$javainput"
2360+
2361+// Specify signature of method to handle
2362+%apply (char * BYTE, int LENGTH) { (char * byteArray, long len) };
2363+
2364+#else
2365+%apply (char * BYTE, int LENGTH) { (char * byteArray, long len) };
2366+#endif
2367+
2368+*/
2369
2370=== modified file 'swig/zorba_api.i'
2371--- swig/zorba_api.i 2012-04-16 20:56:43 +0000
2372+++ swig/zorba_api.i 2012-04-18 15:53:24 +0000
2373@@ -97,6 +97,8 @@
2374 }
2375 #endif
2376
2377+/* %include "various.i" required for mapping to Java byte[]*/
2378+
2379 //%include "ZorbaStreamProxy.i"
2380 %include "SerializationOptions.i"
2381 %include "TypeIdentifier.i"
2382
2383=== modified file 'test/rbkt/modules/CMakeLists.txt'
2384--- test/rbkt/modules/CMakeLists.txt 2012-04-16 20:56:43 +0000
2385+++ test/rbkt/modules/CMakeLists.txt 2012-04-18 15:53:24 +0000
2386@@ -58,3 +58,5 @@
2387 # This is as good a place as any to test this feature
2388 DECLARE_ZORBA_URI_FILE(FILE "random-file.txt"
2389 URI "http://www.zorba-xquery.com/random-file" TEST_ONLY)
2390+
2391+ADD_SUBDIRECTORY(java)
2392
2393=== added directory 'test/rbkt/modules/java'
2394=== added file 'test/rbkt/modules/java/CMakeLists.txt'
2395--- test/rbkt/modules/java/CMakeLists.txt 1970-01-01 00:00:00 +0000
2396+++ test/rbkt/modules/java/CMakeLists.txt 2012-04-18 15:53:24 +0000
2397@@ -0,0 +1,40 @@
2398+# Copyright 2006-2008 The FLWOR Foundation.
2399+#
2400+# Licensed under the Apache License, Version 2.0 (the "License")
2401+# you may not use this file except in compliance with the License.
2402+# You may obtain a copy of the License at
2403+#
2404+# http://www.apache.org/licenses/LICENSE-2.0
2405+#
2406+# Unless required by applicable law or agreed to in writing, software
2407+# distributed under the License is distributed on an "AS IS" BASIS,
2408+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2409+# See the License for the specific language governing permissions and
2410+# limitations under the License.
2411+
2412+# For now we only test building a .jar that we want Zorba to make available
2413+# on the JVM claspath. This test scenario should be extended to include a
2414+# Zorba module using the .jar, etc.
2415+# We make use of the much-improved Java support added in CMake 2.8.6.
2416+COMPARE_VERSION_STRINGS (${CMAKE_VERSION} "2.8.6" RESULT)
2417+IF (${RESULT} GREATER -1)
2418+ FIND_PACKAGE (Java COMPONENTS Development)
2419+ IF (Java_Development_FOUND)
2420+ INCLUDE (UseJava)
2421+
2422+ # Declare two "different" jars, for testing
2423+ ADD_JAR (JavaTest Test.java)
2424+ ADD_JAR (JavaTest2 Test.java)
2425+
2426+ # Tell Zorba about the jars
2427+ GET_PROPERTY (JavaTest_JAR_FILE TARGET JavaTest PROPERTY JAR_FILE)
2428+ GET_PROPERTY (JavaTest2_JAR_FILE TARGET JavaTest2 PROPERTY JAR_FILE)
2429+ DECLARE_ZORBA_JAR(FILE ${JavaTest_JAR_FILE} TARGET JavaTest TEST_ONLY)
2430+ DECLARE_ZORBA_JAR(FILE ${JavaTest2_JAR_FILE} TARGET JavaTest2 TEST_ONLY)
2431+
2432+ # Pretend to tell Zorba about some system jars
2433+ DECLARE_ZORBA_JAR(EXTERNAL FILE
2434+ "${PROJECT_SOURCE_DIR}/MyJar.jar" "${PROJECT_SOURCE_DIR}/MyJar2.jar")
2435+
2436+ ENDIF (Java_Development_FOUND)
2437+ENDIF (${RESULT} GREATER -1)
2438
2439=== added file 'test/rbkt/modules/java/Test.java'
2440--- test/rbkt/modules/java/Test.java 1970-01-01 00:00:00 +0000
2441+++ test/rbkt/modules/java/Test.java 2012-04-18 15:53:24 +0000
2442@@ -0,0 +1,7 @@
2443+package org.zorbaxquery;
2444+
2445+public class Test {
2446+ public static void main(String[] args) {
2447+ System.out.println("Hello, world");
2448+ }
2449+}

Subscribers

People subscribed via source and target branches