cocoapods-spm 0.1.8 → 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 +4 -4
- data/lib/cocoapods-spm/config/spm.rb +11 -0
- data/lib/cocoapods-spm/def/installer.rb +10 -2
- data/lib/cocoapods-spm/def/podfile.rb +2 -2
- data/lib/cocoapods-spm/helpers/io.rb +1 -0
- data/lib/cocoapods-spm/hooks/base.rb +15 -4
- data/lib/cocoapods-spm/hooks/post_integrate/{5.update_settings.rb → 05.update_settings.rb} +1 -1
- data/lib/cocoapods-spm/hooks/post_integrate/06.update_macro_platforms.rb +26 -0
- data/lib/cocoapods-spm/macro/fetcher.rb +22 -2
- data/lib/cocoapods-spm/macro/metadata.rb +16 -0
- data/lib/cocoapods-spm/macro/pod_installer.rb +1 -1
- data/lib/cocoapods-spm/macro/prebuilder.rb +10 -2
- data/lib/cocoapods-spm/main.rb +1 -0
- data/lib/cocoapods-spm/patch/installer.rb +11 -0
- data/lib/cocoapods-spm/resolver/result.rb +1 -1
- metadata +10 -9
- /data/lib/cocoapods-spm/hooks/post_integrate/{1.add_spm_pkgs.rb → 01.add_spm_pkgs.rb} +0 -0
- /data/lib/cocoapods-spm/hooks/post_integrate/{6.update_embed_frameworks_script.rb → 20.update_embed_frameworks_script.rb} +0 -0
- /data/lib/cocoapods-spm/hooks/post_integrate/{7.update_copy_resources_script.rb → 21.update_copy_resources_script.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c78bcd5423ddfdab166cce2e0d9dbb0f856c316e96c9153b0d0e63e24dc522c3
|
4
|
+
data.tar.gz: e2bc22e33f7bd411ea0f185a625a2b22a746e3ff97e8a4f82733d58272f2504b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e73df51891edf85f7f5568a93e0bddf1783fd6277ca184e9116be5192bb8a466ee4f33236beb36fa24ce8430f92a9ecc1f9dea614328dabec2b8a41255df2014
|
7
|
+
data.tar.gz: ea3fe8933774d6173401d5d8994a8107d370d17e83d9e150fa95c0e68029cdf10db818ff4e5f03aab343244c453f537837bb2eeb1778f0a5ff923c4a8ff76925
|
@@ -9,6 +9,17 @@ module Pod
|
|
9
9
|
def macro_pods
|
10
10
|
pod_config.podfile.macro_pods
|
11
11
|
end
|
12
|
+
|
13
|
+
def local_macro_pod?(name)
|
14
|
+
!local_macro_pod_dir(name).nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
def local_macro_pod_dir(name)
|
18
|
+
opts = macro_pods.fetch(name, {})
|
19
|
+
return Path(opts[:podspec]).dirname if opts.key?(:podspec)
|
20
|
+
|
21
|
+
Pathname(opts[:path]) if opts.key?(:path)
|
22
|
+
end
|
12
23
|
end
|
13
24
|
|
14
25
|
attr_accessor :dsl_config, :cli_config
|
@@ -1,7 +1,15 @@
|
|
1
1
|
module Pod
|
2
2
|
class Installer
|
3
|
-
|
4
|
-
|
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
|
@@ -7,7 +7,7 @@ module Pod
|
|
7
7
|
attr_accessor :spm_resolver
|
8
8
|
|
9
9
|
def config_cocoapods_spm(options)
|
10
|
-
SPM::Config.instance.dsl_config
|
10
|
+
SPM::Config.instance.dsl_config.merge!(options)
|
11
11
|
end
|
12
12
|
|
13
13
|
def macro_pods
|
@@ -56,7 +56,7 @@ module Pod
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def prepare_macro_pod_dir(name, requirement)
|
59
|
-
link = requirement[:git]
|
59
|
+
link = requirement[:git] || "N/A"
|
60
60
|
podspec_content = <<~HEREDOC
|
61
61
|
Pod::Spec.new do |s|
|
62
62
|
s.name = "#{name}"
|
@@ -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 =
|
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
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "cocoapods-spm/helpers/io"
|
1
2
|
require "cocoapods-spm/macro/metadata"
|
2
3
|
require_relative "config"
|
3
4
|
|
@@ -16,8 +17,7 @@ module Pod
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def run
|
19
|
-
|
20
|
-
download_macro_source
|
20
|
+
prepare_macro_source
|
21
21
|
macro_dir = spm_config.macro_root_dir / name
|
22
22
|
macro_downloaded_dir = spm_config.macro_downloaded_root_dir / name
|
23
23
|
FileUtils.copy_entry(
|
@@ -29,6 +29,10 @@ module Pod
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
+
def local?
|
33
|
+
local_macro_pod?(name)
|
34
|
+
end
|
35
|
+
|
32
36
|
def generate_metadata
|
33
37
|
raise "Package.swift not exist in #{macro_downloaded_dir}" \
|
34
38
|
unless (macro_downloaded_dir / "Package.swift").exist?
|
@@ -37,7 +41,23 @@ module Pod
|
|
37
41
|
metadata_path.write(raw)
|
38
42
|
end
|
39
43
|
|
44
|
+
def prepare_macro_source
|
45
|
+
if local?
|
46
|
+
symlink_local_macro_source
|
47
|
+
else
|
48
|
+
download_macro_source
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def symlink_local_macro_source
|
53
|
+
UI.message "Creating symlink to local macro source: #{name}..."
|
54
|
+
# For local macro pod, just need to copy local pod dir to downloaded sandbox,
|
55
|
+
# or create a symlink .spm.pods/macros/.downloaded/FOO -> LocalPods/FOO
|
56
|
+
IOUtils.symlink(local_macro_pod_dir(name), macro_downloaded_dir)
|
57
|
+
end
|
58
|
+
|
40
59
|
def download_macro_source
|
60
|
+
UI.puts "Downloading source for macro: #{name}...".magenta
|
41
61
|
@specs_by_platform ||= @podfile.root_target_definitions.to_h do |definition|
|
42
62
|
spec = Pod::Spec.from_file(spm_config.macro_root_dir / name / "#{name}.podspec")
|
43
63
|
[definition.platform, [spec]]
|
@@ -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
|
@@ -23,17 +23,25 @@ module Pod
|
|
23
23
|
config = spm_config.macro_config
|
24
24
|
impl_module_name = metadata.macro_impl_name
|
25
25
|
prebuilt_binary = macro_prebuilt_dir / "#{impl_module_name}-#{config}"
|
26
|
-
|
26
|
+
if spm_config.dont_prebuild_macros_if_exist? && prebuilt_binary.exist?
|
27
|
+
return UI.message "Macro binary exists at #{prebuilt_binary} -> Skip prebuilding macro"
|
28
|
+
end
|
27
29
|
|
28
30
|
UI.section "Building macro implementation: #{impl_module_name} (#{config})...".green do
|
29
31
|
Dir.chdir(macro_downloaded_dir) do
|
32
|
+
swift! ["--version"]
|
30
33
|
swift! ["build", "-c", config, "--product", impl_module_name]
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
34
37
|
prebuilt_binary.parent.mkpath
|
38
|
+
macro_downloaded_build_config_dir = macro_downloaded_dir / ".build" / config
|
39
|
+
macro_build_binary_file_path = macro_downloaded_build_config_dir / impl_module_name
|
40
|
+
unless macro_build_binary_file_path.exist?
|
41
|
+
macro_build_binary_file_path = macro_downloaded_build_config_dir / "#{impl_module_name}-tool"
|
42
|
+
end
|
35
43
|
FileUtils.copy_entry(
|
36
|
-
|
44
|
+
macro_build_binary_file_path,
|
37
45
|
prebuilt_binary
|
38
46
|
)
|
39
47
|
end
|
data/lib/cocoapods-spm/main.rb
CHANGED
@@ -34,6 +34,17 @@ module Pod
|
|
34
34
|
run_spm_post_integrate_hooks
|
35
35
|
end
|
36
36
|
|
37
|
+
patch_method :sandbox_state do
|
38
|
+
state = origin_sandbox_state
|
39
|
+
# NOTE: For macro pods, we force-trigger their source installers even in incremental installations.
|
40
|
+
# This is done by altering the `sandbox_state` & marking them as `added`
|
41
|
+
spm_config.all_macros.each do |name|
|
42
|
+
%i[unchanged changed deleted].each { |key| state.send(key).delete(name) }
|
43
|
+
state.added << (name)
|
44
|
+
end
|
45
|
+
state
|
46
|
+
end
|
47
|
+
|
37
48
|
private
|
38
49
|
|
39
50
|
def hook_options
|
@@ -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.
|
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-
|
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/
|
60
|
-
- lib/cocoapods-spm/hooks/post_integrate/
|
61
|
-
- lib/cocoapods-spm/hooks/post_integrate/
|
62
|
-
- lib/cocoapods-spm/hooks/post_integrate/
|
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: []
|
File without changes
|
File without changes
|