Skip to content

Commit

Permalink
Merge branch 'build-config'
Browse files Browse the repository at this point in the history
  • Loading branch information
mwageringel committed Jul 22, 2022
2 parents bd918ec + 8ec6eb4 commit 8376fb1
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
*.ico
*.apk
*.apk.sha1
/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
/android/app/src/main/res/values/colors.xml

# Miscellaneous
*.class
Expand Down
64 changes: 41 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,52 +1,70 @@
all: app web
app: fonts icons
flutter build apk
FLUTTER=flutter
BASEHREF=/demo/
web: fonts icons
flutter build web --base-href=$(BASEHREF) --release

all: app web
app: assets-android
$(FLUTTER) config --no-analytics
$(FLUTTER) build apk
web: assets-web
$(FLUTTER) build web --base-href=$(BASEHREF) --release
rm -rf website/demo/
cp -p -r build/web/ website/demo/
gh-pages:
flutter clean
make BASEHREF=/everest/demo/ web
$(FLUTTER) clean
$(MAKE) BASEHREF=/everest/demo/ web
# assumes worktree gh-pages is checked out in ./gh-pages/
cd gh-pages && git rm -rf . --ignore-unmatch && cp -p -r ../website/* . && git add . && git commit --amend --no-edit
host:
cd website && python -m http.server 8000
run: fonts icons
flutter run
run: assets-android assets-web
$(FLUTTER) run
test:
flutter test test/expressions_test.dart
$(FLUTTER) test test/expressions_test.dart
clean: icons-clean
flutter clean
$(FLUTTER) clean
rm -rf website/demo/

icons: android/app/src/main/res/mipmap-hdpi/ic_launcher.png website/favicon.ico web/favicon.ico web/icons/Icon-192.png web/icons/Icon-maskable-192.png web/icons/Icon-512.png web/icons/Icon-maskable-512.png
android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png
flutter pub get
flutter pub run flutter_launcher_icons:main
assets-android: fonts icons-android
assets-web: fonts icons-web

# rasterized icons are generated from an svg file
icons-android: android/app/src/main/res/mipmap-hdpi/ic_launcher.png
assets/launcher_icon.png: assets/launcher_icon.svg
inkscape -w 1024 -h 1024 assets/launcher_icon.svg -o assets/launcher_icon.png
rsvg-convert --width=1024 --height=1024 --keep-aspect-ratio assets/launcher_icon.svg > $@
assets/launcher_icon_adaptive.png: assets/launcher_icon_adaptive.svg
rsvg-convert --width=1024 --height=1024 --keep-aspect-ratio assets/launcher_icon_adaptive.svg > $@
android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png assets/launcher_icon_adaptive.png
$(FLUTTER) pub get
$(FLUTTER) pub run flutter_launcher_icons:main

icons-web: website/favicon.ico web/favicon.ico web/icons/Icon-192.png web/icons/Icon-maskable-192.png web/icons/Icon-512.png web/icons/Icon-maskable-512.png
web/favicon.ico website/favicon.ico: assets/launcher_icon.svg
magick -background none assets/launcher_icon.svg -define icon:auto-resize $@
web/icons/Icon-192.png web/icons/Icon-maskable-192.png: assets/launcher_icon.svg
web/icons/Icon-192.png: assets/launcher_icon.svg
mkdir -p web/icons/
rsvg-convert --width=192 --height=192 --keep-aspect-ratio assets/launcher_icon.svg > $@
web/icons/Icon-512.png: assets/launcher_icon.svg
mkdir -p web/icons/
rsvg-convert --width=512 --height=512 --keep-aspect-ratio assets/launcher_icon.svg > $@
web/icons/Icon-maskable-192.png: assets/launcher_icon_maskable.svg
mkdir -p web/icons/
inkscape -w 192 -h 192 assets/launcher_icon.svg -o $@
web/icons/Icon-512.png web/icons/Icon-maskable-512.png: assets/launcher_icon.svg
rsvg-convert --width=192 --height=192 --keep-aspect-ratio -b '#536dfeff' assets/launcher_icon_maskable.svg > $@
web/icons/Icon-maskable-512.png: assets/launcher_icon_maskable.svg
mkdir -p web/icons/
inkscape -w 512 -h 512 assets/launcher_icon.svg -o $@
rsvg-convert --width=512 --height=512 --keep-aspect-ratio -b '#536dfeff' assets/launcher_icon_maskable.svg > $@
icons-clean:
rm -f android/app/src/main/res/mipmap-*/ic_launcher.png
rm -f website/favicon.ico web/favicon.ico web/icons/*.png
rm -f assets/launcher_icon.png
rm -f assets/launcher_icon.png assets/launcher_icon_adaptive.png

# fonts are downloaded and bundled into the app
fonts: fonts/NotoSansMath-Regular.ttf
fonts/NotoSansMath-Regular.ttf: | build/upstream/Noto_Sans_Math.zip
mkdir -p fonts/
unzip -o build/upstream/Noto_Sans_Math.zip -d fonts/
build/upstream/Noto_Sans_Math.zip:
mkdir -p build/upstream/
wget -O build/upstream/Noto_Sans_Math.zip https://fonts.google.com/download?family=Noto%20Sans%20Math
curl --output build/upstream/Noto_Sans_Math.zip https://fonts.google.com/download?family=Noto%20Sans%20Math
.INTERMEDIATE: build/upstream/Noto_Sans_Math.zip

.PHONY: all app web gh-pages host run test zip fonts icons icons-clean clean
.PHONY: all app web gh-pages host run test assets-android assets-web fonts icons-android icons-web icons-clean clean
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ A mathematical puzzle game. Try it at https://mwageringel.github.io/everest/

## Build dependencies

Building with `make` requires `flutter, python, inkscape, imagemagick`.
Building with `make` requires `flutter, curl, rsvg-convert, imagemagick`.


APK signing certificate fingerprint (SHA-256):

576bae61b2aba5d1d32a17d373baa36e05beaaefb67d9b47218d004c0e8333d9
75 changes: 48 additions & 27 deletions assets/launcher_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions assets/launcher_icon_adaptive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8376fb1

Please sign in to comment.