cocoapods-bazel 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +2 -0
- data/.github/workflows/tests.yml +23 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +12 -0
- data/.rubocop_todo.yml +26 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +145 -0
- data/LICENSE.txt +201 -0
- data/README.md +53 -0
- data/Rakefile +47 -0
- data/bin/console +15 -0
- data/bin/pod +29 -0
- data/bin/pod_install_bazel_build +26 -0
- data/bin/rake +29 -0
- data/bin/setup +8 -0
- data/cocoapods-bazel.gemspec +35 -0
- data/lib/cocoapods/bazel.rb +112 -0
- data/lib/cocoapods/bazel/config.rb +60 -0
- data/lib/cocoapods/bazel/target.rb +630 -0
- data/lib/cocoapods/bazel/util.rb +34 -0
- data/lib/cocoapods/bazel/version.rb +7 -0
- data/lib/cocoapods/bazel/xcconfig_resolver.rb +65 -0
- data/lib/cocoapods_plugin.rb +24 -0
- metadata +103 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
module Bazel
|
5
|
+
module Util
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def sort_labels(labels)
|
9
|
+
sort_keys = labels.map.with_index { |string, i| SortKey.new(string, i) }
|
10
|
+
sort_keys.sort_by { |k| [k.phase, k.split, k.value, k.original_index] }.map(&:value)
|
11
|
+
end
|
12
|
+
|
13
|
+
class SortKey
|
14
|
+
attr_reader :phase, :split, :value, :original_index
|
15
|
+
|
16
|
+
def initialize(string, index)
|
17
|
+
@value = string
|
18
|
+
@original_index = index
|
19
|
+
@phase = if string.start_with?(':')
|
20
|
+
1
|
21
|
+
elsif string.start_with?('//')
|
22
|
+
2
|
23
|
+
elsif string.start_with?('@')
|
24
|
+
3
|
25
|
+
else
|
26
|
+
4
|
27
|
+
end
|
28
|
+
|
29
|
+
@split = string.split(/[:.]/)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
module Bazel
|
5
|
+
module XCConfigResolver
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def resolved_build_setting_value(setting, settings:)
|
9
|
+
return unless (value = settings[setting])
|
10
|
+
|
11
|
+
sub_prefix = ->(s) { s.sub(%r{\A:/}, '') }
|
12
|
+
resolved = resolve_string_with_build_settings(value, settings: settings)
|
13
|
+
if Pod::Target::BuildSettings::PLURAL_SETTINGS.include?(setting)
|
14
|
+
resolved.shellsplit.reject(&:empty?).map(&sub_prefix)
|
15
|
+
else
|
16
|
+
sub_prefix[resolved]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def resolve_string_with_build_settings(string, settings:)
|
21
|
+
return string unless string =~ /\$(?:\{([_a-zA-Z0-0]+?)\}|\(([_a-zA-Z0-0]+?)\))/
|
22
|
+
|
23
|
+
match, key = Regexp.last_match.values_at(0, 1, 2).compact
|
24
|
+
sub = settings.fetch(key, '')
|
25
|
+
resolve_string_with_build_settings(string.gsub(match, sub), settings: settings)
|
26
|
+
end
|
27
|
+
|
28
|
+
UNRESOLVED_SETTINGS = [
|
29
|
+
'CONFIGURATION', # not needed, only used to help resolve other settings that may use it in substitutions
|
30
|
+
'HEADER_SEARCH_PATHS', # serialized into copts, handled natively by Xcode instead of via xcspecs
|
31
|
+
'OTHER_CFLAGS', # serialized separately as objc_copts
|
32
|
+
'OTHER_SWIFT_FLAGS', # serialized separately as swift_copts
|
33
|
+
'OTHER_LDFLAGS', # serialized separately as linkopts
|
34
|
+
'PODS_TARGET_SRCROOT', # not needed, used to help resolve file references relative to the current package
|
35
|
+
'SDKROOT', # not needed since the SDKROOT gets propagated via the apple configuration transition
|
36
|
+
'SRCROOT', # not needed, used to help resolve file references relative to the current workspace
|
37
|
+
'SWIFT_VERSION', # serialized separately as swift_version
|
38
|
+
'USER_HEADER_SEARCH_PATHS' # serialized into copts, handled natively by Xcode instead of via xcspecs
|
39
|
+
].freeze
|
40
|
+
private_constant :UNRESOLVED_SETTINGS
|
41
|
+
|
42
|
+
def resolve_xcconfig(xcconfig, default_xcconfigs: [])
|
43
|
+
matching_defaults = default_xcconfigs.select do |_, config|
|
44
|
+
(config.keys - xcconfig.keys).empty?
|
45
|
+
end
|
46
|
+
|
47
|
+
xcconfig.each_key { |k| xcconfig[k] = resolved_build_setting_value(k, settings: xcconfig) }
|
48
|
+
xcconfig.delete_if do |k, v|
|
49
|
+
UNRESOLVED_SETTINGS.include?(k) || v.empty?
|
50
|
+
end
|
51
|
+
|
52
|
+
unless matching_defaults.empty?
|
53
|
+
transformed = matching_defaults.map do |name, default_config|
|
54
|
+
[name, xcconfig.reject do |k, v|
|
55
|
+
v == default_config[k]
|
56
|
+
end]
|
57
|
+
end
|
58
|
+
name, xcconfig = transformed.min_by { |(_, config)| config.size }
|
59
|
+
end
|
60
|
+
|
61
|
+
[name, xcconfig]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods'
|
4
|
+
require 'cocoapods/bazel'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Installer
|
8
|
+
method_name = :perform_post_install_actions
|
9
|
+
unless method_defined?(method_name) || private_method_defined?(method_name)
|
10
|
+
raise Informative, <<~MSG
|
11
|
+
cocoapods-bazel is incompatible with this version of CocoaPods.
|
12
|
+
It requires a version with #{self}##{method_name} defined.
|
13
|
+
Please file an issue at https://github.com/ob/cocoapods-bazel for compatibiltiy with this verion of CocoaPods
|
14
|
+
MSG
|
15
|
+
end
|
16
|
+
|
17
|
+
unbound_method = instance_method(method_name)
|
18
|
+
remove_method(method_name)
|
19
|
+
define_method(method_name) do
|
20
|
+
Pod::Bazel.post_install(installer: self)
|
21
|
+
unbound_method.bind(self).call
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-bazel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shawn Chen
|
8
|
+
- Samuel Giddins
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2021-06-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '2.1'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '2.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: starlark_compiler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0.3'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0.3'
|
42
|
+
description:
|
43
|
+
email:
|
44
|
+
- swchen@linkedin.com
|
45
|
+
- segiddins@squareup.com
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- ".gitattributes"
|
51
|
+
- ".github/workflows/tests.yml"
|
52
|
+
- ".gitignore"
|
53
|
+
- ".rspec"
|
54
|
+
- ".rubocop.yml"
|
55
|
+
- ".rubocop_todo.yml"
|
56
|
+
- CHANGELOG.md
|
57
|
+
- Gemfile
|
58
|
+
- Gemfile.lock
|
59
|
+
- LICENSE.txt
|
60
|
+
- README.md
|
61
|
+
- Rakefile
|
62
|
+
- bin/console
|
63
|
+
- bin/pod
|
64
|
+
- bin/pod_install_bazel_build
|
65
|
+
- bin/rake
|
66
|
+
- bin/setup
|
67
|
+
- cocoapods-bazel.gemspec
|
68
|
+
- lib/cocoapods/bazel.rb
|
69
|
+
- lib/cocoapods/bazel/config.rb
|
70
|
+
- lib/cocoapods/bazel/target.rb
|
71
|
+
- lib/cocoapods/bazel/util.rb
|
72
|
+
- lib/cocoapods/bazel/version.rb
|
73
|
+
- lib/cocoapods/bazel/xcconfig_resolver.rb
|
74
|
+
- lib/cocoapods_plugin.rb
|
75
|
+
homepage: https://github.com/ob/cocoapods-bazel
|
76
|
+
licenses:
|
77
|
+
- apache2
|
78
|
+
metadata:
|
79
|
+
allowed_push_host: https://rubygems.org/
|
80
|
+
homepage_uri: https://github.com/ob/cocoapods-bazel
|
81
|
+
source_code_uri: https://github.com/ob/cocoapods-bazel
|
82
|
+
changelog_uri: https://github.com/ob/cocoapods-bazel/blob/master/CHANGELOG.md
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '2.6'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.7.7
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: A plugin for CocoaPods that generates Bazel build files for pods
|
103
|
+
test_files: []
|