gonative-cli 0.8.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7995dad23118881e1f16097bc42257ab6592b53ec48eed27edd9ad1393a09273
4
- data.tar.gz: 213cf6485bda29cfeeaa561cb316439a9b42fe9def6eb3c2d1f2a9cba441e03d
3
+ metadata.gz: 209c566d675f24e9d390dc519042c8e0e4ae7d34106cc11554420645dec7059e
4
+ data.tar.gz: d64745af6c9013723754bf43e3ad5741d157ab108f9f9257cb6d37bc466873e7
5
5
  SHA512:
6
- metadata.gz: 02d51cad7d56e6d9f233933393c9ee0669e8245ccff392beace11141cfa53c03d2daa86a56c70ae30adf3e581ad0163be523b3da0f8a368331a872a2f6d9edd1
7
- data.tar.gz: d605e247903c38c9a0123700ed55632e1df41cc8185b72755da018b989ea0cabca06d82dd4e79e7dfcb7972b97532bdc53de71d2912c4cad38f1c13d84530c5f
6
+ metadata.gz: c7d09ae152c411ca063d5285d112aa7fd3f62672b0847d24e72c01ef0729402899e82e7e7f98fda7f6909fcfb518676418dc078abbb198d9272c4e12721bfbad
7
+ data.tar.gz: 2d510fa5fb4f2d1ad93b4a52033870eb3bf52a56a3987567133a7c550c8cc87e3ac9282da0a823e8415fa22b6639191f4b6d24bfe95527c1cb4dfea93cf3bc97
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gonative-cli (0.7.17)
4
+ gonative-cli (0.9.0)
5
5
  activesupport (~> 6.0)
6
6
  cocoapods (~> 1.10)
7
7
  colorize (~> 0.8.0)
@@ -4,7 +4,7 @@ module GoNative
4
4
  module Commands
5
5
  module IOS
6
6
  class EmbedExtensions < Base
7
- desc 'Extracts extension targets from a project'
7
+ desc 'Embeds all extensions from plugins to the project'
8
8
 
9
9
  def call(**)
10
10
  Plugins::IOS::EmbedExtensions.call
@@ -11,7 +11,6 @@ module GoNative
11
11
  option :archs, default: 'x86_64,arm64'
12
12
 
13
13
  def call(skip_build:, debug:, archs:, **)
14
- FileUtils.cd('/Users/hunaidhassan/Projects/gonative/AuthPlugin')
15
14
  Plugins::IOS::Verify.call
16
15
  Plugins::IOS::BuildFramework.call(archs, debug) unless skip_build
17
16
  Plugins::IOS::Release.call
@@ -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
@@ -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
@@ -13,6 +13,7 @@ module GoNative
13
13
  attr_reader :extensions
14
14
 
15
15
  def call
16
+ FileUtils.cd('/Users/hunaidhassan/Projects/gonative/gonative-ios')
16
17
  prepare_extensions
17
18
  embed_in_project
18
19
  modify_podfile
@@ -25,13 +26,14 @@ module GoNative
25
26
  .flatten
26
27
  .each { |path| FileUtils.cp_r(path, '.') }
27
28
  @extensions = extension_paths
28
- .map { |path| Pathname(path).children.select{ |p| p.extname == '.json'} }
29
+ .map { |path| Pathname(path).children.select { |p| p.extname == '.json' } }
29
30
  .flatten
30
31
  .map { |p| JSON.parse(File.read(p)) }
31
32
  end
32
33
 
33
34
  def embed_in_project
34
35
  proj = Xcodeproj::Project.open('GoNativeIOS.xcodeproj')
36
+ app_target = proj.native_targets.first
35
37
  extensions.each do |extension|
36
38
  target = proj.new_target(:app_extension,
37
39
  extension['name'],
@@ -39,17 +41,21 @@ module GoNative
39
41
  '11.0')
40
42
  extension_group = proj.new_group(extension['name'], extension['name'])
41
43
 
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) })
44
+ extension['headers'].each { |path| extension_group.new_file(path) }
45
+ target.add_file_references(extension['source_files'].map { |path| extension_group.new_file(path) })
46
+ target.add_resources(extension['resources'].map { |path| extension_group.new_file(path) })
45
47
  target.add_system_frameworks(extension['system_frameworks'])
46
-
47
- if extension['entitlements']
48
- extension_group.new_file(extension['entitlements'])
49
- target.build_configurations.each do |config|
50
- config.build_settings['CODE_SIGN_ENTITLEMENTS'] = "#{extension['name']}/#{extension['entitlements']}"
51
- end
48
+ extension_group.new_file(extension['info'])
49
+ extension_group.new_file(extension['entitlements']) if extension['entitlements']
50
+ target.build_configurations.each do |config|
51
+ config.build_settings['PRODUCT_NAME'] = "$(TARGET_NAME)"
52
+ config.build_settings['INFOPLIST_FILE'] = "#{extension['name']}/#{extension['info']}"
53
+ config.build_settings['CODE_SIGN_ENTITLEMENTS'] = "#{extension['name']}/#{extension['entitlements']}" if extension['entitlements']
52
54
  end
55
+ app_target.add_dependency(target)
56
+ extension_file = proj.files.find{|f| f.path == "#{extension['name']}.appex" }
57
+ embed_phase = app_target.build_phases.find { |phase| phase.class.method_defined?(:name) && phase.name == 'Embed App Extensions' }
58
+ embed_phase.add_file_reference(extension_file, true)
53
59
  end
54
60
 
55
61
  proj.save
@@ -61,7 +67,7 @@ module GoNative
61
67
  f.puts "target '#{extension['name']}' do"
62
68
  f.puts "\tuse_frameworks!"
63
69
  extension['dependencies'].each do |dep|
64
- f.puts "\tpod #{dep['name']}, #{dep['requirement']}"
70
+ f.puts "\tpod '#{dep['name']}', '#{dep['requirement']}'"
65
71
  end
66
72
  f.puts "end"
67
73
  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
 
@@ -45,7 +45,7 @@ module GoNative
45
45
  end
46
46
 
47
47
  def push_to_pod_repo!
48
- system "pod repo push #{GONATIVE_SOURCE_NAME} #{spec_name} --private"
48
+ system "pod repo push #{GONATIVE_SOURCE_NAME} #{spec_name} --private --allow-warnings"
49
49
  end
50
50
 
51
51
  def spec_name
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoNative
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.1"
5
5
  end
@@ -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.8.0
4
+ version: 0.9.1
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-02-27 00:00:00.000000000 Z
11
+ date: 2022-03-02 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