From 7230b6e390c22f66562cdcb31cf877b763042eb1 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 23 Feb 2020 18:00:13 +1000 Subject: [PATCH] support aqt-specific FTL files --- pylib/Makefile | 1 - qt/ftl/.gitignore | 1 + qt/ftl/scripts/fetch-latest-translations | 9 +++++++++ qt/ftl/scripts/upload-latest-templates | 9 +++++++++ rslib/Makefile | 2 +- rspy/Makefile | 15 +++++++++++---- 6 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 qt/ftl/.gitignore create mode 100755 qt/ftl/scripts/fetch-latest-translations create mode 100755 qt/ftl/scripts/upload-latest-templates diff --git a/pylib/Makefile b/pylib/Makefile index 2441d4855..34766523f 100644 --- a/pylib/Makefile +++ b/pylib/Makefile @@ -25,7 +25,6 @@ PROTODEPS := $(wildcard ../proto/*.proto) .build/py-proto: .build/dev-deps $(PROTODEPS) protoc --proto_path=../proto --python_out=anki --mypy_out=anki $(PROTODEPS) - # fixup import path perl -i'' -pe 's/from fluent_pb2/from anki.fluent_pb2/' anki/backend_pb2.pyi perl -i'' -pe 's/import fluent_pb2/import anki.fluent_pb2/' anki/backend_pb2.py @touch $@ diff --git a/qt/ftl/.gitignore b/qt/ftl/.gitignore new file mode 100644 index 000000000..f606d5e0b --- /dev/null +++ b/qt/ftl/.gitignore @@ -0,0 +1 @@ +repo diff --git a/qt/ftl/scripts/fetch-latest-translations b/qt/ftl/scripts/fetch-latest-translations new file mode 100755 index 000000000..5285d7031 --- /dev/null +++ b/qt/ftl/scripts/fetch-latest-translations @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "Downloading latest translations..." + +if [ ! -d repo ]; then + git clone https://github.com/ankitects/anki-desktop-ftl repo +fi + +(cd repo && git pull) diff --git a/qt/ftl/scripts/upload-latest-templates b/qt/ftl/scripts/upload-latest-templates new file mode 100755 index 000000000..a60f3ff2b --- /dev/null +++ b/qt/ftl/scripts/upload-latest-templates @@ -0,0 +1,9 @@ +#!/bin/bash +# +# expects to be run from the ftl folder +# + +test -d repo || exit 1 + +rsync -av --delete *.ftl repo/desktop/templates/ +(cd repo && git add desktop; git commit -m update; git push) diff --git a/rslib/Makefile b/rslib/Makefile index 7afc9979b..8449b4330 100644 --- a/rslib/Makefile +++ b/rslib/Makefile @@ -23,7 +23,7 @@ develop: .build/vernum ftl/repo ftl/repo: (cd ftl && ./scripts/fetch-latest-translations) -ALL_SOURCE := $(find src -type f) $(wildcard ftl/*.ftl) +ALL_SOURCE := $(shell find src -type f) $(wildcard ftl/*.ftl) # nightly currently required for ignoring files in rustfmt.toml RUST_TOOLCHAIN := $(shell cat rust-toolchain) diff --git a/rspy/Makefile b/rspy/Makefile index 7215bf937..9e5dee63f 100644 --- a/rspy/Makefile +++ b/rspy/Makefile @@ -9,16 +9,23 @@ $(shell mkdir -p .build ../dist) OUTDIR := ../dist BUILDFLAGS := --release --strip +FTLS := ../qt/ftl + .PHONY: all develop build check fix clean all: develop -develop: .build/tools .build/vernum - maturin develop $(BUILDFLAGS) +develop: .build/develop -build: .build/tools .build/vernum +.build/develop: .build/tools .build/vernum $(wildcard $(FTLS)/*.ftl) + touch ../proto/backend.proto + FTL_TEMPLATE_DIRS="$(FTLS)" maturin develop $(BUILDFLAGS) + touch $@ + +build: .build/tools .build/vernum $(wildcard $(FTLS)/*.ftl) rm -rf $(OUTDIR)/ankirspy* - maturin build -i $(shell which python3) -o $(OUTDIR) $(BUILDFLAGS) + touch ../proto/backend.proto + FTL_TEMPLATE_DIRS="$(FTLS)" maturin build -i $(shell which python3) -o $(OUTDIR) $(BUILDFLAGS) check: .build/check