-
Notifications
You must be signed in to change notification settings - Fork 76
/
Rakefile
97 lines (82 loc) · 2.43 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
namespace :build do
desc 'Builds the Epoxy package'
task :package do
xcodebuild 'build -scheme Epoxy -destination generic/platform=iOS'
end
desc 'Builds the EpoxyCore package for iOS, macOS, and tvOS'
task :EpoxyCore do
xcodebuild 'build -scheme EpoxyCore -destination generic/platform=iOS'
xcodebuild 'build -scheme EpoxyCore -destination generic/platform=tvOS'
xcodebuild 'build -scheme EpoxyCore -destination generic/platform=macOS'
end
desc 'Builds the EpoxyExample app'
task :example do
xcodebuild 'build -scheme EpoxyExample -destination "platform=iOS Simulator,name=iPhone 14"'
end
end
namespace :test do
desc 'Runs all tests in the package'
task :package => ['test:unit', 'test:performance']
desc 'Runs unit tests'
task :unit do
xcodebuild 'test -scheme EpoxyTests -destination "platform=iOS Simulator,name=iPhone 14"'
end
desc 'Runs performance tests'
task :performance do
xcodebuild 'test -scheme PerformanceTests -destination "platform=iOS Simulator,name=iPhone 14"'
end
end
namespace :lint do
desc 'Lints the podspec'
task :podspec do
Dir.glob('*.podspec') do |spec|
sh "bundle exec pod lib lint #{spec} --include-podspecs=**/*.podspec"
end
end
desc 'Lints swift files'
task :swift do
sh 'swift package --allow-writing-to-package-directory format --lint'
end
end
namespace :publish do
desc 'Publishes the podspec'
task :podspec do
# Topologically sorted by dependencies
podspecs = [
'EpoxyCore',
'EpoxyLayoutGroups',
'EpoxyCollectionView',
'EpoxyBars',
'EpoxyNavigationController',
'EpoxyPresentations',
'Epoxy',
]
for podspec in podspecs
sh "bundle exec pod trunk push #{podspec}.podspec --synchronous"
sh "bundle exec pod repo update"
end
end
end
namespace :format do
desc 'Runs AirbnbSwiftFormatTool'
task :swift do
sh 'swift package --allow-writing-to-package-directory format'
end
end
namespace :run do
desc 'Runs necessary checks before pushing a branch or commit'
task :pre_push => ['format:swift', 'lint:swift', 'test:package']
end
task :default do
system 'rake -T'
end
private
def xcodebuild(command)
# Check if the mint tool is installed -- if so, pipe the xcodebuild output through xcbeautify
`which mint`
if $?.success?
sh "set -o pipefail && xcodebuild #{command} | mint run thii/[email protected]"
else
sh "xcodebuild #{command}"
end
end