gonative-cli 0.8.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gonative/commands/ios/embed_extensions.rb +1 -1
- data/lib/gonative/commands/ios/set_bundle_id.rb +18 -0
- data/lib/gonative/commands.rb +3 -2
- data/lib/gonative/plugins/ios/embed_extensions.rb +16 -11
- data/lib/gonative/plugins/ios/extract_extensions.rb +2 -1
- data/lib/gonative/plugins/ios/set_bundle_id.rb +65 -0
- data/lib/gonative/version.rb +1 -1
- data/templates/plugins/ios/common/PLUGIN_NAME.podspec.tpl +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4acd28ffd8efd342c4c219852429ff3903688af2052b94d3357afd631d62bf5
|
4
|
+
data.tar.gz: a7378f8e35fc7468c7430d42d26e7762909f0d35aa5223e1910e4125b4127287
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3ffa2955b932c8d308fd1c01607a9dd08227e54ac3d2f05771c70e7e9284b4f1f42a7a439688129614cd8e66f6a68d591eab1fed023ea63f12f4e089cf10a25
|
7
|
+
data.tar.gz: ab087bde09fc635de3def712d0a5e9d50fef4af59e3a54302545739b5d1f878ae743ffd147d4ac2fa1c59c8fb29b71d1e1dc9cb07510e839fa999a907fd89bf7
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GoNative
|
4
|
+
module Commands
|
5
|
+
module IOS
|
6
|
+
class SetBundleId < Base
|
7
|
+
desc 'Sets bundle Id '
|
8
|
+
|
9
|
+
argument :bundle_id, required: true, desc: 'Bundle id for the app'
|
10
|
+
option :with_entitlements, type: :boolean, default: false
|
11
|
+
|
12
|
+
def call(bundle_id:, with_entitlements:, **)
|
13
|
+
Plugins::IOS::SetBundleId.call(bundle_id, with_entitlements)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/gonative/commands.rb
CHANGED
@@ -7,8 +7,9 @@ module GoNative
|
|
7
7
|
register 'version', Version, aliases: %w[--version -v]
|
8
8
|
register 'ios create', IOS::Create
|
9
9
|
register 'ios publish', IOS::Publish
|
10
|
-
register 'ios extract', IOS::ExtractExtensions
|
11
|
-
register 'ios embed', IOS::EmbedExtensions
|
10
|
+
register 'ios extract-extensions', IOS::ExtractExtensions
|
11
|
+
register 'ios embed-extensions', IOS::EmbedExtensions
|
12
|
+
register 'ios set-bundle-id', IOS::SetBundleId
|
12
13
|
register 'android create', Android::Create
|
13
14
|
end
|
14
15
|
end
|
@@ -25,13 +25,14 @@ module GoNative
|
|
25
25
|
.flatten
|
26
26
|
.each { |path| FileUtils.cp_r(path, '.') }
|
27
27
|
@extensions = extension_paths
|
28
|
-
.map { |path| Pathname(path).children.select{ |p| p.extname == '.json'} }
|
28
|
+
.map { |path| Pathname(path).children.select { |p| p.extname == '.json' } }
|
29
29
|
.flatten
|
30
30
|
.map { |p| JSON.parse(File.read(p)) }
|
31
31
|
end
|
32
32
|
|
33
33
|
def embed_in_project
|
34
34
|
proj = Xcodeproj::Project.open('GoNativeIOS.xcodeproj')
|
35
|
+
app_target = proj.native_targets.first
|
35
36
|
extensions.each do |extension|
|
36
37
|
target = proj.new_target(:app_extension,
|
37
38
|
extension['name'],
|
@@ -39,17 +40,21 @@ module GoNative
|
|
39
40
|
'11.0')
|
40
41
|
extension_group = proj.new_group(extension['name'], extension['name'])
|
41
42
|
|
42
|
-
extension['headers'].each{ |path| extension_group.new_file(path) }
|
43
|
-
target.add_file_references(extension['source_files'].map{ |path| extension_group.new_file(path) })
|
44
|
-
target.add_resources(extension['resources'].map{ |path| extension_group.new_file(path) })
|
43
|
+
extension['headers'].each { |path| extension_group.new_file(path) }
|
44
|
+
target.add_file_references(extension['source_files'].map { |path| extension_group.new_file(path) })
|
45
|
+
target.add_resources(extension['resources'].map { |path| extension_group.new_file(path) })
|
45
46
|
target.add_system_frameworks(extension['system_frameworks'])
|
46
|
-
|
47
|
-
if extension['entitlements']
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
extension_group.new_file(extension['info'])
|
48
|
+
extension_group.new_file(extension['entitlements']) if extension['entitlements']
|
49
|
+
target.build_configurations.each do |config|
|
50
|
+
config.build_settings['PRODUCT_NAME'] = "$(TARGET_NAME)"
|
51
|
+
config.build_settings['INFOPLIST_FILE'] = "#{extension['name']}/#{extension['info']}"
|
52
|
+
config.build_settings['CODE_SIGN_ENTITLEMENTS'] = "#{extension['name']}/#{extension['entitlements']}" if extension['entitlements']
|
52
53
|
end
|
54
|
+
app_target.add_dependency(target)
|
55
|
+
extension_file = proj.files.find{|f| f.path == "#{extension['name']}.appex" }
|
56
|
+
embed_phase = app_target.build_phases.find { |phase| phase.class.method_defined?(:name) && phase.name == 'Embed App Extensions' }
|
57
|
+
embed_phase.add_file_reference(extension_file, true)
|
53
58
|
end
|
54
59
|
|
55
60
|
proj.save
|
@@ -61,7 +66,7 @@ module GoNative
|
|
61
66
|
f.puts "target '#{extension['name']}' do"
|
62
67
|
f.puts "\tuse_frameworks!"
|
63
68
|
extension['dependencies'].each do |dep|
|
64
|
-
f.puts "\tpod #{dep['name']}, #{dep['requirement']}"
|
69
|
+
f.puts "\tpod '#{dep['name']}', '#{dep['requirement']}'"
|
65
70
|
end
|
66
71
|
f.puts "end"
|
67
72
|
end
|
@@ -31,6 +31,7 @@ module GoNative
|
|
31
31
|
target_definition[:name] = extension_name
|
32
32
|
|
33
33
|
FileUtils.cd(extension_name)
|
34
|
+
target_definition[:info] = `find . -name '*Info.plist'`.split("\n").first
|
34
35
|
target_definition[:entitlements] = `find -E . -regex ".*\.(entitlements)"`.split("\n").first
|
35
36
|
target_definition[:headers] = `find -E . -regex ".*\.(h)"`.split("\n")
|
36
37
|
target_definition[:source_files] = `find -E . -regex ".*\.(m|swift)"`.split("\n")
|
@@ -56,7 +57,7 @@ module GoNative
|
|
56
57
|
}
|
57
58
|
end
|
58
59
|
|
59
|
-
target_definition.slice(:entitlements, :headers, :source_files, :resources).values.compact.flatten.each do |file_path|
|
60
|
+
target_definition.slice(:info, :entitlements, :headers, :source_files, :resources).values.compact.flatten.each do |file_path|
|
60
61
|
system('ditto', file_path, "#{original_path}/#{extension_path}/#{file_path}")
|
61
62
|
end
|
62
63
|
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xcodeproj'
|
4
|
+
require 'cfpropertylist'
|
5
|
+
|
6
|
+
module GoNative
|
7
|
+
module Plugins
|
8
|
+
module IOS
|
9
|
+
class SetBundleId
|
10
|
+
extend DSL::Serviceable
|
11
|
+
|
12
|
+
attr_reader :bundle_id
|
13
|
+
|
14
|
+
def initialize(bundle_id, update_entitlements)
|
15
|
+
@bundle_id = bundle_id
|
16
|
+
@update_entitlements = update_entitlements
|
17
|
+
end
|
18
|
+
|
19
|
+
def call
|
20
|
+
update_project
|
21
|
+
update_entitlements if update_entitlements?
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_project
|
25
|
+
proj = Xcodeproj::Project.open('./GoNativeIOS.xcodeproj')
|
26
|
+
proj.targets.each do |target|
|
27
|
+
case target.product_type
|
28
|
+
when Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]
|
29
|
+
set_target_bundle_id(target, bundle_id)
|
30
|
+
when Xcodeproj::Constants::PRODUCT_TYPE_UTI[:app_extension]
|
31
|
+
set_target_bundle_id(target, bundle_id + '.' + target.name)
|
32
|
+
else
|
33
|
+
next
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
proj.save
|
38
|
+
end
|
39
|
+
|
40
|
+
def update_entitlements
|
41
|
+
entitlement_files = `find -E . -maxdepth 2 -regex ".*\.(entitlements)"`.split("\n")
|
42
|
+
entitlement_files.each do |entitlement_file|
|
43
|
+
plist = CFPropertyList::List.new(file: entitlement_file)
|
44
|
+
entitlements = CFPropertyList.native_types(plist.value)
|
45
|
+
entitlements['com.apple.security.application-groups'] = ['group.' + bundle_id]
|
46
|
+
plist.value = CFPropertyList.guess(entitlements)
|
47
|
+
plist.save(entitlement_file, CFPropertyList::List::FORMAT_XML)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def set_target_bundle_id(target, bundle_id)
|
54
|
+
target.build_configurations.each do |config|
|
55
|
+
config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = bundle_id
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def update_entitlements?
|
60
|
+
@update_entitlements
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/gonative/version.rb
CHANGED
@@ -14,7 +14,7 @@ TODO: Add long description of the pod here.
|
|
14
14
|
|
15
15
|
s.ios.deployment_target = '10.0'
|
16
16
|
s.swift_versions = '5.0'
|
17
|
-
s.preserve_paths = 'plist/*.{plist}'
|
17
|
+
s.preserve_paths = ['plist/*.{plist}', 'Extensions/**/*']
|
18
18
|
|
19
19
|
s.subspec 'Source' do |cs|
|
20
20
|
cs.source_files = '#{plugin_name}/Classes/**/*.{h,m,swift}'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gonative-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hunaid Hassan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- lib/gonative/commands/ios/embed_extensions.rb
|
194
194
|
- lib/gonative/commands/ios/extract_extensions.rb
|
195
195
|
- lib/gonative/commands/ios/publish.rb
|
196
|
+
- lib/gonative/commands/ios/set_bundle_id.rb
|
196
197
|
- lib/gonative/commands/version.rb
|
197
198
|
- lib/gonative/dsl/error_catchable.rb
|
198
199
|
- lib/gonative/dsl/serviceable.rb
|
@@ -202,6 +203,7 @@ files:
|
|
202
203
|
- lib/gonative/plugins/ios/embed_extensions.rb
|
203
204
|
- lib/gonative/plugins/ios/extract_extensions.rb
|
204
205
|
- lib/gonative/plugins/ios/release.rb
|
206
|
+
- lib/gonative/plugins/ios/set_bundle_id.rb
|
205
207
|
- lib/gonative/plugins/ios/verify.rb
|
206
208
|
- lib/gonative/utils.rb
|
207
209
|
- lib/gonative/utils/content_evaluator.rb
|