qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [31/38] qpid-proton git commit: Revert "NO-JIRA: go binding build results in binary dir, not source dir"
Date Thu, 23 Feb 2017 22:51:38 GMT
Revert "NO-JIRA: go binding build results in binary dir, not source dir"

This reverts commit 9bd99ebf096ed83bd23ae05fe9cc0e6f65d9ac2e.

Copying sources into the bin dir for compliation is a bad idea:
- compile errors are located in the binary copy, not the source
- deleted source files are not reflected in the binary copy

Need a better solution.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/5d1c2479
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/5d1c2479
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/5d1c2479

Branch: refs/heads/go1
Commit: 5d1c24796a0411e659e082e81171cde511b04f02
Parents: 204c847
Author: Alan Conway <aconway@redhat.com>
Authored: Thu Feb 23 09:05:39 2017 -0500
Committer: Alan Conway <aconway@redhat.com>
Committed: Thu Feb 23 13:46:57 2017 -0500

----------------------------------------------------------------------
 .gitignore                          |  7 +++++++
 examples/go/CMakeLists.txt          |  8 +++++---
 proton-c/bindings/go/CMakeLists.txt | 17 +++++++++--------
 3 files changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d1c2479/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index b769990..aa9bc36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,9 +31,16 @@ eclipse-classes
 # The usual location for proton-c build files
 proton-c/build
 
+# Executables built by go binding tests
+proton-c/bindings/go/bin
+
 # Testresults from the jenkins build script
 testresults
 
+# Go binding build output
+/proton-c/bindings/go/pkg
+/proton-c/bindings/go/bin
+
 # Python TOX test build output
 /proton-c/bindings/python/MANIFEST
 /proton-c/bindings/python/build

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d1c2479/examples/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/go/CMakeLists.txt b/examples/go/CMakeLists.txt
index 861cdd8..c9aba01 100644
--- a/examples/go/CMakeLists.txt
+++ b/examples/go/CMakeLists.txt
@@ -20,11 +20,12 @@
 if(BUILD_GO)
 
   set(examples electron/broker electron/receive electron/send proton/broker)
+  file(GLOB_RECURSE example_source FOLLOW_SYMLINKS ${CMAKE_CURRENT_SOURCE_DIR}/*.go)
 
   # Build example exes
   foreach(example ${examples})
-    string(REPLACE / - target ${example})
-    set(target "go-example-${target}")
+    string(REPLACE / _ target ${example})
+    set(target "go_example_${target}")
     set(output ${CMAKE_CURRENT_BINARY_DIR}/${example})
     # Always run go_build, it will do nothing if there is nothing to do.
     # Otherwise it's too hard to get the dependencies right.
@@ -32,11 +33,12 @@ if(BUILD_GO)
       COMMAND ${GO_BUILD} ${GO_EXAMPLE_FLAGS} -o ${output} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.go
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
       DEPENDS go-build)
+    list(APPEND example_targets ${target})
   endforeach()
 
   # Build test driver exe
   set(test_exe ${CMAKE_CURRENT_BINARY_DIR}/example_test)
-  add_custom_target(go-example-test ALL
+  add_custom_target(go_example_test ALL
     COMMAND ${GO_TEST} -c -o ${test_exe} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.go
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d1c2479/proton-c/bindings/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/CMakeLists.txt b/proton-c/bindings/go/CMakeLists.txt
index 1cb9d6c..d0ffe9b 100644
--- a/proton-c/bindings/go/CMakeLists.txt
+++ b/proton-c/bindings/go/CMakeLists.txt
@@ -26,6 +26,7 @@ set(GO_TEST_FLAGS "-v" CACHE STRING "Flags for 'go test'")
 
 # Flags that differ for golang go and gcc go.
 if (go_ver MATCHES "gccgo")
+  # TODO aconway 2015-10-08: import cycles with -race under gccgo, investigate.
   set(GO_RPATH_FLAGS -gccgoflags "-Wl,-rpath=${CMAKE_BINARY_DIR}/proton-c")
 else()
   set(GO_RPATH_FLAGS -ldflags "-r ${CMAKE_BINARY_DIR}/proton-c")
@@ -36,7 +37,7 @@ separate_arguments(GO_TEST_FLAGS)
 
 # Following are CACHE INTERNAL so examples/CMakeLists.txt can see them.
 set(GO_ENV ${env_py} --
-  "GOPATH=${CMAKE_CURRENT_BINARY_DIR}"
+  "GOPATH=${CMAKE_CURRENT_SOURCE_DIR}"
   "CGO_CFLAGS=-I${CMAKE_SOURCE_DIR}/proton-c/include -I${CMAKE_BINARY_DIR}/proton-c/include"
   "CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/proton-c"
   "PN_INTEROP_DIR=${CMAKE_SOURCE_DIR}/tests/interop"
@@ -46,15 +47,15 @@ set(GO ${GO_ENV} ${GO_EXE} CACHE INTERNAL "Run go with environment set")
 
 set(GO_BUILD ${GO} build ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} CACHE INTERNAL "Run go build")
 set(GO_INSTALL ${GO} install ${GO_BUILD_FLAGS} CACHE INTERNAL "Run go install" )
-set(GO_TEST ${GO} test ${GO_TEST_FLAGS} ${GO_RPATH_FLAGS} CACHE INTERNAL "Run go test")
+set(GO_TEST ${GO} test ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} ${GO_TEST_FLAGS} CACHE INTERNAL
"Run go test")
 
-# The go build tools handle dependency checks and incremental builds better than CMake so
-# just run them every time, they do nothing if nothing needs to be done.
-#
-# The Go sources are copied to the binary directory so we can respect the standard Go tree
-# layout without polluting the source tree.
+# 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.
+
+# The go build tools handle dependency checks and incremental builds better than
+# CMake so just run them every time, they do nothing if nothing needs to be
+# done.
 add_custom_target(go-build ALL
-  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
   COMMAND ${GO_INSTALL} qpid.apache.org/...
   DEPENDS qpid-proton-core
   WORKING_DIRECTORY $ENV{PWD})


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message