Этот коммит содержится в:
Softonik 2024-06-29 01:24:58 +03:00
родитель 26fbd323d5
коммит bfb036df7a

Просмотреть файл

@ -23,24 +23,14 @@ var (
func init() { func init() {
AppName = "ktgo" AppName = "ktgo"
ImageName = "my/go" ImageName = "my/go"
BuildFn = build
} }
func Test() { func Test() {
mg.Deps(TestLibs) mg.Deps(TestLibs)
mg.Deps(TestIntegration)
mg.Deps(TestSharedLibsBuild)
} }
func TestLibs(ctx context.Context) error { func TestLibs(ctx context.Context) error {
paths := []string{ paths := []string{
"pkg", "pkg",
"pkg/printer",
"pkg/scenarios",
"pkg/link",
"pkg/link/wifi",
"pkg/parser",
"internal",
} }
listTests(paths) listTests(paths)
@ -53,12 +43,6 @@ func TestLibs(ctx context.Context) error {
return runListedTests() 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 { func listTests(paths []string) error {
for _, p := range paths { for _, p := range paths {
@ -89,9 +73,6 @@ func testOne(p string, e os.DirEntry) error {
if !e.IsDir() { if !e.IsDir() {
return nil return nil
} }
if e.Name() == "driver" {
return nil
}
if e.Name() == "lib" { if e.Name() == "lib" {
return nil return nil
} }
@ -140,7 +121,6 @@ func runListedTests() error {
} }
func runTests(paths string) error { func runTests(paths string) error {
Bash(`cp -f $HOME/.Xauthority /tmp/._test_Xauthority`)
return Bash(`sudo docker run -ti --rm \ return Bash(`sudo docker run -ti --rm \
-h host \ -h host \
--net=none \ --net=none \
@ -149,19 +129,11 @@ func runTests(paths string) error {
\ \
-v /gopath:/gopath:rw \ -v /gopath:/gopath:rw \
-v ${PWD}:/app \ -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 GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \ -e GOCACHE=/gopath/gocache \
-e APPDIR=${PWD} \ -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 \ -w /app \
-u 0 \ -u 0 \
\ \
@ -173,39 +145,6 @@ func runTests(paths string) error {
done'`) 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() { func Mobile() {
Build_Mobile() Build_Mobile()
Upload_Mobile() Upload_Mobile()
@ -239,7 +178,7 @@ func Build_Mobile() {
` + ImageName + " " + `\ ` + ImageName + " " + `\
bind -o /app/lib/ktgo.aar \ 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() { func Upload_Mobile() {