cocoapods-spm 0.0.1
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 +7 -0
- data/lib/cocoapods-spm/config.rb +15 -0
- data/lib/cocoapods-spm/dsl.rb +11 -0
- data/lib/cocoapods-spm/main.rb +78 -0
- data/lib/cocoapods-spm/specification.rb +10 -0
- data/lib/cocoapods-spm.rb +1 -0
- data/lib/cocoapods_plugin.rb +5 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 88926a40ad19c2ccc3b9ceccefe301a6f939ec7460c719b914a13eba5c1d3739
|
4
|
+
data.tar.gz: 190363f1092af74595af470f7bdc617e8ffaca00314894b136298a9c31e9d979
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '06209d7e15bdbccf151db058e53dc27dfb9179d75ed76c6341518f5f56f02d62629ae2f0a369cdace8e719725a040aee2a24d626b709f280c15b18277f2ca636'
|
7
|
+
data.tar.gz: c40d20e4560c12625ac7a4a52c6bbcee54407582039ac59f829f75978c29581379f24514e489fa6f393ef8872a131ce7608969b193927cabca7dfc2f06a0db35
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require "cocoapods-spm/config"
|
2
|
+
require "cocoapods-spm/dsl"
|
3
|
+
require "cocoapods-spm/specification"
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
module SPM
|
7
|
+
class Hook
|
8
|
+
def initialize(context)
|
9
|
+
@context = context
|
10
|
+
end
|
11
|
+
|
12
|
+
def sandbox
|
13
|
+
@context.sandbox
|
14
|
+
end
|
15
|
+
|
16
|
+
def pods_project
|
17
|
+
@context.pods_project
|
18
|
+
end
|
19
|
+
|
20
|
+
def config
|
21
|
+
Config.instance
|
22
|
+
end
|
23
|
+
|
24
|
+
def all_specs
|
25
|
+
@all_specs ||= @context.umbrella_targets.flat_map(&:specs).uniq
|
26
|
+
end
|
27
|
+
|
28
|
+
def run
|
29
|
+
all_specs.each do |spec|
|
30
|
+
if spec.spm_dependencies
|
31
|
+
target = pods_project.targets.find { |t| t.name == spec.name }
|
32
|
+
add_spm_dependencies(target, spec.spm_dependencies)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
update_import_paths
|
36
|
+
pods_project.save
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def add_spm_dependencies(target, dependencies)
|
42
|
+
dependencies.each do |data|
|
43
|
+
pkg = pkg_from_data(data)
|
44
|
+
data[:products].each do |product|
|
45
|
+
ref = pods_project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
46
|
+
ref.package = pkg
|
47
|
+
ref.product_name = product
|
48
|
+
target.package_product_dependencies << ref
|
49
|
+
end
|
50
|
+
pods_project.root_object.package_references << pkg
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def update_import_paths
|
55
|
+
# Workaround: Currently, update the swift import paths of the base/Pods project
|
56
|
+
# to make it effective across all pod targets
|
57
|
+
pods_project.build_configurations.each do |config|
|
58
|
+
to_add = '${SYMROOT}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}'
|
59
|
+
import_paths = config.build_settings['SWIFT_INCLUDE_PATHS'] || ['$(inherited)']
|
60
|
+
import_paths << to_add unless import_paths.include?(to_add)
|
61
|
+
config.build_settings['SWIFT_INCLUDE_PATHS'] = import_paths
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def pkg_from_data(data)
|
66
|
+
if data[:requirement]
|
67
|
+
pkg = pods_project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference)
|
68
|
+
pkg.repositoryURL = data[:url]
|
69
|
+
pkg.requirement = data[:requirement]
|
70
|
+
else
|
71
|
+
pkg = pods_project.new(Xcodeproj::Project::Object::XCLocalSwiftPackageReference)
|
72
|
+
pkg.relative_path = data[:relative_path]
|
73
|
+
end
|
74
|
+
pkg
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "cocoapods-spm/gem_version"
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-spm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thuyen Trinh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-11-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: CocoaPods plugin to add SPM dependencies to CocoaPods targets
|
56
|
+
email:
|
57
|
+
- trinhngocthuyen@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/cocoapods-spm.rb
|
63
|
+
- lib/cocoapods-spm/config.rb
|
64
|
+
- lib/cocoapods-spm/dsl.rb
|
65
|
+
- lib/cocoapods-spm/main.rb
|
66
|
+
- lib/cocoapods-spm/specification.rb
|
67
|
+
- lib/cocoapods_plugin.rb
|
68
|
+
homepage: https://github.com/trinhngocthuyen/cocoapods-spm
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubygems_version: 3.2.3
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: CocoaPods plugin to add SPM dependencies to CocoaPods targets
|
91
|
+
test_files: []
|