From 0412527ca624ecc6a348f6260d54f7c7c2d83314 Mon Sep 17 00:00:00 2001 From: Alexey Korolev Date: Tue, 13 Feb 2024 15:58:31 +0300 Subject: [PATCH] Transition to Cocoapods PM (#199) * Transition to Cocoapods PM * Skip fastlane generation * Add mint * Switch to MacOS 14 --- .github/workflows/generate.yml | 12 +++++++----- CHANGELOG.md | 6 ++++++ hooks/post_gen_project.sh | 3 +++ {{ cookiecutter.name }}/Gemfile | 4 +--- {{ cookiecutter.name }}/Makefile | 17 ++++++++++++----- {{ cookiecutter.name }}/Mintfile | 2 -- {{ cookiecutter.name }}/Podfile | 8 ++++++++ {{ cookiecutter.name }}/README.md | 2 +- {{ cookiecutter.name }}/fastlane/Fastfile | 8 ++++---- {{ cookiecutter.name }}/fastlane/Gymfile | 2 +- {{ cookiecutter.name }}/fastlane/Pluginfile | 5 ----- {{ cookiecutter.name }}/project.yml | 7 ++----- 12 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 {{ cookiecutter.name }}/Podfile delete mode 100644 {{ cookiecutter.name }}/fastlane/Pluginfile diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index bd76b6a..8159ca1 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -4,7 +4,7 @@ on: [push] jobs: test: - runs-on: macos-12 + runs-on: macos-14 env: MINT_PATH: "~/mint_cache" @@ -20,8 +20,10 @@ jobs: - name: Generate project and run tests run: | - brew install cookiecutter mint - cookiecutter --no-input -f . - cd Project - mint bootstrap + export PATH=~/.rbenv/shims:"$PATH" + + brew install cookiecutter rbenv mint && + rbenv install 2.7.7 && rbenv global 2.7.7 && + cookiecutter --no-input -f . && + cd Project && make test diff --git a/CHANGELOG.md b/CHANGELOG.md index 96cbff8..d908153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [2.0.0] - 2024-02-13 +### Changed +- Перешел на Cocoapods PM +### Removed +- Удален fastlane badge plugin + ## [1.9.0] - 2023-12-22 ### Added - Добавлен .ruby-version файл diff --git a/hooks/post_gen_project.sh b/hooks/post_gen_project.sh index b725b98..a519f12 100755 --- a/hooks/post_gen_project.sh +++ b/hooks/post_gen_project.sh @@ -15,8 +15,11 @@ echo 'fastlane/api-key.json' >> .gitignore echo '.cache' >> .gitignore {% if cookiecutter.ignore_xcproject == "Yes" %} echo '{{ cookiecutter.name }}.xcodeproj' >> .gitignore + echo '{{ cookiecutter.name }}.xcworkspace' >> .gitignore {% endif %} +echo 'Pods' >> .gitignore + make fmt make gems diff --git a/{{ cookiecutter.name }}/Gemfile b/{{ cookiecutter.name }}/Gemfile index e01f77a..20279b6 100644 --- a/{{ cookiecutter.name }}/Gemfile +++ b/{{ cookiecutter.name }}/Gemfile @@ -1,6 +1,4 @@ source 'https://rubygems.org' gem 'fastlane' - -plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') -eval_gemfile(plugins_path) if File.exist?(plugins_path) +gem 'cocoapods', '~> 1.15.0' diff --git a/{{ cookiecutter.name }}/Makefile b/{{ cookiecutter.name }}/Makefile index c97abc3..f688bf5 100644 --- a/{{ cookiecutter.name }}/Makefile +++ b/{{ cookiecutter.name }}/Makefile @@ -1,4 +1,6 @@ API_KEY := fastlane/api-key.json +SWIFTGEN = Pods/SwiftGen/bin/swiftgen +SWIFTFORMAT = Pods/SwiftFormat/CommandLineTool/swiftformat .PHONY: all all: test @@ -11,6 +13,11 @@ $(API_KEY): bootstrap: homebrew hook certs mint bootstrap +.PHONY: pods +## pods: Download project packages +pods: gems + bundle exec pod install + .PHONY: certs ## certs: Download Apple certificates for development certs: gems $(API_KEY) @@ -19,7 +26,7 @@ certs: gems $(API_KEY) .PHONY: project ## project: Generate .xcodeproj file using XcodeGen utility project: - mint run "yonaskolb/XcodeGen" + mint run "yonaskolb/XcodeGen@2.38.0" .PHONY: test ## test: Launch unit tests @@ -39,24 +46,24 @@ homebrew: .PHONY: fmt ## fmt: Launch swift files code formatter fmt: - mint run swiftformat swiftformat {{ cookiecutter.name }} {{ cookiecutter.name }}Tests + $(SWIFTFORMAT) {{ cookiecutter.name }} {{ cookiecutter.name }}Tests .PHONY: lint ## lint: Launch swift files linter check lint: - mint run swiftformat {{ cookiecutter.name }} {{ cookiecutter.name }}Tests --lint + $(SWIFTFORMAT) {{ cookiecutter.name }} {{ cookiecutter.name }}Tests --lint .PHONY: xcfilelist ## xcfilelist: Regenerate xcfilelist files xcfilelist: - mint run swiftgen config generate-xcfilelists \ + $(SWIFTGEN) config generate-xcfilelists \ --inputs swiftgen-input-files.xcfilelist \ --outputs swiftgen-output-files.xcfilelist .PHONY: swiftgen ## swiftgen: Trigger code generation from assets with swiftgen tool swiftgen: - mint run swiftgen + $(SWIFTGEN) GIT_HOOKS_SCRIPTS := $(wildcard hooks/*) diff --git a/{{ cookiecutter.name }}/Mintfile b/{{ cookiecutter.name }}/Mintfile index fe7f09e..23c906a 100644 --- a/{{ cookiecutter.name }}/Mintfile +++ b/{{ cookiecutter.name }}/Mintfile @@ -1,3 +1 @@ nicklockwood/swiftformat@0.52.0 -swiftgen/swiftgen@6.6.2 -yonaskolb/XcodeGen@2.36.0 diff --git a/{{ cookiecutter.name }}/Podfile b/{{ cookiecutter.name }}/Podfile new file mode 100644 index 0000000..083a5ce --- /dev/null +++ b/{{ cookiecutter.name }}/Podfile @@ -0,0 +1,8 @@ +platform :ios, '{{ cookiecutter.deployment_target }}' + +inhibit_all_warnings! + +target '{{ cookiecutter.name | lower }}' do + pod 'SwiftGen', '~> 6.5.1' + pod 'SwiftFormat/CLI', '~> 0.53' +end diff --git a/{{ cookiecutter.name }}/README.md b/{{ cookiecutter.name }}/README.md index 7cf0ed9..18af738 100644 --- a/{{ cookiecutter.name }}/README.md +++ b/{{ cookiecutter.name }}/README.md @@ -28,4 +28,4 @@ The resulted encrypted file should be committed to the repository. --- -This project was created using [the project template](https://github.com/alphatroya/swift-project-template) version 1.9.0. +This project was created using [the project template](https://github.com/alphatroya/swift-project-template) version 2.0.0. diff --git a/{{ cookiecutter.name }}/fastlane/Fastfile b/{{ cookiecutter.name }}/fastlane/Fastfile index a33efd5..c2c19be 100644 --- a/{{ cookiecutter.name }}/fastlane/Fastfile +++ b/{{ cookiecutter.name }}/fastlane/Fastfile @@ -9,6 +9,10 @@ deploy_dir = ENV['BITRISE_DEPLOY_DIR'] platform :ios do + before_each do + skip_docs + end + desc 'Create a new application on the developer portal' lane :create do produce @@ -48,10 +52,6 @@ platform :ios do readonly: true ) - add_badge( - glob: '/{{ cookiecutter.name }}/**/*.appiconset/*.{png, PNG}' - ) - increment_build_number( build_number: build_number ) diff --git a/{{ cookiecutter.name }}/fastlane/Gymfile b/{{ cookiecutter.name }}/fastlane/Gymfile index 9ec70fd..115b851 100644 --- a/{{ cookiecutter.name }}/fastlane/Gymfile +++ b/{{ cookiecutter.name }}/fastlane/Gymfile @@ -1,3 +1,3 @@ -project "{{ cookiecutter.name }}.xcodeproj" +workspace "{{ cookiecutter.name }}.xcworkspace" scheme "{{ cookiecutter.name | lower }}" clean true diff --git a/{{ cookiecutter.name }}/fastlane/Pluginfile b/{{ cookiecutter.name }}/fastlane/Pluginfile deleted file mode 100644 index 781fae2..0000000 --- a/{{ cookiecutter.name }}/fastlane/Pluginfile +++ /dev/null @@ -1,5 +0,0 @@ -# Autogenerated by fastlane -# -# Ensure this file is checked in to source control! - -gem 'fastlane-plugin-badge' diff --git a/{{ cookiecutter.name }}/project.yml b/{{ cookiecutter.name }}/project.yml index db58800..629c7c8 100644 --- a/{{ cookiecutter.name }}/project.yml +++ b/{{ cookiecutter.name }}/project.yml @@ -1,5 +1,6 @@ name: {{ cookiecutter.name }} options: + postGenCommand: "make pods" deploymentTarget: iOS: {{ cookiecutter.deployment_target }} developmentLanguage: ru @@ -41,11 +42,7 @@ targets: - {{ cookiecutter.name | lower }}Tests prebuildScripts: - script: | - if [ "${CONFIGURATION}" == "Debug" ]; then - if which mint >/dev/null; then - make swiftgen - fi - fi + "${PODS_ROOT}/SwiftGen/bin/swiftgen" name: SwiftGen inputFileLists: - $(SRCROOT)/swiftgen-input-files.xcfilelist