diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..8ec2a4b9 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.PHONY: all + +KOMPOSE_ENVS := \ + -e OS_PLATFORM_ARG \ + -e OS_ARCH_ARG \ + -e TESTDIRS \ + -e TESTFLAGS \ + -e TESTVERBOSE + +BIND_DIR := bundles + +default: binary + +all: + ./script/make.sh + +binary: + ./script/make.sh binary + +clean: + ./script/make.sh clean + diff --git a/script/binary b/script/binary new file mode 100755 index 00000000..e556e2ec --- /dev/null +++ b/script/binary @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +if [ -z "$1" ]; then + OS_PLATFORM_ARG=(-os="darwin linux windows") +else + OS_PLATFORM_ARG=($1) +fi + +if [ -z "$2" ]; then + OS_ARCH_ARG=(-arch="386 amd64") +else + OS_ARCH_ARG=($2) +fi + +# Get rid of existing binaries +rm -f kompose* + +# Build binaries +gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \ + -output="bundles/kompose_{{.OS}}-{{.Arch}}/kompose" \ + ./cli/main + diff --git a/script/make.sh b/script/make.sh new file mode 100755 index 00000000..e6f59591 --- /dev/null +++ b/script/make.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +set -e + +export KOMPOSE_PKG='github.com/skippbox/kompose2' + +# List of bundles to create when no argument is passed +DEFAULT_BUNDLES=( + validate-gofmt + validate-git-marks + validate-lint + validate-vet + binary + + # test-unit + # test-integration + # test-acceptance +) +bundle() { + local bundle="$1"; shift + echo "---> Making bundle: $(basename "$bundle") (in $DEST)" + source "script/$bundle" "$@" +} + +if [ $# -lt 1 ]; then + bundles=(${DEFAULT_BUNDLES[@]}) +else + bundles=($@) +fi +for bundle in ${bundles[@]}; do + export DEST=. + ABS_DEST="$(cd "$DEST" && pwd -P)" + bundle "$bundle" + echo +done +