XcodeGen/Makefile
2018-09-19 21:10:25 +10:00

48 lines
1.4 KiB
Makefile

TOOL_NAME = XcodeGen
export EXECUTABLE_NAME = xcodegen
VERSION = 1.11.2
PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)
SHARE_PATH = $(PREFIX)/share/$(EXECUTABLE_NAME)
CURRENT_PATH = $(PWD)
REPO = https://github.com/yonaskolb/$(TOOL_NAME)
RELEASE_TAR = $(REPO)/archive/$(VERSION).tar.gz
SHA = $(shell curl -L -s $(RELEASE_TAR) | shasum -a 256 | sed 's/ .*//')
.PHONY: install build uninstall format_code update_brew release
install: build
mkdir -p $(PREFIX)/bin
cp -f .build/release/$(EXECUTABLE_NAME) $(INSTALL_PATH)
mkdir -p $(SHARE_PATH)
cp -R $(CURRENT_PATH)/SettingPresets $(SHARE_PATH)/SettingPresets
build:
swift build --disable-sandbox -c release -Xswiftc -static-stdlib
uninstall:
rm -f $(INSTALL_PATH)
rm -rf $(SHARE_PATH)
format_code:
swiftformat Tests --wraparguments beforefirst --stripunusedargs closure-only --header strip --disable blankLinesAtStartOfScope
swiftformat Sources --wraparguments beforefirst --stripunusedargs closure-only --header strip --disable blankLinesAtStartOfScope
release: format_code
sed -i '' 's|\(let version = try Version("\)\(.*\)\(")\)|\1$(VERSION)\3|' Sources/XcodeGen/main.swift
git add .
git commit -m "Update to $(VERSION)"
#git tag $(VERSION)
publish: archive bump_brew
echo "published $(VERSION)"
bump_brew:
brew update
brew bump-formula-pr --url=$(RELEASE_TAR) XcodeGen
archive: build
./scripts/archive.sh