Skip to content

Commit

Permalink
MakeFile
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Sep 8, 2021
1 parent 481d1c2 commit b530dae
Show file tree
Hide file tree
Showing 5 changed files with 334 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
# Dependency directories (remove the comment below to include it)
# vendor/
.DS_Store
.env*
.env*
.tmp
dist
ui
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GOFILES := $(shell find . -name "*.go")
TESTFOLDER := $(shell $(GO) list ./... | grep -E './xiang$$' | grep -v examples)
TESTTAGS ?= ""

# 运行单元测试
.PHONY: test
test:
echo "mode: count" > coverage.out
Expand Down Expand Up @@ -77,6 +78,7 @@ tools:
go install golang.org/x/lint/golint; \
go install github.com/client9/misspell/cmd/misspell;

# 编译测试用插件
.PHONY: plugin
plugin:
rm -rf $(HOME)/data/gou-unit/plugins
Expand All @@ -93,6 +95,59 @@ plugin-mac:
go build -o ./app/plugins/dist/user ./app/plugins/user
chmod +x ./app/plugins/dist/user

# 编译静态文件
.PHONY: static
static:
git clone https://github.com/YaoApp/xiang-saas-ui-kxy .tmp/ui
cd .tmp/ui && yarn install && yarn build
rm -rf ui
mv .tmp/ui/dist ui
rm -rf .tmp/ui

# 将静态文件打包到命令工具
.PHONY: bindata
bindata:
rm -f data.go
mkdir -p .tmp/data
cp -r ui .tmp/data/
cp -r xiang .tmp/data/
go-bindata -o data.go .tmp/data/...
rm -rf .tmp/data

# 编译可执行文件
.PHONY: xiang
xiang: bindata

if [ -f bindata.go ]; then \
mv bindata.go bindata.go.bak; \
fi;

if [ ! -z "${XIANG_DOMAIN}" ]; then \
mv vars.go vars.go.bak; \
sed "s/*.iqka.com/$(XIANG_DOMAIN)/g" vars.go.bak > vars.go; \
fi;

GOOS=linux GOARCH=amd64 go build -v -o .tmp/xiang-linux-amd64
GOOS=linux GOARCH=arm GOARM=7 go build -v -o .tmp/xiang-linux-arm
GOOS=linux GOARCH=arm64 GOARM=7 go build -v -o .tmp/xiang-linux-arm64
GOOS=darwin GOARCH=amd64 go build -v -o .tmp/xiang-darwin-amd64
mkdir -p dist/bin
mv .tmp/xiang-*-* dist/bin/
chmod +x dist/bin/xiang-*-*
rm -f data.go
mv bindata.go.bak bindata.go

if [ ! -z "${XIANG_DOMAIN}" ]; then \
rm vars.go; \
mv vars.go.bak vars.go; \
fi;

.PHONY: clean
clean:
rm -rf ./tmp
rm -rf dist


# .PHONY: migrate
# migrate:
# $(GO) test -tags $(TESTTAGS) -run TestModelMigrate$
264 changes: 264 additions & 0 deletions bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions vars.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

// VERSION 版本号
const VERSION = "0.6.0"

// DOMAIN 许可域
const DOMAIN = "*.iqka.com"
6 changes: 4 additions & 2 deletions xiang.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package main

import "github.com/yaoapp/kun/utils"
import (
"fmt"
)

// 主程序
func main() {
utils.Dump("象传应用引擎")
fmt.Printf("象传应用引擎 %s %s\n", VERSION, DOMAIN)
}

0 comments on commit b530dae

Please sign in to comment.