pod-builder 2.0.0.beta.18 → 2.0.0.beta.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/README.md +13 -13
  4. data/exe/pod_builder +27 -16
  5. data/lib/pod_builder/command/build.rb +28 -159
  6. data/lib/pod_builder/command/build_all.rb +2 -2
  7. data/lib/pod_builder/command/clean.rb +34 -53
  8. data/lib/pod_builder/command/clear_lldbinit.rb +6 -2
  9. data/lib/pod_builder/command/deintegrate.rb +27 -6
  10. data/lib/pod_builder/command/generate_lfs.rb +1 -1
  11. data/lib/pod_builder/command/generate_podspec.rb +3 -2
  12. data/lib/pod_builder/command/info.rb +1 -1
  13. data/lib/pod_builder/command/init.rb +39 -14
  14. data/lib/pod_builder/command/install_sources.rb +20 -13
  15. data/lib/pod_builder/command/none.rb +2 -2
  16. data/lib/pod_builder/command/restore_all.rb +4 -4
  17. data/lib/pod_builder/command/switch.rb +56 -14
  18. data/lib/pod_builder/command/sync_podfile.rb +3 -2
  19. data/lib/pod_builder/command/update.rb +5 -6
  20. data/lib/pod_builder/command/update_lldbinit.rb +10 -8
  21. data/lib/pod_builder/configuration.rb +27 -6
  22. data/lib/pod_builder/core.rb +52 -16
  23. data/lib/pod_builder/info.rb +11 -11
  24. data/lib/pod_builder/install.rb +202 -186
  25. data/lib/pod_builder/licenses.rb +4 -4
  26. data/lib/pod_builder/podfile.rb +243 -85
  27. data/lib/pod_builder/podfile/post_actions.rb +9 -14
  28. data/lib/pod_builder/podfile_cp.rb +93 -0
  29. data/lib/pod_builder/podfile_item.rb +41 -20
  30. data/lib/pod_builder/podspec.rb +33 -16
  31. data/lib/pod_builder/rome/post_install.rb +121 -129
  32. data/lib/pod_builder/rome/pre_install.rb +1 -1
  33. data/lib/pod_builder/templates/build_podfile.template +2 -2
  34. data/lib/pod_builder/version.rb +1 -1
  35. data/pod-builder.gemspec +2 -2
  36. metadata +4 -25
  37. data/Example/Frameworks/.gitignore +0 -6
  38. data/Example/Frameworks/.pod_builder/pod_builder +0 -0
  39. data/Example/Frameworks/PodBuilder.json +0 -38
  40. data/Example/Frameworks/Podfile +0 -23
  41. data/Example/Frameworks/Podfile.restore +0 -40
  42. data/Example/PodBuilderExample.xcodeproj/project.pbxproj +0 -411
  43. data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  44. data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  45. data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcuserdata/tomas.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  46. data/Example/PodBuilderExample.xcworkspace/contents.xcworkspacedata +0 -10
  47. data/Example/PodBuilderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  48. data/Example/PodBuilderExample/AppDelegate.swift +0 -51
  49. data/Example/PodBuilderExample/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
  50. data/Example/PodBuilderExample/Assets.xcassets/Contents.json +0 -6
  51. data/Example/PodBuilderExample/Base.lproj/LaunchScreen.storyboard +0 -25
  52. data/Example/PodBuilderExample/Base.lproj/Main.storyboard +0 -24
  53. data/Example/PodBuilderExample/Info.plist +0 -45
  54. data/Example/PodBuilderExample/ViewController.swift +0 -25
  55. data/Example/Podfile +0 -51
  56. data/Example/Podfile.lock +0 -435
  57. data/Example/Pods-acknowledgements.md +0 -210
  58. data/Example/Pods-acknowledgements.plist +0 -206
@@ -3,7 +3,7 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class Switch
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
9
9
 
@@ -17,25 +17,62 @@ module PodBuilder
17
17
  argument_pods.each do |pod|
18
18
  pod_name_to_switch = pod
19
19
  pod_name_to_switch = Podfile::resolve_pod_names_from_podfile([pod_name_to_switch]).first
20
- raise "\n\nDid not find pod '#{pod}'" if pod_name_to_switch.nil?
20
+ raise "\n\nDid not find pod '#{pod}'".red if pod_name_to_switch.nil?
21
21
 
22
22
  check_not_building_subspec(pod_name_to_switch)
23
23
 
24
24
  pod_names_to_switch.push(pod_name_to_switch)
25
25
  end
26
+
27
+ dep_pod_names_to_switch = []
28
+ if OPTIONS[:switch_all] == true
29
+ pod_names_to_switch.each do |pod|
30
+ podspec_path = PodBuilder::prebuiltpath("#{pod}/#{pod}.podspec")
31
+ unless File.exist?(podspec_path)
32
+ next
33
+ end
34
+
35
+ podspec_content = File.read(podspec_path)
36
+
37
+ regex = "p\\d\\.dependency '(.*)'"
38
+
39
+ podspec_content.each_line do |line|
40
+ matches = line.match(/#{regex}/)
41
+
42
+ if matches&.size == 2
43
+ dep_pod_names_to_switch.push(matches[1].split("/").first)
44
+ end
45
+ end
46
+ end
47
+
48
+ dep_pod_names_to_switch.uniq!
49
+ dep_pod_names_to_switch.reverse.each do |dep_name|
50
+ podspec_path = PodBuilder::prebuiltpath("#{dep_name}/#{dep_name}.podspec")
51
+ if File.exist?(podspec_path)
52
+ if pod = Podfile::resolve_pod_names_from_podfile([dep_name]).first
53
+ pod_names_to_switch.push(pod)
54
+ next
55
+ end
56
+ end
57
+
58
+ dep_pod_names_to_switch.delete(dep_name)
59
+ end
60
+ pod_names_to_switch = pod_names_to_switch.map { |t| t.split("/").first }.uniq
61
+ dep_pod_names_to_switch.reject { |t| pod_names_to_switch.include?(t) }
62
+ end
26
63
 
27
64
  pod_names_to_switch.each do |pod_name_to_switch|
28
65
  development_path = ""
29
66
  default_entries = Hash.new
30
67
 
31
- case options[:switch_mode]
68
+ case OPTIONS[:switch_mode]
32
69
  when "development"
33
- development_path = find_podspec(pod_name_to_switch)
70
+ development_path = find_podspec(pod_name_to_switch)
34
71
  when "prebuilt"
35
72
  podfile_path = PodBuilder::basepath("Podfile.restore")
36
73
  content = File.read(podfile_path)
37
74
  if !content.include?("pod '#{pod_name_to_switch}")
38
- raise "\n\n'#{pod_name_to_switch}' does not seem to be prebuit!"
75
+ raise "\n\n'#{pod_name_to_switch}' does not seem to be prebuit!".red
39
76
  end
40
77
  when "default"
41
78
  podfile_path = PodBuilder::basepath("Podfile")
@@ -57,7 +94,15 @@ module PodBuilder
57
94
  end
58
95
  end
59
96
 
60
- raise "\n\n'#{pod_name_to_switch}' not found in #{podfile_path}" if default_entries.keys.count == 0
97
+ raise "\n\n'#{pod_name_to_switch}' not found in #{podfile_path}".red if default_entries.keys.count == 0
98
+ end
99
+
100
+ if development_path.nil?
101
+ if dep_pod_names_to_switch.include?(pod_name_to_switch)
102
+ next
103
+ else
104
+ raise "\n\nCouln't find `#{pod_name_to_switch}` sources in the following specified development pod paths:\n#{Configuration.development_pods_paths.join("\n")}\n".red
105
+ end
61
106
  end
62
107
 
63
108
  podfile_path = PodBuilder::project_path("Podfile")
@@ -74,10 +119,11 @@ module PodBuilder
74
119
  matches = line.gsub("\"", "'").match(/pod '(.*?)',(.*)/)
75
120
  if matches&.size == 3
76
121
  if matches[1].split("/").first == pod_name_to_switch
77
- case options[:switch_mode]
122
+ case OPTIONS[:switch_mode]
78
123
  when "prebuilt"
79
124
  indentation = line.split("pod '").first
80
- rel_path = Pathname.new(PodBuilder::prebuiltpath).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
125
+ podspec_path = File.dirname(PodBuilder::prebuiltpath("#{pod_name_to_switch}/#{pod_name_to_switch}.podspec"))
126
+ rel_path = Pathname.new(podspec_path).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
81
127
  prebuilt_line = "#{indentation}pod '#{matches[1]}', :path => '#{rel_path}'\n"
82
128
  if line.include?("# pb<") && marker = line.split("# pb<").last
83
129
  prebuilt_line = prebuilt_line.chomp("\n") + " # pb<#{marker}"
@@ -102,10 +148,10 @@ module PodBuilder
102
148
  lines.append(default_line)
103
149
  next
104
150
  elsif
105
- raise "Line for pod '#{matches[1]}' in section '#{current_section}' not found in PodBuilder's Podfile"
151
+ raise "\n\nLine for pod '#{matches[1]}' in section '#{current_section}' not found in PodBuilder's Podfile".red
106
152
  end
107
153
  else
108
- raise "Unsupported mode '#{options[:switch_mode]}'"
154
+ raise "\n\nUnsupported mode '#{OPTIONS[:switch_mode]}'".red
109
155
  end
110
156
  end
111
157
  end
@@ -144,10 +190,6 @@ module PodBuilder
144
190
  end
145
191
  end
146
192
 
147
- if podspec_path.nil?
148
- raise "\n\nCouln't find `#{podname}` sources in the following specified development pod paths:\n#{Configuration.development_pods_paths.join("\n")}\n".red
149
- end
150
-
151
193
  return podspec_path
152
194
  end
153
195
 
@@ -3,11 +3,11 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class SyncPodfile
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
9
9
 
10
- install_update_repo = options.fetch(:update_repos, true)
10
+ install_update_repo = OPTIONS.fetch(:update_repos, true)
11
11
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
12
12
 
13
13
  all_buildable_items = Analyze.podfile_items(installer, analyzer)
@@ -25,6 +25,7 @@ module PodBuilder
25
25
  system("#{bundler_prefix}pod install;")
26
26
  end
27
27
 
28
+ puts "\n\n🎉 done!\n".green
28
29
  return 0
29
30
  end
30
31
  end
@@ -1,10 +1,9 @@
1
1
  require 'pod_builder/core'
2
- require 'cfpropertylist'
3
2
 
4
3
  module PodBuilder
5
4
  module Command
6
5
  class Update
7
- def self.call(options)
6
+ def self.call
8
7
  Configuration.check_inited
9
8
  PodBuilder::prepare_basepath
10
9
 
@@ -25,10 +24,10 @@ module PodBuilder
25
24
  pods_to_update.map! { |x| x.split("/").first }.uniq!
26
25
 
27
26
  unless pods_to_update.count > 0
28
- puts "Frameworks in sync!\n".green
27
+ puts "Prebuilt items in sync!\n".green
29
28
  return 0
30
29
  end
31
- if options.has_key?(:dry_run)
30
+ if OPTIONS.has_key?(:dry_run)
32
31
  puts "`#{pods_to_update.join("`, `")}` need to be rebuilt!\n".red
33
32
  return -2
34
33
  end
@@ -36,8 +35,8 @@ module PodBuilder
36
35
  ARGV.clear
37
36
  pods_to_update.each { |x| ARGV << x }
38
37
 
39
- # options[:auto_resolve_dependencies] = true
40
- return PodBuilder::Command::Build.call(options)
38
+ # OPTIONS[:auto_resolve_dependencies] = true
39
+ return PodBuilder::Command::Build.call
41
40
  end
42
41
  end
43
42
  end
@@ -4,9 +4,12 @@ require 'digest'
4
4
  module PodBuilder
5
5
  module Command
6
6
  class UpdateLldbInit
7
- def self.call(options)
7
+ def self.call
8
8
  Configuration.check_inited
9
-
9
+ if Configuration.build_using_repo_paths
10
+ raise "\n\nlldb shenanigans not supported when 'build_using_repo_paths' is enabled".red
11
+ end
12
+
10
13
  argument_pods = ARGV.dup
11
14
 
12
15
  unless argument_pods.count > 0
@@ -55,10 +58,9 @@ module PodBuilder
55
58
  name = File.basename(framework_path, File.extname(framework_path))
56
59
  executable_path = File.join(framework_path, name)
57
60
 
58
- podbuilder_plist = File.join(framework_path, Configuration.framework_plist_filename)
59
-
60
- plist = CFPropertyList::List.new(:file => podbuilder_plist)
61
- data = CFPropertyList.native_types(plist.value)
61
+ parent_framework_path = File.expand_path(File.joing(framework_path, ".."))
62
+ framework_info_path = File.join(parent_framework_path, Configuration.prebuilt_info_filename)
63
+ data = JSON.parse(File.read(framework_info_path))
62
64
 
63
65
  original_compile_path = data["original_compile_path"]
64
66
  is_prebuilt = data.fetch("is_prebuilt", true)
@@ -125,7 +127,7 @@ module PodBuilder
125
127
  puts "Writing #{lldbinit_path}".yellow
126
128
 
127
129
  FileUtils.touch(lldbinit_path)
128
- raise "\n\nDestination file should be a file" unless File.exist?(lldbinit_path)
130
+ raise "\n\nDestination file should be a file".red unless File.exist?(lldbinit_path)
129
131
 
130
132
  lldbinit_lines = []
131
133
  skipNext = false
@@ -138,7 +140,7 @@ module PodBuilder
138
140
  next
139
141
  elsif line != "\n"
140
142
  if line.include?("settings set target.source-map")
141
- raise "\n\n#{lldbinit_destination_path} already includes a manual `settings set target.source-map`. This is unsupported and you'll have to manually remove that entry\n"
143
+ raise "\n\n#{lldbinit_destination_path} already includes a manual `settings set target.source-map`. This is unsupported and you'll have to manually remove that entry\n".red
142
144
  end
143
145
  lldbinit_lines.push(line)
144
146
  end
@@ -19,13 +19,14 @@ module PodBuilder
19
19
  "module_name": "GoogleMobileAds"
20
20
  }
21
21
  }.freeze
22
- DEFAULT_SKIP_PODS = ["GoogleMaps"]
22
+ DEFAULT_SKIP_PODS = ["GoogleMaps", "Flipper", "FlipperKit", "Flipper-DoubleConversion", "Flipper-Folly", "Flipper-Glog", "Flipper-PeerTalk", "Flipper-RSocket", "React-cxxreact"]
23
23
  DEFAULT_FORCE_PREBUILD_PODS = ["Firebase", "GoogleTagManager"]
24
24
  DEFAULT_BUILD_SYSTEM = "Legacy".freeze # either Latest (New build system) or Legacy (Standard build system)
25
25
  DEFAULT_LIBRARY_EVOLUTION_SUPPORT = false
26
26
  MIN_LFS_SIZE_KB = 256.freeze
27
27
  DEFAULT_PLATFORMS = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
28
28
  DEFAULT_BUILD_FOR_APPLE_SILICON = false
29
+ DEFAULT_BUILD_USING_REPO_PATHS = false
29
30
 
30
31
  private_constant :DEFAULT_BUILD_SETTINGS
31
32
  private_constant :DEFAULT_BUILD_SYSTEM
@@ -55,13 +56,15 @@ module PodBuilder
55
56
  attr_accessor :lfs_include_pods_folder
56
57
  attr_accessor :project_name
57
58
  attr_accessor :restore_enabled
58
- attr_accessor :framework_plist_filename
59
+ attr_accessor :prebuilt_info_filename
59
60
  attr_accessor :lockfile_name
60
61
  attr_accessor :lockfile_path
61
62
  attr_accessor :use_bundler
62
63
  attr_accessor :deterministic_build
63
64
  attr_accessor :supported_platforms
64
65
  attr_accessor :build_for_apple_silicon
66
+ attr_accessor :build_using_repo_paths
67
+ attr_accessor :react_native_project
65
68
  end
66
69
 
67
70
  @allow_building_development_pods = false
@@ -69,7 +72,7 @@ module PodBuilder
69
72
  @build_settings_overrides = {}
70
73
  @build_system = DEFAULT_BUILD_SYSTEM
71
74
  @library_evolution_support = DEFAULT_LIBRARY_EVOLUTION_SUPPORT
72
- @base_path = "Frameworks" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
75
+ @base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
73
76
  @spec_overrides = DEFAULT_SPEC_OVERRIDE
74
77
  @skip_licenses = []
75
78
  @skip_pods = DEFAULT_SKIP_PODS
@@ -86,7 +89,7 @@ module PodBuilder
86
89
  @lfs_include_pods_folder = false
87
90
  @project_name = ""
88
91
  @restore_enabled = true
89
- @framework_plist_filename = "PodBuilder.plist"
92
+ @prebuilt_info_filename = "PodBuilder.json"
90
93
  @lockfile_name = "PodBuilder.lock"
91
94
  @lockfile_path = "/tmp/#{lockfile_name}"
92
95
 
@@ -95,6 +98,8 @@ module PodBuilder
95
98
 
96
99
  @supported_platforms = DEFAULT_PLATFORMS
97
100
  @build_for_apple_silicon = DEFAULT_BUILD_FOR_APPLE_SILICON
101
+ @build_using_repo_paths = DEFAULT_BUILD_USING_REPO_PATHS
102
+ @react_native_project = false
98
103
 
99
104
  def self.check_inited
100
105
  raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil?
@@ -208,12 +213,20 @@ module PodBuilder
208
213
  Configuration.build_for_apple_silicon = value
209
214
  end
210
215
  end
216
+ if value = json["build_using_repo_paths"]
217
+ if [TrueClass, FalseClass].include?(value.class)
218
+ Configuration.build_using_repo_paths = value
219
+ end
220
+ end
221
+ if value = json["react_native_project"]
222
+ if [TrueClass, FalseClass].include?(value.class)
223
+ Configuration.react_native_project = value
224
+ end
225
+ end
211
226
 
212
227
  Configuration.build_settings.freeze
213
228
 
214
229
  sanity_check()
215
- else
216
- write
217
230
  end
218
231
 
219
232
  dev_pods_configuration_path = File.join(Configuration.base_path, Configuration.dev_pods_configuration_filename)
@@ -251,6 +264,13 @@ module PodBuilder
251
264
  config["subspecs_to_split"] = Configuration.subspecs_to_split
252
265
  config["lfs_update_gitattributes"] = Configuration.lfs_update_gitattributes
253
266
  config["lfs_include_pods_folder"] = Configuration.lfs_include_pods_folder
267
+ config["restore_enabled"] = Configuration.restore_enabled
268
+ config["allow_building_development_pods"] = Configuration.allow_building_development_pods
269
+ config["use_bundler"] = Configuration.use_bundler
270
+ config["deterministic_build"] = Configuration.deterministic_build
271
+ config["build_for_apple_silicon"] = Configuration.build_for_apple_silicon
272
+ config["build_using_repo_paths"] = Configuration.build_using_repo_paths
273
+ config["react_native_project"] = Configuration.react_native_project
254
274
 
255
275
  File.write(config_path, JSON.pretty_generate(config))
256
276
  end
@@ -275,6 +295,7 @@ module PodBuilder
275
295
 
276
296
  def self.podbuilder_path
277
297
  paths = Dir.glob("#{PodBuilder::home}/**/.pod_builder")
298
+ paths.reject! { |t| t.match(/pod-builder-.*\/Example\/#{File.basename(Configuration.base_path)}\/\.pod_builder$/i) }
278
299
  raise "\n\nToo many .pod_builder found `#{paths.join("\n")}`\n".red if paths.count > 1
279
300
 
280
301
  return paths.count > 0 ? File.dirname(paths.first) : nil
@@ -3,6 +3,7 @@ require 'fileutils'
3
3
  require 'colored'
4
4
 
5
5
  require 'pod_builder/podfile'
6
+ require 'pod_builder/podfile_cp'
6
7
  require 'pod_builder/podfile_item'
7
8
  require 'pod_builder/analyze'
8
9
  require 'pod_builder/analyzer'
@@ -15,6 +16,13 @@ require 'pod_builder/licenses'
15
16
  require 'core_ext/string'
16
17
 
17
18
  module PodBuilder
19
+ @@xcodeproj_path = nil
20
+ @@xcodeworkspace_path = nil
21
+
22
+ def self.git_rootpath
23
+ return `git rev-parse --show-toplevel`.strip()
24
+ end
25
+
18
26
  def self.safe_rm_rf(path)
19
27
  unless File.exist?(path)
20
28
  return
@@ -30,8 +38,8 @@ module PodBuilder
30
38
 
31
39
  Dir.chdir(path)
32
40
 
33
- h = `git rev-parse --show-toplevel`.strip()
34
- raise "\n\nNo git repository found in '#{path}', can't delete files!\n".red if h.empty? && !path.start_with?(Configuration.build_base_path)
41
+ rootpath = git_rootpath()
42
+ raise "\n\nNo git repository found in '#{path}', can't delete files!\n".red if rootpath.empty? && !path.start_with?(Configuration.build_base_path)
35
43
 
36
44
  FileUtils.rm_rf(path)
37
45
 
@@ -41,6 +49,12 @@ module PodBuilder
41
49
  Dir.chdir(basepath)
42
50
  end
43
51
  end
52
+
53
+ def self.gitignoredfiles
54
+ Dir.chdir(git_rootpath) do
55
+ return `git status --ignored -s | grep "^\!\!" | cut -c4-`.strip().split("\n")
56
+ end
57
+ end
44
58
 
45
59
  def self.basepath(child = "")
46
60
  if child.nil?
@@ -55,7 +69,7 @@ module PodBuilder
55
69
  return nil
56
70
  end
57
71
 
58
- path = basepath("Rome")
72
+ path = basepath("Prebuilt")
59
73
  if child.length > 0
60
74
  path += "/#{child}"
61
75
  end
@@ -68,7 +82,20 @@ module PodBuilder
68
82
  return nil
69
83
  end
70
84
 
71
- path = "#{Configuration.build_path}/Rome"
85
+ path = "#{Configuration.build_path}/Prebuilt"
86
+ if child.length > 0
87
+ path += "/#{child}"
88
+ end
89
+
90
+ return path
91
+ end
92
+
93
+ def self.buildpath_dsympath(child = "")
94
+ if child.nil?
95
+ return nil
96
+ end
97
+
98
+ path = "#{Configuration.build_path}/dSYM"
72
99
  if child.length > 0
73
100
  path += "/#{child}"
74
101
  end
@@ -96,27 +123,36 @@ module PodBuilder
96
123
  end
97
124
 
98
125
  def self.find_xcodeproj
126
+ unless @@xcodeproj_path.nil?
127
+ return @@xcodeproj_path
128
+ end
99
129
  project_name = File.basename(find_xcodeworkspace, ".*")
100
130
 
101
131
  xcodeprojects = Dir.glob("#{home}/**/#{project_name}.xcodeproj").select { |x|
102
132
  folder_in_home = x.gsub(home, "")
103
- !folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(basepath)
133
+ !folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(PodBuilder::basepath + "/")
104
134
  }
105
- raise "xcodeproj not found!".red if xcodeprojects.count == 0
106
- raise "Found multiple xcodeproj:\n#{xcodeprojects.join("\n")}".red if xcodeprojects.count > 1
135
+ raise "\n\nxcodeproj not found!".red if xcodeprojects.count == 0
136
+ raise "\n\nFound multiple xcodeproj:\n#{xcodeprojects.join("\n")}".red if xcodeprojects.count > 1
107
137
 
108
- return xcodeprojects.first
138
+ @@xcodeproj_path = xcodeprojects.first
139
+ return @@xcodeproj_path
109
140
  end
110
141
 
111
142
  def self.find_xcodeworkspace
143
+ unless @@xcodeworkspace_path.nil?
144
+ return @@xcodeworkspace_path
145
+ end
146
+
112
147
  xcworkspaces = Dir.glob("#{home}/**/#{Configuration.project_name}*.xcworkspace").select { |x|
113
148
  folder_in_home = x.gsub(home, "")
114
- !folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(basepath) && !x.include?(".xcodeproj/")
149
+ !folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(PodBuilder::basepath + "/") && !x.include?(".xcodeproj/")
115
150
  }
116
- raise "xcworkspace not found!".red if xcworkspaces.count == 0
117
- raise "Found multiple xcworkspaces:\n#{xcworkspaces.join("\n")}".red if xcworkspaces.count > 1
151
+ raise "\n\nxcworkspace not found!".red if xcworkspaces.count == 0
152
+ raise "\n\nFound multiple xcworkspaces:\n#{xcworkspaces.join("\n")}".red if xcworkspaces.count > 1
118
153
 
119
- return xcworkspaces.first
154
+ @@xcodeworkspace_path = xcworkspaces.first
155
+ return @@xcodeworkspace_path
120
156
  end
121
157
 
122
158
  def self.prepare_basepath
@@ -143,7 +179,7 @@ module PodBuilder
143
179
 
144
180
  def self.system_swift_version
145
181
  swift_version = `swiftc --version | grep -o 'swiftlang-.*\s'`.strip()
146
- raise "Unsupported swift compiler version, expecting `swiftlang` keyword in `swiftc --version`" if swift_version.length == 0
182
+ raise "\n\nUnsupported swift compiler version, expecting `swiftlang` keyword in `swiftc --version`".red if swift_version.length == 0
147
183
  return swift_version
148
184
  end
149
185
 
@@ -179,8 +215,8 @@ module PodBuilder
179
215
  private
180
216
 
181
217
  def self.home
182
- h = `git rev-parse --show-toplevel`.strip()
183
- raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if h.empty?
184
- return h
218
+ rootpath = git_rootpath
219
+ raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if rootpath.empty?
220
+ return rootpath
185
221
  end
186
222
  end