-
Notifications
You must be signed in to change notification settings - Fork 22
Incremental steps to support Android XR #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 34 commits
79e03c1
43d677a
22d1f96
435c798
e1d0f2f
dbef5ba
1159300
39f1536
82b17e8
2dd6185
98c40b5
02a7dc5
99c49b1
a40c852
f98247a
7faff92
b3480ca
118450b
4d9eb96
e5e5648
d205c4a
4633fa3
465685e
fcc3ce1
c1fdff4
a54a121
be1baf6
a6a258d
b9aa23c
27eed75
9a268bb
56be206
f378d3f
ed53fd9
863f962
2e467dd
84005c0
9e3cfc9
98e80ef
499ae36
51f1f45
496c67f
403b452
5253492
ebf6950
cfb1af6
d30f735
d23737f
ada4a17
56c1f3e
04bcc75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ schedules: | |
|
|
||
| variables: | ||
| - name: ndkVersion | ||
| value: 25.2.9519653 | ||
| value: 28.2.13676358 | ||
|
|
||
| jobs: | ||
| # WIN32 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| /Build | ||
| /Tests/UnitTests/dist/ | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,38 @@ struct napi_callback_info__ { | |
| }; | ||
|
|
||
| namespace { | ||
| // Template specialization to provide char_traits functionality for JSChar (unsigned short) | ||
| // at compile time, mimicking std::char_traits interface | ||
| template<typename CharT> | ||
| struct jschar_traits; | ||
|
|
||
| template<> | ||
| struct jschar_traits<JSChar> { | ||
| using char_type = JSChar; | ||
|
|
||
| static constexpr size_t length(const char_type* str) noexcept { | ||
| if (!str) return 0; | ||
| const char_type* s = str; | ||
| while (*s) ++s; | ||
| return s - str; | ||
| } | ||
|
|
||
| static constexpr int compare(const char_type* s1, const char_type* s2, size_t n) noexcept { | ||
| for (size_t i = 0; i < n; ++i) { | ||
| if (s1[i] < s2[i]) return -1; | ||
| if (s1[i] > s2[i]) return 1; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| static constexpr const char_type* find(const char_type* s, size_t n, const char_type& c) noexcept { | ||
| for (size_t i = 0; i < n; ++i) { | ||
| if (s[i] == c) return s + i; | ||
| } | ||
| return nullptr; | ||
| } | ||
|
||
| }; | ||
|
|
||
| class JSString { | ||
| public: | ||
| JSString(const JSString&) = delete; | ||
|
|
@@ -33,7 +65,7 @@ namespace { | |
| } | ||
|
|
||
| JSString(const JSChar* string, size_t length = NAPI_AUTO_LENGTH) | ||
| : _string{JSStringCreateWithCharacters(string, length == NAPI_AUTO_LENGTH ? std::char_traits<JSChar>::length(string) : length)} { | ||
| : _string{JSStringCreateWithCharacters(string, length == NAPI_AUTO_LENGTH ? jschar_traits<JSChar>::length(string) : length)} { | ||
| } | ||
|
|
||
| ~JSString() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "dependencies": { | ||
| "jsc-android": "250231.0.0" | ||
| "jsc-android": "294992.0.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| #include <jni.h> | ||
| #include <Android/log.h> | ||
| #include <android/log.h> | ||
| #include <AndroidExtensions/Globals.h> | ||
| #include <AndroidExtensions/JavaWrappers.h> | ||
| #include <AndroidExtensions/StdoutLogger.h> | ||
|
|
@@ -17,16 +17,17 @@ Java_com_jsruntimehost_unittests_Native_javaScriptTests(JNIEnv* env, jclass claz | |
| jclass webSocketClass{env->FindClass("com/jsruntimehost/unittests/WebSocket")}; | ||
| java::websocket::WebSocketClient::InitializeJavaWebSocketClass(webSocketClass, env); | ||
|
|
||
| android::StdoutLogger::Start(); | ||
| // Temporarily disable StdoutLogger due to fdsan issue with NDK 28 | ||
| // android::StdoutLogger::Start(); | ||
|
||
|
|
||
| android::global::Initialize(javaVM, context); | ||
|
|
||
| Babylon::DebugTrace::EnableDebugTrace(true); | ||
| Babylon::DebugTrace::SetTraceOutput([](const char* trace) { printf("%s\n", trace); fflush(stdout); }); | ||
| Babylon::DebugTrace::SetTraceOutput([](const char* trace) { __android_log_print(ANDROID_LOG_INFO, "JsRuntimeHost", "%s", trace); }); | ||
|
|
||
| auto testResult = RunTests(); | ||
|
|
||
| android::StdoutLogger::Stop(); | ||
| // android::StdoutLogger::Stop(); | ||
|
|
||
| java::websocket::WebSocketClient::DestructJavaWebSocketClass(env); | ||
| return testResult; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.