cocoapods-spm 0.1.10 → 0.1.11

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: c78bcd5423ddfdab166cce2e0d9dbb0f856c316e96c9153b0d0e63e24dc522c3
4
- data.tar.gz: e2bc22e33f7bd411ea0f185a625a2b22a746e3ff97e8a4f82733d58272f2504b
3
+ metadata.gz: 6c3b50f5ee1f6aac5f97a26a629a3db6e979d9d3f64d23d8b0ad09efb64b65a8
4
+ data.tar.gz: f9a36254b07ad0a945a4f74a408f86e5c64061401b1313d1176a6cf6d9a3b961
5
5
  SHA512:
6
- metadata.gz: e73df51891edf85f7f5568a93e0bddf1783fd6277ca184e9116be5192bb8a466ee4f33236beb36fa24ce8430f92a9ecc1f9dea614328dabec2b8a41255df2014
7
- data.tar.gz: ea3fe8933774d6173401d5d8994a8107d370d17e83d9e150fa95c0e68029cdf10db818ff4e5f03aab343244c453f537837bb2eeb1778f0a5ff923c4a8ff76925
6
+ metadata.gz: 9129545f35676f21d34e904e5517b3a05d0fc18eaff8ca0e9fa3045d97d965ab61f7f0c07428df4e663a482d585de920e499f04d2cd76f5732f323295f1ae86b
7
+ data.tar.gz: 16461e45669ff05d949264c52dfd7b820e562ed5fd8096d86593e07c2a9f4fdb974e22923bc8f79c22d79d95b68c6573317c51a8fe0353862bf1aa1b8e85608a
@@ -22,6 +22,7 @@ module Pod
22
22
  end
23
23
 
24
24
  def run
25
+ verify_podfile_exists!
25
26
  spm_config.macros.each do |name|
26
27
  SPM::MacroFetcher.new(name: name, can_cache: true).run
27
28
  end
@@ -26,6 +26,7 @@ module Pod
26
26
  end
27
27
 
28
28
  def run
29
+ verify_podfile_exists!
29
30
  spm_config.macros.each do |name|
30
31
  SPM::MacroPrebuilder.new(name: name).run
31
32
  end
@@ -5,6 +5,7 @@ module Pod
5
5
  class Command
6
6
  class Spm < Command
7
7
  include SPM::Config::Mixin
8
+ include ProjectDirectory
8
9
 
9
10
  self.summary = "Working with SPM"
10
11
  self.abstract_command = true
@@ -1,7 +1,11 @@
1
+ require "cocoapods-spm/helpers/path"
2
+
1
3
  module Pod
2
4
  module SPM
3
5
  class Config
4
6
  module PodConfigMixin
7
+ include PathMixn
8
+
5
9
  def pod_config
6
10
  Pod::Config.instance
7
11
  end
@@ -1,3 +1,5 @@
1
+ require "cocoapods-spm/helpers/path"
2
+
1
3
  module Pod
2
4
  module SPM
3
5
  class Config
@@ -1,6 +1,10 @@
1
+ require "cocoapods-spm/helpers/path"
2
+
1
3
  module Pod
2
4
  module SPM
3
5
  class Config
6
+ include PathMixn
7
+
4
8
  module SPMConfigMixin
5
9
  def spm_config
6
10
  Config.instance
@@ -61,7 +65,7 @@ module Pod
61
65
  end
62
66
 
63
67
  def root_dir
64
- @root_dir ||= Pathname(".spm.pods")
68
+ @root_dir ||= prepare_dir(Pod::Config.instance.installation_root / ".spm.pods")
65
69
  end
66
70
 
67
71
  def pkg_root_dir
@@ -99,13 +103,6 @@ module Pod
99
103
  def pkg_metadata_dir
100
104
  @pkg_metadata_dir ||= prepare_dir(pkg_root_dir / "metadata")
101
105
  end
102
-
103
- private
104
-
105
- def prepare_dir(dir)
106
- dir.mkpath
107
- dir
108
- end
109
106
  end
110
107
  end
111
108
  end
@@ -18,7 +18,8 @@ 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).to_s
21
+ macro_dir = prepare_macro_pod_dir(name, macro)
22
+ requirements[0][:path] = macro_dir.relative_path_from(Pod::Config.instance.installation_root).to_s
22
23
  macro_pods[name] = macro
23
24
  end
24
25
  origin_pod(name, *requirements)
@@ -22,6 +22,7 @@ module Pod
22
22
  @relative_path = relative_path_from(options)
23
23
  @requirement = requirement_from(options)
24
24
  @linking_opts = options[:linking] || {}
25
+ validate!
25
26
  end
26
27
 
27
28
  def slug
@@ -86,6 +87,16 @@ module Pod
86
87
 
87
88
  private
88
89
 
90
+ def validate!
91
+ if use_default_xcode_linking? # rubocop:disable Style/GuardClause
92
+ UI.warn <<~HEREDOC
93
+ The option :use_default_xcode_linking in the following declaration is deprecated:
94
+ #{@_options}
95
+ You are recommended to omit this option in `spm_pkg`.
96
+ HEREDOC
97
+ end
98
+ end
99
+
89
100
  def requirement_from(options)
90
101
  return if @relative_path
91
102
 
@@ -0,0 +1,10 @@
1
+ module Pod
2
+ module SPM
3
+ module PathMixn
4
+ def prepare_dir(dir)
5
+ dir.mkpath
6
+ dir
7
+ end
8
+ end
9
+ end
10
+ end
@@ -13,7 +13,8 @@ module Pod
13
13
  private
14
14
 
15
15
  def macro_plugin_flag_by_config
16
- path_prefix = "${PODS_ROOT}/../#{spm_config.macro_prebuilt_root_dir}"
16
+ prebuild_root_dir = spm_config.macro_prebuilt_root_dir.relative_path_from(pod_config.installation_root)
17
+ path_prefix = "${PODS_ROOT}/../#{prebuild_root_dir}"
17
18
  @macro_plugin_flag_by_config ||= begin
18
19
  hash = user_build_configurations.keys.to_h do |config|
19
20
  flags = macro_pods.keys.map do |name|
@@ -2,6 +2,7 @@ module Pod
2
2
  module SPM
3
3
  module MacroConfigMixin
4
4
  include Config::Mixin
5
+ include PathMixn
5
6
 
6
7
  def macro_downloaded_dir
7
8
  spm_config.macro_downloaded_root_dir / name
@@ -11,6 +12,10 @@ module Pod
11
12
  @macro_dir ||= spm_config.macro_root_dir / name
12
13
  end
13
14
 
15
+ def macro_scratch_dir
16
+ @macro_scratch_dir ||= prepare_dir(spm_config.macro_root_dir / ".build")
17
+ end
18
+
14
19
  def macro_prebuilt_dir
15
20
  spm_config.macro_prebuilt_root_dir / name
16
21
  end
@@ -28,14 +28,23 @@ module Pod
28
28
  end
29
29
 
30
30
  UI.section "Building macro implementation: #{impl_module_name} (#{config})...".green do
31
- Dir.chdir(macro_downloaded_dir) do
32
- swift! ["--version"]
33
- swift! ["build", "-c", config, "--product", impl_module_name]
34
- end
31
+ swift! ["--version"]
32
+ swift! [
33
+ "build",
34
+ "-c", config,
35
+ "--product", impl_module_name,
36
+ "--package-path", macro_downloaded_dir,
37
+ "--scratch-path", macro_scratch_dir,
38
+ ]
39
+ # Workaround: When building a macro, the debug.yaml under the scratch dir contains some corrupted info,
40
+ # causing the following failure when building the next macro:
41
+ # No target named 'OrcamImpl-debug.exe' in build description
42
+ # Idk what this file is for, but deleting it helps
43
+ macro_scratch_dir.glob("*.yaml").each { |p| p.delete if p.exist? }
35
44
  end
36
45
 
37
46
  prebuilt_binary.parent.mkpath
38
- macro_downloaded_build_config_dir = macro_downloaded_dir / ".build" / config
47
+ macro_downloaded_build_config_dir = macro_scratch_dir / config
39
48
  macro_build_binary_file_path = macro_downloaded_build_config_dir / impl_module_name
40
49
  unless macro_build_binary_file_path.exist?
41
50
  macro_build_binary_file_path = macro_downloaded_build_config_dir / "#{impl_module_name}-tool"
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.10
4
+ version: 0.1.11
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-12-29 00:00:00.000000000 Z
11
+ date: 2025-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -54,6 +54,7 @@ files:
54
54
  - lib/cocoapods-spm/executables.rb
55
55
  - lib/cocoapods-spm/helpers/io.rb
56
56
  - lib/cocoapods-spm/helpers/patch.rb
57
+ - lib/cocoapods-spm/helpers/path.rb
57
58
  - lib/cocoapods-spm/hooks/base.rb
58
59
  - lib/cocoapods-spm/hooks/helpers/update_script.rb
59
60
  - lib/cocoapods-spm/hooks/post_integrate/01.add_spm_pkgs.rb