mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-08-16 22:20:30 +03:00
Closes #2576. Updates #2275. Updates #2419. Updates #2443. Squashed commit of the following: commit b1a4809ada298d675de12740051ba26fb9945957 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri May 21 14:01:40 2021 +0300 all: add --local-frontend, upd docker commit 619ee7c82f27e3405753003dbec556ffb056d025 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 15:02:33 2021 +0300 bamboo-specs: bump docker version commit 5c2b2fbce80afdcc81fd0cb83674dc3d64facbf1 Merge: 6536b32d9c60aef6
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 15:01:47 2021 +0300 Merge branch 'master' into 2275-upd-go commit 6536b32dd4580425f7dedde6765463a79b9bd699 Merge: 9bb32bc46f7fd33a
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 19 20:38:48 2021 +0300 Merge branch 'master' into 2275-upd-go commit 9bb32bc4c0ac0f3a97195adc75359e48c9c58897 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 19 18:48:50 2021 +0300 all: fix build, imp err handling commit 6868eac7f7d2980fb706881f53e72afe5f7c3447 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 19 18:09:32 2021 +0300 all: fix github lint commit ebbb9c55f32fbd57e34e8b161016aa6b291c097c Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 19 17:36:56 2021 +0300 all: update go and backend tools
126 lines
4.2 KiB
Makefile
126 lines
4.2 KiB
Makefile
# Keep the Makefile POSIX-compliant. We currently allow hyphens in
|
|
# target names, but that may change in the future.
|
|
#
|
|
# See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
|
|
.POSIX:
|
|
|
|
CHANNEL = development
|
|
CLIENT_BETA_DIR = client2
|
|
CLIENT_DIR = client
|
|
COMMIT = $$( git rev-parse --short HEAD )
|
|
DIST_DIR = dist
|
|
# Don't name this macro "GO", because GNU Make apparenly makes it an
|
|
# exported environment variable with the literal value of "${GO:-go}",
|
|
# which is not what we need. Use a dot in the name to make sure that
|
|
# users don't have an environment variable with the same name.
|
|
#
|
|
# See https://unix.stackexchange.com/q/646255/105635.
|
|
GO.MACRO = $${GO:-go}
|
|
GOPROXY = https://goproxy.cn|https://proxy.golang.org|direct
|
|
GPG_KEY = devteam@adguard.com
|
|
GPG_KEY_PASSPHRASE = not-a-real-password
|
|
NPM = npm
|
|
NPM_FLAGS = --prefix $(CLIENT_DIR)
|
|
NPM_INSTALL_FLAGS = $(NPM_FLAGS) --quiet --no-progress --ignore-engines\
|
|
--ignore-optional --ignore-platform --ignore-scripts
|
|
RACE = 0
|
|
SIGN = 1
|
|
VERBOSE = 0
|
|
VERSION = v0.0.0
|
|
YARN = yarn
|
|
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
|
|
YARN_INSTALL_FLAGS = $(YARN_FLAGS) --network-timeout 120000 --silent\
|
|
--ignore-engines --ignore-optional --ignore-platform\
|
|
--ignore-scripts
|
|
|
|
# Macros for the build-release target. If FRONTEND_PREBUILT is 0, the
|
|
# default, the macro $(BUILD_RELEASE_DEPS_$(FRONTEND_PREBUILT)) expands
|
|
# into BUILD_RELEASE_DEPS_0, and so both frontend and backend
|
|
# dependencies are fetched and the frontend is built. Otherwise, if
|
|
# FRONTEND_PREBUILT is 1, only backend dependencies are fetched and the
|
|
# frontend isn't reuilt.
|
|
#
|
|
# TODO(a.garipov): We could probably do that from .../build-release.sh,
|
|
# but that would mean either calling make from inside make or
|
|
# duplicating commands in two places, both of which don't seem to me
|
|
# like nice solutions.
|
|
FRONTEND_PREBUILT = 0
|
|
BUILD_RELEASE_DEPS_0 = deps js-build
|
|
BUILD_RELEASE_DEPS_1 = go-deps
|
|
|
|
ENV = env\
|
|
COMMIT='$(COMMIT)'\
|
|
CHANNEL='$(CHANNEL)'\
|
|
GPG_KEY='$(GPG_KEY)'\
|
|
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
|
|
DIST_DIR='$(DIST_DIR)'\
|
|
GO="$(GO.MACRO)"\
|
|
GOPROXY='$(GOPROXY)'\
|
|
PATH="$${PWD}/bin:$$( "$(GO.MACRO)" env GOPATH )/bin:$${PATH}"\
|
|
RACE='$(RACE)'\
|
|
SIGN='$(SIGN)'\
|
|
VERBOSE='$(VERBOSE)'\
|
|
VERSION='$(VERSION)'\
|
|
|
|
# Keep the line above blank.
|
|
|
|
# Keep this target first, so that a naked make invocation triggers
|
|
# a full build.
|
|
build: deps quick-build
|
|
|
|
quick-build: js-build go-build
|
|
|
|
ci: deps test
|
|
|
|
deps: js-deps go-deps
|
|
lint: js-lint go-lint
|
|
test: js-test go-test
|
|
|
|
# Here and below, keep $(SHELL) in quotes, because on Windows this will
|
|
# expand to something like "C:/Program Files/Git/usr/bin/sh.exe".
|
|
build-docker: ; $(ENV) "$(SHELL)" ./scripts/make/build-docker.sh
|
|
|
|
build-release: $(BUILD_RELEASE_DEPS_$(FRONTEND_PREBUILT))
|
|
$(ENV) "$(SHELL)" ./scripts/make/build-release.sh
|
|
|
|
clean: ; $(ENV) "$(SHELL)" ./scripts/make/clean.sh
|
|
init: ; git config core.hooksPath ./scripts/hooks
|
|
|
|
js-build:
|
|
$(NPM) $(NPM_FLAGS) run build-prod
|
|
$(YARN) $(YARN_FLAGS) build
|
|
js-deps:
|
|
$(NPM) $(NPM_INSTALL_FLAGS) ci
|
|
$(YARN) $(YARN_INSTALL_FLAGS) install
|
|
|
|
# TODO(a.garipov): Remove the legacy client tasks support once the new
|
|
# client is done and the old one is removed.
|
|
js-lint: ; $(NPM) $(NPM_FLAGS) run lint
|
|
js-test: ; $(NPM) $(NPM_FLAGS) run test
|
|
js-beta-lint: ; $(YARN) $(YARN_FLAGS) lint
|
|
js-beta-test: ; # TODO(v.abdulmyanov): Add tests for the new client.
|
|
|
|
go-build: ; $(ENV) "$(SHELL)" ./scripts/make/go-build.sh
|
|
go-deps: ; $(ENV) "$(SHELL)" ./scripts/make/go-deps.sh
|
|
go-lint: ; $(ENV) "$(SHELL)" ./scripts/make/go-lint.sh
|
|
go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh
|
|
|
|
# TODO(a.garipov): Think about making RACE='1' the default for all
|
|
# targets.
|
|
go-test: ; $(ENV) RACE='1' "$(SHELL)" ./scripts/make/go-test.sh
|
|
|
|
go-check: go-tools go-lint go-test
|
|
|
|
# A quick check to make sure that all supported operating systems can be
|
|
# typechecked and built successfully.
|
|
go-os-check:
|
|
env GOOS='darwin' "$(GO.MACRO)" vet ./internal/...
|
|
env GOOS='freebsd' "$(GO.MACRO)" vet ./internal/...
|
|
env GOOS='linux' "$(GO.MACRO)" vet ./internal/...
|
|
env GOOS='windows' "$(GO.MACRO)" vet ./internal/...
|
|
|
|
openapi-lint: ; cd ./openapi/ && $(YARN) test
|
|
openapi-show: ; cd ./openapi/ && $(YARN) start
|
|
|
|
txt-lint: ; $(ENV) "$(SHELL)" ./scripts/make/txt-lint.sh
|