bare-ui-kit 0.0.0 → 0.1.0
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.
package/lib/runtime.m
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#import <path.h>
|
|
6
6
|
#import <rlimit.h>
|
|
7
7
|
#import <signal.h>
|
|
8
|
+
#import <unistd.h>
|
|
8
9
|
#import <uv.h>
|
|
9
10
|
|
|
10
11
|
#import <UIKit/UIKit.h>
|
|
@@ -14,9 +15,6 @@ static uv_async_t bare__platform_shutdown;
|
|
|
14
15
|
static uv_thread_t bare__platform_thread;
|
|
15
16
|
static js_platform_t *bare__platform;
|
|
16
17
|
|
|
17
|
-
static int bare__argc;
|
|
18
|
-
static char **bare__argv;
|
|
19
|
-
|
|
20
18
|
static uv_loop_t *bare__loop;
|
|
21
19
|
static uv_async_t bare__shutdown;
|
|
22
20
|
static bare_t *bare;
|
|
@@ -89,24 +87,6 @@ static void
|
|
|
89
87
|
bare__launch(void) {
|
|
90
88
|
int err;
|
|
91
89
|
|
|
92
|
-
err = uv_barrier_init(&bare__platform_ready, 2);
|
|
93
|
-
assert(err == 0);
|
|
94
|
-
|
|
95
|
-
err = uv_thread_create(&bare__platform_thread, bare__on_platform_thread, NULL);
|
|
96
|
-
assert(err == 0);
|
|
97
|
-
|
|
98
|
-
uv_barrier_wait(&bare__platform_ready);
|
|
99
|
-
|
|
100
|
-
uv_barrier_destroy(&bare__platform_ready);
|
|
101
|
-
|
|
102
|
-
bare__loop = uv_default_loop();
|
|
103
|
-
|
|
104
|
-
err = uv_async_init(bare__loop, &bare__shutdown, bare__on_shutdown);
|
|
105
|
-
assert(err == 0);
|
|
106
|
-
|
|
107
|
-
err = bare_setup(bare__loop, bare__platform, NULL, bare__argc, (const char **) bare__argv, NULL, &bare);
|
|
108
|
-
assert(err == 0);
|
|
109
|
-
|
|
110
90
|
size_t len;
|
|
111
91
|
|
|
112
92
|
char bin[4096];
|
|
@@ -115,22 +95,18 @@ bare__launch(void) {
|
|
|
115
95
|
err = uv_exepath(bin, &len);
|
|
116
96
|
assert(err == 0);
|
|
117
97
|
|
|
118
|
-
|
|
119
|
-
err = path_dirname(bin, &dir, path_behavior_system);
|
|
120
|
-
assert(err == 0);
|
|
121
|
-
|
|
122
|
-
char bundle[4096];
|
|
98
|
+
char entry[4096];
|
|
123
99
|
len = 4096;
|
|
124
100
|
|
|
125
101
|
err = path_join(
|
|
126
102
|
(const char *[]) {bin, "..", "app.bundle", NULL},
|
|
127
|
-
|
|
103
|
+
entry,
|
|
128
104
|
&len,
|
|
129
105
|
path_behavior_system
|
|
130
106
|
);
|
|
131
107
|
assert(err == 0);
|
|
132
108
|
|
|
133
|
-
err = bare_load(bare,
|
|
109
|
+
err = bare_load(bare, entry, NULL, NULL);
|
|
134
110
|
(void) err;
|
|
135
111
|
|
|
136
112
|
dispatch_queue_t queue = dispatch_get_main_queue();
|
|
@@ -223,8 +199,62 @@ main(int argc, char *argv[]) {
|
|
|
223
199
|
|
|
224
200
|
argv = uv_setup_args(argc, argv);
|
|
225
201
|
|
|
226
|
-
|
|
227
|
-
|
|
202
|
+
err = uv_barrier_init(&bare__platform_ready, 2);
|
|
203
|
+
assert(err == 0);
|
|
204
|
+
|
|
205
|
+
err = uv_thread_create(&bare__platform_thread, bare__on_platform_thread, NULL);
|
|
206
|
+
assert(err == 0);
|
|
207
|
+
|
|
208
|
+
uv_barrier_wait(&bare__platform_ready);
|
|
209
|
+
|
|
210
|
+
uv_barrier_destroy(&bare__platform_ready);
|
|
211
|
+
|
|
212
|
+
bare__loop = uv_default_loop();
|
|
213
|
+
|
|
214
|
+
size_t len;
|
|
215
|
+
|
|
216
|
+
char bin[4096];
|
|
217
|
+
len = sizeof(bin);
|
|
218
|
+
|
|
219
|
+
err = uv_exepath(bin, &len);
|
|
220
|
+
assert(err == 0);
|
|
221
|
+
|
|
222
|
+
char preflight[4096];
|
|
223
|
+
len = 4096;
|
|
224
|
+
|
|
225
|
+
err = path_join(
|
|
226
|
+
(const char *[]) {bin, "..", "preflight.bundle", NULL},
|
|
227
|
+
preflight,
|
|
228
|
+
&len,
|
|
229
|
+
path_behavior_system
|
|
230
|
+
);
|
|
231
|
+
assert(err == 0);
|
|
232
|
+
|
|
233
|
+
uv_fs_t fs;
|
|
234
|
+
err = uv_fs_access(bare__loop, &fs, preflight, R_OK, NULL);
|
|
235
|
+
|
|
236
|
+
if (err == 0) {
|
|
237
|
+
err = bare_setup(bare__loop, bare__platform, NULL, argc, (const char **) argv, NULL, &bare);
|
|
238
|
+
assert(err == 0);
|
|
239
|
+
|
|
240
|
+
err = bare_load(bare, preflight, NULL, NULL);
|
|
241
|
+
(void) err;
|
|
242
|
+
|
|
243
|
+
err = bare_run(bare, UV_RUN_DEFAULT);
|
|
244
|
+
assert(err == 0);
|
|
245
|
+
|
|
246
|
+
int exit_code;
|
|
247
|
+
err = bare_teardown(bare, UV_RUN_DEFAULT, &exit_code);
|
|
248
|
+
assert(err == 0);
|
|
249
|
+
|
|
250
|
+
if (exit_code != 0) _exit(exit_code);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
err = uv_async_init(bare__loop, &bare__shutdown, bare__on_shutdown);
|
|
254
|
+
assert(err == 0);
|
|
255
|
+
|
|
256
|
+
err = bare_setup(bare__loop, bare__platform, NULL, argc, (const char **) argv, NULL, &bare);
|
|
257
|
+
assert(err == 0);
|
|
228
258
|
|
|
229
259
|
@autoreleasepool {
|
|
230
260
|
return UIApplicationMain(argc, argv, @"BareApp", @"BareApp");
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|