cint 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cint +57 -15
- data/lib/cint.rb +2 -0
- data/lib/cint/carthage_files.rb +14 -0
- data/lib/cint/cleanup.rb +19 -0
- data/lib/cint/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20a5e222485438a3ffb646bb8b4330e7cbb14001d41df6317d4a5cf8353cf437
|
4
|
+
data.tar.gz: 694344df09fbcdd6774feff23ce3ee9587aa813c0362228e2388b28a940e6253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12d6f169dd2e8f3914f5a4baa74345863fdc65f8bc9d494a7bda4852c7e6872390317b525866fff54786bddd38bd1035b3a422058c7e0a28110a0b4cb46c5b56
|
7
|
+
data.tar.gz: ea55553f8aa0300f081e1448f50ea8c57990de2bea1cf30e14dcf737545cbc18d28756b2ba648445c3994125da78082a4e30122157a210003e6b11a165b1b679
|
data/bin/cint
CHANGED
@@ -15,6 +15,8 @@ program :version, Cint::VERSION
|
|
15
15
|
program :description, 'Integrates Carthage Frameworks'
|
16
16
|
program :help, 'Author', 'Alex Antonyuk <alex@antonyuk.me>'
|
17
17
|
|
18
|
+
default_command :install
|
19
|
+
|
18
20
|
def error(message)
|
19
21
|
puts "\nError: #{message}".red
|
20
22
|
exit
|
@@ -40,19 +42,6 @@ SDK_TO_PLATFORM = {
|
|
40
42
|
|
41
43
|
PLATFORMS = %w(iOS Mac watchOS tvOS).freeze
|
42
44
|
|
43
|
-
# Carthage
|
44
|
-
class CarthageFiles
|
45
|
-
def self.exists
|
46
|
-
Dir.exist? './Carthage/Build'
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.frameworks(platform)
|
50
|
-
return [] unless PLATFORMS.include?(platform)
|
51
|
-
pattern = "./Carthage/Build/#{platform}/*.framework"
|
52
|
-
Dir.glob(pattern)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
45
|
def prepare_inputs(frameworks)
|
57
46
|
frameworks.map do |f|
|
58
47
|
"$(SRCROOT)#{f[1..-1]}"
|
@@ -107,7 +96,7 @@ end
|
|
107
96
|
|
108
97
|
def intergate_frameworks(target, project)
|
109
98
|
platform = SDK_TO_PLATFORM[target.sdk]
|
110
|
-
frameworks = CarthageFiles.frameworks(platform)
|
99
|
+
frameworks = Cint::CarthageFiles.frameworks(platform)
|
111
100
|
|
112
101
|
if frameworks.empty?
|
113
102
|
warning 'No frameworks found'
|
@@ -138,7 +127,7 @@ command :install do |c|
|
|
138
127
|
c.syntax = 'cint install <project_name>'
|
139
128
|
c.description = 'Adds frameworks built by Carthage into a project'
|
140
129
|
c.action do |args, _|
|
141
|
-
error 'Carthage build folder does not exists' unless CarthageFiles.exists
|
130
|
+
error 'Carthage build folder does not exists' unless Cint::CarthageFiles.exists
|
142
131
|
|
143
132
|
# Choose Project
|
144
133
|
project_name = get_project_name(args)
|
@@ -159,3 +148,56 @@ command :install do |c|
|
|
159
148
|
info 'Done. Re-open Project'
|
160
149
|
end
|
161
150
|
end
|
151
|
+
|
152
|
+
def cleanup_orphaned_symbols(frameworks)
|
153
|
+
used_symbols = frameworks.flat_map do |framework|
|
154
|
+
Cint::Cleanup.bcsymbolmap(framework)
|
155
|
+
end
|
156
|
+
all = Cint::Cleanup.all_bcsymbolmap
|
157
|
+
orphans = all - used_symbols
|
158
|
+
|
159
|
+
warning "There are no orphan symbols" if orphans.empty?
|
160
|
+
orphans.each_with_index do |symb, index|
|
161
|
+
puts "(#{index + 1}/#{orphans.count}) Removing #{symb}...".red
|
162
|
+
File.delete(symb)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def cleanup_symbols(frameworks, args)
|
167
|
+
if args.empty?
|
168
|
+
filtered_frameworks = frameworks
|
169
|
+
else
|
170
|
+
filtered_frameworks = frameworks.select do |framework|
|
171
|
+
name = File.basename(framework)
|
172
|
+
args.include?(name)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
warning "Nothing to precess" if filtered_frameworks.empty?
|
176
|
+
|
177
|
+
progress(filtered_frameworks) do |framework|
|
178
|
+
puts "Processing #{framework}...".green
|
179
|
+
Cint::Cleanup.bcsymbolmap(framework).each do |bcs|
|
180
|
+
if File.exists?(bcs)
|
181
|
+
print "\tRemoving #{bcs}".red
|
182
|
+
File.delete(bcs)
|
183
|
+
end
|
184
|
+
$stdout.flush
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
command :cleanup do |c|
|
190
|
+
c.syntax = 'cint cleanup [framework,...]'
|
191
|
+
c.description = 'Remove bcsymbolmap files for frameworks. If no parameters passed it will perform cleanup for every framework.'
|
192
|
+
c.option '--orphans'
|
193
|
+
c.action do |args, options|
|
194
|
+
frameworks = Cint::Cleanup.frameworks
|
195
|
+
error "There are not a single framework found. Check directory, it should be ran in Build/* directory." if frameworks.empty?
|
196
|
+
|
197
|
+
if options.orphans
|
198
|
+
cleanup_orphaned_symbols(frameworks)
|
199
|
+
else
|
200
|
+
cleanup_symbols(frameworks, args)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
data/lib/cint.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
module Cint
|
3
|
+
class CarthageFiles
|
4
|
+
def self.exists
|
5
|
+
Dir.exist? './Carthage/Build'
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.frameworks(platform)
|
9
|
+
return [] unless PLATFORMS.include?(platform)
|
10
|
+
pattern = "./Carthage/Build/#{platform}/*.framework"
|
11
|
+
Dir.glob(pattern)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/cint/cleanup.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
module Cint
|
3
|
+
class Cleanup
|
4
|
+
def self.frameworks
|
5
|
+
Dir.glob("*.framework")
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.all_bcsymbolmap
|
9
|
+
Dir.glob("*.bcsymbolmap")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.bcsymbolmap(framework_path)
|
13
|
+
name = File.basename(framework_path, ".framework")
|
14
|
+
path = framework_path + "/#{name}"
|
15
|
+
uuids = `xcrun dwarfdump --uuid "#{path}" | awk '{print $2}'`.split("\n").map(&:chomp)
|
16
|
+
uuids.map { |uuid| "#{uuid}.bcsymbolmap" }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/cint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Antonyuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|
@@ -106,6 +106,8 @@ files:
|
|
106
106
|
- README.md
|
107
107
|
- bin/cint
|
108
108
|
- lib/cint.rb
|
109
|
+
- lib/cint/carthage_files.rb
|
110
|
+
- lib/cint/cleanup.rb
|
109
111
|
- lib/cint/project.rb
|
110
112
|
- lib/cint/version.rb
|
111
113
|
- lib/xcodeproj.rb
|