brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/3] brooklyn-client git commit: Update build so that it includes only the files that we want.
Date Wed, 06 Apr 2016 14:42:44 GMT
Repository: brooklyn-client
Updated Branches:
  refs/heads/0.9.0 64573c8e1 -> bc8593a93


Update build so that it includes only the files that we want.

Reduces build time and distribution size.

This was discussed in relation to previous commits, see

https://github.com/apache/brooklyn-docs/pull/25#discussion_r55650931


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/20399546
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/20399546
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/20399546

Branch: refs/heads/0.9.0
Commit: 20399546c3dfe5d90b98be265cec4793e2c3a436
Parents: 64573c8
Author: Geoff Macartney <geoff.macartney@cloudsoftcorp.com>
Authored: Mon Apr 4 17:13:26 2016 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Wed Apr 6 15:33:20 2016 +0100

----------------------------------------------------------------------
 release/assembly.xml |  2 +-
 release/build.sh     | 50 +++++++++++++++++++++++++++++++++++------------
 2 files changed, 38 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/20399546/release/assembly.xml
----------------------------------------------------------------------
diff --git a/release/assembly.xml b/release/assembly.xml
index 893d2c8..8a32f91 100644
--- a/release/assembly.xml
+++ b/release/assembly.xml
@@ -36,7 +36,7 @@
             <directory>${project.build.directory}/bin</directory>
             <outputDirectory><!-- leave blank, meaning 'root of archive' --></outputDirectory>
             <includes>
-                <include>**/br</include>
+                <include>**/br*</include>
             </includes>
         </fileSet>
     </fileSets>

http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/20399546/release/build.sh
----------------------------------------------------------------------
diff --git a/release/build.sh b/release/build.sh
index e524f17..f7cf01c 100755
--- a/release/build.sh
+++ b/release/build.sh
@@ -20,7 +20,7 @@
 #
 # Constants
 #
-OSVALUES="darwin freebsd linux netbsd openbsd windows"
+OSVALUES="darwin linux windows"
 ARCHVALUES="386 amd64"
 BRNAME="br"
 GOPACKAGE="github.com/apache/brooklyn-client/${BRNAME}"
@@ -42,6 +42,18 @@ sourcedir="."
 label=""
 timestamp=""
 
+declare -a builds
+function add_build () {
+  builds[${#builds[@]}]=$1
+}
+
+add_build darwin/amd64
+add_build linux/386
+add_build linux/amd64
+add_build windows/386
+add_build windows/amd64
+
+
 show_help() {
 # 
 # -A  Build for all OS/ARCH combinations
@@ -210,10 +222,28 @@ mkdir -p ${GOPATH}/bin
 # Disable use of C code modules (causes problems with cross-compiling)
 export CGO_ENABLED=0
 
+# build requested file
+function build_cli () {
+    local filepath=$1
+    mkdir -p ${filepath%/*}
+    $GODEP $GOBIN build -ldflags "-s" -o $filepath $CLI_PACKAGE || return $?
+}
+
+# Do a build for one platorm, usage like: build_for_platform darwin/amd64
+function build_for_platform () {
+    local os=${1%/*}
+    local arch=${1#*/}
+    local BINARY=${BRNAME}
+    if [ "windows" = $os ] ; then
+        BINARY=${BINARY}.exe
+    fi
+    GOOS="$os" GOARCH="$arch" build_cli "${GOPATH}/bin/$os.$arch/${BINARY}${label}" || return
$?
+}
+
 # Build as instructed
 if [ -z "$os" -a -z "$all" ]; then
 	echo "Building $BRNAME for native OS/ARCH"
-	$GODEP $GOBIN build -ldflags "-s" -o "${GOPATH}/bin/${BRNAME}${label}${timestamp}" $CLI_PACKAGE
|| exit $?
+	build_cli "${GOPATH}/bin/${BRNAME}${label}${timestamp}" || exit $?
 elif [ -z "$all" ]; then
 	validos=`expr " $OSVALUES " : ".* $os "`
 	if [ "$validos" -eq 0 ]; then
@@ -227,19 +257,13 @@ elif [ -z "$all" ]; then
 		echo "Unrecognised ARCH: $arch"
 		exit 1
 	fi
-	echo "Building $BRNAME for $os/$arch"
-	mkdir -p ${GOPATH}/bin/$os.$arch
-	GOOS="$os" GOARCH="$arch" $GODEP $GOBIN build -ldflags "-s" -o "${GOPATH}/bin/$os.$arch/${BRNAME}${label}"
$CLI_PACKAGE || exit $?
+	echo "Building $BRNAME for $os/$arch:"
+	build_for_platform $os/$arch || exit $?
 else
 	echo "Building $BRNAME for all OS/ARCH:"
-	os="$OSVALUES"
-	arch="$ARCHVALUES"
-	for archv in $arch; do
-		for osv in $os; do
-			echo "    $osv/$archv"
-			mkdir -p ${GOPATH}/bin/$osv.$archv
-			GOOS="$osv" GOARCH="$archv" $GODEP $GOBIN build -ldflags "-s" -o "${GOPATH}/bin/$osv.$archv/${BRNAME}${label}"
$CLI_PACKAGE || exit $?
-		done
+	for build in ${builds[@]}; do
+		echo "    $build"
+		build_for_platform $build || exit $?
 	done
 fi
 


Mime
View raw message