Skip to content

Commit

Permalink
Update archive task and add clean, release task.
Browse files Browse the repository at this point in the history
  • Loading branch information
niw committed Jul 19, 2023
1 parent 1ce0ff4 commit 44dcd41
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
NAME := WindowAlignment

BUNDLE_ID := at.niw.$(NAME)

PROJECT_PATH := Applications/$(NAME).xcodeproj
SOURCES_PATH := Applications/$(NAME)/Sources
RESOURCES_PATH := Applications/$(NAME)/Resources

BUILD_PATH := .build

ARCHIVE_PATH := $(BUILD_PATH)/archive
ARCHIVE_PRODUCT_BUNDLE_PATH := $(ARCHIVE_PATH).xcarchive/Products/Applications/$(NAME).app

RELEASE_ARCHIVE_PATH := $(BUILD_PATH)/$(NAME).zip

# This is intentional to have this as a default target.
.PHONY: reset_accessibility_access
reset_accessibility_access:
tccutil reset Accessibility $(BUNDLE_ID)

.PHONY: clean
clean:
git clean -dfX

.PHONY: genstrings
genstrings:
find "$(SOURCES_PATH)" -name "*.swift" -print0 | \
xargs -0 genstrings -SwiftUI -u -q -o $(RESOURCES_PATH)/Base.lproj
find "$(RESOURCES_PATH)/Base.lproj" -name "*.strings" -print0 | \
xargs -0 -n 1 bash -c 'iconv -f UTF-16LE -t UTF-8 "$$@" > "$$@".utf8 && mv "$$@".utf8 "$$@"' -

.PHONY: archive
archive:
$(ARCHIVE_PRODUCT_BUNDLE_PATH):
xcodebuild \
-project "$(PROJECT_PATH)" \
-configuration Release \
-scheme "$(NAME)" \
-derivedDataPath "$(BUILD_PATH)" \
-archivePath "$(BUILD_PATH)/$(NAME)" \
-archivePath "$(ARCHIVE_PATH)" \
archive

.PHONY: archive
archive: $(ARCHIVE_PRODUCT_BUNDLE_PATH)

$(RELEASE_ARCHIVE_PATH): $(ARCHIVE_PRODUCT_BUNDLE_PATH)
ditto -c -k --sequesterRsrc --keepParent "$<" "$@"

.PHONY: release
release: $(RELEASE_ARCHIVE_PATH)

0 comments on commit 44dcd41

Please sign in to comment.