cocoapods-spm 0.1.4 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 922b55ffd54350ec1e1be78c273b0078acfcdf7bca7f29c87281367507ffcf13
4
- data.tar.gz: 9e0d2e7202e2d5486d92e039aae84b0caeb690b7c6e8c73a3b57110177ec8b14
3
+ metadata.gz: 815b5b5db4530e4fd685d421cd33fb1cde41b29abfa667aa0ba9d3c1b61f8ef0
4
+ data.tar.gz: 6befd92a1d7528b4da4a5f62a1f8676c8bfb8be0dd5cc65d8c134a7df01d5b01
5
5
  SHA512:
6
- metadata.gz: c02a69fa12d098b6103d3eccb6dbf5b19ba50473b8c23913b6e5f17c9fd067c7fac3539c9a84264ba9a614c20771c4f641c0640a6c63a862aa2c5d7fc6e35154
7
- data.tar.gz: 5bafa557cfb91f192eaf0923e5e86503a490442104f102abd69a5b1e458395fcb1980394e0d4a65a567dd80f93bff1034ea118f37e09d2cf038dd8e83eaa4597
6
+ metadata.gz: abf5bf865306d931a1fbe53d230d17d80f62a1813a96b199c902c9f7da9dfc7ecbfff44eac5a3c7043ca73f856d66225c94f38d6ca5cf634f3b475d29f4a5476
7
+ data.tar.gz: 87e9e3935e947420740e3bdbd2d4c8ca0f36c8ad955a9ab15b2d7756c6bf58dc37aa7a3b9378df75b4db60b30c2e1e1a8b666b19d547cbe5216c907a0f89607a
@@ -0,0 +1,31 @@
1
+ module Pod
2
+ class Command
3
+ class Spm < Command
4
+ class Clean < Spm
5
+ self.summary = "Clean caches"
6
+ def self.options
7
+ [
8
+ ["--all", "Clean all"],
9
+ ["--macros", "Clean macros"],
10
+ ["--packages", "Clean packages"],
11
+ ].concat(super)
12
+ end
13
+
14
+ def initialize(argv)
15
+ super
16
+ @clean_all = argv.flag?("all")
17
+ @clean_macros = argv.flag?("macros")
18
+ @clean_pkgs = argv.flag?("packages")
19
+ end
20
+
21
+ def run
22
+ to_clean = []
23
+ to_clean << spm_config.pkg_root_dir if @clean_pkgs
24
+ to_clean << spm_config.macro_root_dir if @clean_macros
25
+ to_clean << spm_config.root_dir if @clean_all
26
+ to_clean.each { |dir| dir.rmtree if dir.exist? }
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,35 @@
1
+ module Pod
2
+ class Command
3
+ class Spm < Command
4
+ def self.bind_command(cls)
5
+ Class.new(Spm) do
6
+ define_method(:cls) { cls }
7
+
8
+ self.summary = "[Deprecated] #{cls.summary}"
9
+
10
+ def self.options
11
+ cls.options
12
+ end
13
+
14
+ def initialize(argv)
15
+ name = self.class.name.demodulize.downcase
16
+ warn "[DEPRECATION] `pod spm #{name}` is deprecated. Please use `pod spm macro #{name}` instead.".yellow
17
+ @_binded = cls.new(argv)
18
+ super
19
+ end
20
+
21
+ def validate!
22
+ @_binded.validate!
23
+ end
24
+
25
+ def run
26
+ @_binded.run
27
+ end
28
+ end
29
+ end
30
+
31
+ Fetch = bind_command(Macro::Fetch)
32
+ Prebuild = bind_command(Macro::Prebuild)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,33 @@
1
+ require "cocoapods-spm/macro/fetcher"
2
+
3
+ module Pod
4
+ class Command
5
+ class Spm < Command
6
+ class Macro < Spm
7
+ class Fetch < Macro
8
+ self.summary = "Fetch macros"
9
+ def self.options
10
+ [
11
+ ["--all", "Prebuild all macros"],
12
+ ["--macros=foo", "Macros to prebuild, separated by comma (,)"],
13
+ ].concat(super)
14
+ end
15
+
16
+ def initialize(argv)
17
+ super
18
+ update_cli_config(
19
+ all: argv.flag?("all"),
20
+ macros: argv.option("macros", "").split(",")
21
+ )
22
+ end
23
+
24
+ def run
25
+ spm_config.macros.each do |name|
26
+ SPM::MacroFetcher.new(name: name, can_cache: true).run
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,37 @@
1
+ require "cocoapods-spm/macro/prebuilder"
2
+
3
+ module Pod
4
+ class Command
5
+ class Spm < Command
6
+ class Macro < Spm
7
+ class Prebuild < Macro
8
+ self.summary = "Prebuild macros"
9
+ def self.options
10
+ [
11
+ ["--all", "Prebuild all macros"],
12
+ ["--macros=foo", "Macros to prebuild, separated by comma (,)"],
13
+ ["--config=foo", "Config (debug/release) to prebuild macros"],
14
+ ].concat(super)
15
+ end
16
+
17
+ def initialize(argv)
18
+ super
19
+ update_cli_config(
20
+ all: argv.flag?("all"),
21
+ macros: argv.option("macros", "").split(","),
22
+ config: argv.option("config"),
23
+ dont_prebuild_macros: false,
24
+ dont_prebuild_macros_if_exist: false
25
+ )
26
+ end
27
+
28
+ def run
29
+ spm_config.macros.each do |name|
30
+ SPM::MacroPrebuilder.new(name: name).run
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,14 @@
1
+ require "cocoapods-spm/command/macro/fetch"
2
+ require "cocoapods-spm/command/macro/prebuild"
3
+ require "cocoapods-spm/command/macro/deprecated"
4
+
5
+ module Pod
6
+ class Command
7
+ class Spm < Command
8
+ class Macro < Spm
9
+ self.summary = "Working with macros"
10
+ self.abstract_command = true
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
- require "cocoapods-spm/command/prebuild"
2
- require "cocoapods-spm/command/fetch"
1
+ require "cocoapods-spm/command/macro"
2
+ require "cocoapods-spm/command/clean"
3
3
 
4
4
  module Pod
5
5
  class Command
@@ -58,19 +58,23 @@ module Pod
58
58
  end
59
59
 
60
60
  def macro_root_dir
61
- root_dir # To be updated: rootdir / "macros"
61
+ @macro_root_dir ||= prepare_dir(root_dir / "macros")
62
62
  end
63
63
 
64
64
  def macro_downloaded_root_dir
65
65
  macro_root_dir / ".downloaded"
66
66
  end
67
67
 
68
+ def macro_prebuilt_root_dir
69
+ macro_root_dir / ".prebuilt"
70
+ end
71
+
68
72
  def macro_downloaded_sandbox
69
73
  @macro_downloaded_sandbox ||= Sandbox.new(macro_downloaded_root_dir)
70
74
  end
71
75
 
72
76
  def pkg_umbrella_dir
73
- @pkg_umbrella_dir ||= prepare_dir(root_dir / ".umbrella")
77
+ @pkg_umbrella_dir ||= prepare_dir(pkg_root_dir / ".umbrella")
74
78
  end
75
79
 
76
80
  def pkg_checkouts_dir
@@ -18,7 +18,7 @@ module Pod
18
18
  macro = requirements[0].delete(:macro) if requirements.first.is_a?(Hash)
19
19
  macro ||= {}
20
20
  unless macro.empty?
21
- requirements[0][:path] = prepare_macro_pod_dir(name, macro)
21
+ requirements[0][:path] = prepare_macro_pod_dir(name, macro).to_s
22
22
  macro_pods[name] = macro
23
23
  end
24
24
  origin_pod(name, *requirements)
@@ -67,8 +67,7 @@ module Pod
67
67
  end
68
68
  HEREDOC
69
69
 
70
- path = Pathname(".spm.pods/#{name}")
71
- (path / ".prebuilt").mkpath
70
+ path = Pod::SPM::Config.instance.macro_root_dir / name
72
71
  (path / "Sources").mkpath
73
72
  (path / "#{name}.podspec").write(podspec_content)
74
73
  path
@@ -0,0 +1,13 @@
1
+ module Pod
2
+ module IOUtils
3
+ def self.symlink(src, dst)
4
+ # NOTE: File operations are case-insensitive (foo.json and Foo.json are identical)
5
+ return if File.identical?(src, dst)
6
+
7
+ src = Pathname.new(src) unless src.is_a?(Pathname)
8
+ dst = Pathname.new(dst) unless dst.is_a?(Pathname)
9
+ dst.delete if dst.exist?
10
+ File.symlink(src.absolute? ? src : src.realpath, dst)
11
+ end
12
+ end
13
+ end
@@ -7,22 +7,21 @@ module Pod
7
7
  class UpdateSettings < Hook
8
8
  def run
9
9
  update_macro_plugin_flags
10
- update_modulemap_flags
11
- update_swift_include_paths
12
- update_linker_flags
10
+ update_packages_flags
13
11
  end
14
12
 
15
13
  private
16
14
 
17
15
  def macro_plugin_flag_by_config
16
+ path_prefix = "${PODS_ROOT}/../#{spm_config.macro_prebuilt_root_dir}"
18
17
  @macro_plugin_flag_by_config ||= begin
19
18
  hash = user_build_configurations.keys.to_h do |config|
20
19
  flags = macro_pods.keys.map do |name|
21
20
  metadata = MacroMetadata.for_pod(name)
22
21
  impl_module_name = metadata.macro_impl_name
23
22
  plugin_executable_path =
24
- "${PODS_ROOT}/../.spm.pods/#{name}/.prebuilt/#{config.to_s.downcase}/" \
25
- "#{impl_module_name}##{impl_module_name}"
23
+ "#{path_prefix}/#{name}/" \
24
+ "#{impl_module_name}-#{config.to_s.downcase}##{impl_module_name}"
26
25
  "-load-plugin-executable \"#{plugin_executable_path}\""
27
26
  end.join(" ")
28
27
  [config, flags]
@@ -42,27 +41,20 @@ module Pod
42
41
  )
43
42
  end
44
43
 
45
- def update_modulemap_flags
46
- perform_settings_update(
47
- update_targets: lambda do |target, _, _|
48
- {
49
- "OTHER_SWIFT_FLAGS" => modulemap_args_for_target(target, prefix: "-Xcc"),
50
- "OTHER_CFLAGS" => modulemap_args_for_target(target),
51
- }
52
- end
53
- )
54
- end
55
-
56
- def update_linker_flags
44
+ def update_packages_flags
57
45
  return if @spm_resolver.result.spm_pkgs.empty?
58
46
 
59
- # For packages to work in the main target
60
47
  perform_settings_update(
61
48
  update_targets: lambda do |target, _, _|
62
49
  {
63
- "OTHER_LDFLAGS" => linker_flags_for(target),
50
+ "SOURCE_PACKAGES_CHECKOUTS_DIR" => "${PODS_CONFIGURATION_BUILD_DIR}/../../../SourcePackages/checkouts",
64
51
  "FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/PackageFrameworks\"",
65
52
  "LIBRARY_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}\"",
53
+ "SWIFT_INCLUDE_PATHS" => "$(PODS_CONFIGURATION_BUILD_DIR)",
54
+ "OTHER_SWIFT_FLAGS" => modulemap_args_for_target(target, prefix: "-Xcc"),
55
+ "OTHER_CFLAGS" => modulemap_args_for_target(target),
56
+ "HEADER_SEARCH_PATHS" => header_search_paths_for(target),
57
+ "OTHER_LDFLAGS" => linker_flags_for(target),
66
58
  }
67
59
  end
68
60
  )
@@ -74,16 +66,6 @@ module Pod
74
66
  @spm_resolver.result.linker_flags_for(target)
75
67
  end
76
68
 
77
- def update_swift_include_paths
78
- return if @spm_resolver.result.spm_pkgs.empty? && spm_config.all_macros.empty?
79
-
80
- perform_settings_update(
81
- update_targets: lambda do |_, _, _|
82
- { "SWIFT_INCLUDE_PATHS" => "$(PODS_CONFIGURATION_BUILD_DIR)" }
83
- end
84
- )
85
- end
86
-
87
69
  def modulemap_args_for_target(target, prefix: nil)
88
70
  @spm_resolver
89
71
  .result
@@ -92,6 +74,14 @@ module Pod
92
74
  .map { |v| prefix.nil? ? v : "#{prefix} #{v}" }
93
75
  .join(" ")
94
76
  end
77
+
78
+ def header_search_paths_for(target)
79
+ @spm_resolver
80
+ .result
81
+ .spm_targets_for(target)
82
+ .filter_map(&:header_search_path_arg)
83
+ .join(" ")
84
+ end
95
85
  end
96
86
  end
97
87
  end
@@ -26,7 +26,7 @@ module Pod
26
26
  end
27
27
 
28
28
  def macro_prebuilt_dir
29
- macro_dir / ".prebuilt"
29
+ spm_config.macro_prebuilt_root_dir / name
30
30
  end
31
31
 
32
32
  def metadata_path
@@ -47,7 +47,8 @@ module Pod
47
47
 
48
48
  config = spm_config.macro_config
49
49
  impl_module_name = @metadata.macro_impl_name
50
- return if spm_config.dont_prebuild_macros_if_exist? && (macro_prebuilt_dir / config / impl_module_name).exist?
50
+ prebuilt_binary = macro_prebuilt_dir / "#{impl_module_name}-#{config}"
51
+ return if spm_config.dont_prebuild_macros_if_exist? && prebuilt_binary.exist?
51
52
 
52
53
  UI.section "Building macro implementation: #{impl_module_name} (#{config})...".green do
53
54
  Dir.chdir(macro_downloaded_dir) do
@@ -55,10 +56,10 @@ module Pod
55
56
  end
56
57
  end
57
58
 
58
- (macro_prebuilt_dir / config).mkpath
59
+ prebuilt_binary.parent.mkpath
59
60
  FileUtils.copy_entry(
60
61
  macro_downloaded_dir / ".build" / config / impl_module_name,
61
- macro_prebuilt_dir / config / impl_module_name
62
+ prebuilt_binary
62
63
  )
63
64
  end
64
65
  end
@@ -1,3 +1,5 @@
1
+ require "cocoapods-spm/helpers/io"
2
+ require "cocoapods-spm/helpers/patch"
1
3
  require "cocoapods-spm/config"
2
4
  require "cocoapods-spm/executables"
3
5
  require "cocoapods-spm/def/target_definition"
@@ -56,10 +56,15 @@ module Pod
56
56
  end
57
57
 
58
58
  def create_symlinks_to_local_pkgs
59
- @spm_pkgs.select(&:local?).each do |pkg|
60
- dst_dir = spm_config.pkg_checkouts_dir / pkg.slug
61
- dst_dir.delete if dst_dir.exist?
62
- File.symlink(pkg.absolute_path, dst_dir)
59
+ local_spm_pkgs = @spm_pkgs.select(&:local?)
60
+ symlinks = local_spm_pkgs.to_h { |p| [p.slug, p.absolute_path] }
61
+ local_spm_pkgs.each do |pkg|
62
+ pkg_desc = Swift::PackageDescription.from_dir(pkg.absolute_path)
63
+ pkg_desc.dependencies.select(&:local?).each { |d| symlinks[d.slug] = d.path }
64
+ end
65
+
66
+ symlinks.each do |slug, src_dir|
67
+ IOUtils.symlink(src_dir, spm_config.pkg_checkouts_dir / slug)
63
68
  end
64
69
  end
65
70
  end
@@ -0,0 +1,27 @@
1
+ require "cocoapods-spm/swift/package/base"
2
+
3
+ module Pod
4
+ module Swift
5
+ class PackageDescription
6
+ class Dependency < PackageDescriptionBaseObject
7
+ def local?
8
+ raw.key?("fileSystem")
9
+ end
10
+
11
+ def slug
12
+ hash["identity"]
13
+ end
14
+
15
+ def path
16
+ hash["path"]
17
+ end
18
+
19
+ private
20
+
21
+ def hash
22
+ raw.values.flatten[0] || {}
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -4,9 +4,15 @@ module Pod
4
4
  module Swift
5
5
  class PackageDescription < PackageDescriptionBaseObject
6
6
  include SPM::Config::Mixin
7
+ autoload :Dependency, "cocoapods-spm/swift/package/dependency"
7
8
  autoload :Target, "cocoapods-spm/swift/package/target"
8
9
  autoload :Product, "cocoapods-spm/swift/package/product"
9
10
 
11
+ def self.from_dir(dir)
12
+ raw = `swift package dump-package --package-path #{dir.shellescape}`
13
+ from_s(raw)
14
+ end
15
+
10
16
  def src_dir
11
17
  @src_dir ||= begin
12
18
  path = raw.fetch("packageKind", {}).fetch("root", [])[0]
@@ -14,6 +20,10 @@ module Pod
14
20
  end
15
21
  end
16
22
 
23
+ def checkouts_dir
24
+ src_dir.parent
25
+ end
26
+
17
27
  def artifacts_dir
18
28
  spm_config.pkg_artifacts_dir / slug
19
29
  end
@@ -22,12 +32,16 @@ module Pod
22
32
  src_dir.nil? ? name : src_dir.basename.to_s
23
33
  end
24
34
 
35
+ def dependencies
36
+ @dependencies ||= convert_field("dependencies", Dependency)
37
+ end
38
+
25
39
  def targets
26
- @targets ||= raw.fetch("targets", []).flat_map { |h| Target.new(h, parent: self) }
40
+ @targets ||= convert_field("targets", Target)
27
41
  end
28
42
 
29
43
  def products
30
- @products ||= raw.fetch("products", []).flat_map { |h| Product.new(h, parent: nil) }
44
+ @products ||= convert_field("products", Product)
31
45
  end
32
46
 
33
47
  def targets_of_product(name)
@@ -51,6 +65,12 @@ module Pod
51
65
  pkg = pod_config.podfile.spm_pkgs.find { |t| t.name == name }
52
66
  @use_default_xcode_linking = pkg&.use_default_xcode_linking?
53
67
  end
68
+
69
+ private
70
+
71
+ def convert_field(name, type)
72
+ raw.fetch(name, []).flat_map { |h| type.new(h, parent: self) }
73
+ end
54
74
  end
55
75
  end
56
76
  end
@@ -21,7 +21,9 @@ module Pod
21
21
  until to_visit.empty?
22
22
  target = to_visit.pop
23
23
  res << target
24
- to_visit += target.resolve_dependencies(@pkg_desc_cache)
24
+ # Exclude macros as they wont be linked to the project's binary
25
+ # https://github.com/trinhngocthuyen/cocoapods-spm/issues/107
26
+ to_visit += target.resolve_dependencies(@pkg_desc_cache).reject(&:macro?)
25
27
  end
26
28
  @recursive_targets_cache[product_name] = res.uniq(&:name)
27
29
  end
@@ -38,17 +40,17 @@ module Pod
38
40
  @src_dir.glob("*").each do |dir|
39
41
  next if dir.glob("Package*.swift").empty?
40
42
 
41
- raw = Dir.chdir(dir) { `swift package dump-package` }
42
- pkg_desc = PackageDescription.from_s(raw)
43
- write_data = lambda do |name|
44
- @pkg_desc_cache[name] = pkg_desc
45
- (@json_dir / "#{name}.json").write(raw) unless @json_dir.nil?
46
- end
47
-
48
- pkg_name = pkg_desc.name
49
- pkg_slug = dir.basename.to_s
50
- write_data.call(pkg_name)
51
- write_data.call(pkg_slug) unless pkg_name == pkg_slug
43
+ pkg_desc = PackageDescription.from_dir(dir)
44
+ name = pkg_desc.name
45
+ slug = dir.basename.to_s
46
+ @pkg_desc_cache[name] = pkg_desc
47
+ @pkg_desc_cache[slug] = pkg_desc
48
+ next if @json_dir.nil?
49
+
50
+ json_path = @json_dir / "#{name}.json"
51
+ slug_json_path = @json_dir / "#{slug}.json"
52
+ json_path.write(pkg_desc.raw.to_json)
53
+ IOUtils.symlink(json_path, slug_json_path) unless name == slug
52
54
  end
53
55
  end
54
56
  end
@@ -28,18 +28,66 @@ module Pod
28
28
  @product_name || name
29
29
  end
30
30
 
31
+ def sources_path
32
+ @sources_path ||= begin
33
+ path = raw["path"] || "Sources/#{name}"
34
+ root.src_dir / path
35
+ end
36
+ end
37
+
38
+ def header_search_path_arg
39
+ return nil if public_headers_path.nil?
40
+
41
+ path = public_headers_path.to_s.sub(root.checkouts_dir.to_s, "${SOURCE_PACKAGES_CHECKOUTS_DIR}")
42
+ "\"#{path}\""
43
+ end
44
+
31
45
  def public_headers_path
32
- raw["publicHeadersPath"]
46
+ res = sources_path / raw["publicHeadersPath"] if raw.key?("publicHeadersPath")
47
+ res = implicit_public_headers if res.nil?
48
+ res
49
+ end
50
+
51
+ def implicit_public_headers
52
+ path = sources_path / "include"
53
+ path unless path.glob("**/*.h*").empty?
54
+ end
55
+
56
+ def use_generated_modulemap?
57
+ return false if public_headers_path.nil?
58
+
59
+ # If there exists module.modulemap, it'll be auto picked up during compilation
60
+ true if public_headers_path.glob("module.modulemap").empty?
33
61
  end
34
62
 
35
63
  def clang_modulemap_arg
36
- return nil if public_headers_path.nil?
64
+ return nil unless use_generated_modulemap?
37
65
 
38
66
  "-fmodule-map-file=\"${GENERATED_MODULEMAP_DIR}/#{name}.modulemap\""
39
67
  end
40
68
 
41
69
  def resources
42
- raw.fetch("resources", []).flat_map { |h| Resources.new(h, parent: self) }
70
+ res = raw.fetch("resources", []).flat_map { |h| Resources.new(h, parent: self) }
71
+ res = implicit_resources if res.empty?
72
+ res
73
+ end
74
+
75
+ def implicit_resources
76
+ target_sources_path = raw["path"] || "Sources/#{name}"
77
+ target_sources_path = root.src_dir / target_sources_path
78
+
79
+ # Refer to the following link for the implicit resources
80
+ # https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package#Add-resource-files
81
+ patterns = [
82
+ "*.xcassets",
83
+ "*.xib",
84
+ "*.storyboard",
85
+ "*.xcdatamodeld",
86
+ "*.lproj",
87
+ ]
88
+ return [] if patterns.all? { |p| target_sources_path.glob(p).empty? }
89
+
90
+ [Resources.new({}, parent: self)]
43
91
  end
44
92
 
45
93
  def linker_flags
@@ -48,8 +96,8 @@ module Pod
48
96
 
49
97
  case binary_basename
50
98
  when /(\S+)\.framework/ then ["-framework \"#{$1}\""]
51
- when /lib(\S+)\.a/ then ["-library \"#{$1}\""]
52
- when /(\S+\.a)/ then ["\"${PODS_CONFIGURATION_BUILD_DIR}/#{$1}\""]
99
+ when /lib(\S+)\.(a|dylib)/ then ["-l\"#{$1}\""]
100
+ when /(\S+\.(a|dylib))/ then ["\"${PODS_CONFIGURATION_BUILD_DIR}/#{$1}\""]
53
101
  else []
54
102
  end
55
103
  end
@@ -78,11 +126,21 @@ module Pod
78
126
  "${BUILT_PRODUCTS_DIR}/PackageFrameworks/#{framework_name}.framework"
79
127
  end
80
128
 
129
+ def xcframework
130
+ @xcframework ||= begin
131
+ path = (root.artifacts_dir / name).glob("*.xcframework")[0]
132
+ Xcode::XCFramework.new(name, path.realpath) unless path.nil?
133
+ end
134
+ end
135
+
81
136
  def binary_basename
82
137
  return nil unless binary?
83
138
 
84
139
  @binary_basename ||= begin
85
- paths = (root.artifacts_dir / name).glob("*.xcframework/*/*.{a,framework}")
140
+ xcframework_dir ||= (root.artifacts_dir / name).glob("*.xcframework")[0]
141
+ xcframework_dir ||= root.src_dir / raw["path"] if raw.key?("path")
142
+ paths = xcframework_dir.glob("*/*.{a,framework}")
143
+ UI.warn "Cannot detect binary_basename for #{name}" if paths.empty?
86
144
  paths[0].basename.to_s unless paths.empty?
87
145
  end
88
146
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-spm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thuyen Trinh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-25 00:00:00.000000000 Z
11
+ date: 2024-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -32,8 +32,11 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - lib/cocoapods-spm.rb
35
- - lib/cocoapods-spm/command/fetch.rb
36
- - lib/cocoapods-spm/command/prebuild.rb
35
+ - lib/cocoapods-spm/command/clean.rb
36
+ - lib/cocoapods-spm/command/macro.rb
37
+ - lib/cocoapods-spm/command/macro/deprecated.rb
38
+ - lib/cocoapods-spm/command/macro/fetch.rb
39
+ - lib/cocoapods-spm/command/macro/prebuild.rb
37
40
  - lib/cocoapods-spm/command/spm.rb
38
41
  - lib/cocoapods-spm/config.rb
39
42
  - lib/cocoapods-spm/config/pod.rb
@@ -46,6 +49,7 @@ files:
46
49
  - lib/cocoapods-spm/def/target_definition.rb
47
50
  - lib/cocoapods-spm/def/xcodeproj.rb
48
51
  - lib/cocoapods-spm/executables.rb
52
+ - lib/cocoapods-spm/helpers/io.rb
49
53
  - lib/cocoapods-spm/helpers/patch.rb
50
54
  - lib/cocoapods-spm/hooks/base.rb
51
55
  - lib/cocoapods-spm/hooks/helpers/update_script.rb
@@ -67,6 +71,7 @@ files:
67
71
  - lib/cocoapods-spm/resolver/umbrella_package.rb
68
72
  - lib/cocoapods-spm/resolver/validator.rb
69
73
  - lib/cocoapods-spm/swift/package/base.rb
74
+ - lib/cocoapods-spm/swift/package/dependency.rb
70
75
  - lib/cocoapods-spm/swift/package/description.rb
71
76
  - lib/cocoapods-spm/swift/package/product.rb
72
77
  - lib/cocoapods-spm/swift/package/project_packages.rb
@@ -1,31 +0,0 @@
1
- require "cocoapods-spm/macro/fetcher"
2
-
3
- module Pod
4
- class Command
5
- class Spm < Command
6
- class Fetch < Spm
7
- self.summary = "Fetch macros"
8
- def self.options
9
- [
10
- ["--all", "Prebuild all macros"],
11
- ["--macros=foo", "Macros to prebuild, separated by comma (,)"],
12
- ].concat(super)
13
- end
14
-
15
- def initialize(argv)
16
- super
17
- update_cli_config(
18
- all: argv.flag?("all"),
19
- macros: argv.option("macros", "").split(",")
20
- )
21
- end
22
-
23
- def run
24
- spm_config.macros.each do |name|
25
- SPM::MacroFetcher.new(name: name, can_cache: true).run
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,35 +0,0 @@
1
- require "cocoapods-spm/macro/prebuilder"
2
-
3
- module Pod
4
- class Command
5
- class Spm < Command
6
- class Prebuild < Spm
7
- self.summary = "Prebuild macros"
8
- def self.options
9
- [
10
- ["--all", "Prebuild all macros"],
11
- ["--macros=foo", "Macros to prebuild, separated by comma (,)"],
12
- ["--config=foo", "Config (debug/release) to prebuild macros"],
13
- ].concat(super)
14
- end
15
-
16
- def initialize(argv)
17
- super
18
- update_cli_config(
19
- all: argv.flag?("all"),
20
- macros: argv.option("macros", "").split(","),
21
- config: argv.option("config"),
22
- dont_prebuild_macros: false,
23
- dont_prebuild_macros_if_exist: false
24
- )
25
- end
26
-
27
- def run
28
- spm_config.macros.each do |name|
29
- SPM::MacroPrebuilder.new(name: name).run
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end