2023-12-13 20:07:22 +01:00
|
|
|
LINT_ARGS ?= --timeout 5m
|
|
|
|
GORELEASER_VERSION ?= v1.13.1
|
|
|
|
GORELEASER_ARGS ?= release --snapshot --rm-dist
|
|
|
|
GITCHLOG_ARGS ?=
|
|
|
|
SHELL := /bin/bash
|
|
|
|
JDK_PATH ?= /usr/lib/jvm/java-11-openjdk
|
2024-01-21 15:04:48 +01:00
|
|
|
GOARCH ?= amd64
|
2023-12-13 20:07:22 +01:00
|
|
|
|
2024-01-12 15:49:24 +01:00
|
|
|
MKT_GITEA_RELEASE_PROJECT := arcast
|
|
|
|
MKT_GITEA_RELEASE_ORG := arcad
|
|
|
|
|
2023-12-13 20:07:22 +01:00
|
|
|
GOTEST_ARGS ?= -short
|
|
|
|
|
|
|
|
watch: tools/modd/bin/modd deps ## Watching updated files - live reload
|
|
|
|
( set -o allexport && source .env && set +o allexport && tools/modd/bin/modd )
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: test-go ## Executing tests
|
|
|
|
|
|
|
|
test-go: deps
|
|
|
|
( set -o allexport && source .env && set +o allexport && go test -v -count=1 $(GOTEST_ARGS) ./... )
|
|
|
|
|
2024-01-12 15:15:24 +01:00
|
|
|
build: build-desktop build-android build-client ## Build artefacts
|
2023-12-13 20:07:22 +01:00
|
|
|
|
|
|
|
build-desktop: deps ## Build executable
|
2024-01-21 15:04:48 +01:00
|
|
|
CGO_ENABLED=0 GOARCH=$(GOARCH) go build \
|
2023-12-13 20:07:22 +01:00
|
|
|
-v \
|
2024-01-21 15:04:48 +01:00
|
|
|
-o ./bin/desktop_$(GOARCH) \
|
2023-12-13 20:07:22 +01:00
|
|
|
./cmd/desktop
|
|
|
|
|
|
|
|
build-client: deps ## Build executable
|
|
|
|
CGO_ENABLED=0 go build \
|
|
|
|
-v \
|
|
|
|
-o ./bin/client \
|
|
|
|
./cmd/client
|
|
|
|
|
2024-01-12 15:15:24 +01:00
|
|
|
build-android: tools/gogio/bin/gogio deps ## Build executable
|
2023-12-13 20:07:22 +01:00
|
|
|
mkdir -p dist
|
|
|
|
GOOS=android CGO_CFLAGS="-I${JDK_PATH}/include -I${JDK_PATH}/include/linux -w" tools/gogio/bin/gogio -target android -buildmode archive -o android/app/libs/mobile.aar -x ./cmd/mobile
|
|
|
|
( cd android && ./gradlew assembleDebug )
|
|
|
|
|
2024-01-12 15:15:24 +01:00
|
|
|
install-android: build-android
|
2023-12-13 20:07:22 +01:00
|
|
|
adb install android/app/build/outputs/apk/debug/app-debug.apk
|
|
|
|
adb shell monkey -p com.cadoles.arcast_player -c android.intent.category.LAUNCHER 1
|
|
|
|
|
|
|
|
debug-android:
|
|
|
|
adb logcat -s 'com.cadoles.arcast_player:* GoLog:* s.arcast_player:* com.cadoles.forge.mobile:*'
|
|
|
|
|
|
|
|
.env:
|
|
|
|
cp -f .env.dist .env
|
|
|
|
|
|
|
|
run: .env
|
|
|
|
( set -o allexport && source .env && set +o allexport && $(RUN_CMD))
|
|
|
|
|
|
|
|
.PHONY: deps
|
|
|
|
deps: .env
|
|
|
|
|
|
|
|
tools/modd/bin/modd:
|
|
|
|
mkdir -p tools/modd/bin
|
|
|
|
GOBIN=$(PWD)/tools/modd/bin go install github.com/cortesi/modd/cmd/modd@latest
|
|
|
|
|
|
|
|
tools/gogio/bin/gogio:
|
|
|
|
mkdir -p tools/gogio/bin
|
|
|
|
GOBIN=$(PWD)/tools/gogio/bin go install gioui.org/cmd/gogio@latest
|
2024-01-12 15:49:24 +01:00
|
|
|
|
|
|
|
gitea-release: .mktools build
|
|
|
|
rm -rf .gitea-release
|
|
|
|
mkdir -p .gitea-release
|
|
|
|
|
2024-01-21 15:04:48 +01:00
|
|
|
cp ./bin/desktop_amd64 .gitea-release/arcad_player_linux_amd64
|
|
|
|
|
|
|
|
$(MAKE) GOARCH=arm build-desktop
|
|
|
|
cp ./bin/desktop_arm .gitea-release/arcad_player_linux_arm
|
|
|
|
|
|
|
|
$(MAKE) GOARCH=arm64 build-desktop
|
|
|
|
cp ./bin/desktop_arm64 .gitea-release/arcad_player_linux_arm64
|
|
|
|
|
2024-01-12 15:49:24 +01:00
|
|
|
cp ./bin/client .gitea-release/arcad_client_linux_amd64
|
|
|
|
cp ./android/app/build/outputs/apk/debug/app-debug.apk .gitea-release/arcast_player_debug.apk
|
|
|
|
|
|
|
|
MKT_GITEA_RELEASE_PROJECT="arcast" \
|
|
|
|
MKT_GITEA_RELEASE_ORG="arcad" \
|
|
|
|
MKT_GITEA_RELEASE_BASE_URL="https://forge.cadoles.com" \
|
|
|
|
MKT_GITEA_RELEASE_VERSION="$(MKT_PROJECT_VERSION)" \
|
|
|
|
MKT_GITEA_RELEASE_NAME="$(MKT_PROJECT_VERSION)" \
|
|
|
|
MKT_GITEA_RELEASE_COMMITISH_TARGET="$$(git rev-parse HEAD)" \
|
|
|
|
MKT_GITEA_RELEASE_IS_DRAFT="false" \
|
|
|
|
MKT_GITEA_RELEASE_IS_PRERELEASE="false" \
|
|
|
|
MKT_GITEA_RELEASE_BODY="" \
|
|
|
|
MKT_GITEA_RELEASE_ATTACHMENTS="$$(find .gitea-release/* -type f)" \
|
|
|
|
$(MAKE) mkt-gitea-release
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: mktools
|
|
|
|
mktools:
|
|
|
|
rm -rf .mktools
|
|
|
|
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | $(SHELL)
|
|
|
|
|
|
|
|
.mktools:
|
|
|
|
$(MAKE) mktools
|
|
|
|
|
|
|
|
-include .mktools/*.mk
|