Magefile поправлен
Этот коммит содержится в:
родитель
26fbd323d5
коммит
bfb036df7a
1 изменённых файлов: 1 добавлений и 62 удалений
63
Magefile.go
63
Magefile.go
|
@ -23,24 +23,14 @@ var (
|
|||
func init() {
|
||||
AppName = "ktgo"
|
||||
ImageName = "my/go"
|
||||
|
||||
BuildFn = build
|
||||
}
|
||||
|
||||
func Test() {
|
||||
mg.Deps(TestLibs)
|
||||
mg.Deps(TestIntegration)
|
||||
mg.Deps(TestSharedLibsBuild)
|
||||
}
|
||||
func TestLibs(ctx context.Context) error {
|
||||
paths := []string{
|
||||
"pkg",
|
||||
"pkg/printer",
|
||||
"pkg/scenarios",
|
||||
"pkg/link",
|
||||
"pkg/link/wifi",
|
||||
"pkg/parser",
|
||||
"internal",
|
||||
}
|
||||
|
||||
listTests(paths)
|
||||
|
@ -53,12 +43,6 @@ func TestLibs(ctx context.Context) error {
|
|||
|
||||
return runListedTests()
|
||||
}
|
||||
func TestIntegration(ctx context.Context) error {
|
||||
return runTests("./test/int")
|
||||
}
|
||||
func TestSystem(ctx context.Context) error {
|
||||
return runTests("./test")
|
||||
}
|
||||
|
||||
func listTests(paths []string) error {
|
||||
for _, p := range paths {
|
||||
|
@ -89,9 +73,6 @@ func testOne(p string, e os.DirEntry) error {
|
|||
if !e.IsDir() {
|
||||
return nil
|
||||
}
|
||||
if e.Name() == "driver" {
|
||||
return nil
|
||||
}
|
||||
if e.Name() == "lib" {
|
||||
return nil
|
||||
}
|
||||
|
@ -140,7 +121,6 @@ func runListedTests() error {
|
|||
}
|
||||
|
||||
func runTests(paths string) error {
|
||||
Bash(`cp -f $HOME/.Xauthority /tmp/._test_Xauthority`)
|
||||
return Bash(`sudo docker run -ti --rm \
|
||||
-h host \
|
||||
--net=none \
|
||||
|
@ -149,19 +129,11 @@ func runTests(paths string) error {
|
|||
\
|
||||
-v /gopath:/gopath:rw \
|
||||
-v ${PWD}:/app \
|
||||
-v /usr/bin/docker:/usr/bin/docker:ro \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock:ro \
|
||||
-v /usr/bin/socat:/usr/bin/socat \
|
||||
\
|
||||
-e GOPATH=/gopath \
|
||||
-e GOCACHE=/gopath/gocache \
|
||||
-e APPDIR=${PWD} \
|
||||
\
|
||||
--device=/dev/dri/card0 \
|
||||
-e DISPLAY=:0 \
|
||||
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
|
||||
-v /tmp/._test_Xauthority:/home/user/.Xauthority:ro \
|
||||
\
|
||||
-w /app \
|
||||
-u 0 \
|
||||
\
|
||||
|
@ -173,39 +145,6 @@ func runTests(paths string) error {
|
|||
done'`)
|
||||
}
|
||||
|
||||
func TestSharedLibsBuild(ctx context.Context) error {
|
||||
mg.Deps(Build_shared_lib)
|
||||
return Bash(`rm lib/lib3dscreen.*`)
|
||||
}
|
||||
|
||||
func build() {
|
||||
Build_shared_lib(context.Background())
|
||||
}
|
||||
|
||||
func Build_shared_lib(ctx context.Context) error {
|
||||
return Bash(`sudo docker run --rm \
|
||||
-h host \
|
||||
--net=none \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ` + GolangVolume + `:/usr/local/go:ro \
|
||||
\
|
||||
-v /gopath:/gopath:rw \
|
||||
-v ${PWD}:/app \
|
||||
\
|
||||
-e GOPATH=/gopath \
|
||||
-e GOCACHE=/gopath/gocache \
|
||||
\
|
||||
-w /app/pkg/sharedlib \
|
||||
-u 1000 \
|
||||
\
|
||||
--entrypoint=/bin/bash \
|
||||
\
|
||||
` + ImageName + " -c '" + ` \
|
||||
go build -o /app/lib/libktgo.so -buildmode=c-shared \
|
||||
&& strip /app/lib/libktgo.so \
|
||||
'`)
|
||||
}
|
||||
|
||||
func Mobile() {
|
||||
Build_Mobile()
|
||||
Upload_Mobile()
|
||||
|
@ -239,7 +178,7 @@ func Build_Mobile() {
|
|||
` + ImageName + " " + `\
|
||||
bind -o /app/lib/ktgo.aar \
|
||||
`)
|
||||
Bash(`cp -afv lib/ktgo.aar ~/wd/mobile/apks/src/Telegram-FOSS/TMessagesProj/libs`)
|
||||
Bash(`cp -afv lib/ktgo.aar /Telegram-FOSS/TMessagesProj/libs`)
|
||||
}
|
||||
|
||||
func Upload_Mobile() {
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче