Skip to content

Commit

Permalink
Transition to Cocoapods PM (#199)
Browse files Browse the repository at this point in the history
* Transition to Cocoapods PM

* Skip fastlane generation

* Add mint

* Switch to MacOS 14
  • Loading branch information
alphatroya authored Feb 13, 2024
1 parent 1ff093c commit 0412527
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 31 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push]

jobs:
test:
runs-on: macos-12
runs-on: macos-14
env:
MINT_PATH: "~/mint_cache"

Expand All @@ -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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 файл
Expand Down
3 changes: 3 additions & 0 deletions hooks/post_gen_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions {{ cookiecutter.name }}/Gemfile
Original file line number Diff line number Diff line change
@@ -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'
17 changes: 12 additions & 5 deletions {{ cookiecutter.name }}/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
API_KEY := fastlane/api-key.json
SWIFTGEN = Pods/SwiftGen/bin/swiftgen
SWIFTFORMAT = Pods/SwiftFormat/CommandLineTool/swiftformat

.PHONY: all
all: test
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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/*)

Expand Down
2 changes: 0 additions & 2 deletions {{ cookiecutter.name }}/Mintfile
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
nicklockwood/[email protected]
swiftgen/[email protected]
yonaskolb/[email protected]
8 changes: 8 additions & 0 deletions {{ cookiecutter.name }}/Podfile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion {{ cookiecutter.name }}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 4 additions & 4 deletions {{ cookiecutter.name }}/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,10 +52,6 @@ platform :ios do
readonly: true
)

add_badge(
glob: '/{{ cookiecutter.name }}/**/*.appiconset/*.{png, PNG}'
)

increment_build_number(
build_number: build_number
)
Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.name }}/fastlane/Gymfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
project "{{ cookiecutter.name }}.xcodeproj"
workspace "{{ cookiecutter.name }}.xcworkspace"
scheme "{{ cookiecutter.name | lower }}"
clean true
5 changes: 0 additions & 5 deletions {{ cookiecutter.name }}/fastlane/Pluginfile

This file was deleted.

7 changes: 2 additions & 5 deletions {{ cookiecutter.name }}/project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: {{ cookiecutter.name }}
options:
postGenCommand: "make pods"
deploymentTarget:
iOS: {{ cookiecutter.deployment_target }}
developmentLanguage: ru
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0412527

Please sign in to comment.