提交 4fd4ce33 编写于 作者: J Jingwen Owen Ou

Change build script and package script to use `go build` directly

上级 6137851f
......@@ -5,18 +5,6 @@
set -e
setup_gopath() {
TMP_GOPATH="${TMPDIR:-/tmp}/go"
TMP_SELF="${TMP_GOPATH}/src/github.com/github/hub"
export GOPATH="${TMP_GOPATH}:${PWD}/Godeps/_workspace:$GOPATH"
if [ ! -e "$TMP_SELF" ]; then
mkdir -p "${TMP_SELF%/*}"
ln -snf "$PWD" "$TMP_SELF"
fi
}
find_source_files() {
find . -maxdepth 2 -name '*.go' -not -name '*_test.go' "$@"
}
......@@ -29,19 +17,17 @@ up_to_date() {
[ -e "$1" ] && [ "$(count_changed_files "$1")" -eq 0 ]
}
# always build with noupdate for now until Hub 2.0 is released
build_hub() {
setup_gopath
[ -n "$1" ] && (up_to_date "$1" || go build -tags "noupdate" -ldflags "-X github.com/github/hub/commands.Version `./script/version`" -o "$1")
}
test_hub() {
setup_gopath
go test ./...
}
case "$1" in
"" )
# always build with noupdate for now until Hub 2.0 is released
build_hub hub
;;
-o )
......
......@@ -83,7 +83,7 @@ class Packer
def parse_version!
content = File.read root_path("commands", "version.go")
match = /const Version = "(.+)"/.match content
match = /var Version = "(.+)"/.match content
raise "Fail to parse Hub version" unless match
match[1]
......@@ -113,7 +113,8 @@ class Packer
def build_hub!
puts "Building for #{OS.type}"
exec!("script/godep gox -os=#{OS.type} -output=./target/{{.Dir}}_#{version}_{{.OS}}_{{.Arch}}/{{.Dir}} -tags=noupdate")
release_version = `./script/version`
exec!("gox -os=#{OS.type} -output=./target/{{.Dir}}_#{version}_{{.OS}}_{{.Arch}}/{{.Dir}} -tags=noupdate -ldflags '-X github.com/github/hub/commands.Version #{release_version}'")
end
def cp_assets
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册