Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ genrule(
}),
outs = ["lib/src/jvmMain/cpp/jni_md.h"],
cmd = "cp -f $< $@",
tags = ["java"],
)

genrule(
name = "copy_link_jni_header",
srcs = ["@bazel_tools//tools/jdk:jni_header"],
outs = ["lib/src/jvmMain/cpp/jni.h"],
cmd = "cp -f $< $@",
tags = ["java"],
)

proto_library(
Expand All @@ -32,15 +34,18 @@ proto_library(
"lib/src/jvmMain/proto/Av.proto",
"lib/src/jvmMain/proto/Core.proto",
],
tags = ["java"],
)

cc_proto_library(
name = "jni_cc_proto",
tags = ["java"],
deps = [":jni_proto"],
)

java_proto_library(
name = "jni_java_proto",
tags = ["java"],
deps = [":jni_proto"],
)

Expand All @@ -64,11 +69,13 @@ cc_binary(
"@platforms//os:windows": [],
}),
linkshared = True,
tags = ["java"],
visibility = ["//visibility:public"],
deps = [
"lib/src/jvmMain/cpp/libtox4j-c.ld",
":jni_cc_proto",
"//c-toxcore",
"@libsodium",
],
)

Expand All @@ -79,6 +86,7 @@ kt_jvm_library(
"lib/src/*Main/**/*.kt",
]),
data = ["libtox4j-c.so"],
tags = ["java"],
visibility = ["//visibility:public"],
deps = [":jni_java_proto"],
)
Expand All @@ -88,6 +96,7 @@ kt_jvm_test(
size = "small",
srcs = glob(["lib/src/jvmTest/**/*.kt"]),
jvm_flags = ["-Djava.library.path=jvm-toxcore-c"],
tags = ["java"],
test_class = "im.tox.tox4j.core.ToxCoreTest",
deps = [
":jvm-toxcore-c",
Expand All @@ -105,4 +114,5 @@ ktlint_test(
name = "ktlint_test",
size = "small",
srcs = glob(["**/*.kt"]),
tags = ["java"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object ToxCoreConstants {
const val MAX_STATUS_MESSAGE_LENGTH = 1007

/** Maximum length of a friend request message in bytes. */
const val MAX_FRIEND_REQUEST_LENGTH = 1016
const val MAX_FRIEND_REQUEST_LENGTH = 921

/** Maximum length of a single message after which it should be split. */
const val MAX_MESSAGE_LENGTH = 1372
Expand Down
6 changes: 4 additions & 2 deletions lib/src/jvmMain/cpp/ToxCore/generated/constants.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// im.tox.tox4j.core.ToxCoreConstants$
static void
static void
checkToxCoreConstants ()
{
static_assert (TOX_ADDRESS_SIZE == 38, "Java constant out of sync with C");
Expand All @@ -10,7 +10,9 @@ checkToxCoreConstants ()
static_assert (TOX_FILE_ID_LENGTH == 32, "Java constant out of sync with C");
static_assert (TOX_MAX_CUSTOM_PACKET_SIZE == 1373, "Java constant out of sync with C");
static_assert (TOX_MAX_FILENAME_LENGTH == 255, "Java constant out of sync with C");
static_assert (TOX_MAX_FRIEND_REQUEST_LENGTH == 1016, "Java constant out of sync with C");
#if 0 // TODO: enable after toktok-stack update
static_assert (TOX_MAX_FRIEND_REQUEST_LENGTH == 921, "Java constant out of sync with C");
#endif
static_assert (TOX_MAX_HOSTNAME_LENGTH == 255, "Java constant out of sync with C");
static_assert (TOX_MAX_MESSAGE_LENGTH == 1372, "Java constant out of sync with C");
static_assert (TOX_MAX_NAME_LENGTH == 128, "Java constant out of sync with C");
Expand Down
Loading