add makefile shortcuts for iOS development

This commit is contained in:
Ivan Smolin 2022-12-08 18:59:01 +03:00
parent 18cf87ea18
commit a54982e482
4 changed files with 115 additions and 0 deletions

14
xcode/bootstrap/Brewfile Normal file
View File

@ -0,0 +1,14 @@
# Working environment
brew "rbenv" # ruby + bundler
brew "gettext"
# Code, configs and project generation
brew "php"
brew "python"
brew "xcodegen"
# code quality
brew "pmd"
# CI badge
# brew "imagemagick"

9
xcode/bootstrap/Gemfile Normal file
View File

@ -0,0 +1,9 @@
source "https://rubygems.org"
gem "cocoapods"
gem "fastlane"
gem 'mustache' # for config generator
gem 'xcode-install'
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

86
xcode/bootstrap/Makefile Normal file
View File

@ -0,0 +1,86 @@
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
RUBY_VERSION="2.7.6"
open_project=(open *.xcworkspace)
install_dev_certs=(bundle exec fastlane SyncCodeSigning type:development readonly:true)
install_pods=(bundle exec pod install || bundle exec pod install --repo-update)
TARGET_MAX_CHAR_NUM=20
## Show help
help:
@echo ''
@echo 'Использование:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Команды:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
## Инициализирует проект и устанавливает системные утилиты
init:
brew bundle
eval "$(rbenv init -)"
rbenv install -s ${RUBY_VERSION}
rbenv global ${RUBY_VERSION}
if ! gem spec bundler > /dev/null 2>&1; then\
echo "bundler gem is not installed!";\
-sudo gem install bundler;\
fi
bundle install
xcodegen generate
$(call install_pods)
bundle exec fastlane install_plugins
$(call install_dev_certs)
$(call open_project)
git config --local core.hooksPath .githooks
## Устанавливает поды
pod:
$(call install_pods)
## Устанавливает сертификат и профили для запуска на девайсе
dev_certs:
$(call install_dev_certs)
## Открывает папку для ручного редактирования сертификатов и профайлов
update_certs:
bundle exec fastlane ManuallyUpdateCodeSignin
## Поднимает версию приложения (параметр "X.Y.Z")
bumpAppVersion:
ifeq ($(version),undefined)
@echo "Version parameter is missing (ex: x.y.z)" $(target)
else
bundle exec fastlane run increment_version_number version_number:$(version)
endif
## Позволяет быстро открыть workspace проекта
start:
$(call open_project)
## Очищает содержимое папки DerivedData
clean:
rm -rf ~/Library/Developer/Xcode/DerivedData/*

6
xcode/bootstrap/setup.command Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIR="${DIR}/../../../"
make init -C ${PROJECT_DIR}