Repository: qpid-proton Updated Branches: refs/heads/javascript [created] a5cb27e73
merge from trunk to javascript branch Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/726a49bc Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/726a49bc Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/726a49bc Branch: refs/heads/javascript Commit: 726a49bccd2858ff641e8fa30d8ff327b7578220 Parents: e8faa57 1781b4e Author: Rafael Schloming <[email protected]> Authored: Thu Nov 27 13:22:12 2014 -0500 Committer: Rafael Schloming <[email protected]> Committed: Fri Nov 28 07:02:53 2014 -0500 ---------------------------------------------------------------------- CMakeLists.txt | 14 +- .../jms/AMQPNativeOutboundTransformer.java | 4 +- .../proton/jms/AutoOutboundTransformer.java | 6 + .../qpid/proton/jms/InboundTransformer.java | 84 +- .../jms/JMSMappingOutboundTransformer.java | 51 +- .../org/apache/qpid/proton/jms/JMSVendor.java | 16 +- .../qpid/proton/jms/OutboundTransformer.java | 14 +- .../jms/JMSMappingInboundTransformerTest.java | 287 ++ .../jms/JMSMappingOutboundTransformerTest.java | 351 ++ examples/README.txt | 3 + examples/engine/java/LICENSE | 201 + examples/engine/java/drain | 2 + examples/engine/java/pom.xml | 40 + examples/engine/java/server | 2 + examples/engine/java/spout | 2 + .../org/apache/qpid/proton/examples/Drain.java | 128 + .../org/apache/qpid/proton/examples/Driver.java | 262 ++ .../qpid/proton/examples/FlowController.java | 80 + .../apache/qpid/proton/examples/Handshaker.java | 88 + .../apache/qpid/proton/examples/Message.java | 83 + .../org/apache/qpid/proton/examples/Pool.java | 153 + .../org/apache/qpid/proton/examples/Router.java | 191 + .../org/apache/qpid/proton/examples/Server.java | 179 + .../org/apache/qpid/proton/examples/Spout.java | 116 + proton-c/CMakeLists.txt | 34 +- proton-c/bindings/CMakeLists.txt | 3 +- proton-c/bindings/javascript/CMakeLists.txt | 2 + .../bindings/perl/lib/qpid/proton/Message.pm | 2 +- proton-c/bindings/perl/lib/qpid/proton/utils.pm | 2 +- proton-c/bindings/perl/lib/qpid_proton.pm | 1 + proton-c/bindings/python/CMakeLists.txt | 83 +- proton-c/bindings/python/proton.py | 3771 ----------------- proton-c/bindings/python/proton/__init__.py | 3891 ++++++++++++++++++ proton-c/bindings/python/setup.py.in | 107 - proton-c/bindings/ruby/lib/qpid_proton.rb | 5 +- proton-c/bindings/ruby/lib/qpid_proton/array.rb | 10 +- proton-c/bindings/ruby/lib/qpid_proton/data.rb | 14 +- .../bindings/ruby/lib/qpid_proton/described.rb | 4 +- .../ruby/lib/qpid_proton/exception_handling.rb | 53 +- .../bindings/ruby/lib/qpid_proton/exceptions.rb | 8 +- .../bindings/ruby/lib/qpid_proton/filters.rb | 8 +- proton-c/bindings/ruby/lib/qpid_proton/hash.rb | 6 +- .../bindings/ruby/lib/qpid_proton/mapping.rb | 36 +- .../bindings/ruby/lib/qpid_proton/message.rb | 51 +- .../ruby/lib/qpid_proton/message_format.rb | 8 +- .../bindings/ruby/lib/qpid_proton/messenger.rb | 106 +- .../bindings/ruby/lib/qpid_proton/selectable.rb | 8 +- .../bindings/ruby/lib/qpid_proton/strings.rb | 69 + .../ruby/lib/qpid_proton/subscription.rb | 8 +- .../bindings/ruby/lib/qpid_proton/tracker.rb | 8 +- .../ruby/lib/qpid_proton/tracker_status.rb | 8 +- .../bindings/ruby/lib/qpid_proton/version.rb | 11 +- .../ruby/spec/qpid/proton/messenger_spec.rb | 16 + proton-c/include/proton/cid.h | 1 + proton-c/include/proton/connection.h | 10 + proton-c/include/proton/cproton.i | 3 +- proton-c/include/proton/delivery.h | 10 + proton-c/include/proton/driver.h | 13 +- proton-c/include/proton/event.h | 39 +- proton-c/include/proton/link.h | 11 + proton-c/include/proton/object.h | 9 + proton-c/include/proton/sasl.h | 20 +- proton-c/include/proton/session.h | 10 + proton-c/include/proton/ssl.h | 6 + proton-c/include/proton/transport.h | 47 +- proton-c/src/engine/engine-internal.h | 54 +- proton-c/src/engine/engine.c | 180 +- proton-c/src/events/event.c | 28 +- proton-c/src/messenger/messenger.c | 21 +- proton-c/src/object/record.c | 142 + proton-c/src/platform.h | 10 + proton-c/src/posix/driver.c | 16 +- proton-c/src/posix/io.c | 14 +- proton-c/src/protocol.py | 2 + proton-c/src/proton.c | 10 +- proton-c/src/sasl/sasl-internal.h | 6 +- proton-c/src/sasl/sasl.c | 289 +- proton-c/src/ssl/openssl.c | 492 +-- proton-c/src/ssl/ssl-internal.h | 6 +- proton-c/src/ssl/ssl_stub.c | 22 +- proton-c/src/tests/CMakeLists.txt | 13 +- proton-c/src/tests/engine.c | 3 + proton-c/src/tests/refcount.c | 176 + proton-c/src/transport/autodetect.c | 135 + proton-c/src/transport/autodetect.h | 40 + proton-c/src/transport/transport.c | 641 ++- proton-c/src/util.c | 15 +- proton-c/src/util.h | 2 + proton-c/src/windows/driver.c | 16 +- proton-c/src/windows/io.c | 17 +- proton-c/src/windows/schannel.c | 384 +- proton-c/src/windows/selector.c | 8 +- .../org/apache/qpid/proton/amqp/Binary.java | 378 +- .../org/apache/qpid/proton/amqp/Symbol.java | 188 +- .../apache/qpid/proton/amqp/UnsignedByte.java | 268 +- .../qpid/proton/amqp/UnsignedInteger.java | 298 +- .../apache/qpid/proton/amqp/UnsignedLong.java | 320 +- .../apache/qpid/proton/amqp/UnsignedShort.java | 268 +- .../qpid/proton/amqp/messaging/Accepted.java | 3 + .../qpid/proton/amqp/messaging/Modified.java | 3 + .../qpid/proton/amqp/messaging/Rejected.java | 2 + .../qpid/proton/amqp/messaging/Released.java | 3 + .../qpid/proton/amqp/transaction/Declared.java | 3 + .../qpid/proton/codec/impl/ArrayElement.java | 13 + .../apache/qpid/proton/codec/impl/DataImpl.java | 10 + .../apache/qpid/proton/engine/BaseHandler.java | 67 + .../org/apache/qpid/proton/engine/Event.java | 18 +- .../org/apache/qpid/proton/engine/Handler.java | 67 + .../qpid/proton/engine/impl/ConnectionImpl.java | 4 +- .../qpid/proton/engine/impl/EventImpl.java | 97 + .../qpid/proton/engine/impl/LinkImpl.java | 6 +- .../qpid/proton/engine/impl/SaslImpl.java | 7 +- .../qpid/proton/engine/impl/SessionImpl.java | 4 +- .../qpid/proton/engine/impl/TransportImpl.java | 5 +- .../impl/ssl/SimpleSslTransportWrapper.java | 6 + .../engine/impl/ssl/SslEngineFacadeFactory.java | 15 + proton-j/src/main/resources/cengine.py | 44 +- proton-j/src/main/resources/csasl.py | 14 +- proton-j/src/main/resources/cssl.py | 3 + .../qpid/proton/codec/impl/DataImplTest.java | 84 + tests/python/proton_tests/common.py | 13 +- tests/python/proton_tests/engine.py | 68 +- tests/python/proton_tests/sasl.py | 14 +- tests/python/proton_tests/url.py | 7 - tests/ruby/proton_tests/smoke.rb | 4 +- tools/cmake/Modules/FindPerlLibs.cmake | 54 - tools/cmake/Modules/ProtonFindPerl.cmake | 81 + tools/cmake/Modules/WindowsC99CheckDef.cmake | 2 +- version.txt | 2 +- 129 files changed, 9987 insertions(+), 6067 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/726a49bc/proton-c/CMakeLists.txt ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/726a49bc/proton-c/bindings/javascript/CMakeLists.txt ---------------------------------------------------------------------- diff --cc proton-c/bindings/javascript/CMakeLists.txt index ee1241f,0000000..38d039b mode 100644,000000..100644 --- a/proton-c/bindings/javascript/CMakeLists.txt +++ b/proton-c/bindings/javascript/CMakeLists.txt @@@ -1,270 -1,0 +1,272 @@@ +# +# 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. +# + +# This file allows cross-compiling of proton to JavaScript using emscripten +# (https://github.com/kripken/emscripten). As it is really a cross-compilation +# (as opposed to a binding like with swig) the approach is rather different and +# somewhat replicates the main build in the proton-c/CMakeLists.txt using quite +# a bit of "copy and paste reuse". +# TODO refactor this file (and proton-c/CMakeLists.txt) to keep the main +# compilation and cross-compilation consistent. + +message(STATUS "Found emscripten, using that to build JavaScript binding") + +# Find and install the node.js packages that we might need. We can assume that +# node.js itself is installed because Emscripten has a dependency on it. +find_package(NodePackages) + +# Describe the target OS we are building to - Emscripten mimics the Linux platform. +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_CROSSCOMPILING TRUE) + +# Specify the compiler to use for cross-compilation. +set(CMAKE_C_COMPILER "${EMCC}") + +# Don't do compiler autodetection, since we are cross-compiling. +include(CMakeForceCompiler) +CMAKE_FORCE_C_COMPILER("${CMAKE_C_COMPILER}" Clang) + +# The Proton default build type is RelWithDebInfo, but for JavaScript the C debug +# mechanism is irrelevant. If Debug is explicitly set we turn off optimisations +# and don't run the closure compiler so any error/profiling messages are readable. +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + message(STATUS "JavaScript build type is \"Debug\"") +else() + set (CMAKE_BUILD_TYPE Release) + message(STATUS "JavaScript build type is \"Release\"") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") + set(EMSCRIPTEN_LINK_OPTIMISATIONS "-O2 --closure 1") +endif() + +# From this point we should be using emscripten compilation tools. +message(STATUS "emscripten compilation environment:") +message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}") + + +# Set this to the proton-c directory, we're cross-compiling code from there. +set(PN_PATH ${CMAKE_SOURCE_DIR}/proton-c) + + +# TODO the OpenSSL stuff won't work for emscripten by default. It might well be +# possible to compile it from source using emscripten (that's the standard practice +# for libraries with emscripten) see https://github.com/kripken/emscripten/wiki/FAQ +# "Q. How do I link against system libraries like SDL, boost, etc.?" +# Though it might be more natural to simply use a TLS protected wss:// WebSocket URL. +# set(pn_driver_ssl_impl src/ssl/openssl.c) +# set(SSL_LIB ${OPENSSL_LIBRARIES}) +set(pn_driver_ssl_impl ${PN_PATH}/src/ssl/ssl_stub.c) + +# emscripten is Linux like so use the posix driver. +set(pn_io_impl ${PN_PATH}/src/posix/io.c) +set(pn_selector_impl ${PN_PATH}/src/posix/selector.c) +set(pn_driver_impl ${PN_PATH}/src/posix/driver.c) + + +# Generate encodings.h and protocol.h +# It may be possible to use the ones generated for the main proton-c build but +# qpid-proton-core has a dependency on the generated files, so I'm not sure if +# it'll work without a command that can be run as a dependency. Probably best +# do it this way when cross-compiling - though more copy'n'paste +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/encodings.h + COMMAND python ${PN_PATH}/env.py PYTHONPATH=${PN_PATH} python ${PN_PATH}/src/codec/encodings.h.py > ${CMAKE_CURRENT_BINARY_DIR}/encodings.h + DEPENDS ${PN_PATH}/src/codec/encodings.h.py + ) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/protocol.h + COMMAND python ${PN_PATH}/env.py PYTHONPATH=${PN_PATH} python ${PN_PATH}/src/protocol.h.py > ${CMAKE_CURRENT_BINARY_DIR}/protocol.h + DEPENDS ${PN_PATH}/src/protocol.h.py + ) + +set(COMPILE_WARNING_FLAGS "-Werror -Wall -pedantic-errors -Wno-comment -Wno-warn-absolute-paths") + +# Explicitly set PLATFORM_DEFINITIONS to Linux ones for emscripten as we don't +# want to inadvertently use Windows versions if we happen to be cross-compiling +# from a Windows platform +set(PLATFORM_DEFINITIONS "USE_CLOCK_GETTIME;USE_UUID_GENERATE;USE_STRERROR_R;USE_ATOLL") + +# The following is largely a copy from the the main proton-c/CMakeLists.txt. +# The main difference is prefixing paths with ${PN_PATH}/ as we can't use a +# relative path from this CMakeLists.txt. + +set(qpid-proton-platform + ${pn_io_impl} + ${pn_selector_impl} + ${pn_driver_impl} + ${PN_PATH}/src/platform.c + ${pn_driver_ssl_impl} + ) + +set(qpid-proton-core + ${PN_PATH}/src/object/object.c + ${PN_PATH}/src/object/list.c + ${PN_PATH}/src/object/map.c + ${PN_PATH}/src/object/string.c + ${PN_PATH}/src/object/iterator.c ++ ${PN_PATH}/src/object/record.c + + ${PN_PATH}/src/util.c + ${PN_PATH}/src/url.c + ${PN_PATH}/src/error.c + ${PN_PATH}/src/buffer.c + ${PN_PATH}/src/parser.c + ${PN_PATH}/src/scanner.c + ${PN_PATH}/src/types.c + + ${PN_PATH}/src/framing/framing.c + + ${PN_PATH}/src/codec/codec.c + ${PN_PATH}/src/codec/decoder.c + ${PN_PATH}/src/codec/encoder.c + + ${PN_PATH}/src/dispatcher/dispatcher.c + ${PN_PATH}/src/engine/engine.c + ${PN_PATH}/src/events/event.c ++ ${PN_PATH}/src/transport/autodetect.c + ${PN_PATH}/src/transport/transport.c + ${PN_PATH}/src/message/message.c + ${PN_PATH}/src/sasl/sasl.c + + ${PN_PATH}/src/messenger/messenger.c + ${PN_PATH}/src/messenger/subscription.c + ${PN_PATH}/src/messenger/store.c + ${PN_PATH}/src/messenger/transform.c + ${PN_PATH}/src/selectable.c + + ${CMAKE_CURRENT_BINARY_DIR}/encodings.h + ${CMAKE_CURRENT_BINARY_DIR}/protocol.h + ) + +set_source_files_properties( + ${qpid-proton-core} + PROPERTIES + COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS}" + ) + +set_source_files_properties( + ${qpid-proton-platform} + PROPERTIES + COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS}" + COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}" + ) + +# Compile Proton into LLVM bitcode which will be used later in the linking stage +# of add_executable for compilation into Javascript. +add_library( + qpid-proton-bitcode SHARED + + ${qpid-proton-core} + ${qpid-proton-platform} + ) + +set_target_properties( + qpid-proton-bitcode + PROPERTIES + VERSION "${PN_LIB_SOMAJOR}.${PN_LIB_SOMINOR}" + SOVERSION "${PN_LIB_SOMAJOR}" + LINK_FLAGS "${CATCH_UNDEFINED}" + ) + + +# Compile the send-async.c and recv-async.c examples into JavaScript +add_executable(send-async.js ${PN_PATH}/../examples/messenger/c/send-async.c) +target_link_libraries(send-async.js qpid-proton-bitcode) + +add_executable(recv-async.js ${PN_PATH}/../examples/messenger/c/recv-async.c) +target_link_libraries(recv-async.js qpid-proton-bitcode) + +set_target_properties( + send-async.js recv-async.js + PROPERTIES + COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS}" + RUNTIME_OUTPUT_DIRECTORY examples + DEPENDS ws + + LINK_FLAGS "-s \"WEBSOCKET_SUBPROTOCOL='AMQPWSB10'\" -${EMSCRIPTEN_LINK_OPTIMISATIONS}" + ) + +# Build the main JavaScript library called proton.js +add_executable(proton.js binding.c) +target_link_libraries(proton.js qpid-proton-bitcode) + +set_target_properties( + proton.js + PROPERTIES + COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS}" + + # The --memory-init-file 0 stops emscripten emitting a separate memory + # initialization file, if this was enabled it makes packaging harder as + # applications would expect proton.js.mem to be served too. It's even more + # fiddly with node.js packages. This behaviour might be reinstated if the + # packaging mechanism improves. + + LINK_FLAGS "-s \"EXPORT_NAME='proton'\" -s \"WEBSOCKET_SUBPROTOCOL='AMQPWSB10'\" ${EMSCRIPTEN_LINK_OPTIMISATIONS} --memory-init-file 0 --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/binding-open.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/module.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/error.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/messenger.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/subscription.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/message.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-uuid.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-symbol.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-described.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-array.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-typed-number.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-long.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-binary.js --post-js ${CMAKE_CURRENT_SOURCE_DIR}/binding-close.js -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"[]\" -s EXPORTED_FUNCTIONS=\"['_pn_get_version_major', ' _pn_get_version_minor', '_pn_bytes', '_pn_error_text', '_pn_code', '_pn_messenger', '_pn_messenger_name', '_pn_messenger_set_blocking', '_pn_messenger_free', '_pn_messenger_errno', '_pn_messenger_error', '_pn_messenger_get_outgoing_window', '_pn_messenger_set_outgoing_window', '_pn_messenger_get_incoming_window', '_pn_messenger_set_incoming_window', '_pn_messenger_start', '_pn_messenger_stop', '_pn_messenger_stopped', '_pn_messenger_subscribe', '_pn_messenger_put', '_pn_messenger_status', '_pn_messenger_buffered', '_pn_messenger_settle', '_pn_messenger_outgoing_tracker', '_pn_messenger_work', '_pn_messenger_recv', '_pn_messenger_receiving', '_pn_messenger_get', '_pn_messenger_incoming_tracker', '_pn_messenger_incoming_subscription', '_pn_messenger_accept', '_pn_messenger_reject', '_pn_messenger_outgoing', '_pn_messenger_incoming', '_pn_messenger_route', '_pn_messenger_rewrite', '_pn_messenger_set_passive', '_pn_messenger_selectable', '_pn_subscription_get_context', '_pn_subscriptio n_set_context', '_pn_subscription_address', '_pn_message', '_pn_message_id', '_pn_message_correlation_id', '_pn_message_free', '_pn_message_errno', '_pn_message_error', '_pn_message_clear', '_pn_message_is_inferred', '_pn_message_set_inferred', '_pn_message_is_durable', '_pn_message_set_durable', '_pn_message_get_priority', '_pn_message_set_priority', '_pn_message_get_ttl', '_pn_message_set_ttl', '_pn_message_is_first_acquirer', '_pn_message_set_first_acquirer', '_pn_message_get_delivery_count', '_pn_message_set_delivery_count', '_pn_message_get_user_id', '_pn_message_set_user_id', '_pn_message_get_address', '_pn_message_set_address', '_pn_message_get_subject', '_pn_message_set_subject', '_pn_message_get_reply_to', '_pn_message_set_reply_to', '_pn_message_get_content_type', '_pn_message_set_content_type', '_pn_message_get_content_encoding', '_pn_message_set_content_encoding', '_pn_message_get_expiry_time', '_pn_message_set_expiry_time', '_pn_message_get_creation_time', '_pn_message_ set_creation_time', '_pn_message_get_group_id', '_pn_message_set_group_id', '_pn_message_get_group_sequence', '_pn_message_set_group_sequence', '_pn_message_get_reply_to_group_id', '_pn_message_set_reply_to_group_id', '_pn_message_encode', '_pn_message_decode', '_pn_message_instructions', '_pn_message_annotations', '_pn_message_properties', '_pn_message_body', '_pn_data', '_pn_data_free', '_pn_data_error', '_pn_data_errno', '_pn_data_clear', '_pn_data_rewind', '_pn_data_next', '_pn_data_prev', '_pn_data_enter', '_pn_data_exit', '_pn_data_lookup', '_pn_data_narrow', '_pn_data_widen', '_pn_data_type', '_pn_data_encode', '_pn_data_decode', '_pn_data_put_list', '_pn_data_put_map', '_pn_data_put_array', '_pn_data_put_described', '_pn_data_put_null', '_pn_data_put_bool', '_pn_data_put_ubyte', '_pn_data_put_byte', '_pn_data_put_ushort', '_pn_data_put_short', '_pn_data_put_uint', '_pn_data_put_int', '_pn_data_put_char', '_pn_data_put_ulong', '_pn_data_put_long', '_pn_data_put_timestamp', '_ pn_data_put_float', '_pn_data_put_double', '_pn_data_put_decimal32', '_pn_data_put_decimal64', '_pn_data_put_decimal128', '_pn_data_put_uuid', '_pn_data_put_binary', '_pn_data_put_string', '_pn_data_put_symbol', '_pn_data_get_list', '_pn_data_get_map', '_pn_data_get_array', '_pn_data_is_array_described', '_pn_data_get_array_type', '_pn_data_is_described', '_pn_data_is_null', '_pn_data_get_bool', '_pn_data_get_ubyte', '_pn_data_get_byte', '_pn_data_get_ushort', '_pn_data_get_short', '_pn_data_get_uint', '_pn_data_get_int', '_pn_data_get_char', '_pn_data_get_ulong', '_pn_data_get_long', '_pn_data_get_timestamp', '_pn_data_get_float', '_pn_data_get_double', '_pn_data_get_decimal32', '_pn_data_get_decimal64', '_pn_data_get_decimal128', '_pn_data_get_uuid', '_pn_data_get_binary', '_pn_data_get_string', '_pn_data_get_symbol', '_pn_data_copy', '_pn_data_format', '_pn_data_dump', '_pn_selectable_readable', '_pn_selectable_capacity', '_pn_selectable_writable', '_pn_selectable_pending', '_pn_ selectable_is_terminal', '_pn_selectable_fd', '_pn_selectable_free']\"" + ) + +# This command packages up the compiled proton.js into a node.js package called +# qpid-proton and copies it to the <proton>/node_modules directory. This allows +# the node.js test and example programs to do proton = require("qpid-proton"); +add_custom_command( + TARGET proton.js + COMMAND ${CMAKE_COMMAND} + -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/qpid-proton + ${PROJECT_SOURCE_DIR}/node_modules/qpid-proton + COMMAND ${CMAKE_COMMAND} + -E copy + ${CMAKE_CURRENT_BINARY_DIR}/proton.js + ${PROJECT_SOURCE_DIR}/node_modules/qpid-proton/lib + COMMENT "Building qpid-proton package for node.js" +) + +# The cleanall target removes the qpid-proton package from <proton>/node_modules +add_custom_target( + cleanall + COMMAND echo "CLEAN NODE MODULES" + COMMAND ${CMAKE_COMMAND} + -E remove_directory + ${PROJECT_SOURCE_DIR}/node_modules/qpid-proton +) + +# If the docs target is specified and the jsdoc3 package for node.js has been +# installed then build the JavaScript API documentation. +if (NODE_JSDOC_FOUND) + set(JSDOC_EXE ${PROJECT_SOURCE_DIR}/node_modules/.bin/jsdoc) + + message(STATUS "Documentation Enabled. Using ${JSDOC_EXE} to build JavaScript docs") + add_custom_target(docs-js COMMAND ${JSDOC_EXE} + -d ${CMAKE_CURRENT_BINARY_DIR}/html + ${CMAKE_CURRENT_SOURCE_DIR}/module.js + ${CMAKE_CURRENT_SOURCE_DIR}/error.js + ${CMAKE_CURRENT_SOURCE_DIR}/messenger.js + ${CMAKE_CURRENT_SOURCE_DIR}/subscription.js + ${CMAKE_CURRENT_SOURCE_DIR}/message.js + ${CMAKE_CURRENT_SOURCE_DIR}/data.js + ${CMAKE_CURRENT_SOURCE_DIR}/data-uuid.js + ${CMAKE_CURRENT_SOURCE_DIR}/data-symbol.js + ${CMAKE_CURRENT_SOURCE_DIR}/data-described.js + ${CMAKE_CURRENT_SOURCE_DIR}/data-array.js + ${CMAKE_CURRENT_SOURCE_DIR}/data-typed-number.js + ${CMAKE_CURRENT_SOURCE_DIR}/data-long.js + ${CMAKE_CURRENT_SOURCE_DIR}/data-binary.js) + add_dependencies(docs docs-js) +endif (NODE_JSDOC_FOUND) + --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
