rhodes 2.0.0.beta1 → 2.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/LICENSE +19 -674
- data/Manifest.txt +21 -4
- data/README.textile +5 -36
- data/Rakefile +5 -0
- data/lib/build/jake.rb +3 -1
- data/lib/extensions/rexml/rexml/document.rb +2 -0
- data/lib/extensions/rexml/rexml/parsers/baseparser.rb +0 -6
- data/lib/extensions/rhoxml/rexml/child.rb +96 -0
- data/lib/extensions/rhoxml/rexml/document.rb +527 -0
- data/lib/extensions/rhoxml/rexml/element.rb +987 -0
- data/lib/extensions/rhoxml/rexml/encoding.rb +71 -0
- data/lib/extensions/rhoxml/rexml/encodings/US-ASCII.rb +30 -0
- data/lib/extensions/rhoxml/rexml/encodings/UTF-16.rb +35 -0
- data/lib/extensions/rhoxml/rexml/encodings/UTF-8.rb +18 -0
- data/lib/extensions/rhoxml/rexml/namespace.rb +47 -0
- data/lib/extensions/rhoxml/rexml/node.rb +76 -0
- data/lib/extensions/rhoxml/rexml/parent.rb +166 -0
- data/lib/extensions/rhoxml/rexml/parseexception.rb +51 -0
- data/lib/extensions/rhoxml/rexml/parsers/baseparser.rb +531 -0
- data/lib/extensions/rhoxml/rexml/parsers/treeparser.rb +100 -0
- data/lib/extensions/rhoxml/rexml/parsers/xpathparser.rb +698 -0
- data/lib/extensions/rhoxml/rexml/set.rb +1274 -0
- data/lib/extensions/rhoxml/rexml/source.rb +258 -0
- data/lib/extensions/rhoxml/rexml/xmltokens.rb +18 -0
- data/lib/extensions/rhoxml/rexml/xpath.rb +77 -0
- data/lib/extensions/rhoxml/rexml/xpath_parser.rb +806 -0
- data/lib/framework/builtinME.rb +2 -0
- data/lib/framework/dateME.rb +5 -1
- data/lib/framework/rho/render.rb +10 -2
- data/lib/framework/rhom/rhom_object_factory.rb +2 -1
- data/lib/framework/singleton.rb +1 -1
- data/platform/android/Rhodes/jni/src/rhodes.cpp +2 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +23 -18
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +42 -69
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +59 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/Annotation.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +97 -85
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/SmsUriHandler.java +52 -0
- data/platform/android/build/RhodesSRC_build.files +1 -0
- data/platform/android/build/android.rake +38 -14
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +44 -2
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +1 -1
- data/platform/bb/rhodes/rhodes.jdp +4 -4
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +8 -4
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +149 -17
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +20 -17
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +54 -28
- data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +1 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +37 -11
- data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +49 -19
- data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +6 -0
- data/platform/iphone/Classes/MapView/GoogleGeocoder.h +6 -7
- data/platform/iphone/Classes/MapView/GoogleGeocoder.m +70 -70
- data/platform/iphone/Classes/MapView/MapAnnotation.h +5 -3
- data/platform/iphone/Classes/MapView/MapAnnotation.m +10 -8
- data/platform/iphone/Classes/MapView/MapViewController.h +13 -10
- data/platform/iphone/Classes/MapView/MapViewController.m +131 -72
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +13 -1
- data/platform/iphone/Classes/SimpleMainView.m +0 -1
- data/platform/iphone/Classes/TabbedMainView.m +5 -6
- data/platform/shared/common/RhoTime.h +2 -2
- data/platform/shared/common/RhodesApp.cpp +1 -1
- data/platform/shared/db/DBAdapter.cpp +6 -0
- data/platform/shared/net/CURLNetRequest.cpp +23 -1
- data/platform/shared/ruby/thread_win32.c +9 -1
- data/platform/shared/rubyJVM/src/com/rho/Capabilities.java +6 -0
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +1 -1
- data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +1 -1
- data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubySymbol_Methods.java +6 -1
- data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubyTime_Methods.java +3 -3
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/InputStreamExecutor.java +1 -1
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyArray.java +15 -3
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyString.java +10 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyTime.java +12 -1
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyKernelModule.java +18 -9
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubySymbol.java +5 -0
- data/platform/shared/rubyJVM/src/org/json/me/JSONArray.java +2 -1
- data/platform/shared/unzip/unzip.cpp +1 -1
- data/platform/wm/build/wm.rake +27 -6
- data/platform/wm/rhodes/Alert.cpp +335 -5
- data/platform/wm/rhodes/Alert.h +84 -1
- data/platform/wm/rhodes/MainWindow.cpp +28 -6
- data/platform/wm/rhodes/MainWindow.h +7 -2
- data/platform/wm/rhodes/Rhodes.cpp +23 -0
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +2 -1
- data/platform/wm/rhodes/stdafx.h +1 -0
- data/platform/wm/tools/detool/detool.cpp +405 -14
- data/rakefile.rb +5 -0
- data/res/build-tools/detool.exe +0 -0
- data/res/generators/rhogen.rb +2 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/spec/fixtures/object_values.txt +1 -1
- data/spec/framework_spec/app/spec/pagination/fixtures/object_values.txt +1 -1
- data/spec/framework_spec/app/spec/rhom_object_spec.rb +12 -12
- metadata +23 -6
- data/LICENSING_OPTIONS +0 -1
- data/platform/bb/build/rhodesApp.rapc +0 -9
- data/res/generators/templates/source/source_adapter.rb +0 -48
- data/rhobuild.yml +0 -37
@@ -1,13 +1,14 @@
|
|
1
1
|
package com.rhomobile.rhodes.mapview;
|
2
2
|
|
3
|
-
import java.io.
|
4
|
-
import java.
|
3
|
+
import java.io.IOException;
|
4
|
+
import java.util.List;
|
5
5
|
import java.util.Map;
|
6
6
|
import java.util.Vector;
|
7
7
|
|
8
8
|
import android.content.Intent;
|
9
9
|
import android.graphics.drawable.Drawable;
|
10
|
-
import android.
|
10
|
+
import android.location.Address;
|
11
|
+
import android.location.Geocoder;
|
11
12
|
import android.os.Bundle;
|
12
13
|
import android.view.ViewGroup.LayoutParams;
|
13
14
|
import android.widget.RelativeLayout;
|
@@ -30,6 +31,9 @@ public class MapView extends MapActivity {
|
|
30
31
|
private com.google.android.maps.MapView view;
|
31
32
|
private AnnotationsOverlay annOverlay;
|
32
33
|
|
34
|
+
private double spanLat = 0;
|
35
|
+
private double spanLon = 0;
|
36
|
+
|
33
37
|
private String apiKey;
|
34
38
|
|
35
39
|
private Vector<Annotation> annotations;
|
@@ -64,13 +68,35 @@ public class MapView extends MapActivity {
|
|
64
68
|
intent.putExtra(SETTINGS_PREFIX + "shows_user_location", ((String)shows_user_location).equalsIgnoreCase("true"));
|
65
69
|
|
66
70
|
Object region = hash.get("region");
|
67
|
-
if (region != null
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
if (region != null) {
|
72
|
+
if (region instanceof Vector<?>) {
|
73
|
+
Vector<String> reg = (Vector<String>)region;
|
74
|
+
if (reg.size() == 4) {
|
75
|
+
intent.putExtra(SETTINGS_PREFIX + "region", "square");
|
76
|
+
intent.putExtra(SETTINGS_PREFIX + "region.latitude", reg.elementAt(0));
|
77
|
+
intent.putExtra(SETTINGS_PREFIX + "region.longitude", reg.elementAt(1));
|
78
|
+
intent.putExtra(SETTINGS_PREFIX + "region.latSpan", reg.elementAt(2));
|
79
|
+
intent.putExtra(SETTINGS_PREFIX + "region.lonSpan", reg.elementAt(3));
|
80
|
+
}
|
81
|
+
}
|
82
|
+
else if (region instanceof Map<?,?>) {
|
83
|
+
Map<Object, Object> reg = (Map<Object,Object>)region;
|
84
|
+
String center = null;
|
85
|
+
String radius = null;
|
86
|
+
|
87
|
+
Object centerObj = reg.get("center");
|
88
|
+
if (centerObj != null && (centerObj instanceof String))
|
89
|
+
center = (String)centerObj;
|
90
|
+
|
91
|
+
Object radiusObj = reg.get("radius");
|
92
|
+
if (radiusObj != null && (radiusObj instanceof String))
|
93
|
+
radius = (String)radiusObj;
|
94
|
+
|
95
|
+
if (center != null && radius != null) {
|
96
|
+
intent.putExtra(SETTINGS_PREFIX + "region", "circle");
|
97
|
+
intent.putExtra(SETTINGS_PREFIX + "region.center", center);
|
98
|
+
intent.putExtra(SETTINGS_PREFIX + "region.radius", radius);
|
99
|
+
}
|
74
100
|
}
|
75
101
|
}
|
76
102
|
}
|
@@ -145,13 +171,8 @@ public class MapView extends MapActivity {
|
|
145
171
|
//boolean scroll_enabled = extras.getBoolean(SETTINGS_PREFIX + "scroll_enabled");
|
146
172
|
//boolean shows_user_location = extras.getBoolean(SETTINGS_PREFIX + "shows_user_location");
|
147
173
|
|
148
|
-
String latitude = extras.getString(SETTINGS_PREFIX + "region.latitude");
|
149
|
-
String longitude = extras.getString(SETTINGS_PREFIX + "region.longitude");
|
150
|
-
String latSpan = extras.getString(SETTINGS_PREFIX + "region.latSpan");
|
151
|
-
String lonSpan = extras.getString(SETTINGS_PREFIX + "region.lonSpan");
|
152
|
-
|
153
174
|
// Extract annotations
|
154
|
-
int size = extras.getInt(ANNOTATIONS_PREFIX + "size");
|
175
|
+
int size = extras.getInt(ANNOTATIONS_PREFIX + "size") + 1;
|
155
176
|
annotations = new Vector<Annotation>(size);
|
156
177
|
for (int i = 0; i < size; ++i) {
|
157
178
|
Annotation ann = new Annotation();
|
@@ -176,10 +197,13 @@ public class MapView extends MapActivity {
|
|
176
197
|
catch (NumberFormatException e) {}
|
177
198
|
}
|
178
199
|
|
200
|
+
ann.type = "ann";
|
179
201
|
ann.address = extras.getString(prefix + "address");
|
180
202
|
ann.title = extras.getString(prefix + "title");
|
181
203
|
ann.subtitle = extras.getString(prefix + "subtitle");
|
182
|
-
ann.url =
|
204
|
+
ann.url = extras.getString(prefix + "url");
|
205
|
+
if (ann.url != null)
|
206
|
+
ann.url = RhodesInstance.getInstance().normalizeUrl(ann.url);
|
183
207
|
annotations.addElement(ann);
|
184
208
|
}
|
185
209
|
|
@@ -200,25 +224,50 @@ public class MapView extends MapActivity {
|
|
200
224
|
view.setStreetView(false);
|
201
225
|
|
202
226
|
MapController controller = view.getController();
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
227
|
+
String type = extras.getString(SETTINGS_PREFIX + "region");
|
228
|
+
if (type.equals("square")) {
|
229
|
+
String latitude = extras.getString(SETTINGS_PREFIX + "region.latitude");
|
230
|
+
String longitude = extras.getString(SETTINGS_PREFIX + "region.longitude");
|
231
|
+
if (latitude != null && longitude != null) {
|
232
|
+
try {
|
233
|
+
double lat = Double.parseDouble(latitude);
|
234
|
+
double lon = Double.parseDouble(longitude);
|
235
|
+
controller.setCenter(new GeoPoint((int)(lat*1000000), (int)(lon*1000000)));
|
236
|
+
}
|
237
|
+
catch (NumberFormatException e) {
|
238
|
+
Logger.E(TAG, "Wrong region center: " + e.getMessage());
|
239
|
+
}
|
208
240
|
}
|
209
|
-
|
210
|
-
|
241
|
+
|
242
|
+
String latSpan = extras.getString(SETTINGS_PREFIX + "region.latSpan");
|
243
|
+
String lonSpan = extras.getString(SETTINGS_PREFIX + "region.lonSpan");
|
244
|
+
if (latSpan != null && lonSpan != null) {
|
245
|
+
try {
|
246
|
+
double lat = Double.parseDouble(latSpan);
|
247
|
+
double lon = Double.parseDouble(lonSpan);
|
248
|
+
controller.zoomToSpan((int)(lat*1000000), (int)(lon*1000000));
|
249
|
+
}
|
250
|
+
catch (NumberFormatException e) {
|
251
|
+
Logger.E(TAG, "Wrong region span: " + e.getMessage());
|
252
|
+
}
|
211
253
|
}
|
212
254
|
}
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
255
|
+
else if (type.equals("circle")) {
|
256
|
+
String center = extras.getString(SETTINGS_PREFIX + "region.center");
|
257
|
+
String radius = extras.getString(SETTINGS_PREFIX + "region.radius");
|
258
|
+
if (center != null && radius != null) {
|
259
|
+
try {
|
260
|
+
double span = Double.parseDouble(radius);
|
261
|
+
spanLat = spanLon = span;
|
262
|
+
Annotation ann = new Annotation();
|
263
|
+
ann.type = "center";
|
264
|
+
ann.latitude = ann.longitude = 10000;
|
265
|
+
ann.address = center;
|
266
|
+
annotations.insertElementAt(ann, 0);
|
267
|
+
}
|
268
|
+
catch (NumberFormatException e) {
|
269
|
+
Logger.E(TAG, "Wrong region radius: " + e.getMessage());
|
270
|
+
}
|
222
271
|
}
|
223
272
|
}
|
224
273
|
|
@@ -247,45 +296,25 @@ public class MapView extends MapActivity {
|
|
247
296
|
if (ann.address == null)
|
248
297
|
continue;
|
249
298
|
|
299
|
+
Geocoder gc = new Geocoder(RhodesInstance.getInstance());
|
250
300
|
try {
|
251
|
-
|
252
|
-
|
253
|
-
b.append(Uri.encode(ann.address));
|
254
|
-
b.append("&output=csv&mobile=false&sensor=false");
|
255
|
-
|
256
|
-
URL url = new URL(b.toString());
|
257
|
-
|
258
|
-
b = new StringBuffer();
|
259
|
-
|
260
|
-
InputStream is = url.openStream();
|
261
|
-
byte[] buf = new byte[128];
|
262
|
-
for (;;) {
|
263
|
-
int n = is.read(buf);
|
264
|
-
if (n == -1)
|
265
|
-
break;
|
266
|
-
|
267
|
-
String s = new String(buf, 0, n);
|
268
|
-
b.append(s);
|
269
|
-
}
|
270
|
-
|
271
|
-
String response = b.toString();
|
272
|
-
Vector<String> res = split(response, ",");
|
273
|
-
if (res.size() != 4) {
|
274
|
-
Logger.E(TAG, "Geocoding response parse error. Response: " + response);
|
301
|
+
List<Address> addrs = gc.getFromLocationName(ann.address, 1);
|
302
|
+
if (addrs.size() == 0)
|
275
303
|
continue;
|
276
|
-
}
|
277
304
|
|
278
|
-
|
279
|
-
//int accuracy = Integer.parseInt(res.elementAt(1));
|
280
|
-
double latitude = Double.parseDouble(res.elementAt(2));
|
281
|
-
double longitude = Double.parseDouble(res.elementAt(3));
|
305
|
+
Address addr = addrs.get(0);
|
282
306
|
|
283
|
-
ann.latitude =
|
284
|
-
ann.longitude =
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
307
|
+
ann.latitude = addr.getLatitude();
|
308
|
+
ann.longitude = addr.getLongitude();
|
309
|
+
if (ann.type.equals("center")) {
|
310
|
+
MapController controller = view.getController();
|
311
|
+
controller.setCenter(new GeoPoint((int)(ann.latitude*1000000), (int)(ann.longitude*1000000)));
|
312
|
+
controller.zoomToSpan((int)(spanLat*1000000), (int)(spanLon*1000000));
|
313
|
+
}
|
314
|
+
else
|
315
|
+
annOverlay.addAnnotation(ann);
|
316
|
+
} catch (IOException e) {
|
317
|
+
Logger.E(TAG, "GeoCoding request failed: " + e.getMessage());
|
289
318
|
}
|
290
319
|
|
291
320
|
Rhodes.performOnUiThread(new Runnable() {
|
@@ -301,21 +330,4 @@ public class MapView extends MapActivity {
|
|
301
330
|
return false;
|
302
331
|
}
|
303
332
|
|
304
|
-
private static Vector<String> split(String s, String delimiter) {
|
305
|
-
Vector<String> res = new Vector<String>();
|
306
|
-
for (int start = 0, end = start;;) {
|
307
|
-
end = s.indexOf(delimiter, start);
|
308
|
-
if (end == -1) {
|
309
|
-
res.addElement(s.substring(start));
|
310
|
-
break;
|
311
|
-
}
|
312
|
-
else {
|
313
|
-
res.addElement(s.substring(start, end));
|
314
|
-
start = end + delimiter.length();
|
315
|
-
}
|
316
|
-
}
|
317
|
-
|
318
|
-
return res;
|
319
|
-
}
|
320
|
-
|
321
333
|
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/*
|
2
|
+
============================================================================
|
3
|
+
Author : Dmitry Moskalchuk
|
4
|
+
Version : 1.5
|
5
|
+
Copyright : Copyright (C) 2008 Rhomobile. All rights reserved.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
============================================================================
|
20
|
+
*/
|
21
|
+
package com.rhomobile.rhodes.uri;
|
22
|
+
|
23
|
+
import com.rhomobile.rhodes.Logger;
|
24
|
+
|
25
|
+
import android.content.Context;
|
26
|
+
import android.content.Intent;
|
27
|
+
import android.net.Uri;
|
28
|
+
|
29
|
+
public class SmsUriHandler implements UriHandler {
|
30
|
+
|
31
|
+
private static final String TAG = "SmsUriHandler";
|
32
|
+
private Context ctx;
|
33
|
+
|
34
|
+
public SmsUriHandler(Context c) {
|
35
|
+
ctx = c;
|
36
|
+
}
|
37
|
+
|
38
|
+
public boolean handle(String url) {
|
39
|
+
Uri uri = Uri.parse(url);
|
40
|
+
if (!uri.getScheme().equals("sms"))
|
41
|
+
return false;
|
42
|
+
|
43
|
+
Logger.D(TAG, "This is 'sms' uri, handle it");
|
44
|
+
|
45
|
+
Intent intent = new Intent(Intent.ACTION_SENDTO);
|
46
|
+
intent.setData(uri);
|
47
|
+
|
48
|
+
ctx.startActivity(Intent.createChooser(intent, "Send SMS..."));
|
49
|
+
return true;
|
50
|
+
}
|
51
|
+
|
52
|
+
}
|
@@ -40,6 +40,7 @@ platform/android/Rhodes/src/com/rhomobile/rhodes/ui/AboutDialog.java
|
|
40
40
|
platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogOptionsDialog.java
|
41
41
|
platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogViewDialog.java
|
42
42
|
platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java
|
43
|
+
platform/android/Rhodes/src/com/rhomobile/rhodes/uri/SmsUriHandler.java
|
43
44
|
platform/android/Rhodes/src/com/rhomobile/rhodes/uri/TelUriHandler.java
|
44
45
|
platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java
|
45
46
|
platform/android/Rhodes/src/com/rhomobile/rhodes/uri/VideoUriHandler.java
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#
|
2
2
|
require File.dirname(__FILE__) + '/androidcommon.rb'
|
3
|
+
require 'pathname'
|
3
4
|
|
4
5
|
USE_STLPORT = true
|
5
6
|
USE_TRACES = false
|
@@ -831,12 +832,19 @@ namespace "build" do
|
|
831
832
|
exit 1
|
832
833
|
end
|
833
834
|
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
835
|
+
files = []
|
836
|
+
Dir.glob(File.join($tmpdir, "Rhodes", "*")).each do |f|
|
837
|
+
relpath = Pathname.new(f).relative_path_from(Pathname.new(File.join($tmpdir, "Rhodes"))).to_s
|
838
|
+
files << relpath
|
839
|
+
end
|
840
|
+
unless files.empty?
|
841
|
+
args = ["cf", "../../Rhodes.jar"]
|
842
|
+
args += files
|
843
|
+
puts Jake.run($jarbin, args, File.join($tmpdir, "Rhodes"))
|
844
|
+
unless $? == 0
|
845
|
+
puts "Error running jar"
|
846
|
+
exit 1
|
847
|
+
end
|
840
848
|
end
|
841
849
|
end
|
842
850
|
|
@@ -870,20 +878,36 @@ namespace "package" do
|
|
870
878
|
args = ["package", "-f", "-M", manifest, "-S", resource, "-A", assets, "-I", $androidjar, "-F", resourcepkg]
|
871
879
|
puts Jake.run($aapt, args)
|
872
880
|
unless $? == 0
|
873
|
-
puts "Error running AAPT"
|
881
|
+
puts "Error running AAPT (1)"
|
874
882
|
exit 1
|
875
883
|
end
|
876
884
|
|
877
|
-
|
878
|
-
|
879
|
-
cp_r
|
880
|
-
|
885
|
+
# Workaround: manually add files starting with '_' because aapt silently ignore such files when creating package
|
886
|
+
rm_rf File.join($tmpdir, "assets")
|
887
|
+
cp_r assets, $tmpdir
|
888
|
+
Dir.glob(File.join($tmpdir, "assets/**/*")).each do |f|
|
889
|
+
next unless File.basename(f) =~ /^_/
|
890
|
+
relpath = Pathname.new(f).relative_path_from(Pathname.new($tmpdir)).to_s
|
891
|
+
puts "Add #{relpath} to #{resourcepkg}..."
|
892
|
+
args = ["add", resourcepkg, relpath]
|
893
|
+
puts Jake.run($aapt, args, $tmpdir)
|
894
|
+
unless $? == 0
|
895
|
+
puts "Error running AAPT (2)"
|
896
|
+
exit 1
|
897
|
+
end
|
898
|
+
end
|
899
|
+
|
900
|
+
# Add native librhodes.so
|
901
|
+
rm_rf File.join($tmpdir, "lib")
|
902
|
+
mkdir_p File.join($tmpdir, "lib/armeabi")
|
903
|
+
cp_r File.join($bindir, "libs", $confdir, "librhodes.so"), File.join($tmpdir, "lib/armeabi")
|
904
|
+
cc_run($stripbin, [$tmpdir + "/lib/armeabi/librhodes.so"])
|
881
905
|
args = ["add", resourcepkg, "lib/armeabi/librhodes.so"]
|
882
|
-
puts Jake.run($aapt, args, $
|
906
|
+
puts Jake.run($aapt, args, $tmpdir)
|
883
907
|
err = $?
|
884
|
-
rm_rf $
|
908
|
+
rm_rf $tmpdir + "/lib"
|
885
909
|
unless err == 0
|
886
|
-
puts "Error running AAPT"
|
910
|
+
puts "Error running AAPT (3)"
|
887
911
|
exit 1
|
888
912
|
end
|
889
913
|
end
|
@@ -61,6 +61,7 @@ ExcludeFromBuildAll=0
|
|
61
61
|
..\..\shared\rubyJVM\src\com\rho\RhoThread.java
|
62
62
|
..\..\shared\rubyJVM\src\com\rho\Sprintf.java
|
63
63
|
..\..\shared\rubyJVM\src\com\rho\StringScanner.java
|
64
|
+
..\..\shared\rubyJVM\src\com\rho\Capabilities.java
|
64
65
|
..\..\shared\rubyJVM\src\com\rho\sync\ClientRegister.java
|
65
66
|
..\..\shared\rubyJVM\src\com\rho\sync\ISyncStatusListener.java
|
66
67
|
..\..\shared\rubyJVM\src\com\rho\sync\JSONArrayIterator.java
|
@@ -37,6 +37,7 @@ platform\shared\rubyJVM\src\com\rho\RhoProfiler.java
|
|
37
37
|
platform\shared\rubyJVM\src\com\rho\RhoRuby.java
|
38
38
|
platform\shared\rubyJVM\src\com\rho\RhoThread.java
|
39
39
|
platform\shared\rubyJVM\src\com\rho\StringScanner.java
|
40
|
+
platform\shared\rubyJVM\src\com\rho\Capabilities.java
|
40
41
|
platform\shared\rubyJVM\src\com\rho\sync\JSONArrayIterator.java
|
41
42
|
platform\shared\rubyJVM\src\com\rho\sync\JSONStructIterator.java
|
42
43
|
platform\shared\rubyJVM\src\com\rho\sync\JSONEntry.java
|
data/platform/bb/build/bb.rake
CHANGED
@@ -128,7 +128,8 @@ namespace "config" do
|
|
128
128
|
$preverified = $app_path + "/preverified"
|
129
129
|
$targetdir = $bindir + "/target/" + $bbver
|
130
130
|
$rubyVMdir = $app_path + "/RubyVM"
|
131
|
-
$excludelib = ['**/
|
131
|
+
$excludelib = ['**/rational.rb','**/rhoframework.rb','**/dateOrig.rb']
|
132
|
+
$excludeextlib = ['rexml/parsers/baseparser.rb', 'rexml/set.rb']
|
132
133
|
$compileERB = $app_path + "/build/compileERB.rb"
|
133
134
|
$tmpdir = $bindir +"/tmp"
|
134
135
|
|
@@ -223,9 +224,50 @@ namespace "build" do
|
|
223
224
|
sdcardpath = $config["env"]["paths"][$bbver]["jde"] +"/simulator/sdcard/Rho/rhodes/apps/rhoconfig.txt"
|
224
225
|
cp $app_path+"/rhoconfig.txt", sdcardpath if File.exists? sdcardpath
|
225
226
|
end
|
227
|
+
|
228
|
+
task :gensources => "config:bb" do
|
229
|
+
caps = $app_config["capabilities"]
|
230
|
+
caps = [] if caps.nil?
|
231
|
+
caps = [] unless caps.is_a? Array
|
232
|
+
|
233
|
+
has_push = caps.index("push") != nil
|
234
|
+
|
235
|
+
$service_enabled = has_push
|
236
|
+
|
237
|
+
puts "Modify MANIFEST.MF"
|
238
|
+
$stdout.flush
|
239
|
+
mf = File.join($builddir, "MANIFEST.MF")
|
240
|
+
tmpmf = File.join($builddir, "MANIFEST.MF.new")
|
241
|
+
File.open(tmpmf, "w") do |nf|
|
242
|
+
File.open(mf, "r") do |f|
|
243
|
+
while line = f.gets
|
244
|
+
if line =~ /^\s*RIM-MIDlet-Flags-1\s*:/
|
245
|
+
nf.puts "RIM-MIDlet-Flags-1: 1" if has_push
|
246
|
+
else
|
247
|
+
nf.puts line
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
rm mf
|
253
|
+
cp tmpmf, mf
|
254
|
+
rm tmpmf
|
255
|
+
|
256
|
+
puts "Modify Capabilities.java"
|
257
|
+
$stdout.flush
|
258
|
+
capabilities = File.join($builddir, "..", "..", "..", "platform", "shared", "rubyJVM", "src", "com", "rho", "Capabilities.java")
|
259
|
+
File.open(capabilities, 'w') do |f|
|
260
|
+
f.puts "package com.rho;"
|
261
|
+
f.puts ""
|
262
|
+
f.puts "public class Capabilities {"
|
263
|
+
f.puts " public static final boolean ENABLE_PUSH = #{has_push.to_s};"
|
264
|
+
f.puts " public static final boolean RUNAS_SERVICE = #{has_push.to_s};"
|
265
|
+
f.puts "}"
|
266
|
+
end
|
267
|
+
end
|
226
268
|
|
227
269
|
# desc "Build RubyVM"
|
228
|
-
task :rubyvm => ["config:bb"] do
|
270
|
+
task :rubyvm => [:gensources, "config:bb"] do
|
229
271
|
javac = $config["env"]["paths"]["java"] + "/javac.exe"
|
230
272
|
jdehome = $config["env"]["paths"][$bbver]["jde"]
|
231
273
|
|