rhodes 5.5.0.7 → 5.5.0.22

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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +1 -1
  3. data/CREDITS +3 -3
  4. data/Rakefile +24 -0
  5. data/extensions/instrumentation/ext/platform/android/src/com/rho/instrumentation/Instrumentation.java +5 -0
  6. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/Rakefile +1 -1
  7. data/lib/build/jake.rb +5 -0
  8. data/lib/commonAPI/clipboard/ext.yml +17 -0
  9. data/lib/commonAPI/clipboard/ext/Clipboard.xml +49 -0
  10. data/lib/commonAPI/clipboard/ext/build +19 -0
  11. data/lib/commonAPI/clipboard/ext/build.bat +29 -0
  12. data/lib/commonAPI/clipboard/ext/platform/android/Rakefile +141 -0
  13. data/lib/commonAPI/clipboard/ext/platform/android/ext_java.files +9 -0
  14. data/lib/commonAPI/clipboard/ext/platform/android/ext_native.files +7 -0
  15. data/lib/commonAPI/clipboard/ext/platform/android/jni/Clipboard_impl.cpp +61 -0
  16. data/lib/commonAPI/clipboard/ext/platform/android/src/com/rho/clipboard/Clipboard.java +15 -0
  17. data/lib/commonAPI/clipboard/ext/platform/android/src/com/rho/clipboard/ClipboardFactory.java +18 -0
  18. data/lib/commonAPI/clipboard/ext/platform/android/src/com/rho/clipboard/ClipboardSingleton.java +146 -0
  19. data/lib/commonAPI/clipboard/ext/platform/iphone/Clipboard.xcodeproj/project.pbxproj +368 -0
  20. data/lib/commonAPI/clipboard/ext/platform/iphone/Clipboard_Prefix.pch +7 -0
  21. data/lib/commonAPI/clipboard/ext/platform/iphone/Rakefile +73 -0
  22. data/lib/commonAPI/clipboard/ext/platform/iphone/impl/Clipboard.h +11 -0
  23. data/lib/commonAPI/clipboard/ext/platform/iphone/impl/Clipboard.m +12 -0
  24. data/lib/commonAPI/clipboard/ext/platform/iphone/impl/ClipboardFactorySingleton.m +16 -0
  25. data/lib/commonAPI/clipboard/ext/platform/iphone/impl/ClipboardSetup.m +9 -0
  26. data/lib/commonAPI/clipboard/ext/platform/iphone/impl/ClipboardSingleton.h +18 -0
  27. data/lib/commonAPI/clipboard/ext/platform/iphone/impl/ClipboardSingleton.m +43 -0
  28. data/lib/commonAPI/clipboard/ext/platform/iphone/impl/readme.txt +7 -0
  29. data/lib/commonAPI/coreapi/ext/NativeTabbar.xml +3 -3
  30. data/lib/commonAPI/coreapi/ext/shared/TimerImpl.cpp +36 -27
  31. data/lib/commonAPI/coreapi/public/api/rhoapi-force.ajax.js +3 -1
  32. data/lib/commonAPI/coreapi/public/api/rhoapi.js +2 -1
  33. data/lib/commonAPI/devicesecurity/ext.yml +11 -0
  34. data/lib/commonAPI/devicesecurity/ext/DeviceSecurity.xml +91 -0
  35. data/lib/commonAPI/devicesecurity/ext/build +19 -0
  36. data/lib/commonAPI/devicesecurity/ext/build.bat +29 -0
  37. data/lib/commonAPI/devicesecurity/ext/platform/android/InbuiltValues.erb +16 -0
  38. data/lib/commonAPI/devicesecurity/ext/platform/android/Rakefile +166 -0
  39. data/lib/commonAPI/devicesecurity/ext/platform/android/ext_java.files +10 -0
  40. data/lib/commonAPI/devicesecurity/ext/platform/android/ext_native.files +7 -0
  41. data/lib/commonAPI/devicesecurity/ext/platform/android/jni/DeviceSecurity_impl.cpp +61 -0
  42. data/lib/commonAPI/devicesecurity/ext/platform/android/src/com/rho/devicesecurity/DeviceSecurity.java +14 -0
  43. data/lib/commonAPI/devicesecurity/ext/platform/android/src/com/rho/devicesecurity/DeviceSecurityFactory.java +18 -0
  44. data/lib/commonAPI/devicesecurity/ext/platform/android/src/com/rho/devicesecurity/DeviceSecuritySingleton.java +412 -0
  45. data/lib/commonAPI/devicesecurity/ext/platform/iphone/DeviceSecurity.xcodeproj/project.pbxproj +368 -0
  46. data/lib/commonAPI/devicesecurity/ext/platform/iphone/DeviceSecurity_Prefix.pch +7 -0
  47. data/lib/commonAPI/devicesecurity/ext/platform/iphone/Rakefile +73 -0
  48. data/lib/commonAPI/devicesecurity/ext/platform/iphone/impl/DeviceSecurity.h +11 -0
  49. data/lib/commonAPI/devicesecurity/ext/platform/iphone/impl/DeviceSecurity.m +12 -0
  50. data/lib/commonAPI/devicesecurity/ext/platform/iphone/impl/DeviceSecurityFactorySingleton.m +16 -0
  51. data/lib/commonAPI/devicesecurity/ext/platform/iphone/impl/DeviceSecuritySetup.m +9 -0
  52. data/lib/commonAPI/devicesecurity/ext/platform/iphone/impl/DeviceSecuritySingleton.h +19 -0
  53. data/lib/commonAPI/devicesecurity/ext/platform/iphone/impl/DeviceSecuritySingleton.m +106 -0
  54. data/lib/commonAPI/devicesecurity/ext/platform/iphone/impl/readme.txt +7 -0
  55. data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +5 -1
  56. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/Utils.java +9 -0
  57. data/platform/android/build/android.rake +42 -1
  58. data/platform/android/build/androidcommon.rb +4 -2
  59. data/platform/iphone/Classes/RhoWKWebView.m +4 -0
  60. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.h +2 -0
  61. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +195 -30
  62. data/platform/iphone/Classes/rho/net/IPhoneNetRequest.mm +91 -4
  63. data/platform/iphone/rbuild/iphone.rake +297 -231
  64. data/platform/iphone/rbuild/putsOverride.rake +8 -0
  65. data/platform/shared/common/RhoTime.cpp +81 -40
  66. data/platform/shared/common/RhodesApp.cpp +16 -18
  67. data/platform/shared/db/DBAdapter.cpp +33 -0
  68. data/platform/shared/db/DBAdapter.h +5 -0
  69. data/platform/shared/net/HttpServer.cpp +27 -1
  70. data/platform/shared/net/INetRequest.cpp +33 -6
  71. data/platform/shared/qt/rhodes/qkineticscroller.cpp +2 -2
  72. data/platform/shared/qt/rhodes/qkineticscroller_p.h +1 -1
  73. data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +3 -3
  74. data/platform/shared/qt/rhodes/qtscrollevent.cpp +2 -2
  75. data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +1 -1
  76. data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +1 -1
  77. data/platform/wm/build/wm.rake +7 -3
  78. data/platform/wm/rhodes/browser/BrowserFactory.cpp +4 -6
  79. data/platform/wm/rhodes/browser/stubs.cpp +5 -0
  80. data/platform/wm/rhodes/rhodes.vcproj +31 -2
  81. data/rakefile.rb +24 -0
  82. data/res/generators/templates/application/app/Settings/home.erb +1 -1
  83. data/res/generators/templates/application/build.yml +61 -4
  84. data/res/generators/templates/application/icon/icon.png +0 -0
  85. data/res/generators/templates/application/icon/icon114.png +0 -0
  86. data/res/generators/templates/application/icon/icon120.png +0 -0
  87. data/res/generators/templates/application/icon/icon144.png +0 -0
  88. data/res/generators/templates/application/icon/icon152.png +0 -0
  89. data/res/generators/templates/application/icon/icon180.png +0 -0
  90. data/res/generators/templates/application/icon/icon57.png +0 -0
  91. data/res/generators/templates/application/icon/icon60.png +0 -0
  92. data/res/generators/templates/application/icon/icon72.png +0 -0
  93. data/res/generators/templates/application/icon/icon76.png +0 -0
  94. data/res/generators/templates/application/production/iTunesArtwork.png +0 -0
  95. data/res/generators/templates/application/production/iTunesArtwork@2x.png +0 -0
  96. data/res/generators/templates/iphone_project/Bremen7.xcodeproj/project.pbxproj +1 -0
  97. data/res/generators/templates/iphone_project/buildRhoBundle +23 -7
  98. data/res/generators/templates/iphone_project/root/Info.plist +0 -2
  99. data/res/generators/templates/iphone_project/root/iTunesArtwork +0 -0
  100. data/res/generators/templates/iphone_project/root/iTunesArtwork@2x +0 -0
  101. data/res/generators/templates/iphone_project/root/icon114.png +0 -0
  102. data/res/generators/templates/iphone_project/root/icon120.png +0 -0
  103. data/res/generators/templates/iphone_project/root/icon144.png +0 -0
  104. data/res/generators/templates/iphone_project/root/icon152.png +0 -0
  105. data/res/generators/templates/iphone_project/root/icon180.png +0 -0
  106. data/res/generators/templates/iphone_project/root/icon57.png +0 -0
  107. data/res/generators/templates/iphone_project/root/icon60.png +0 -0
  108. data/res/generators/templates/iphone_project/root/icon72.png +0 -0
  109. data/res/generators/templates/iphone_project/root/icon76.png +0 -0
  110. data/res/generators/templates/iphone_project/root/rhorunner_development.entitlements +6 -0
  111. data/rhodes.gemspec +19 -17
  112. data/version +1 -1
  113. metadata +118 -44
@@ -12,9 +12,31 @@
12
12
  #import "common/RhoFilePath.h"
13
13
  #import "common/StringConverter.h"
14
14
  #import "common/RhoConf.h"
15
+ #import "logging/RhoLog.h"
16
+
17
+
18
+ #undef DEFAULT_LOGCATEGORY
19
+ #define DEFAULT_LOGCATEGORY "iPhoneNetRequest"
15
20
 
16
21
  extern "C" void rho_net_impl_network_indicator(int active);
17
22
 
23
+
24
+ static bool is_net_trace() {
25
+ static int res = -1;
26
+ if (res == -1) {
27
+ if (rho_conf_getBool("net_trace") ) {
28
+ res = 1;
29
+ }
30
+ else {
31
+ res = 0;
32
+ }
33
+ }
34
+ return res == 1;
35
+ }
36
+
37
+
38
+
39
+
18
40
  @interface NetRequestDelegateContext : NSObject
19
41
  {
20
42
  NSCondition* netDelegateThreadStartCond;
@@ -115,6 +137,13 @@ public:
115
137
 
116
138
  - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
117
139
 
140
+ - (nullable NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(nullable NSURLResponse *)response;
141
+ - (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten
142
+ totalBytesWritten:(NSInteger)totalBytesWritten
143
+ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
144
+
145
+
146
+
118
147
  //- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response;
119
148
 
120
149
  @property (retain)NSHTTPURLResponse* response;
@@ -146,18 +175,28 @@ public:
146
175
 
147
176
  - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)err
148
177
  {
178
+ if (is_net_trace()) {
179
+ RAWTRACE3("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didFailWithError uri = %s ERRCODE = %d, ERRTEXT = %s", [[[[connection currentRequest] URL] absoluteString] UTF8String], (int)[err code], [err localizedDescription]);
180
+ }
181
+
149
182
  self.error = err;
150
183
  m_pCppDelegate->onDone();
151
184
  }
152
185
 
153
186
  - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)resp
154
187
  {
188
+ if (is_net_trace()) {
189
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didReceiveResponse uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
190
+ }
155
191
  self.response = (NSHTTPURLResponse*)resp;
156
192
  m_pCppDelegate->onResponse((NSHTTPURLResponse*)resp);
157
193
  }
158
194
 
159
195
  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
160
196
  {
197
+ if (is_net_trace()) {
198
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didReceiveData uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
199
+ }
161
200
  if ( m_pCppDelegate->shouldSaveData() )
162
201
  {
163
202
  [self.data appendData:data];
@@ -167,11 +206,17 @@ public:
167
206
 
168
207
  - (void)connectionDidFinishLoading:(NSURLConnection *)connection
169
208
  {
209
+ if (is_net_trace()) {
210
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::connectionDidFinishLoading uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
211
+ }
170
212
  m_pCppDelegate->onDone();
171
213
  }
172
214
 
173
215
  - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
174
216
  {
217
+ if (is_net_trace()) {
218
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::willSendRequestForAuthenticationChallenge uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
219
+ }
175
220
  if ( (!m_pCppDelegate->verifySSLPeers()) && [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust] )
176
221
  {
177
222
  SecTrustRef trust = challenge.protectionSpace.serverTrust;
@@ -184,6 +229,24 @@ public:
184
229
  }
185
230
  }
186
231
 
232
+ - (nullable NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(nullable NSURLResponse *)response {
233
+ if (is_net_trace()) {
234
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::willSendRequest uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
235
+ }
236
+ return request;
237
+ }
238
+
239
+
240
+ - (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten
241
+ totalBytesWritten:(NSInteger)totalBytesWritten
242
+ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
243
+ if (is_net_trace()) {
244
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didSendBodyData uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
245
+ }
246
+ }
247
+
248
+
249
+
187
250
  /*
188
251
  - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response
189
252
  {
@@ -651,16 +714,28 @@ public:
651
714
 
652
715
  INetResponse* perform( Hashtable<String,String>* pHeaders, IRhoSession* pSession )
653
716
  {
654
-
655
- [m_pPerformCond lock];
717
+ if (is_net_trace()) {
718
+ RAWLOG_INFO1("$NetRequestProcess$ PRE LOCK IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
719
+ }
720
+
721
+ [m_pPerformCond lock];
722
+ if (is_net_trace()) {
723
+ RAWLOG_INFO1("$NetRequestProcess$ POST LOCK IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
724
+ }
656
725
 
657
726
  //start();
658
727
  rho_net_impl_network_indicator(1);
659
728
 
660
729
  [m_pConnDelegate performSelector:@selector(startAsyncRequest) onThread:[[NetRequestDelegateContext sharedInstance] netRequestDelegateThread] withObject:nil waitUntilDone:NO];
661
730
 
731
+ if (is_net_trace()) {
732
+ RAWTRACE1("$NetRequestProcess$ PRE WAIT IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
733
+ }
662
734
  [m_pPerformCond wait];
663
735
  [m_pPerformCond unlock];
736
+ if (is_net_trace()) {
737
+ RAWTRACE1("$NetRequestProcess$ POST WAIT IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
738
+ }
664
739
 
665
740
  NSHTTPURLResponse* resp = nil;
666
741
  NSError* err = nil;
@@ -739,6 +814,11 @@ public:
739
814
  }
740
815
  }
741
816
  rho_net_impl_network_indicator(0);
817
+
818
+ if (is_net_trace()) {
819
+ RAWTRACE1("$NetRequestProcess$ FINISH IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
820
+ }
821
+
742
822
  return ret;
743
823
 
744
824
  }
@@ -747,8 +827,15 @@ public:
747
827
  {
748
828
  [m_pConn initWithRequest:m_pReq delegate:m_pConnDelegate startImmediately:NO];
749
829
  // [m_pConn setDelegateQueue:[NSOperationQueue mainQueue]];
750
- // [m_pConn scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
830
+ //[m_pConn scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
831
+ if (is_net_trace()) {
832
+ RAWTRACE1("$NetRequestProcess$ PRE START IPhoneNetRequest::start uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
833
+ }
834
+
751
835
  [m_pConn start];
836
+ if (is_net_trace()) {
837
+ RAWTRACE1("$NetRequestProcess$ POST START IPhoneNetRequest::start uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
838
+ }
752
839
  }
753
840
 
754
841
  void cancel()
@@ -933,4 +1020,4 @@ void CIPhoneNetRequest::setCallback(INetRequestCallback* cb)
933
1020
 
934
1021
  }
935
1022
 
936
- }
1023
+ }
@@ -28,6 +28,35 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'iphonecommon'))
28
28
  require File.dirname(__FILE__) + '/../../../lib/build/BuildConfig'
29
29
 
30
30
 
31
+ $out_file_buf_enable = false
32
+ $out_file_buf_path = 'rhobuildlog.txt'
33
+ $out_file_buf = []
34
+
35
+ puts 'iphone.rake execute'
36
+ puts 'ENV["RHO_BUNDLE_BUILD_LOG_FILE"] = '+ENV["RHO_BUNDLE_BUILD_LOG_FILE"].to_s
37
+ if (ENV["RHO_BUNDLE_BUILD_LOG_FILE"] != nil)
38
+ $out_file_buf_path = ENV["RHO_BUNDLE_BUILD_LOG_FILE"]
39
+ $out_file_buf_enable = true
40
+ load File.expand_path(File.join(File.dirname(__FILE__), 'putsOverride.rake'))
41
+ end
42
+
43
+
44
+
45
+ def save_out_file
46
+ if $out_file_buf_enable
47
+ f = File.new($out_file_buf_path,"w")
48
+ $out_file_buf.each do |line|
49
+ f.write(line)
50
+ f.write("\n")
51
+ end
52
+ f.close
53
+ end
54
+ end
55
+
56
+
57
+
58
+
59
+
31
60
  def load_plist(fname)
32
61
  require 'cfpropertylist'
33
62
 
@@ -149,6 +178,205 @@ end
149
178
  # return ret_value
150
179
  # end
151
180
 
181
+ def recursive_replace_bool(value)
182
+ if value.kind_of?(Hash)
183
+ value.each_key do |nkey|
184
+ value[nkey] = recursive_replace_bool(value[nkey])
185
+ end
186
+ elsif value.kind_of?(Array)
187
+ new_array = []
188
+ value.each do |el|
189
+ new_array << recursive_replace_bool(el)
190
+ end
191
+ else
192
+ if (value.to_s.downcase == 'true') || (value.to_s.downcase == 'yes')
193
+ value = true
194
+ end
195
+ if (value.to_s.downcase == 'false') || (value.to_s.downcase == 'no')
196
+ value = false
197
+ end
198
+ end
199
+ return value
200
+ end
201
+
202
+ def recursive_merge_hash(hash, key, value)
203
+ old_value = hash[key]
204
+ if old_value.nil?
205
+ hash[key] = value
206
+ elsif value.kind_of?(Array)
207
+ if old_value.kind_of?(Array)
208
+ value.each do |element|
209
+ if !old_value.include?(element)
210
+ old_value << element
211
+ end
212
+ end
213
+ else
214
+ hash[key] = value
215
+ end
216
+ elsif value.kind_of?(Hash)
217
+ if old_value.kind_of?(Hash)
218
+ value.each do |nkey, nvalue|
219
+ recursive_merge_hash(old_value, nkey, nvalue)
220
+ end
221
+ else
222
+ hash[key] = value
223
+ end
224
+ else
225
+ hash[key] = value
226
+ end
227
+ end
228
+
229
+
230
+ def recursive_remove_hash(hash, key)
231
+ if key.kind_of?(Array)
232
+ key.each do |element|
233
+ recursive_remove_hash(hash, element)
234
+ end
235
+ elsif key.kind_of?(Hash)
236
+ key.each do |keykey, keyvalue|
237
+ if hash.has_key? keykey
238
+ oldkey = hash[keykey]
239
+ recursive_remove_hash(oldkey, keyvalue)
240
+ end
241
+ end
242
+ elsif key.kind_of?(String)
243
+ #if hash.has_key? key
244
+ hash.delete(key)
245
+ #end
246
+ end
247
+ end
248
+
249
+
250
+
251
+ def update_plist_procedure
252
+ appname = $app_config["name"] ? $app_config["name"] : "rhorunner"
253
+ appname_fixed = appname.split(/[^a-zA-Z0-9]/).map { |w| w }.join("")
254
+
255
+ vendor = $app_config['vendor'] ? $app_config['vendor'] : "rhomobile"
256
+ bundle_identifier = "com.#{vendor}.#{appname}"
257
+ bundle_identifier = $app_config["iphone"]["BundleIdentifier"] unless $app_config["iphone"]["BundleIdentifier"].nil?
258
+
259
+ on_suspend = $app_config["iphone"]["UIApplicationExitsOnSuspend"]
260
+ on_suspend_value = false
261
+
262
+ if on_suspend.nil?
263
+ puts "UIApplicationExitsOnSuspend not configured, using default of false"
264
+ elsif on_suspend.to_s.downcase == "true" || on_suspend.to_s == "1"
265
+ on_suspend_value = true
266
+ elsif on_suspend.to_s.downcase == "false" || on_suspend.to_s == "0"
267
+ on_suspend_value = false
268
+ else
269
+ raise "UIApplicationExitsOnSuspend is not set to a valid value. Current value: '#{$app_config["iphone"]["UIApplicationExitsOnSuspend"]}'"
270
+ end
271
+
272
+ init_extensions( nil, "get_ext_xml_paths")
273
+
274
+ ext_name, changed_value = get_ext_plist_changes($app_extension_cfg)
275
+
276
+ set_app_plist_options($app_path + "/project/iphone/Info.plist", appname, bundle_identifier, $app_config["version"], $app_config["iphone"]["BundleURLScheme"]) do |hash|
277
+ hash['UIApplicationExitsOnSuspend'] = on_suspend_value
278
+
279
+ changed_value.each do |k, v|
280
+ puts "Info.plist: Setting key #{k} = #{v} from #{File.basename(ext_name[k])}"
281
+ hash[k] = v
282
+ end
283
+
284
+ #setup GPS access
285
+ gps_request_text = nil
286
+ if $app_config["capabilities"].index("gps") != nil
287
+ gps_request_text = 'application tracks your position'
288
+ end
289
+ if !$app_config["iphone"].nil?
290
+ if !$app_config["iphone"]["capabilities"].nil?
291
+ if $app_config["iphone"]["capabilities"].index("gps") != nil
292
+ gps_request_text = 'application tracks your position'
293
+ end
294
+ end
295
+ end
296
+ if gps_request_text != nil
297
+ if hash['NSLocationWhenInUseUsageDescription'] == nil
298
+ puts "Info.plist: added key [NSLocationWhenInUseUsageDescription]"
299
+ hash['NSLocationWhenInUseUsageDescription'] = gps_request_text
300
+ end
301
+ end
302
+
303
+ #setup Camera access
304
+ camera_request_text = nil
305
+ if $app_config["capabilities"].index("camera") != nil
306
+ camera_request_text = 'application wants to use camera'
307
+ end
308
+ if !$app_config["iphone"].nil?
309
+ if !$app_config["iphone"]["capabilities"].nil?
310
+ if $app_config["iphone"]["capabilities"].index("camera") != nil
311
+ camera_request_text = 'application wants to use camera'
312
+ end
313
+ end
314
+ end
315
+ if camera_request_text != nil
316
+ if hash['NSCameraUsageDescription'] == nil
317
+ puts "Info.plist: added key [NSCameraUsageDescription]"
318
+ hash['NSCameraUsageDescription'] = camera_request_text
319
+ end
320
+ end
321
+
322
+
323
+ #LSApplicationQueriesSchemes
324
+ if $app_config["iphone"].has_key?("ApplicationQueriesSchemes")
325
+ arr_app_queries_schemes = $app_config["iphone"]["ApplicationQueriesSchemes"]
326
+ if arr_app_queries_schemes.kind_of?(Array)
327
+ hash['LSApplicationQueriesSchemes'] = arr_app_queries_schemes
328
+ else
329
+ hash['LSApplicationQueriesSchemes'] = []
330
+ end
331
+ end
332
+
333
+ #http_connection_domains
334
+ if !hash.has_key?("NSAppTransportSecurity")
335
+ hash['NSAppTransportSecurity'] = {}
336
+ end
337
+ if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoads")
338
+ hash['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true
339
+ end
340
+ if $app_config["iphone"].has_key?("http_connection_domains")
341
+ http_connection_domains = $app_config["iphone"]["http_connection_domains"]
342
+ if http_connection_domains.kind_of?(Array)
343
+ hash['NSAppTransportSecurity']['NSExceptionDomains'] = {}
344
+ http_connection_domains.each do |domain|
345
+ domain_hash = {}
346
+ domain_hash['NSIncludesSubdomains'] = true
347
+ domain_hash['NSTemporaryExceptionAllowsInsecureHTTPLoads'] = true
348
+ domain_hash['NSTemporaryExceptionMinimumTLSVersion'] = 'TLSv1.0'
349
+
350
+ hash['NSAppTransportSecurity']['NSExceptionDomains'][domain.to_s] = domain_hash
351
+ end
352
+ end
353
+ end
354
+
355
+ # add custom data
356
+ if $app_config["iphone"].has_key?("info_plist_data_remove")
357
+ info_plist_data_remove = $app_config["iphone"]["info_plist_data_remove"]
358
+ if info_plist_data_remove.kind_of?(Array)
359
+ info_plist_data_remove.each do |key|
360
+ recursive_remove_hash(hash, key)
361
+ end
362
+ end
363
+ end
364
+ if $app_config["iphone"].has_key?("info_plist_data")
365
+ info_plist_data = $app_config["iphone"]["info_plist_data"]
366
+ if info_plist_data.kind_of?(Hash)
367
+ info_plist_data.each do |key, value|
368
+ value = recursive_replace_bool(value)
369
+ recursive_merge_hash(hash, key, value)
370
+ end
371
+ end
372
+ end
373
+
374
+
375
+ set_app_icon(false)
376
+ set_default_images(false, hash)
377
+ end
378
+ end
379
+
152
380
  def set_signing_identity(identity,profile,entitlements)
153
381
 
154
382
  appname = $app_config["name"] ? $app_config["name"] : "rhorunner"
@@ -591,6 +819,31 @@ def update_xcode_project_files_by_capabilities
591
819
  remove_lines_from_xcode_project(['com.apple.Push = {enabled = 1;};'])
592
820
  end
593
821
 
822
+ #keychain access
823
+ enable_keychain = false
824
+ if $app_config['capabilities'] != nil
825
+ if $app_config['capabilities'].index('keychain')
826
+ enable_keychain = true
827
+ end
828
+ end
829
+ if $app_config['iphone'] != nil
830
+ if $app_config['iphone']['capabilities'] != nil
831
+ if $app_config['iphone']['capabilities'].index('keychain')
832
+ enable_keychain = true
833
+ end
834
+ end
835
+ end
836
+ # required for database encryption
837
+ if $app_config['encrypt_database'] != nil
838
+ if $app_config['encrypt_database'] == '1'
839
+ enable_keychain = true
840
+ end
841
+ end
842
+ if enable_keychain
843
+ else
844
+ remove_lines_from_xcode_project(['com.apple.Keychain = {enabled = 1;};'])
845
+ end
846
+
594
847
  save_plist(info_plist, hash_info_plist)
595
848
  save_plist(dev_ent, hash_dev_ent)
596
849
  save_plist(prd_ent, hash_prd_ent)
@@ -955,6 +1208,8 @@ namespace "build" do
955
1208
 
956
1209
  print_timestamp('build:iphone:rhobundle FINISH')
957
1210
 
1211
+ save_out_file
1212
+
958
1213
  end
959
1214
 
960
1215
  desc "build upgrade package with full bundle"
@@ -1158,6 +1413,7 @@ namespace "build" do
1158
1413
  end
1159
1414
 
1160
1415
  def is_options_was_changed(options_hash, options_file)
1416
+ puts " is_options_was_changed( "+options_hash.to_s+", "+options_file.to_s+")"
1161
1417
  if !File.exist?(options_file)
1162
1418
  File.open(options_file,"w") {|f| f.write(YAML::dump(options_hash)) }
1163
1419
  return true
@@ -1196,6 +1452,7 @@ namespace "build" do
1196
1452
  arch = ENV['ARCHS']
1197
1453
  gccbin = bindir + '/gcc-4.2'
1198
1454
  arbin = bindir + '/ar'
1455
+ xcode_version = ENV['XCODE_VERSION_ACTUAL']
1199
1456
 
1200
1457
  iphone_path = '.'
1201
1458
 
@@ -1208,33 +1465,53 @@ namespace "build" do
1208
1465
  result_lib = iphone_path + '/build/' + configuration + '-' + ( simulator ? "iphonesimulator" : "iphoneos") + '/lib'+xcodetarget+'.a'
1209
1466
  target_lib = targetdir + '/lib'+xcodetarget+'.a'
1210
1467
 
1211
- if check_for_rebuild(result_lib, depfile) || is_options_was_changed({"configuration" => configuration,"sdk" => sdk}, "lastbuildoptions.yml")
1468
+ puts "BEGIN build xcode extension : ["+extpath+"]"
1469
+ puts " result_lib : ["+result_lib+"]"
1470
+ puts " target_lib : ["+target_lib+"]"
1471
+ puts " depfile : ["+depfile.to_s+"]"
1472
+ puts " configuration : ["+configuration+"]"
1473
+ puts " sdk : ["+sdk+"]"
1212
1474
 
1213
- rm_rf 'build'
1214
- rm_rf target_lib
1215
1475
 
1216
- args = ['build', '-target', xcodetarget, '-configuration', configuration, '-sdk', sdk, '-project', xcodeproject]
1217
1476
 
1218
- additional_string = ''
1219
- if simulator
1220
- #args << '-arch'
1221
- #args << 'i386'
1222
- additional_string = ' ARCHS="i386 x86_64"'
1223
- end
1477
+ rm_rf target_lib
1224
1478
 
1225
- require rootdir + '/lib/build/jake.rb'
1479
+ check_f_r = check_for_rebuild(result_lib, depfile)
1480
+ puts " check_for_rebuild = "+check_f_r.to_s
1481
+ is_opt_c = is_options_was_changed({"configuration" => configuration,"sdk" => sdk, "xcode_version" => xcode_version}, "lastbuildoptions.yml")
1482
+ puts " is_options_was_changed = "+is_opt_c.to_s
1226
1483
 
1227
- ret = IPhoneBuild.run_and_trace(xcodebuild,args,{:rootdir => rootdir, :string_for_add_to_command_line => additional_string})
1484
+ if check_f_r || is_opt_c
1485
+ puts " we should rebuild because previous builded library is not actual or not exist !"
1228
1486
  else
1487
+ puts " ssskip rebuild because previous builded library is still actual !"
1488
+ end
1489
+
1490
+ if !File.exist?(result_lib)
1491
+ # library bot found ! We should build it !
1492
+ puts " build xcode extension !"
1493
+
1494
+ rm_rf 'build'
1229
1495
 
1230
- puts "ssskip rebuild because previous builded library is still actual !"
1231
- rm_rf target_lib
1496
+ args = ['build', '-target', xcodetarget, '-configuration', configuration, '-sdk', sdk, '-project', xcodeproject]
1497
+
1498
+ additional_string = ''
1499
+ if simulator
1500
+ #args << '-arch'
1501
+ #args << 'i386'
1502
+ additional_string = ' ARCHS="i386 x86_64"'
1503
+ end
1504
+
1505
+ require rootdir + '/lib/build/jake.rb'
1506
+
1507
+ ret = IPhoneBuild.run_and_trace(xcodebuild,args,{:rootdir => rootdir, :string_for_add_to_command_line => additional_string})
1232
1508
 
1233
1509
  end
1234
1510
 
1235
1511
  cp result_lib,target_lib
1236
1512
 
1237
1513
  Dir.chdir currentdir
1514
+ puts "END build xcode extension : ["+extpath+"]"
1238
1515
 
1239
1516
 
1240
1517
  end
@@ -1246,6 +1523,9 @@ namespace "build" do
1246
1523
 
1247
1524
  puts "build extension START :" + extpath
1248
1525
 
1526
+
1527
+ ENV["SDK_NAME"] ||= sdk
1528
+ sdk = ENV["SDK_NAME"]
1249
1529
  #puts "xcodeproject = "+xcodeproject.to_s
1250
1530
  #puts "xcodetarget = "+xcodetarget.to_s
1251
1531
 
@@ -1276,7 +1556,7 @@ namespace "build" do
1276
1556
  # added by dmitrys
1277
1557
  ENV["XCODEBUILD"] = $xcodebuild
1278
1558
  ENV["CONFIGURATION"] ||= $configuration
1279
- ENV["SDK_NAME"] ||= sdk
1559
+
1280
1560
 
1281
1561
 
1282
1562
  build_script = File.join(extpath, 'build')
@@ -1836,121 +2116,12 @@ namespace "build" do
1836
2116
 
1837
2117
 
1838
2118
  task :update_plist => ["config:iphone"] do
1839
- appname = $app_config["name"] ? $app_config["name"] : "rhorunner"
1840
- appname_fixed = appname.split(/[^a-zA-Z0-9]/).map { |w| w }.join("")
1841
2119
 
1842
2120
  chdir $app_path
1843
2121
 
1844
2122
  puts 'update info.plist'
1845
2123
 
1846
- vendor = $app_config['vendor'] ? $app_config['vendor'] : "rhomobile"
1847
- bundle_identifier = "com.#{vendor}.#{appname}"
1848
- bundle_identifier = $app_config["iphone"]["BundleIdentifier"] unless $app_config["iphone"]["BundleIdentifier"].nil?
1849
-
1850
- on_suspend = $app_config["iphone"]["UIApplicationExitsOnSuspend"]
1851
- on_suspend_value = false
1852
-
1853
- if on_suspend.nil?
1854
- puts "UIApplicationExitsOnSuspend not configured, using default of false"
1855
- elsif on_suspend.to_s.downcase == "true" || on_suspend.to_s == "1"
1856
- on_suspend_value = true
1857
- elsif on_suspend.to_s.downcase == "false" || on_suspend.to_s == "0"
1858
- on_suspend_value = false
1859
- else
1860
- raise "UIApplicationExitsOnSuspend is not set to a valid value. Current value: '#{$app_config["iphone"]["UIApplicationExitsOnSuspend"]}'"
1861
- end
1862
-
1863
- init_extensions( nil, "get_ext_xml_paths")
1864
-
1865
- ext_name, changed_value = get_ext_plist_changes($app_extension_cfg)
1866
-
1867
- set_app_plist_options($app_path + "/project/iphone/Info.plist", appname, bundle_identifier, $app_config["version"], $app_config["iphone"]["BundleURLScheme"]) do |hash|
1868
- hash['UIApplicationExitsOnSuspend'] = on_suspend_value
1869
-
1870
- changed_value.each do |k, v|
1871
- puts "Info.plist: Setting key #{k} = #{v} from #{File.basename(ext_name[k])}"
1872
- hash[k] = v
1873
- end
1874
-
1875
- #setup GPS access
1876
- gps_request_text = nil
1877
- if $app_config["capabilities"].index("gps") != nil
1878
- gps_request_text = 'application tracks your position'
1879
- end
1880
- if !$app_config["iphone"].nil?
1881
- if !$app_config["iphone"]["capabilities"].nil?
1882
- if $app_config["iphone"]["capabilities"].index("gps") != nil
1883
- gps_request_text = 'application tracks your position'
1884
- end
1885
- end
1886
- end
1887
- if gps_request_text != nil
1888
- if hash['NSLocationWhenInUseUsageDescription'] == nil
1889
- puts "Info.plist: added key [NSLocationWhenInUseUsageDescription]"
1890
- hash['NSLocationWhenInUseUsageDescription'] = gps_request_text
1891
- end
1892
- end
1893
-
1894
- #setup Camera access
1895
- camera_request_text = nil
1896
- if $app_config["capabilities"].index("camera") != nil
1897
- camera_request_text = 'application wants to use camera'
1898
- end
1899
- if !$app_config["iphone"].nil?
1900
- if !$app_config["iphone"]["capabilities"].nil?
1901
- if $app_config["iphone"]["capabilities"].index("camera") != nil
1902
- camera_request_text = 'application wants to use camera'
1903
- end
1904
- end
1905
- end
1906
- if camera_request_text != nil
1907
- if hash['NSCameraUsageDescription'] == nil
1908
- puts "Info.plist: added key [NSCameraUsageDescription]"
1909
- hash['NSCameraUsageDescription'] = camera_request_text
1910
- end
1911
- end
1912
-
1913
-
1914
- #LSApplicationQueriesSchemes
1915
- if $app_config["iphone"].has_key?("ApplicationQueriesSchemes")
1916
- arr_app_queries_schemes = $app_config["iphone"]["ApplicationQueriesSchemes"]
1917
- if arr_app_queries_schemes.kind_of?(Array)
1918
- hash['LSApplicationQueriesSchemes'] = arr_app_queries_schemes
1919
- else
1920
- hash['LSApplicationQueriesSchemes'] = []
1921
- end
1922
- end
1923
-
1924
- #http_connection_domains
1925
- if !hash.has_key?("NSAppTransportSecurity")
1926
- hash['NSAppTransportSecurity'] = {}
1927
- end
1928
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoads")
1929
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true
1930
- end
1931
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoadsInWebContent")
1932
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoadsInWebContent'] = true
1933
- end
1934
- if $app_config["iphone"].has_key?("http_connection_domains")
1935
- http_connection_domains = $app_config["iphone"]["http_connection_domains"]
1936
- if http_connection_domains.kind_of?(Array)
1937
- hash['NSAppTransportSecurity']['NSExceptionDomains'] = {}
1938
- http_connection_domains.each do |domain|
1939
- domain_hash = {}
1940
- domain_hash['NSIncludesSubdomains'] = true
1941
- domain_hash['NSTemporaryExceptionAllowsInsecureHTTPLoads'] = true
1942
- domain_hash['NSTemporaryExceptionMinimumTLSVersion'] = 'TLSv1.0'
1943
-
1944
- hash['NSAppTransportSecurity']['NSExceptionDomains'][domain.to_s] = domain_hash
1945
- end
1946
- end
1947
- end
1948
-
1949
-
1950
- set_app_icon(false)
1951
- set_default_images(false, hash)
1952
- end
1953
-
2124
+ update_plist_procedure
1954
2125
 
1955
2126
  set_signing_identity($signidentity,$provisionprofile,$entitlements) #if $signidentity.to_s != ""
1956
2127
  end
@@ -1981,112 +2152,7 @@ namespace "build" do
1981
2152
  #xml_path = File.join($startdir, "/lib/commonAPI/coreapi/ext/Application.xml")
1982
2153
  #Jake.run3("\"#{$startdir}/bin/rhogen\" api \"#{xml_path}\"")
1983
2154
 
1984
- vendor = $app_config['vendor'] ? $app_config['vendor'] : "rhomobile"
1985
- bundle_identifier = "com.#{vendor}.#{appname}"
1986
- bundle_identifier = $app_config["iphone"]["BundleIdentifier"] unless $app_config["iphone"]["BundleIdentifier"].nil?
1987
-
1988
- on_suspend = $app_config["iphone"]["UIApplicationExitsOnSuspend"]
1989
- on_suspend_value = false
1990
-
1991
- if on_suspend.nil?
1992
- puts "UIApplicationExitsOnSuspend not configured, using default of false"
1993
- elsif on_suspend.to_s.downcase == "true" || on_suspend.to_s == "1"
1994
- on_suspend_value = true
1995
- elsif on_suspend.to_s.downcase == "false" || on_suspend.to_s == "0"
1996
- on_suspend_value = false
1997
- else
1998
- raise "UIApplicationExitsOnSuspend is not set to a valid value. Current value: '#{$app_config["iphone"]["UIApplicationExitsOnSuspend"]}'"
1999
- end
2000
-
2001
- init_extensions( nil, "get_ext_xml_paths")
2002
-
2003
- ext_name, changed_value = get_ext_plist_changes($app_extension_cfg)
2004
-
2005
- set_app_plist_options($app_path + "/project/iphone/Info.plist", appname, bundle_identifier, $app_config["version"], $app_config["iphone"]["BundleURLScheme"]) do |hash|
2006
- hash['UIApplicationExitsOnSuspend'] = on_suspend_value
2007
-
2008
- changed_value.each do |k, v|
2009
- puts "Info.plist: Setting key #{k} = #{v} from #{File.basename(ext_name[k])}"
2010
- hash[k] = v
2011
- end
2012
-
2013
- #setup GPS access
2014
- gps_request_text = nil
2015
- if $app_config["capabilities"].index("gps") != nil
2016
- gps_request_text = 'application tracks your position'
2017
- end
2018
- if !$app_config["iphone"].nil?
2019
- if !$app_config["iphone"]["capabilities"].nil?
2020
- if $app_config["iphone"]["capabilities"].index("gps") != nil
2021
- gps_request_text = 'application tracks your position'
2022
- end
2023
- end
2024
- end
2025
- if gps_request_text != nil
2026
- if hash['NSLocationWhenInUseUsageDescription'] == nil
2027
- puts "Info.plist: added key [NSLocationWhenInUseUsageDescription]"
2028
- hash['NSLocationWhenInUseUsageDescription'] = gps_request_text
2029
- end
2030
- end
2031
-
2032
- #setup Camera access
2033
- camera_request_text = nil
2034
- if $app_config["capabilities"].index("camera") != nil
2035
- camera_request_text = 'application wants to use camera'
2036
- end
2037
- if !$app_config["iphone"].nil?
2038
- if !$app_config["iphone"]["capabilities"].nil?
2039
- if $app_config["iphone"]["capabilities"].index("camera") != nil
2040
- camera_request_text = 'application wants to use camera'
2041
- end
2042
- end
2043
- end
2044
- if camera_request_text != nil
2045
- if hash['NSCameraUsageDescription'] == nil
2046
- puts "Info.plist: added key [NSCameraUsageDescription]"
2047
- hash['NSCameraUsageDescription'] = camera_request_text
2048
- end
2049
- end
2050
-
2051
-
2052
- #LSApplicationQueriesSchemes
2053
- if $app_config["iphone"].has_key?("ApplicationQueriesSchemes")
2054
- arr_app_queries_schemes = $app_config["iphone"]["ApplicationQueriesSchemes"]
2055
- if arr_app_queries_schemes.kind_of?(Array)
2056
- hash['LSApplicationQueriesSchemes'] = arr_app_queries_schemes
2057
- else
2058
- hash['LSApplicationQueriesSchemes'] = []
2059
- end
2060
- end
2061
-
2062
- #http_connection_domains
2063
- if !hash.has_key?("NSAppTransportSecurity")
2064
- hash['NSAppTransportSecurity'] = {}
2065
- end
2066
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoads")
2067
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true
2068
- end
2069
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoadsInWebContent")
2070
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoadsInWebContent'] = true
2071
- end
2072
- if $app_config["iphone"].has_key?("http_connection_domains")
2073
- http_connection_domains = $app_config["iphone"]["http_connection_domains"]
2074
- if http_connection_domains.kind_of?(Array)
2075
- hash['NSAppTransportSecurity']['NSExceptionDomains'] = {}
2076
- http_connection_domains.each do |domain|
2077
- domain_hash = {}
2078
- domain_hash['NSIncludesSubdomains'] = true
2079
- domain_hash['NSTemporaryExceptionAllowsInsecureHTTPLoads'] = true
2080
- domain_hash['NSTemporaryExceptionMinimumTLSVersion'] = 'TLSv1.0'
2081
-
2082
- hash['NSAppTransportSecurity']['NSExceptionDomains'][domain.to_s] = domain_hash
2083
- end
2084
- end
2085
- end
2086
-
2087
- set_app_icon(false)
2088
- set_default_images(false, hash)
2089
- end
2155
+ update_plist_procedure
2090
2156
 
2091
2157
 
2092
2158
  if $entitlements == ""