cocoapods-spm 0.1.9 → 0.1.10

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: 24612d253fbaf74d473abe53ca7b3293e06b5dda91b1ef52fd2795f96d5a3a97
4
- data.tar.gz: 1394cfc0a85d5378fab7929926f1f65acd7635a9236f427e2f746b4bc973a145
3
+ metadata.gz: c78bcd5423ddfdab166cce2e0d9dbb0f856c316e96c9153b0d0e63e24dc522c3
4
+ data.tar.gz: e2bc22e33f7bd411ea0f185a625a2b22a746e3ff97e8a4f82733d58272f2504b
5
5
  SHA512:
6
- metadata.gz: b9a897b591b5265b2ab5fc760261fd4d2bc319d26e23a4dcf603e51f8dd40103b0d67c3ee6fbc53749727373d748ae8b0252ad2b2e74d4d972ed6f0716cc7267
7
- data.tar.gz: 062b87214c04d88dc26fbc871951006eb69c65055410a7537c03c5f7177e039adf2cf93f6ece2d718e51dd8eec66d392acd8462157dbd5634ef6f4347d587221
6
+ metadata.gz: e73df51891edf85f7f5568a93e0bddf1783fd6277ca184e9116be5192bb8a466ee4f33236beb36fa24ce8430f92a9ecc1f9dea614328dabec2b8a41255df2014
7
+ data.tar.gz: ea3fe8933774d6173401d5d8994a8107d370d17e83d9e150fa95c0e68029cdf10db818ff4e5f03aab343244c453f537837bb2eeb1778f0a5ff923c4a8ff76925
@@ -1,7 +1,15 @@
1
1
  module Pod
2
2
  class Installer
3
- def native_targets
4
- pods_project.targets + pod_target_subprojects.flat_map(&:targets)
3
+ module InstallerMixin
4
+ def native_targets
5
+ projects_to_integrate.flat_map(&:targets)
6
+ end
7
+
8
+ def projects_to_integrate
9
+ [pods_project] + pod_target_subprojects
10
+ end
5
11
  end
12
+
13
+ include InstallerMixin
6
14
  end
7
15
  end
@@ -1,11 +1,13 @@
1
1
  require "cocoapods-spm/config"
2
2
  require "cocoapods-spm/def/podfile"
3
3
  require "cocoapods-spm/def/spec"
4
+ require "cocoapods-spm/macro/metadata"
4
5
 
5
6
  module Pod
6
7
  module SPM
7
8
  class Hook
8
9
  include Config::Mixin
10
+ include Installer::InstallerMixin
9
11
 
10
12
  def initialize(context, options = {})
11
13
  @context = context
@@ -34,10 +36,6 @@ module Pod
34
36
  @context.pod_target_subprojects
35
37
  end
36
38
 
37
- def projects_to_integrate
38
- [pods_project] + pod_target_subprojects
39
- end
40
-
41
39
  def user_build_configurations
42
40
  @user_build_configurations ||= (pod_targets + aggregate_targets)[0].user_build_configurations
43
41
  end
@@ -94,6 +92,19 @@ module Pod
94
92
  end
95
93
  end
96
94
  end
95
+
96
+ def macro_metadata_for_pod(name)
97
+ return nil unless spm_config.all_macros.include?(name)
98
+
99
+ @macro_metadata_cache ||= {}
100
+ @macro_metadata_cache[name] = MacroMetadata.for_pod(name) unless @macro_metadata_cache.key?(name)
101
+ @macro_metadata_cache[name]
102
+ end
103
+
104
+ def pod_name_of_target(name)
105
+ target = @analysis_result.pod_targets.find { |x| x.name == name }
106
+ target.nil? ? name : target.pod_name
107
+ end
97
108
  end
98
109
  end
99
110
  end
@@ -17,7 +17,7 @@ module Pod
17
17
  @macro_plugin_flag_by_config ||= begin
18
18
  hash = user_build_configurations.keys.to_h do |config|
19
19
  flags = macro_pods.keys.map do |name|
20
- metadata = MacroMetadata.for_pod(name)
20
+ metadata = macro_metadata_for_pod(name)
21
21
  impl_module_name = metadata.macro_impl_name
22
22
  plugin_executable_path =
23
23
  "#{path_prefix}/#{name}/" \
@@ -0,0 +1,26 @@
1
+ require "cocoapods-spm/hooks/base"
2
+ require "cocoapods-spm/macro/metadata"
3
+
4
+ module Pod
5
+ module SPM
6
+ class Hook
7
+ class UpdateMacroPlatforms < Hook
8
+ def run
9
+ to_save = Set.new
10
+ native_targets.each do |target|
11
+ name = pod_name_of_target(target.name)
12
+ metadata = macro_metadata_for_pod(name)
13
+ next if metadata.nil?
14
+
15
+ settings = metadata.platform_build_settings
16
+ target.build_configurations.each do |config|
17
+ settings.each { |k, v| config.build_settings[k] = v }
18
+ end
19
+ to_save << target.project
20
+ end
21
+ to_save.each(&:save)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -12,6 +12,22 @@ module Pod
12
12
  end
13
13
  from_file(path)
14
14
  end
15
+
16
+ def platforms
17
+ raw["platforms"].to_h { |ds| [ds["platformName"], ds["version"]] }
18
+ end
19
+
20
+ def platform_build_settings
21
+ ds = {
22
+ "ios" => "IPHONEOS_DEPLOYMENT_TARGET",
23
+ "macos" => "MACOSX_DEPLOYMENT_TARGET",
24
+ "tvos" => "TVOS_DEPLOYMENT_TARGET",
25
+ "watchos" => "WATCHOS_DEPLOYMENT_TARGET",
26
+ "visionos" => "XROS_DEPLOYMENT_TARGET",
27
+ "driverkit" => "DRIVERKIT_DEPLOYMENT_TARGET",
28
+ }
29
+ platforms.transform_keys { |k| ds[k] }.reject { |k, _| k.nil? }
30
+ end
15
31
  end
16
32
  end
17
33
  end
@@ -63,7 +63,7 @@ module Pod
63
63
  return target.name if target.is_a?(Pod::AggregateTarget)
64
64
 
65
65
  cmps = target.name.split("-")
66
- return cmps[...-1].join("-") if ["iOS", "macOS", "watchOS", "tvOS"].include?(cmps[-1])
66
+ return cmps[...-1].join("-") if ["iOS", "macOS", "watchOS", "tvOS", "visionOS"].include?(cmps[-1])
67
67
 
68
68
  target.name
69
69
  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.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thuyen Trinh
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-08 00:00:00.000000000 Z
11
+ date: 2024-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -56,10 +56,11 @@ files:
56
56
  - lib/cocoapods-spm/helpers/patch.rb
57
57
  - lib/cocoapods-spm/hooks/base.rb
58
58
  - lib/cocoapods-spm/hooks/helpers/update_script.rb
59
- - lib/cocoapods-spm/hooks/post_integrate/1.add_spm_pkgs.rb
60
- - lib/cocoapods-spm/hooks/post_integrate/5.update_settings.rb
61
- - lib/cocoapods-spm/hooks/post_integrate/6.update_embed_frameworks_script.rb
62
- - lib/cocoapods-spm/hooks/post_integrate/7.update_copy_resources_script.rb
59
+ - lib/cocoapods-spm/hooks/post_integrate/01.add_spm_pkgs.rb
60
+ - lib/cocoapods-spm/hooks/post_integrate/05.update_settings.rb
61
+ - lib/cocoapods-spm/hooks/post_integrate/06.update_macro_platforms.rb
62
+ - lib/cocoapods-spm/hooks/post_integrate/20.update_embed_frameworks_script.rb
63
+ - lib/cocoapods-spm/hooks/post_integrate/21.update_copy_resources_script.rb
63
64
  - lib/cocoapods-spm/macro/config.rb
64
65
  - lib/cocoapods-spm/macro/fetcher.rb
65
66
  - lib/cocoapods-spm/macro/metadata.rb
@@ -86,7 +87,7 @@ homepage: https://github.com/trinhngocthuyen/cocoapods-spm
86
87
  licenses:
87
88
  - MIT
88
89
  metadata: {}
89
- post_install_message:
90
+ post_install_message:
90
91
  rdoc_options: []
91
92
  require_paths:
92
93
  - lib
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  version: '0'
103
104
  requirements: []
104
105
  rubygems_version: 3.2.33
105
- signing_key:
106
+ signing_key:
106
107
  specification_version: 4
107
108
  summary: CocoaPods plugin to add SPM dependencies to CocoaPods targets
108
109
  test_files: []