Skip to content

Commit

Permalink
Fixed the localization export/import scripts for Xcode 15
Browse files Browse the repository at this point in the history
  • Loading branch information
newmarcel committed Jun 23, 2023
1 parent e5fc332 commit f7d4c2c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Localizations/l10n-config.sh
Expand Up @@ -4,6 +4,7 @@ set -e
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
PROJECT_NAME="KeepingYouAwake"
PROJECT_FILE_PATH="${BASE_DIR}/../${PROJECT_NAME}.xcodeproj"
WORKSPACE_FILE_PATH="${BASE_DIR}/../${PROJECT_NAME}.xcworkspace"
TARGET_DIR="${BASE_DIR}/${PROJECT_NAME}"

TRANSLATIONS=("da" "de" "es" "fr" "id" "it" "ja" "ko" "nl" "pl" "pt" "ru" "tr" "uk" "zh-Hant-TW" "zh")
TRANSLATIONS=("da" "de" "es" "fr" "id" "it" "ja" "ko" "nl" "pl" "pt" "ru" "tr" "uk" "zh-Hant" "zh")
6 changes: 4 additions & 2 deletions Localizations/l10n-export.sh
Expand Up @@ -11,6 +11,8 @@ done

echo "Exporting translations..."
xcodebuild -exportLocalizations -localizationPath "${TARGET_DIR}" \
-project "${PROJECT_FILE_PATH}" ${EXPORT_LANG} \
-disableAutomaticPackageResolution -onlyUsePackageVersionsFromResolvedFile
-workspace "${WORKSPACE_FILE_PATH}" ${EXPORT_LANG} \
-scheme "${PROJECT_NAME}" \
-disableAutomaticPackageResolution -onlyUsePackageVersionsFromResolvedFile -skipPackageUpdates \
PRODUCT_NAME="\$(TARGET_NAME)"
echo "Done."
6 changes: 4 additions & 2 deletions Localizations/l10n-import.sh
Expand Up @@ -10,7 +10,9 @@ fi
echo "Importing translations..."
for language in "${TRANSLATIONS[@]}"; do
xcodebuild -importLocalizations -localizationPath "${TARGET_DIR}/${language}.xcloc" \
-project "${PROJECT_FILE_PATH}" \
-disableAutomaticPackageResolution -onlyUsePackageVersionsFromResolvedFile
-workspace "${WORKSPACE_FILE_PATH}" ${EXPORT_LANG} \
-scheme "${PROJECT_NAME}" \
-disableAutomaticPackageResolution -onlyUsePackageVersionsFromResolvedFile -skipPackageUpdates \
PRODUCT_NAME="\$(TARGET_NAME)"
done
echo "Done."
6 changes: 0 additions & 6 deletions Localizations/l10n-update.sh

This file was deleted.

43 changes: 34 additions & 9 deletions Makefile
@@ -1,12 +1,14 @@
NAME = KeepingYouAwake
VERSION = 1.6.3
VERSION = 1.6.5

SCHEME = $(NAME)
TARGET = $(NAME)
DIST_TARGET = $(NAME) (Direct)
WORKSPACE = $(NAME).xcworkspace
CONFIGURATION = Debug

BUILD_DIR = build
OUTPUT_DIR = dist
LOCALIZATIONS_DIR = Localizations

XCODEBUILD = set -o pipefail && env NSUnbufferedIO=YES xcodebuild
BEAUTIFY = | xcbeautify
Expand All @@ -17,20 +19,48 @@ default: clean

clean:
$(RM) -r $(BUILD_DIR)
PHONY: clean

dist-clean:
$(RM) -r $(OUTPUT_DIR)
PHONY: dist-clean

test:
@mkdir -p "$(BUILD_DIR)"
$(XCODEBUILD) test \
-workspace "$(WORKSPACE)" \
-scheme "$(SCHEME)" \
-configuration "$(CONFIGURATION)" \
-derivedDataPath "$(BUILD_DIR)" \
$(DISABLE_PACKAGE_RESOLUTION) \
$(SAVE_LOG) \
$(BEAUTIFY)
PHONY: test

test-with-sanitizers:
@mkdir -p "$(BUILD_DIR)"
$(XCODEBUILD) test \
-workspace "$(WORKSPACE)" \
-scheme "$(SCHEME)" \
-testPlan "SanitizerTestPlan" \
-derivedDataPath "$(BUILD_DIR)" \
$(DISABLE_PACKAGE_RESOLUTION) \
$(SAVE_LOG) \
$(BEAUTIFY)
PHONY: test-with-sanitizers

l10n-export:
Localizations/l10n-export.sh
.PHONY: l10n-export

l10n-import:
Localizations/l10n-import.sh
.PHONY: l10n-export

l10n-update:
$(MAKE) l10n-export
$(MAKE) l10n-import
$(MAKE) l10n-export
.PHONY: l10n-update

$(OUTPUT_DIR)/$(NAME).xcarchive:
$(XCODEBUILD) archive \
Expand Down Expand Up @@ -58,9 +88,4 @@ $(OUTPUT_DIR)/$(NAME)-$(VERSION).zip:
dist: $(OUTPUT_DIR)/$(NAME)-$(VERSION).zip
@echo "Verifying code signing identity..."
@spctl -a -vv $(OUTPUT_DIR)/$(NAME).app

clangformat:
$(info Reformatting source files with clang-format...)
clang-format -style=file -i $(shell pwd)/**/*.{h,m}

.PHONY: clean dist-clean test dist clang-format
PHONY: dist

0 comments on commit f7d4c2c

Please sign in to comment.