Repository: qpid-proton Updated Branches: refs/heads/master e2357e2cc -> cac0fc437
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/java/shim/creactor.py ---------------------------------------------------------------------- diff --git a/tests/java/shim/creactor.py b/tests/java/shim/creactor.py deleted file mode 100644 index b61c1df..0000000 --- a/tests/java/shim/creactor.py +++ /dev/null @@ -1,118 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -import sys -from proton import _compat -from cerror import Skipped -from cengine import wrap, pn_connection_wrapper - -from org.apache.qpid.proton.reactor import Reactor -from org.apache.qpid.proton.engine import BaseHandler, HandlerException - -# from proton/reactor.h -def pn_reactor(): - return Reactor.Factory.create() -def pn_reactor_attachments(r): - return r.attachments() -def pn_reactor_get_global_handler(r): - return r.getGlobalHandler() -def pn_reactor_set_global_handler(r, h): - r.setGlobalHandler(h) -def pn_reactor_get_handler(r): - return r.getHandler() -def pn_reactor_set_handler(r, h): - r.setHandler(h) -def pn_reactor_set_timeout(r, t): - r.setTimeout(t) -def pn_reactor_get_timeout(r): - return r.getTimeout() -def pn_reactor_schedule(r, t, h): - return r.schedule(t, h) -def pn_reactor_yield(r): - getattr(r, "yield")() -def pn_reactor_start(r): - r.start() -def pn_reactor_process(r): - return peel_handler_exception(r.process) -def pn_reactor_stop(r): - return peel_handler_exception(r.stop) -def pn_reactor_selectable(r): - return r.selectable() -def pn_reactor_connection(r, h): - return wrap(r.connection(h), pn_connection_wrapper) -def pn_reactor_connection_to_host(r, host, port, h): - return wrap(r.connectionToHost(host, int(port), h), - pn_connection_wrapper) -def pn_reactor_get_connection_address(r, c): - return r.getConnectionAddress(c.impl) -def pn_reactor_set_connection_host(r, c, h, p): - r.setConnectionHost(c.impl, h, int(p)) -def pn_reactor_acceptor(r, host, port, handler): - return r.acceptor(host, int(port), handler) -def pn_reactor_mark(r): - return r.mark() -def pn_reactor_wakeup(r): - return r.wakeup() - -def peel_handler_exception(meth): - try: - return meth() - except HandlerException, he: - cause = he.cause - t = getattr(cause, "type", cause.__class__) - info = sys.exc_info() - _compat.raise_(t, cause, info[2]) - -def pn_handler_add(h, c): - h.add(c) -def pn_handler_dispatch(h, ev, et): - if et != None and et != ev.impl.type: - ev.impl.redispatch(et, h) - else: - ev.impl.dispatch(h) -def pn_record_set_handler(r, h): - BaseHandler.setHandler(r, h) -def pn_record_get_handler(r): - return BaseHandler.getHandler(r) - -def pn_task_attachments(t): - return t.attachments() - -def pn_selectable_attachments(s): - return s.attachments() - -def pn_selectable_set_fd(s, fd): - s.setChannel(fd.getChannel()) - -def pn_acceptor_close(a): - a.close() - -def pn_task_cancel(t): - t.cancel() - -def pn_object_reactor(o): - if hasattr(o, "impl"): - if hasattr(o.impl, "getSession"): - return o.impl.getSession().getConnection().getReactor() - elif hasattr(o.impl, "getConnection"): - return o.impl.getConnection().getReactor() - else: - return o.impl.getReactor() - else: - return o.getReactor() http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/java/shim/csasl.py ---------------------------------------------------------------------- diff --git a/tests/java/shim/csasl.py b/tests/java/shim/csasl.py deleted file mode 100644 index b540f82..0000000 --- a/tests/java/shim/csasl.py +++ /dev/null @@ -1,91 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -from org.apache.qpid.proton.engine import Sasl - -from compat import array, zeros - -from cerror import * - -# from proton/sasl.h -PN_SASL_NONE=-1 -PN_SASL_OK=0 -PN_SASL_AUTH=1 -PN_SASL_SYS=2 -PN_SASL_PERM=3 -PN_SASL_TEMP=4 - -def pn_sasl_extended(): - return False - -def pn_sasl(tp): - sasl = tp.impl.sasl() - if tp.server: - sasl.server() - else: - sasl.client() - return sasl - -SASL_OUTCOMES_P2J = { - PN_SASL_NONE: Sasl.PN_SASL_NONE, - PN_SASL_OK: Sasl.PN_SASL_OK, - PN_SASL_AUTH: Sasl.PN_SASL_AUTH, - PN_SASL_SYS: Sasl.PN_SASL_SYS, - PN_SASL_PERM: Sasl.PN_SASL_PERM, - PN_SASL_TEMP: Sasl.PN_SASL_TEMP, -} - -SASL_OUTCOMES_J2P = { - Sasl.PN_SASL_NONE: PN_SASL_NONE, - Sasl.PN_SASL_OK: PN_SASL_OK, - Sasl.PN_SASL_AUTH: PN_SASL_AUTH, - Sasl.PN_SASL_SYS: PN_SASL_SYS, - Sasl.PN_SASL_PERM: PN_SASL_PERM, - Sasl.PN_SASL_TEMP: PN_SASL_TEMP, -} - -def pn_transport_require_auth(transport, require): - raise Skipped('Not supported in Proton-J') - -# TODO: Placeholders -def pn_transport_is_authenticated(transport): - raise Skipped('Not supported in Proton-J') - -def pn_transport_is_encrypted(transport): - raise Skipped('Not supported in Proton-J') - -def pn_transport_get_user(transport): - raise Skipped('Not supported in Proton-J') - -def pn_connection_set_user(connection, user): - pass - -def pn_connection_set_password(connection, password): - pass - -def pn_sasl_allowed_mechs(sasl, mechs): - sasl.setMechanisms(*mechs.split()) - -def pn_sasl_set_allow_insecure_mechs(sasl, insecure): - pass - -def pn_sasl_done(sasl, outcome): - sasl.done(SASL_OUTCOMES_P2J[outcome]) - -def pn_sasl_outcome(sasl): - return SASL_OUTCOMES_J2P[sasl.getOutcome()] http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/java/shim/cssl.py ---------------------------------------------------------------------- diff --git a/tests/java/shim/cssl.py b/tests/java/shim/cssl.py deleted file mode 100644 index d389984..0000000 --- a/tests/java/shim/cssl.py +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -from org.apache.qpid.proton import Proton -from org.apache.qpid.proton.engine import SslDomain - -from cerror import * - -# from proton/ssl.h -PN_SSL_MODE_CLIENT = 1 -PN_SSL_MODE_SERVER = 2 - -PN_SSL_RESUME_UNKNOWN = 0 -PN_SSL_RESUME_NEW = 1 -PN_SSL_RESUME_REUSED = 2 - -PN_SSL_VERIFY_NULL=0 -PN_SSL_VERIFY_PEER=1 -PN_SSL_ANONYMOUS_PEER=2 -PN_SSL_VERIFY_PEER_NAME=3 - -PN_SSL_SHA1=0 -PN_SSL_SHA256=1 -PN_SSL_SHA512=2 -PN_SSL_MD5=3 - -PN_SSL_CERT_SUBJECT_COUNTRY_NAME=0 -PN_SSL_CERT_SUBJECT_STATE_OR_PROVINCE=1 -PN_SSL_CERT_SUBJECT_CITY_OR_LOCALITY=2 -PN_SSL_CERT_SUBJECT_ORGANIZATION_NAME=3 -PN_SSL_CERT_SUBJECT_ORGANIZATION_UNIT=4 -PN_SSL_CERT_SUBJECT_COMMON_NAME=5 - -PN_SSL_MODE_J2P = { - SslDomain.Mode.CLIENT: PN_SSL_MODE_CLIENT, - SslDomain.Mode.SERVER: PN_SSL_MODE_SERVER -} - -PN_SSL_MODE_P2J = { - PN_SSL_MODE_CLIENT: SslDomain.Mode.CLIENT, - PN_SSL_MODE_SERVER: SslDomain.Mode.SERVER -} - -def pn_ssl_present(): - return True - -def pn_ssl_domain(mode): - domain = Proton.sslDomain() - domain.init(PN_SSL_MODE_P2J[mode]) - return domain - -def pn_ssl_domain_set_credentials(domain, certificate_file, private_key_file, password): - domain.setCredentials(certificate_file, private_key_file, password) - return 0 - -def pn_ssl_domain_set_trusted_ca_db(domain, trusted_db): - domain.setTrustedCaDb(trusted_db) - return 0 - -PN_VERIFY_MODE_J2P = { - None: PN_SSL_VERIFY_NULL, - SslDomain.VerifyMode.VERIFY_PEER: PN_SSL_VERIFY_PEER, - SslDomain.VerifyMode.VERIFY_PEER_NAME: PN_SSL_VERIFY_PEER_NAME, - SslDomain.VerifyMode.ANONYMOUS_PEER: PN_SSL_ANONYMOUS_PEER -} - -PN_VERIFY_MODE_P2J = { - PN_SSL_VERIFY_NULL: None, - PN_SSL_VERIFY_PEER: SslDomain.VerifyMode.VERIFY_PEER, - PN_SSL_VERIFY_PEER_NAME: SslDomain.VerifyMode.VERIFY_PEER_NAME, - PN_SSL_ANONYMOUS_PEER: SslDomain.VerifyMode.ANONYMOUS_PEER -} - -def pn_ssl_domain_set_peer_authentication(domain, mode, trusted=None): - domain.setPeerAuthentication(PN_VERIFY_MODE_P2J[mode]) - if trusted: - domain.setTrustedCaDb(trusted) - return 0 - -def pn_ssl_domain_allow_unsecured_client(domain): - domain.allowUnsecuredClient(True) - return 0 - -class pn_ssl_wrapper: - - def __init__(self, transport): - self.impl = None - self.transport = transport - -def pn_ssl(transport): - if getattr(transport, "ssl", None) is not None: - return transport.ssl - else: - transport.ssl = pn_ssl_wrapper(transport) - return transport.ssl - -def pn_ssl_init(ssl, domain, session_id): - # XXX: session_id - ssl.impl = ssl.transport.impl.ssl(domain, None) - -def pn_ssl_resume_status(ssl): - raise Skipped() - -def pn_ssl_get_cipher_name(ssl, size): - name = ssl.impl.getCipherName() - return (bool(name), name) - -def pn_ssl_get_protocol_name(ssl, size): - name = ssl.impl.getProtocolName() - return (bool(name), name) - http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/java/shim/ctypes.py ---------------------------------------------------------------------- diff --git a/tests/java/shim/ctypes.py b/tests/java/shim/ctypes.py deleted file mode 100644 index bd88b17..0000000 --- a/tests/java/shim/ctypes.py +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# from proton/types.h -PN_MILLIS_MAX = 4294967295 http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/java/shim/curl.py ---------------------------------------------------------------------- diff --git a/tests/java/shim/curl.py b/tests/java/shim/curl.py deleted file mode 100644 index d4d3d37..0000000 --- a/tests/java/shim/curl.py +++ /dev/null @@ -1,47 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License -# - -from org.apache.qpid.proton.messenger.impl import Address - -def pn_url(): - return Address() - -def pn_url_parse(urlstr): - return Address(urlstr) - -def pn_url_free(url): pass - -def pn_url_clear(url): - url.clear(); - -def pn_url_str(url): return url.toString() - -def pn_url_get_scheme(url): return url.getScheme() -def pn_url_get_username(url): return url.getUser() -def pn_url_get_password(url): return url.getPass() -def pn_url_get_host(url): return url.getHost() or None -def pn_url_get_port(url): return url.getPort() -def pn_url_get_path(url): return url.getName() - -def pn_url_set_scheme(url, value): url.setScheme(value) -def pn_url_set_username(url, value): url.setUser(value) -def pn_url_set_password(url, value): url.setPass(value) -def pn_url_set_host(url, value): url.setHost(value) -def pn_url_set_port(url, value): url.setPort(value) -def pn_url_set_path(url, value): url.setName(value) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/pom.xml ---------------------------------------------------------------------- diff --git a/tests/pom.xml b/tests/pom.xml deleted file mode 100644 index c01089f..0000000 --- a/tests/pom.xml +++ /dev/null @@ -1,111 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <artifactId>proton-tests</artifactId> - <name>proton-tests</name> - - <parent> - <groupId>org.apache.qpid</groupId> - <artifactId>proton-project</artifactId> - <version>0.17.0-SNAPSHOT</version> - </parent> - - <description>The Proton python system tests execute against the Java or C implementation, using Maven (via this pom) and CMake/CTest respectively. - -To run the tests against proton-j, execute: - -mvn test - -Example of advanced usage (all of the -D flags are optional): - -mvn test \ --Dproton.pythontest.pattern='proton_tests.transport.ClientTransportTest.*' \ --Dproton.pythontest.invocations=20 \ --Dproton.pythontest.always_colorize=true - </description> - - <scm> - <url>http://svn.apache.org/viewvc/qpid/proton/</url> - </scm> - - <properties> - <testReportOutputDirectory>${basedir}/target/surefire-reports</testReportOutputDirectory> - </properties> - - <build> - <!-- System tests are arranged by language, hence the non-default location of the JUnit tests. --> - <testSourceDirectory>java</testSourceDirectory> - <resources> - <resource><directory>resources</directory></resource> - </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <systemPropertyVariables> - <protonJythonIgnoreFile>${basedir}/java/pythonTests.ignore</protonJythonIgnoreFile> - <protonJythonTestRoot>${basedir}/python</protonJythonTestRoot> - <protonJythonBinding>${basedir}/../proton-c/bindings/python</protonJythonBinding> - <protonJythonShim>${basedir}/java/shim</protonJythonShim> - <protonJythonTestScript>${basedir}/python/proton-test</protonJythonTestScript> - <protonJythonTestXmlOutputDirectory>${testReportOutputDirectory}</protonJythonTestXmlOutputDirectory> - <java.util.logging.config.file>${project.build.outputDirectory}/logging.properties</java.util.logging.config.file> - </systemPropertyVariables> - <reportsDirectory>${testReportOutputDirectory}</reportsDirectory> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>2.6</version> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>org.apache.qpid</groupId> - <artifactId>proton-j</artifactId> - <version>${project.parent.version}</version> - </dependency> - <dependency> - <groupId>org.bouncycastle</groupId> - <artifactId>bcpkix-jdk15on</artifactId> - <version>1.53</version> - </dependency> - <dependency> - <groupId>org.python</groupId> - <artifactId>jython-standalone</artifactId> - <version>2.7.0</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/python/proton_tests/__init__.py ---------------------------------------------------------------------- diff --git a/tests/python/proton_tests/__init__.py b/tests/python/proton_tests/__init__.py index 091fa49..66ce650 100644 --- a/tests/python/proton_tests/__init__.py +++ b/tests/python/proton_tests/__init__.py @@ -22,7 +22,6 @@ import proton_tests.engine import proton_tests.message import proton_tests.handler import proton_tests.reactor -import proton_tests.reactor_interop import proton_tests.messenger import proton_tests.sasl import proton_tests.transport http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/python/proton_tests/reactor.py ---------------------------------------------------------------------- diff --git a/tests/python/proton_tests/reactor.py b/tests/python/proton_tests/reactor.py index a25dc2f..424570d 100644 --- a/tests/python/proton_tests/reactor.py +++ b/tests/python/proton_tests/reactor.py @@ -267,144 +267,6 @@ class ExceptionTest(Test): assert False, "expected barf to be cancelled" -class HandlerDerivationTest(Test): - def setUp(self): - import platform - if platform.python_implementation() != "Jython": - # Exception propagation does not work currently for CPython - raise SkipTest() - self.reactor = Reactor() - - def wrong_exception(self): - import sys - ex = sys.exc_info() - assert False, " Unexpected exception " + str(ex[1]) - - def test_reactor_final_derived(self): - h = BarfOnFinalDerived() - self.reactor.global_handler = h - try: - self.reactor.run() - assert False, "expected to barf" - except Barf: - pass - except: - self.wrong_exception() - - def test_reactor_final_py_child_py(self): - class APoorExcuseForAHandler: - def __init__(self): - self.handlers = [BarfOnFinal()] - self.reactor.global_handler = APoorExcuseForAHandler() - try: - self.reactor.run() - assert False, "expected to barf" - except Barf: - pass - except: - self.wrong_exception() - - def test_reactor_final_py_child_derived(self): - class APoorExcuseForAHandler: - def __init__(self): - self.handlers = [BarfOnFinalDerived()] - self.reactor.global_handler = APoorExcuseForAHandler() - try: - self.reactor.run() - assert False, "expected to barf" - except Barf: - pass - except: - self.wrong_exception() - - def test_reactor_final_derived_child_derived(self): - class APoorExcuseForAHandler(CHandshaker): - def __init__(self): - CHandshaker.__init__(self) - self.handlers = [BarfOnFinalDerived()] - self.reactor.global_handler = APoorExcuseForAHandler() - try: - self.reactor.run() - assert False, "expected to barf" - except Barf: - pass - except: - self.wrong_exception() - - def test_reactor_final_derived_child_py(self): - class APoorExcuseForAHandler(CHandshaker): - def __init__(self): - CHandshaker.__init__(self) - self.handlers = [BarfOnFinal()] - self.reactor.global_handler = APoorExcuseForAHandler() - try: - self.reactor.run() - assert False, "expected to barf" - except Barf: - pass - except: - self.wrong_exception() - - def test_reactor_init_derived(self): - h = BarfOnFinalDerived() - self.reactor.global_handler = h - try: - self.reactor.run() - assert False, "expected to barf" - except: - assert h.init, "excpected the init" - - def test_reactor_init_py_child_py(self): - h = BarfOnFinal() - class APoorExcuseForAHandler: - def __init__(self): - self.handlers = [h] - self.reactor.global_handler = APoorExcuseForAHandler() - try: - self.reactor.run() - assert False, "expected to barf" - except: - assert h.init, "excpected the init" - - def test_reactor_init_py_child_derived(self): - h = BarfOnFinalDerived() - class APoorExcuseForAHandler: - def __init__(self): - self.handlers = [h] - self.reactor.global_handler = APoorExcuseForAHandler() - try: - self.reactor.run() - assert False, "expected to barf" - except: - assert h.init, "excpected the init" - - def test_reactor_init_derived_child_derived(self): - h = BarfOnFinalDerived() - class APoorExcuseForAHandler(CHandshaker): - def __init__(self): - CHandshaker.__init__(self) - self.handlers = [h] - self.reactor.global_handler = APoorExcuseForAHandler() - try: - self.reactor.run() - assert False, "expected to barf" - except: - assert h.init, "excpected the init" - - def test_reactor_init_derived_child_py(self): - h = BarfOnFinal() - class APoorExcuseForAHandler(CHandshaker): - def __init__(self): - CHandshaker.__init__(self) - self.handlers = [h] - self.reactor.global_handler = APoorExcuseForAHandler() - try: - self.reactor.run() - assert False, "expected to barf" - except: - assert h.init, "excpected the init" - - class ApplicationEventTest(Test): """Test application defined events and handlers.""" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/python/proton_tests/reactor_interop.py ---------------------------------------------------------------------- diff --git a/tests/python/proton_tests/reactor_interop.py b/tests/python/proton_tests/reactor_interop.py deleted file mode 100644 index 801a417..0000000 --- a/tests/python/proton_tests/reactor_interop.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/python -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -from __future__ import absolute_import - -from .common import Test, free_tcp_port, Skipped -from proton import Message -from proton.handlers import CHandshaker, CFlowController -from proton.reactor import Reactor - -import os -import subprocess -from threading import Thread -import time - -class JavaThread(Thread): - def __init__(self, operation, port, count): - Thread.__init__(self) - self.operation = operation - self.port = str(port) - self.count = str(count) - self.result = 1 - - def run(self): - self.result = subprocess.call(['java', - 'org.apache.qpid.proton.ProtonJInterop', - self.operation, self.port, self.count]) - -class ReceiveHandler: - def __init__(self, count): - self.count = count - self.handlers = [CHandshaker(), CFlowController()] - self.messages = [] - - def on_reactor_init(self, event): - port = free_tcp_port() - self.acceptor = event.reactor.acceptor("127.0.0.1", port) - self.java_thread = JavaThread("send", port, self.count) - self.java_thread.start() - - def on_delivery(self, event): - rcv = event.receiver - msg = Message() - if rcv and msg.recv(rcv): - event.delivery.settle() - self.messages += [msg.body] - self.count -= 1 - if (self.count == 0): - self.acceptor.close() - -class SendHandler: - def __init__(self, host, num_msgs): - self.host = host - self.num_msgs = num_msgs - self.count = 0 - self.handlers = [CHandshaker()] - - def on_connection_init(self, event): - conn = event.connection - conn.hostname = self.host - ssn = conn.session() - snd = ssn.sender("sender") - conn.open() - ssn.open() - snd.open() - - def on_link_flow(self, event): - snd = event.sender - if snd.credit > 0 and self.count < self.num_msgs: - self.count += 1 - msg = Message("message-" + str(self.count)) - dlv = snd.send(msg) - dlv.settle() - if (self.count == self.num_msgs): - snd.close() - snd.session.close() - snd.connection.close() - - def on_reactor_init(self, event): - event.reactor.connection(self) - -class ReactorInteropTest(Test): - - def setUp(self): - classpath = "" - if ('CLASSPATH' in os.environ): - classpath = os.environ['CLASSPATH'] - entries = classpath.split(os.pathsep) - self.proton_j_available = False - for entry in entries: - self.proton_j_available |= entry != "" and os.path.exists(entry) - - def protonc_to_protonj(self, count): - if (not self.proton_j_available): - raise Skipped("ProtonJ not found") - - port = free_tcp_port() - java_thread = JavaThread("recv", port, count) - java_thread.start() - # Give the Java thread time to spin up a JVM and start listening - # XXX: would be better to parse the stdout output for a message - time.sleep(1) - - sh = SendHandler('127.0.0.1:' + str(port), count) - r = Reactor(sh) - r.run() - - java_thread.join() - assert(java_thread.result == 0) - - def protonj_to_protonc(self, count): - if (not self.proton_j_available): - raise Skipped("ProtonJ not found") - - rh = ReceiveHandler(count) - r = Reactor(rh) - r.run() - - rh.java_thread.join() - assert(rh.java_thread.result == 0) - - for i in range(1, count): - assert(rh.messages[i-1] == ("message-" + str(i))) - - def test_protonc_to_protonj_1(self): - self.protonc_to_protonj(1) - - def test_protonc_to_protonj_5(self): - self.protonc_to_protonj(5) - - def test_protonc_to_protonj_500(self): - self.protonc_to_protonj(500) - - def test_protonc_to_protonj_5000(self): - self.protonc_to_protonj(5000) - - def test_protonj_to_protonc_1(self): - self.protonj_to_protonc(1) - - def test_protonj_to_protonc_5(self): - self.protonj_to_protonc(5) - - def test_protonj_to_protonc_500(self): - self.protonj_to_protonc(500) - - def test_protonj_to_protonc_5000(self): - self.protonj_to_protonc(5000) - http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tests/resources/logging.properties ---------------------------------------------------------------------- diff --git a/tests/resources/logging.properties b/tests/resources/logging.properties deleted file mode 100644 index 311654f..0000000 --- a/tests/resources/logging.properties +++ /dev/null @@ -1,29 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -handlers = java.util.logging.ConsoleHandler - -java.util.logging.ConsoleHandler.level = ALL -java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter - -# Note: the following line forces log statements to appear on a single line -# when running on JDK 1.7 and later -java.util.logging.SimpleFormatter.format = %1$tF %1$tT.%tL %4$s %5$s%n - -.level = INFO http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tools/cmake/Modules/FindJava.cmake ---------------------------------------------------------------------- diff --git a/tools/cmake/Modules/FindJava.cmake b/tools/cmake/Modules/FindJava.cmake deleted file mode 100644 index 1664fe1..0000000 --- a/tools/cmake/Modules/FindJava.cmake +++ /dev/null @@ -1,214 +0,0 @@ -# - Find Java -# This module finds if Java is installed and determines where the -# include files and libraries are. This code sets the following -# variables: -# -# Java_JAVA_EXECUTABLE = the full path to the Java runtime -# Java_JAVAC_EXECUTABLE = the full path to the Java compiler -# Java_JAVAH_EXECUTABLE = the full path to the Java header generator -# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator -# Java_JAR_EXECUTABLE = the full path to the Java archiver -# Java_VERSION_STRING = Version of the package found (java version), eg. 1.6.0_12 -# Java_VERSION_MAJOR = The major version of the package found. -# Java_VERSION_MINOR = The minor version of the package found. -# Java_VERSION_PATCH = The patch version of the package found. -# Java_VERSION_TWEAK = The tweak version of the package found (after '_') -# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) -# -# The minimum required version of Java can be specified using the -# standard CMake syntax, e.g. find_package(Java 1.5) -# -# NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to be -# identical. For example some java version may return: -# Java_VERSION_STRING = 1.5.0_17 -# and -# Java_VERSION = 1.5.0.17 -# -# another example is the Java OEM, with: -# Java_VERSION_STRING = 1.6.0-oem -# and -# Java_VERSION = 1.6.0 -# -# For these components the following variables are set: -# -# Java_FOUND - TRUE if all components are found. -# Java_INCLUDE_DIRS - Full paths to all include dirs. -# Java_LIBRARIES - Full paths to all libraries. -# Java_<component>_FOUND - TRUE if <component> is found. -# -# Example Usages: -# find_package(Java) -# find_package(Java COMPONENTS Runtime) -# find_package(Java COMPONENTS Development) -# - -#============================================================================= -# Copyright 2002-2009 Kitware, Inc. -# Copyright 2009-2011 Mathieu Malaterre <mathieu.malate...@gmail.com> -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# The HINTS option should only be used for values computed from the system. -set(_JAVA_HINTS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin" - $ENV{JAVA_HOME}/bin - ) -# Hard-coded guesses should still go in PATHS. This ensures that the user -# environment can always override hard guesses. -set(_JAVA_PATHS - /usr/lib/java/bin - /usr/share/java/bin - /usr/local/java/bin - /usr/local/java/share/bin - /usr/java/j2sdk1.4.2_04 - /usr/lib/j2sdk1.4-sun/bin - /usr/java/j2sdk1.4.2_09/bin - /usr/lib/j2sdk1.5-sun/bin - /opt/sun-jdk-1.5.0.04/bin - ) -find_program(Java_JAVA_EXECUTABLE - NAMES java - HINTS ${_JAVA_HINTS} - PATHS ${_JAVA_PATHS} -) - -if(Java_JAVA_EXECUTABLE) - execute_process(COMMAND ${Java_JAVA_EXECUTABLE} -version - RESULT_VARIABLE res - OUTPUT_VARIABLE var - ERROR_VARIABLE var # sun-java output to stderr - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE) - if( res ) - if(${Java_FIND_REQUIRED}) - message( FATAL_ERROR "Error executing java -version" ) - else() - message( STATUS "Warning, could not run java --version") - endif() - else() - # extract major/minor version and patch level from "java -version" output - # Tested on linux using - # 1. Sun / Sun OEM - # 2. OpenJDK 1.6 - # 3. GCJ 1.5 - # 4. Kaffe 1.4.2 - if(var MATCHES "(java|openjdk) version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*") - # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer - string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*" - "\\1" Java_VERSION_STRING "${var}" ) - elseif(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*") - # Kaffe style - string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*" - "\\1" Java_VERSION_STRING "${var}" ) - else() - if(NOT Java_FIND_QUIETLY) - message(WARNING "regex not supported: ${var}. Please report") - endif() - endif() - string( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" ) - string( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" ) - string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" ) - # warning tweak version can be empty: - string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+[_\\.]?([0-9]*).*$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" ) - if( Java_VERSION_TWEAK STREQUAL "" ) # check case where tweak is not defined - set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}) - else() - set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}.${Java_VERSION_TWEAK}) - endif() - endif() - -endif() - - -find_program(Java_JAR_EXECUTABLE - NAMES jar - HINTS ${_JAVA_HINTS} - PATHS ${_JAVA_PATHS} -) - -find_program(Java_JAVAC_EXECUTABLE - NAMES javac - HINTS ${_JAVA_HINTS} - PATHS ${_JAVA_PATHS} -) - -find_program(Java_JAVAH_EXECUTABLE - NAMES javah - HINTS ${_JAVA_HINTS} - PATHS ${_JAVA_PATHS} -) - -find_program(Java_JAVADOC_EXECUTABLE - NAMES javadoc - HINTS ${_JAVA_HINTS} - PATHS ${_JAVA_PATHS} -) - -#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -include(FindPackageHandleStandardArgs) -if(Java_FIND_COMPONENTS) - - # Apache Qpid Proton doesn't support this because of find_package_handle_standard_args - # differences (see comment below) - message(FATAL_ERROR "Apache Qpid Proton FindJava does not support Java_FIND_COMPONENTS") - - foreach(component ${Java_FIND_COMPONENTS}) - # User just want to execute some Java byte-compiled - if(component STREQUAL "Runtime") - find_package_handle_standard_args(Java - REQUIRED_VARS Java_JAVA_EXECUTABLE - VERSION_VAR Java_VERSION - ) - elseif(component STREQUAL "Development") - find_package_handle_standard_args(Java - REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE - Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE - VERSION_VAR Java_VERSION - ) - else() - message(FATAL_ERROR "Comp: ${component} is not handled") - endif() - set(Java_${component}_FOUND TRUE) - endforeach() -else() - # Check for everything - - # Apache Qpid Proton local change: the line below has been tweaked because - # the signature of find_package_handle_standard_args in cmake 2.6 lacks the - # REQUIRED_VARS and VERSION_VAR parameters, and specifies the error message differently. - - find_package_handle_standard_args(Java DEFAULT_MSG - Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE - Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE - ) -endif() - - -mark_as_advanced( - Java_JAVA_EXECUTABLE - Java_JAR_EXECUTABLE - Java_JAVAC_EXECUTABLE - Java_JAVAH_EXECUTABLE - Java_JAVADOC_EXECUTABLE - ) - -# LEGACY -set(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE}) -set(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE}) -set(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE}) - http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tools/cmake/Modules/ProtonUseJava.cmake ---------------------------------------------------------------------- diff --git a/tools/cmake/Modules/ProtonUseJava.cmake b/tools/cmake/Modules/ProtonUseJava.cmake deleted file mode 100644 index 4b011ef..0000000 --- a/tools/cmake/Modules/ProtonUseJava.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Adds a custom command to rebuild the JAR to include resources and the -# directory entries that are missed by add_jar() - -function (rebuild_jar upstream_target jar_name) - add_custom_command(TARGET ${upstream_target} POST_BUILD - COMMAND ${Java_JAR_EXECUTABLE} cf ${jar_name} - -C ${CMAKE_CURRENT_SOURCE_DIR}/src/main/resources . - -C ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${upstream_target}.dir/ org - COMMENT "Rebuilding ${jar_name} to include missing resources") -endfunction () - http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tools/cmake/Modules/ProtonUseJavaSourceFileList.cmake ---------------------------------------------------------------------- diff --git a/tools/cmake/Modules/ProtonUseJavaSourceFileList.cmake b/tools/cmake/Modules/ProtonUseJavaSourceFileList.cmake deleted file mode 100644 index f1c106d..0000000 --- a/tools/cmake/Modules/ProtonUseJavaSourceFileList.cmake +++ /dev/null @@ -1,68 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# -# Produces a text file containing a list of java source files from one -# or more java source directories. Produces output suitable for use -# with javac's @ source file argument. -# -# JAVA_SOURCE_DIR_PATHS - colon (:) separated string of java source directories -# JAVA_SOURCE_FILE_LIST - name of text file to write -# - -if (JAVA_SOURCE_DIR_PATHS) - string(REPLACE ":" ";" JAVA_SOURCE_DIR_PATHS_LIST ${JAVA_SOURCE_DIR_PATHS}) - message(STATUS "Java source paths: ${JAVA_SOURCE_DIR_PATHS}") - - set(_JAVA_GLOBBED_FILES) - foreach(JAVA_SOURCE_DIR_PATH ${JAVA_SOURCE_DIR_PATHS_LIST}) - if (EXISTS "${JAVA_SOURCE_DIR_PATH}") - file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${JAVA_SOURCE_DIR_PATH}/*.java") - if (_JAVA_GLOBBED_TMP_FILES) - list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES}) - endif () - else () - message(SEND_ERROR "FATAL: Java source path ${JAVA_SOURCE_DIR_PATH} doesn't exist") - endif () - endforeach() - - set (_CHECK_STALE OFF) - set(_GENERATE_FILE_LIST ON) - if (EXISTS ${JAVA_SOURCE_FILE_LIST}) - set (_CHECK_STALE ON) - set(_GENERATE_FILE_LIST OFF) - endif () - - set(_JAVA_SOURCE_FILES_SEPARATED) - foreach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES}) - if (_CHECK_STALE) - if (${_JAVA_GLOBBED_FILE} IS_NEWER_THAN ${JAVA_SOURCE_FILE_LIST}) - set(_GENERATE_FILE_LIST ON) - endif() - endif() - set(_JAVA_SOURCE_FILES_SEPARATED ${_JAVA_SOURCE_FILES_SEPARATED}${_JAVA_GLOBBED_FILE}\n) - endforeach() - - if (_GENERATE_FILE_LIST) - message(STATUS "Writing Java source file list to ${JAVA_SOURCE_FILE_LIST}") - file(WRITE ${JAVA_SOURCE_FILE_LIST} ${_JAVA_SOURCE_FILES_SEPARATED}) - endif() -else () - message(SEND_ERROR "FATAL: Can't find JAVA_SOURCE_DIR_PATHS") -endif () http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tools/cmake/Modules/README ---------------------------------------------------------------------- diff --git a/tools/cmake/Modules/README b/tools/cmake/Modules/README deleted file mode 100644 index 1c679c0..0000000 --- a/tools/cmake/Modules/README +++ /dev/null @@ -1,14 +0,0 @@ -CMake Modules -============= - -Contents: - -UseJava, UseJavaSymLinks, UseJavaClassFilelist: - -These are Andreas Schneider's CMake Java Support. We have our own local copy as all versions of -CMake < 2.8.9 have defects in their Java support that affect us. Local modifications are commented -with "Apache Qpid Proton...". - -UseProtonJava: - -Custom support functions for the Proton Java modules http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tools/cmake/Modules/UseJava.cmake ---------------------------------------------------------------------- diff --git a/tools/cmake/Modules/UseJava.cmake b/tools/cmake/Modules/UseJava.cmake deleted file mode 100644 index 444343e..0000000 --- a/tools/cmake/Modules/UseJava.cmake +++ /dev/null @@ -1,1015 +0,0 @@ -# - Use Module for Java -# This file provides functions for Java. It is assumed that FindJava.cmake -# has already been loaded. See FindJava.cmake for information on how to -# load Java into your CMake project. -# -# add_jar(TARGET_NAME SRC1 SRC2 .. SRCN RCS1 RCS2 .. RCSN) -# -# This command creates a <TARGET_NAME>.jar. It compiles the given source -# files (SRC) and adds the given resource files (RCS) to the jar file. -# If only resource files are given then just a jar file is created. -# -# Additional instructions: -# To add compile flags to the target you can set these flags with -# the following variable: -# -# set(CMAKE_JAVA_COMPILE_FLAGS -nowarn) -# -# To add a path or a jar file to the class path you can do this -# with the CMAKE_JAVA_INCLUDE_PATH variable. -# -# set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar) -# -# To use a different output name for the target you can set it with: -# -# set(CMAKE_JAVA_TARGET_OUTPUT_NAME shibboleet.jar) -# add_jar(foobar foobar.java) -# -# To use a different output directory than CMAKE_CURRENT_BINARY_DIR -# you can set it with: -# -# set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) -# -# To define an entry point in your jar you can set it with: -# -# set(CMAKE_JAVA_JAR_ENTRY_POINT com/examples/MyProject/Main) -# -# To add a VERSION to the target output name you can set it using -# CMAKE_JAVA_TARGET_VERSION. This will create a jar file with the name -# shibboleet-1.0.0.jar and will create a symlink shibboleet.jar -# pointing to the jar with the version information. -# -# set(CMAKE_JAVA_TARGET_VERSION 1.2.0) -# add_jar(shibboleet shibbotleet.java) -# -# If the target is a JNI library, utilize the following commands to -# create a JNI symbolic link: -# -# set(CMAKE_JNI_TARGET TRUE) -# set(CMAKE_JAVA_TARGET_VERSION 1.2.0) -# add_jar(shibboleet shibbotleet.java) -# install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) -# install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) -# -# If a single target needs to produce more than one jar from its -# java source code, to prevent the accumulation of duplicate class -# files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior -# to calling the add_jar() function: -# -# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo) -# add_jar(foo foo.java) -# -# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar) -# add_jar(bar bar.java) -# -# Target Properties: -# The add_jar() functions sets some target properties. You can get these -# properties with the -# get_property(TARGET <target_name> PROPERTY <propery_name>) -# command. -# -# INSTALL_FILES The files which should be installed. This is used by -# install_jar(). -# JNI_SYMLINK The JNI symlink which should be installed. -# This is used by install_jni_symlink(). -# JAR_FILE The location of the jar file so that you can include -# it. -# CLASS_DIR The directory where the class files can be found. For -# example to use them with javah. -# -# find_jar(<VAR> -# name | NAMES name1 [name2 ...] -# [PATHS path1 [path2 ... ENV var]] -# [VERSIONS version1 [version2]] -# [DOC "cache documentation string"] -# ) -# -# This command is used to find a full path to the named jar. A cache -# entry named by <VAR> is created to stor the result of this command. If -# the full path to a jar is found the result is stored in the variable -# and the search will not repeated unless the variable is cleared. If -# nothing is found, the result will be <VAR>-NOTFOUND, and the search -# will be attempted again next time find_jar is invoked with the same -# variable. -# The name of the full path to a file that is searched for is specified -# by the names listed after NAMES argument. Additional search locations -# can be specified after the PATHS argument. If you require special a -# version of a jar file you can specify it with the VERSIONS argument. -# The argument after DOC will be used for the documentation string in -# the cache. -# -# install_jar(TARGET_NAME DESTINATION) -# -# This command installs the TARGET_NAME files to the given DESTINATION. -# It should be called in the same scope as add_jar() or it will fail. -# -# install_jni_symlink(TARGET_NAME DESTINATION) -# -# This command installs the TARGET_NAME JNI symlinks to the given -# DESTINATION. It should be called in the same scope as add_jar() -# or it will fail. -# -# create_javadoc(<VAR> -# PACKAGES pkg1 [pkg2 ...] -# [SOURCEPATH <sourcepath>] -# [CLASSPATH <classpath>] -# [INSTALLPATH <install path>] -# [DOCTITLE "the documentation title"] -# [WINDOWTITLE "the title of the document"] -# [AUTHOR TRUE|FALSE] -# [USE TRUE|FALSE] -# [VERSION TRUE|FALSE] -# ) -# -# Create java documentation based on files or packages. For more -# details please read the javadoc manpage. -# -# There are two main signatures for create_javadoc. The first -# signature works with package names on a path with source files: -# -# Example: -# create_javadoc(my_example_doc -# PACKAGES com.exmaple.foo com.example.bar -# SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" -# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} -# WINDOWTITLE "My example" -# DOCTITLE "<h1>My example</h1>" -# AUTHOR TRUE -# USE TRUE -# VERSION TRUE -# ) -# -# The second signature for create_javadoc works on a given list of -# files. -# -# create_javadoc(<VAR> -# FILES file1 [file2 ...] -# [CLASSPATH <classpath>] -# [INSTALLPATH <install path>] -# [DOCTITLE "the documentation title"] -# [WINDOWTITLE "the title of the document"] -# [AUTHOR TRUE|FALSE] -# [USE TRUE|FALSE] -# [VERSION TRUE|FALSE] -# ) -# -# Example: -# create_javadoc(my_example_doc -# FILES ${example_SRCS} -# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} -# WINDOWTITLE "My example" -# DOCTITLE "<h1>My example</h1>" -# AUTHOR TRUE -# USE TRUE -# VERSION TRUE -# ) -# -# Both signatures share most of the options. These options are the -# same as what you can find in the javadoc manpage. Please look at -# the manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and -# VERSION. -# -# The documentation will be by default installed to -# -# ${CMAKE_INSTALL_PREFIX}/share/javadoc/<VAR> -# -# if you don't set the INSTALLPATH. -# - -#============================================================================= -# Copyright 2010-2011 Andreas schneider <a...@redhat.com> -# Copyright 2010 Ben Boeckel <ben.boec...@kitware.com> -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -function (__java_copy_file src dest comment) - add_custom_command( - OUTPUT ${dest} - COMMAND cmake -E copy_if_different - ARGS ${src} - ${dest} - DEPENDS ${src} - COMMENT ${comment}) -endfunction () - -# define helper scripts -#set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake) -#set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) -set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_MODULE_PATH}/UseJavaClassFilelist.cmake) -set(_JAVA_SYMLINK_SCRIPT ${CMAKE_MODULE_PATH}/UseJavaSymlinks.cmake) - -# Apache Qpid Proton: changed to write a source file list to avoid hitting -# command line limits when processing many source files. -function(add_jar _TARGET_NAME) - set(_JAVA_SOURCE_FILES ${ARGN}) - - if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) - set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - if (CMAKE_JAVA_JAR_ENTRY_POINT) - set(_ENTRY_POINT_OPTION e) - set(_ENTRY_POINT_VALUE ${CMAKE_JAVA_JAR_ENTRY_POINT}) - endif () - - if (LIBRARY_OUTPUT_PATH) - set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) - else () - set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR}) - endif () - - set(CMAKE_JAVA_INCLUDE_PATH - ${CMAKE_JAVA_INCLUDE_PATH} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_JAVA_OBJECT_OUTPUT_PATH} - ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH} - ) - - if (WIN32 AND NOT CYGWIN) - set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") - else () - set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") - endif() - - foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) - set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") - endforeach() - - set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_JAVA_TARGET_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") - - set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar") - if (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION) - set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar") - set(_JAVA_TARGET_OUTPUT_LINK "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") - elseif (CMAKE_JAVA_TARGET_VERSION) - set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar") - set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar") - elseif (CMAKE_JAVA_TARGET_OUTPUT_NAME) - set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") - endif () - # reset - set(CMAKE_JAVA_TARGET_OUTPUT_NAME) - - set(_JAVA_CLASS_FILES) - set(_JAVA_COMPILE_FILES) - set(_JAVA_DEPENDS) - set(_JAVA_RESOURCE_FILES) - foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) - get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) - get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) - get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) - get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) - - file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR} ${_JAVA_FULL}) - file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) - string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) - string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) - if (${_BIN_LEN} LESS ${_SRC_LEN}) - set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH}) - else () - set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH}) - endif () - get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH) - - if (_JAVA_EXT MATCHES ".java") - list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE}) - set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class") - set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE}) - - elseif (_JAVA_EXT MATCHES ".jar" - OR _JAVA_EXT MATCHES ".war" - OR _JAVA_EXT MATCHES ".ear" - OR _JAVA_EXT MATCHES ".sar") - list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_SOURCE_FILE}) - - elseif (_JAVA_EXT STREQUAL "") - list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH}) - list(APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}}) - - else () - __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} - ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} - "Copying ${_JAVA_SOURCE_FILE} to the build directory") - list(APPEND _JAVA_RESOURCE_FILES ${_JAVA_SOURCE_FILE}) - endif () - endforeach() - - set(CMAKE_JAVA_SOURCE_FILE_LIST ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_source_filelist) - string(REPLACE ";" "\n" _JAVA_COMPILE_FILES_NEWLINE_SEPARATED "${_JAVA_COMPILE_FILES}") - file(WRITE ${CMAKE_JAVA_SOURCE_FILE_LIST} "${_JAVA_COMPILE_FILES_NEWLINE_SEPARATED}") - - # create an empty java_class_filelist - if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) - file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") - endif() - - if (_JAVA_COMPILE_FILES) - # Compile the java files and create a list of class files - add_custom_command( - # NOTE: this command generates an artificial dependency file - OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} - COMMAND ${Java_JAVAC_EXECUTABLE} - ${CMAKE_JAVA_COMPILE_FLAGS} - -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}" - -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - @${CMAKE_JAVA_SOURCE_FILE_LIST} - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} - DEPENDS ${_JAVA_COMPILE_FILES} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Building Java objects for ${_TARGET_NAME}.jar" - ) - add_custom_command( - OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist - COMMAND ${CMAKE_COMMAND} - -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH} - -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}" - -P ${_JAVA_CLASS_FILELIST_SCRIPT} - DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - ) - endif () - - # create the jar file - set(_JAVA_JAR_OUTPUT_PATH - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) - if (CMAKE_JNI_TARGET) - add_custom_command( - OUTPUT ${_JAVA_JAR_OUTPUT_PATH} - COMMAND ${Java_JAR_EXECUTABLE} - -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} - ${_JAVA_RESOURCE_FILES} @java_class_filelist - COMMAND ${CMAKE_COMMAND} - -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} - -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} - -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} - -P ${_JAVA_SYMLINK_SCRIPT} - COMMAND ${CMAKE_COMMAND} - -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} - -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH} - -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} - -P ${_JAVA_SYMLINK_SCRIPT} - DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist - WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" - ) - else () - add_custom_command( - OUTPUT ${_JAVA_JAR_OUTPUT_PATH} - COMMAND ${Java_JAR_EXECUTABLE} - -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} - ${_JAVA_RESOURCE_FILES} @java_class_filelist - COMMAND ${CMAKE_COMMAND} - -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} - -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} - -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} - -P ${_JAVA_SYMLINK_SCRIPT} - WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist - COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" - ) - endif () - - # Add the target and make sure we have the latest resource files. - add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH}) - - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - INSTALL_FILES - ${_JAVA_JAR_OUTPUT_PATH} - ) - - if (_JAVA_TARGET_OUTPUT_LINK) - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - INSTALL_FILES - ${_JAVA_JAR_OUTPUT_PATH} - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} - ) - - if (CMAKE_JNI_TARGET) - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - JNI_SYMLINK - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} - ) - endif () - endif () - - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - JAR_FILE - ${_JAVA_JAR_OUTPUT_PATH} - ) - - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - CLASSDIR - ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - ) - -endfunction() - -# Apache Qpid Proton: new function that accepts a file containing the Java source -# files. This is useful when the set of source files is only discovered at make-time, -# and avoids passing a wildcard argument to javac (which fails on some platforms) -function(add_jar_from_filelist _TARGET_NAME CMAKE_JAVA_SOURCE_FILE_LIST) - - if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) - set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_JAVA_TARGET_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") - - set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar") - if (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION) - set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar") - set(_JAVA_TARGET_OUTPUT_LINK "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") - elseif (CMAKE_JAVA_TARGET_VERSION) - set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar") - set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar") - elseif (CMAKE_JAVA_TARGET_OUTPUT_NAME) - set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") - endif () - # reset - set(CMAKE_JAVA_TARGET_OUTPUT_NAME) - - foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) - set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") - endforeach() - - # create an empty java_class_filelist - if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) - file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") - endif () - - # Compile the java files and create a list of class files - add_custom_command( - # NOTE: this command generates an artificial dependency file - OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} - COMMAND ${Java_JAVAC_EXECUTABLE} - ${CMAKE_JAVA_COMPILE_FLAGS} - -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}" - -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - @${CMAKE_JAVA_SOURCE_FILE_LIST} - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} - DEPENDS ${CMAKE_JAVA_SOURCE_FILE_LIST} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Building Java objects for ${_TARGET_NAME}.jar" - ) - add_custom_command( - OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist - COMMAND ${CMAKE_COMMAND} - -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH} - -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}" - -P ${_JAVA_CLASS_FILELIST_SCRIPT} - DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - ) - - # create the jar file - set(_JAVA_JAR_OUTPUT_PATH - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) - add_custom_command( - OUTPUT ${_JAVA_JAR_OUTPUT_PATH} - COMMAND ${Java_JAR_EXECUTABLE} - -cf ${_JAVA_JAR_OUTPUT_PATH} - ${_JAVA_RESOURCE_FILES} @java_class_filelist - COMMAND ${CMAKE_COMMAND} - -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} - -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} - -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} - -P ${_JAVA_SYMLINK_SCRIPT} - WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist - COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" - ) - # Add the target and make sure we have the latest resource files. - add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH}) - - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - INSTALL_FILES - ${_JAVA_JAR_OUTPUT_PATH} - ) - - if (_JAVA_TARGET_OUTPUT_LINK) - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - INSTALL_FILES - ${_JAVA_JAR_OUTPUT_PATH} - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} - ) - - if (CMAKE_JNI_TARGET) - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - JNI_SYMLINK - ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} - ) - endif () - endif () - - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - JAR_FILE - ${_JAVA_JAR_OUTPUT_PATH} - ) - - set_property( - TARGET - ${_TARGET_NAME} - PROPERTY - CLASSDIR - ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - ) - -endfunction() - -# Apache Qpid Proton: make the install files optional so as not to error if there is no symlink -function(INSTALL_JAR _TARGET_NAME _DESTINATION) - get_property(__FILES - TARGET - ${_TARGET_NAME} - PROPERTY - INSTALL_FILES - ) - - if (__FILES) - install( - FILES - ${__FILES} - DESTINATION - ${_DESTINATION} - OPTIONAL - ) - else () - message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") - endif () -endfunction() - -function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) - get_property(__SYMLINK - TARGET - ${_TARGET_NAME} - PROPERTY - JNI_SYMLINK - ) - - if (__SYMLINK) - install( - FILES - ${__SYMLINK} - DESTINATION - ${_DESTINATION} - ) - else () - message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") - endif () -endfunction() - -function (find_jar VARIABLE) - set(_jar_names) - set(_jar_files) - set(_jar_versions) - set(_jar_paths - /usr/share/java/ - /usr/local/share/java/ - ${Java_JAR_PATHS}) - set(_jar_doc "NOTSET") - - set(_state "name") - - foreach (arg ${ARGN}) - if (${_state} STREQUAL "name") - if (${arg} STREQUAL "VERSIONS") - set(_state "versions") - elseif (${arg} STREQUAL "NAMES") - set(_state "names") - elseif (${arg} STREQUAL "PATHS") - set(_state "paths") - elseif (${arg} STREQUAL "DOC") - set(_state "doc") - else () - set(_jar_names ${arg}) - if (_jar_doc STREQUAL "NOTSET") - set(_jar_doc "Finding ${arg} jar") - endif () - endif () - elseif (${_state} STREQUAL "versions") - if (${arg} STREQUAL "NAMES") - set(_state "names") - elseif (${arg} STREQUAL "PATHS") - set(_state "paths") - elseif (${arg} STREQUAL "DOC") - set(_state "doc") - else () - set(_jar_versions ${_jar_versions} ${arg}) - endif () - elseif (${_state} STREQUAL "names") - if (${arg} STREQUAL "VERSIONS") - set(_state "versions") - elseif (${arg} STREQUAL "PATHS") - set(_state "paths") - elseif (${arg} STREQUAL "DOC") - set(_state "doc") - else () - set(_jar_names ${_jar_names} ${arg}) - if (_jar_doc STREQUAL "NOTSET") - set(_jar_doc "Finding ${arg} jar") - endif () - endif () - elseif (${_state} STREQUAL "paths") - if (${arg} STREQUAL "VERSIONS") - set(_state "versions") - elseif (${arg} STREQUAL "NAMES") - set(_state "names") - elseif (${arg} STREQUAL "DOC") - set(_state "doc") - else () - set(_jar_paths ${_jar_paths} ${arg}) - endif () - elseif (${_state} STREQUAL "doc") - if (${arg} STREQUAL "VERSIONS") - set(_state "versions") - elseif (${arg} STREQUAL "NAMES") - set(_state "names") - elseif (${arg} STREQUAL "PATHS") - set(_state "paths") - else () - set(_jar_doc ${arg}) - endif () - endif () - endforeach () - - if (NOT _jar_names) - message(FATAL_ERROR "find_jar: No name to search for given") - endif () - - foreach (jar_name ${_jar_names}) - foreach (version ${_jar_versions}) - set(_jar_files ${_jar_files} ${jar_name}-${version}.jar) - endforeach () - set(_jar_files ${_jar_files} ${jar_name}.jar) - endforeach () - - find_file(${VARIABLE} - NAMES ${_jar_files} - PATHS ${_jar_paths} - DOC ${_jar_doc} - NO_DEFAULT_PATH) -endfunction () - -function(create_javadoc _target) - set(_javadoc_packages) - set(_javadoc_files) - set(_javadoc_sourcepath) - set(_javadoc_classpath) - set(_javadoc_installpath "${CMAKE_INSTALL_PREFIX}/share/javadoc") - set(_javadoc_doctitle) - set(_javadoc_windowtitle) - set(_javadoc_author FALSE) - set(_javadoc_version FALSE) - set(_javadoc_use FALSE) - - set(_state "package") - - foreach (arg ${ARGN}) - if (${_state} STREQUAL "package") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - set(_javadoc_packages ${arg}) - set(_state "packages") - endif () - elseif (${_state} STREQUAL "packages") - if (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - list(APPEND _javadoc_packages ${arg}) - endif () - elseif (${_state} STREQUAL "files") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - list(APPEND _javadoc_files ${arg}) - endif () - elseif (${_state} STREQUAL "sourcepath") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - list(APPEND _javadoc_sourcepath ${arg}) - endif () - elseif (${_state} STREQUAL "classpath") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - list(APPEND _javadoc_classpath ${arg}) - endif () - elseif (${_state} STREQUAL "installpath") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - set(_javadoc_installpath ${arg}) - endif () - elseif (${_state} STREQUAL "doctitle") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - set(_javadoc_doctitle ${arg}) - endif () - elseif (${_state} STREQUAL "windowtitle") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - set(_javadoc_windowtitle ${arg}) - endif () - elseif (${_state} STREQUAL "author") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - set(_javadoc_author ${arg}) - endif () - elseif (${_state} STREQUAL "use") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - set(_javadoc_use ${arg}) - endif () - elseif (${_state} STREQUAL "version") - if (${arg} STREQUAL "PACKAGES") - set(_state "packages") - elseif (${arg} STREQUAL "FILES") - set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") - set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") - set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") - set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") - set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") - set(_state "author") - elseif (${arg} STREQUAL "USE") - set(_state "use") - elseif (${arg} STREQUAL "VERSION") - set(_state "version") - else () - set(_javadoc_version ${arg}) - endif () - endif () - endforeach () - - set(_javadoc_builddir ${CMAKE_CURRENT_BINARY_DIR}/javadoc/${_target}) - set(_javadoc_options -d ${_javadoc_builddir}) - - if (_javadoc_sourcepath) - set(_start TRUE) - foreach(_path ${_javadoc_sourcepath}) - if (_start) - set(_sourcepath ${_path}) - set(_start FALSE) - else () - set(_sourcepath ${_sourcepath}:${_path}) - endif () - endforeach() - set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath}) - endif () - - if (_javadoc_classpath) - set(_start TRUE) - foreach(_path ${_javadoc_classpath}) - if (_start) - set(_classpath ${_path}) - set(_start FALSE) - else () - set(_classpath ${_classpath}:${_path}) - endif () - endforeach() - set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}") - endif () - - if (_javadoc_doctitle) - set(_javadoc_options ${_javadoc_options} -doctitle '${_javadoc_doctitle}') - endif () - - if (_javadoc_windowtitle) - set(_javadoc_options ${_javadoc_options} -windowtitle '${_javadoc_windowtitle}') - endif () - - if (_javadoc_author) - set(_javadoc_options ${_javadoc_options} -author) - endif () - - if (_javadoc_use) - set(_javadoc_options ${_javadoc_options} -use) - endif () - - if (_javadoc_version) - set(_javadoc_options ${_javadoc_options} -version) - endif () - - add_custom_target(${_target}_javadoc ALL - COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options} - ${_javadoc_files} - ${_javadoc_packages} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - ) - - install( - DIRECTORY ${_javadoc_builddir} - DESTINATION ${_javadoc_installpath} - ) -endfunction() http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tools/cmake/Modules/UseJavaClassFilelist.cmake ---------------------------------------------------------------------- diff --git a/tools/cmake/Modules/UseJavaClassFilelist.cmake b/tools/cmake/Modules/UseJavaClassFilelist.cmake deleted file mode 100644 index 6f3a4e7..0000000 --- a/tools/cmake/Modules/UseJavaClassFilelist.cmake +++ /dev/null @@ -1,52 +0,0 @@ -# -# This script create a list of compiled Java class files to be added to a -# jar file. This avoids including cmake files which get created in the -# binary directory. -# - -#============================================================================= -# Copyright 2010-2011 Andreas schneider <a...@redhat.com> -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -if (CMAKE_JAVA_CLASS_OUTPUT_PATH) - if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") - - set(_JAVA_GLOBBED_FILES) - if (CMAKE_JAR_CLASSES_PREFIX) - foreach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX}) - message(STATUS "JAR_CLASS_PREFIX: ${JAR_CLASS_PREFIX}") - - file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${JAR_CLASS_PREFIX}/*.class") - if (_JAVA_GLOBBED_TMP_FILES) - list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES}) - endif () - endforeach() - else() - file(GLOB_RECURSE _JAVA_GLOBBED_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/*.class") - endif () - - set(_JAVA_CLASS_FILES) - # file(GLOB_RECURSE foo RELATIVE) is broken so we need this. - foreach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES}) - file(RELATIVE_PATH _JAVA_CLASS_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH} ${_JAVA_GLOBBED_FILE}) - set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES}${_JAVA_CLASS_FILE}\n) - endforeach() - - # write to file - file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist ${_JAVA_CLASS_FILES}) - - else () - message(SEND_ERROR "FATAL: Java class output path doesn't exist") - endif () -else () - message(SEND_ERROR "FATAL: Can't find CMAKE_JAVA_CLASS_OUTPUT_PATH") -endif () http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ccdcf329/tools/cmake/Modules/UseJavaSymlinks.cmake ---------------------------------------------------------------------- diff --git a/tools/cmake/Modules/UseJavaSymlinks.cmake b/tools/cmake/Modules/UseJavaSymlinks.cmake deleted file mode 100644 index 88dd768..0000000 --- a/tools/cmake/Modules/UseJavaSymlinks.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# -# Helper script for UseJava.cmake -# - -#============================================================================= -# Copyright 2010-2011 Andreas schneider <a...@redhat.com> -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) - if (_JAVA_TARGET_OUTPUT_NAME) - find_program(LN_EXECUTABLE - NAMES - ln - ) - - execute_process( - COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}" - WORKING_DIRECTORY ${_JAVA_TARGET_DIR} - ) - else () - message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME") - endif () -endif () --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org