Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hexbee
Cloudreve
提交
d80446d3
C
Cloudreve
项目概览
hexbee
/
Cloudreve
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cloudreve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d80446d3
编写于
3月 10, 2020
作者:
A
Aaron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feat: cross compile script
上级
98c122f0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
12 deletion
+32
-12
.gitignore
.gitignore
+1
-0
.travis.yml
.travis.yml
+9
-4
build.sh
build.sh
+21
-7
pkg/util/logger.go
pkg/util/logger.go
+1
-1
未找到文件。
.gitignore
浏览文件 @
d80446d3
...
...
@@ -6,6 +6,7 @@
*.dylib
*.db
*.bin
/release/
# Test binary, build with `go test -c`
*.test
...
...
.travis.yml
浏览文件 @
d80446d3
...
...
@@ -3,7 +3,12 @@ go:
-
1.13.x
git
:
depth
:
1
script
:
-
go test -coverprofile=coverage.txt -covermode=atomic ./...
after_success
:
-
bash <(curl -s https://codecov.io/bash)
install
:
-
sudo apt install gcc-mingw-w64
-
chmod +x ./build.sh
script
:
-
./build.sh -r b
# script:
# - go test -coverprofile=coverage.txt -covermode=atomic ./...
# after_success:
# - bash <(curl -s https://codecov.io/bash)
build.sh
浏览文件 @
d80446d3
...
...
@@ -26,6 +26,7 @@ buildAssets () {
yarn run build
if
!
[
-x
"
$(
command
-v
statik
)
"
]
;
then
export
CGO_ENABLED
=
0
go get github.com/rakyll/statik
fi
...
...
@@ -43,21 +44,34 @@ _build() {
IFS
=
/
read
-r
-a
arr
<<<
"
$osarch
"
os
=
"
${
arr
[0]
}
"
arch
=
"
${
arr
[1]
}
"
gcc
=
"
${
arr
[2]
}
"
# Go build to build the binary.
export
GOOS
=
$os
export
GOARCH
=
$arch
go build
-a
-o
cloudreve_
$VERSION_$GOOS_$GOARCH
-ldflags
" -X 'github.com/HFO4/cloudreve/pkg/conf.BackendVersion=
$VERSION
' -X 'github.com/HFO4/cloudreve/pkg/conf.LastCommit=
$COMMIT_SHA
'"
export
CC
=
$gcc
export
CGO_ENABLED
=
1
out
=
"release/cloudreve_
${
VERSION
}
_
${
os
}
_
${
arch
}
"
go build
-a
-o
"
${
out
}
"
-ldflags
" -X 'github.com/HFO4/cloudreve/pkg/conf.BackendVersion=
$VERSION
' -X 'github.com/HFO4/cloudreve/pkg/conf.LastCommit=
$COMMIT_SHA
'"
if
[
"
$os
"
=
"windows"
]
;
then
mv
$out
release/cloudreve.exe
zip
-j
-q
"
${
out
}
.zip"
release/cloudreve.exe
rm
-f
"release/cloudreve.exe"
else
mv
$out
release/cloudreve
tar
-zcvf
"
${
out
}
.tar.gz"
-C
release cloudreve
rm
-f
"release/cloudreve"
fi
}
release
(){
cd
$REPO
export
CGO_ENABLED
=
1
## List of architectures and OS to test coss compilation.
SUPPORTED_OSARCH
=
"linux/a
rm64 darwin/amd64 windows/amd64 linux/arm linux/386 windows/386
"
SUPPORTED_OSARCH
=
"linux/a
md64/gcc linux/arm/arm-linux-gnueabihf-gcc windows/amd64/x86_64-w64-mingw32-gcc
"
echo
"Release builds for OS/Arch:
${
SUPPORTED_OSARCH
}
"
echo
"Release builds for OS/Arch
/CC
:
${
SUPPORTED_OSARCH
}
"
for
each_osarch
in
${
SUPPORTED_OSARCH
}
;
do
_build
"
${
each_osarch
}
"
done
...
...
@@ -81,7 +95,7 @@ while getopts "bacr:d" o; do
BINARY
=
"true"
;;
r
)
ASSETS
=
"true"
#
ASSETS="true"
RELEASE
=
"true"
;;
d
)
...
...
@@ -108,4 +122,4 @@ fi
if
[
"
$RELEASE
"
=
"true"
]
;
then
release
fi
fi
\ No newline at end of file
pkg/util/logger.go
浏览文件 @
d80446d3
...
...
@@ -46,7 +46,7 @@ var spaces = map[string]string{
// Println 打印
func
(
ll
*
Logger
)
Println
(
prefix
string
,
msg
string
)
{
// TODO Release时去掉
color
.
NoColor
=
false
//
color.NoColor = false
c
:=
color
.
New
()
_
,
_
=
c
.
Printf
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录