Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5EAF018BBD for ; Wed, 14 Oct 2015 21:42:07 +0000 (UTC) Received: (qmail 31284 invoked by uid 500); 14 Oct 2015 21:42:07 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 31254 invoked by uid 500); 14 Oct 2015 21:42:07 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 31245 invoked by uid 99); 14 Oct 2015 21:42:07 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Oct 2015 21:42:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 259D5E0BB5; Wed, 14 Oct 2015 21:42:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aconway@apache.org To: commits@qpid.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: qpid-proton git commit: NO-JIRA: Add cmake dependencies to go build, avoid cmake calling 'go build' if up to date. Date: Wed, 14 Oct 2015 21:42:07 +0000 (UTC) Repository: qpid-proton Updated Branches: refs/heads/master f7a4cb3ea -> d3c53d8ce NO-JIRA: Add cmake dependencies to go build, avoid cmake calling 'go build' if up to date. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d3c53d8c Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d3c53d8c Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d3c53d8c Branch: refs/heads/master Commit: d3c53d8cefec7896c9dc2056ac1db9a0da452a10 Parents: f7a4cb3 Author: Alan Conway Authored: Wed Oct 14 13:54:51 2015 -0400 Committer: Alan Conway Committed: Wed Oct 14 17:41:47 2015 -0400 ---------------------------------------------------------------------- appveyor.yml | 1 - examples/go/CMakeLists.txt | 37 +++++++----- examples/go/example_test.go | 1 - proton-c/bindings/go/CMakeLists.txt | 61 +++++++++++++++----- .../src/qpid.apache.org/electron/connection.go | 3 +- .../go/src/qpid.apache.org/electron/handler.go | 6 +- .../qpid.apache.org/electron/messaging_test.go | 2 +- .../src/qpid.apache.org/proton/proton_test.go | 27 +++++++++ proton-c/include/proton/types.h | 1 + 9 files changed, 100 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/appveyor.yml ---------------------------------------------------------------------- diff --git a/appveyor.yml b/appveyor.yml index 9729c57..a147e0d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,6 @@ version: 0.10-SNAPSHOT-{branch}.{build} configuration: RelWithDebInfo install: - cinst -y swig -- cinst -y mingw before_build: - mkdir BLD - cd BLD http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/examples/go/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/go/CMakeLists.txt b/examples/go/CMakeLists.txt index 67c6cd7..2a36ec8 100644 --- a/examples/go/CMakeLists.txt +++ b/examples/go/CMakeLists.txt @@ -18,26 +18,37 @@ # if(BUILD_GO) - set(examples electron/receive electron/send electron/broker proton/broker) + set(examples electron/broker electron/receive electron/send proton/broker) + + # Build example exes foreach(example ${examples}) - string(REPLACE / - target ${example}) - add_custom_target(go-example-${target} ALL - COMMAND ${GO_BUILD} ${GO_EXAMPLE_FLAGS} -o ${CMAKE_CURRENT_BINARY_DIR}/${example} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.go - DEPENDS go-packages qpid-proton) + set(source ${CMAKE_CURRENT_SOURCE_DIR}/${example}.go) + set(target ${CMAKE_CURRENT_BINARY_DIR}/${example}) + add_custom_command( + OUTPUT ${target} + COMMAND ${GO_BUILD} ${GO_EXAMPLE_FLAGS} -o ${target} ${source} + DEPENDS ${source} ${GO_TARGETS}) + list(APPEND example_exes ${target}) endforeach() - add_custom_target(go-example-test ALL - COMMAND ${GO_TEST} -c ${GO_EXAMPLE_FLAGS} -o ${CMAKE_CURRENT_BINARY_DIR}/example_test ${CMAKE_CURRENT_SOURCE_DIR}/example_test.go - DEPENDS go-packages qpid-proton) - add_test( - NAME go_example_electron_test - COMMAND ${GO_ENV} ${CMAKE_CURRENT_BINARY_DIR}/example_test -dir ${CMAKE_CURRENT_BINARY_DIR}/electron -broker broker) + # Build test driver exe + set(test_exe ${CMAKE_CURRENT_BINARY_DIR}/example_test) + add_custom_command( + OUTPUT ${test_exe} + DEPENDS ${example_exes} + COMMAND ${GO_TEST} -c -o ${test_exe} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.go) + add_custom_target(go-test-exe ALL DEPENDS ${test_exe}) add_test( - NAME go_example_proton_test - COMMAND ${GO_ENV} ${CMAKE_CURRENT_BINARY_DIR}/example_test -dir ${CMAKE_CURRENT_BINARY_DIR}/electron -broker ../proton/broker) + NAME go_example_electron_test + COMMAND ${GO_ENV} ${test_exe} -dir ${CMAKE_CURRENT_BINARY_DIR}/electron -broker broker) + + # FIXME aconway 2015-10-14: proton broker is buggy, enable when fixed. + # add_test( + # NAME go_example_proton_test + # COMMAND ${test_exe} -dir ${CMAKE_CURRENT_BINARY_DIR}/electron -broker ../proton/broker) list(APPEND ADDITIONAL_MAKE_CLEAN_FILES ${examples}) endif() http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/examples/go/example_test.go ---------------------------------------------------------------------- diff --git a/examples/go/example_test.go b/examples/go/example_test.go index 479864c..1e497b9 100644 --- a/examples/go/example_test.go +++ b/examples/go/example_test.go @@ -113,7 +113,6 @@ func checkStaleLibs(t *testing.T) { var stale []string pp := "qpid.apache.org" for _, p := range []string{pp + "/proton", pp + "/amqp", pp + "/electron"} { - t.Log("FIXME", os.Getenv("GOPATH")) out, err := exec.Command("go", "list", "-f", "{{.Stale}}", p).CombinedOutput() if err != nil { t.Fatalf("failed to execute 'go list': %v\n%v", err, string(out)) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/proton-c/bindings/go/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/go/CMakeLists.txt b/proton-c/bindings/go/CMakeLists.txt index 27d2349..e791555 100644 --- a/proton-c/bindings/go/CMakeLists.txt +++ b/proton-c/bindings/go/CMakeLists.txt @@ -18,18 +18,17 @@ # # Go version -execute_process(COMMAND ${GO_EXE} version OUTPUT_VARIABLE go_out) -message(STATUS "Found Go: ${go_out}") +execute_process(COMMAND ${GO_EXE} version OUTPUT_VARIABLE go_ver OUTPUT_STRIP_TRAILING_WHITESPACE) +message(STATUS "Found Go: ${GO_EXE} (${go_ver})") set(GO_BUILD_FLAGS "" CACHE STRING "Flags for 'go build'") +set(GO_TEST_FLAGS "-v" CACHE STRING "Flags for 'go test'") # Flags that differ for golang go and gcc go. if (go_out MATCHES "gccgo") # TODO aconway 2015-10-08: import cycles with -race under gccgo, investigate. - set(GO_TEST_FLAGS "-v" CACHE STRING "Flags for 'go test'") set(GO_RPATH_FLAGS -gccgoflags "-Wl,-rpath=${CMAKE_BINARY_DIR}/proton-c") else() - set(GO_TEST_FLAGS "-v -race" CACHE STRING "Flags for 'go test'") set(GO_RPATH_FLAGS -ldflags "-r ${CMAKE_BINARY_DIR}/proton-c") endif() @@ -49,24 +48,54 @@ set(GO_BUILD ${GO} build ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} CACHE INTERNAL "Run set(GO_INSTALL ${GO} install ${GO_BUILD_FLAGS} CACHE INTERNAL "Run go install") set(GO_TEST ${GO} test ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} ${GO_TEST_FLAGS} CACHE INTERNAL "Run go test") -# Install packages in the source tree, go tools aren't friendly otherwise. -# All build output goes in git-ignored pkg or bin subdirectories. -set(q "qpid.apache.org") -set(packages ${q}/amqp ${q}/internal ${q}/proton ${q}/electron) -add_custom_target(go-packages ALL - COMMAND ${GO_INSTALL} ${packages} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - DEPENDS qpid-proton) +# Go build depends on the C headers +file(GLOB headers ${CMAKE_SOURCE_DIR}/proton_c/include/proton/*.h) -add_test( - NAME go_test_packages - COMMAND ${GO_TEST} ${packages} - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") +# Go tools insist on standard Go layout which puts compiled code in the source tree :( +# Build output is all under git-ignored pkg or bin subdirectories, they are removed by make clean. +foreach (pkg amqp proton electron) + set(package "qpid.apache.org/${pkg}") + + # Get the target library location + macro(go_list var template) + execute_process(COMMAND ${GO} list -f "${template}" ${package} + OUTPUT_VARIABLE ${var} OUTPUT_STRIP_TRAILING_WHITESPACE) + endmacro() + go_list(lib "{{.Target}}") + + # Get package sources + go_list(dir "{{.Dir}}") + macro(go_sources field) + go_list(${field} "{{range .${field}}}${dir}/{{.}};{{end}}") + endmacro() + go_sources(GoFiles) + go_sources(CgoFiles) + set(sources "${GoFiles}${CgoFiles}") + + # Build the package library + add_custom_command(OUTPUT ${lib} COMMAND ${GO_INSTALL} ${package} DEPENDS ${sources} ${headers}) + set(target go-package-${pkg}) + add_custom_target(${target} ALL DEPENDS ${lib}) + + # Package test + go_sources(TestGoFiles) + set(test_exe ${CMAKE_CURRENT_BINARY_DIR}/${pkg}.test) + add_custom_command(OUTPUT ${test_exe} COMMAND ${GO_TEST} -c -o ${test_exe} ${package} + DEPENDS ${target} qpid-proton) + add_custom_target(go-package-test-${pkg} ALL DEPENDS ${test_exe}) + add_test(NAME go_test_${pkg} COMMAND ${test_exe} WORKING_DIRECTORY ${dir}) + + list(APPEND GO_TARGETS ${target}) + +endforeach() + +# Clean up go output directories. list(APPEND ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkg ${CMAKE_CURRENT_SOURCE_DIR}/bin) +# Install go sources. set (GO_INSTALL_DIR ${SHARE_INSTALL_DIR}/gocode/src CACHE PATH "Installation directory for Go code") mark_as_advanced (GO_INSTALL_DIR) install(DIRECTORY src/qpid.apache.org DESTINATION ${GO_INSTALL_DIR} COMPONENT Go) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go ---------------------------------------------------------------------- diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go b/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go index 7c8024b..bef8c17 100644 --- a/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go +++ b/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go @@ -24,9 +24,9 @@ import "C" import ( "net" + "qpid.apache.org/amqp" "qpid.apache.org/internal" "qpid.apache.org/proton" - "qpid.apache.org/amqp" "sync" ) @@ -140,7 +140,6 @@ func (c *connection) Close(err error) { c.engine.Close(err) } func (c *connection) Disconnect(err error) { c.engine.Disconnect(err) } -// FIXME aconway 2015-10-07: func (c *connection) closed(err error) { // Call from another goroutine to initiate close without deadlock. go c.Close(err) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go ---------------------------------------------------------------------- diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go b/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go index f6065a1..1b07109 100644 --- a/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go +++ b/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go @@ -17,15 +17,11 @@ specific language governing permissions and limitations under the License. */ -// FIXME aconway 2015-10-07: move to amqp or split into sub packages? -// proton.core -// proton.msg - package electron import ( - "qpid.apache.org/proton" "qpid.apache.org/amqp" + "qpid.apache.org/proton" ) // NOTE: methods in this file are called only in the proton goroutine unless otherwise indicated. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/proton-c/bindings/go/src/qpid.apache.org/electron/messaging_test.go ---------------------------------------------------------------------- diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/messaging_test.go b/proton-c/bindings/go/src/qpid.apache.org/electron/messaging_test.go index 3b315cd..36b0c24 100644 --- a/proton-c/bindings/go/src/qpid.apache.org/electron/messaging_test.go +++ b/proton-c/bindings/go/src/qpid.apache.org/electron/messaging_test.go @@ -30,7 +30,7 @@ import ( ) func fatalIf(t *testing.T, err error) { - if err != nil { // FIXME aconway 2015-10-07: + if err != nil { _, file, line, ok := runtime.Caller(1) // annotate with location of caller. if ok { _, file = path.Split(file) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/proton-c/bindings/go/src/qpid.apache.org/proton/proton_test.go ---------------------------------------------------------------------- diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/proton_test.go b/proton-c/bindings/go/src/qpid.apache.org/proton/proton_test.go new file mode 100644 index 0000000..bb3f21c --- /dev/null +++ b/proton-c/bindings/go/src/qpid.apache.org/proton/proton_test.go @@ -0,0 +1,27 @@ +/* +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. +*/ + +package proton + +import ( + "testing" +) + +// TODO aconway 2015-10-14: placeholder, add unit tests. +func Test(*testing.T) {} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3c53d8c/proton-c/include/proton/types.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/types.h b/proton-c/include/proton/types.h index 10799ff..4b7c953 100644 --- a/proton-c/include/proton/types.h +++ b/proton-c/include/proton/types.h @@ -1,6 +1,7 @@ #ifndef PROTON_TYPES_H #define PROTON_TYPES_H 1 + /* * * Licensed to the Apache Software Foundation (ASF) under one --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org