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: 9 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
* text=auto
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: ci

on:
pull_request:
branches: [master]

# Cancel old PR builds when pushing new commits.
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
common:
uses: TokTok/ci-tools/.github/workflows/common-ci.yml@master

docker-jvm:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build toxchat/jvm-toxcore-c:jvm
uses: docker/build-push-action@v5
with:
file: docker/jvm.Dockerfile
tags: toxchat/jvm-toxcore-c:jvm
24 changes: 2 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# GitHub pages.
/.web

# SBT compiled build system.
/project/project
/project/target

# SBT output directory.
/target

# Generated startup scripts for main classes.
/bin

# Local user settings for SBT and Java.
/local.sbt
/local.properties

# CMake build directory.
/android-ndk-*.zip
_git
Expand All @@ -34,14 +17,11 @@ _install
# Virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Debug log from toxcore.
libtoxcore.log

# Gradle temporary directory.
.gradle

# Java runtime support for disassembly.
hsdis-*.*

# Generated proguard configuration.
/proguard-sbt.txt
# Ignore Gradle build output directory
build
3 changes: 3 additions & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
exclude:
- "gradlew"
34 changes: 17 additions & 17 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ genrule(
"//tools/config:osx": ["@bazel_tools//tools/jdk:jni_md_header-darwin"],
"//tools/config:windows": ["@bazel_tools//tools/jdk:jni_md_header-windows"],
}),
outs = ["cpp/src/jni_md.h"],
outs = ["lib/src/main/cpp/jni_md.h"],
cmd = "cp -f $< $@",
)

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

proto_library(
name = "jni_proto",
srcs = [
"src/main/protobuf/Av.proto",
"src/main/protobuf/Core.proto",
"src/main/protobuf/ProtoLog.proto",
"lib/src/main/proto/Av.proto",
"lib/src/main/proto/Core.proto",
"lib/src/main/proto/ProtoLog.proto",
],
)

Expand All @@ -47,28 +47,28 @@ java_proto_library(
cc_binary(
name = "libtox4j-c.so",
srcs = glob([
"cpp/src/**/*.cpp",
"cpp/src/**/*.h",
"lib/src/main/cpp/**/*.cpp",
"lib/src/main/cpp/**/*.h",
]) + [
":cpp/src/jni.h",
":cpp/src/jni_md.h",
":lib/src/main/cpp/jni.h",
":lib/src/main/cpp/jni_md.h",
],
copts = [
"-DHAVE_TO_STRING",
],
includes = [
"cpp/src",
"src/main/protobuf",
"lib/src/main/cpp",
"lib/src/main/proto",
],
linkopts = select({
"//tools/config:freebsd": ["-Wl,--version-script,$(location cpp/src/libtox4j-c.ld)"],
"//tools/config:linux": ["-Wl,--version-script,$(location cpp/src/libtox4j-c.ld)"],
"//tools/config:freebsd": ["-Wl,--version-script,$(location lib/src/main/cpp/libtox4j-c.ld)"],
"//tools/config:linux": ["-Wl,--version-script,$(location lib/src/main/cpp/libtox4j-c.ld)"],
"//tools/config:osx": [],
"//tools/config:windows": [],
}),
linkshared = True,
deps = [
"cpp/src/libtox4j-c.ld",
"lib/src/main/cpp/libtox4j-c.ld",
":jni_cc_proto",
"//c-toxcore",
],
Expand All @@ -77,8 +77,8 @@ cc_binary(
kt_jvm_library(
name = "jvm-toxcore-c",
srcs = glob([
"src/main/java/**/*.java",
"src/main/java/**/*.kt",
"lib/src/main/java/**/*.java",
"lib/src/main/java/**/*.kt",
]),
data = ["libtox4j-c.so"],
deps = [":jni_java_proto"],
Expand All @@ -87,7 +87,7 @@ kt_jvm_library(
kt_jvm_test(
name = "ToxCoreTest",
size = "small",
srcs = ["src/test/java/im/tox/tox4j/core/ToxCoreTest.kt"],
srcs = ["lib/src/test/java/im/tox/tox4j/core/ToxCoreTest.kt"],
jvm_flags = ["-Djava.library.path=jvm-toxcore-c"],
test_class = "im.tox.tox4j.core.ToxCoreTest",
deps = [
Expand Down
1 change: 0 additions & 1 deletion cpp/src/ToxAv/Av.proto

This file was deleted.

1 change: 0 additions & 1 deletion cpp/src/ToxCore/Core.proto

This file was deleted.

3 changes: 0 additions & 3 deletions cpp/src/main/resources/im/tox/tox4j/impl/jni/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion cpp/src/util/ProtoLog.proto

This file was deleted.

25 changes: 25 additions & 0 deletions docker/jvm.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:22.04

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
ca-certificates \
cmake \
default-jdk \
git \
libtool \
make \
pkg-config \
yasm \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /work/jvm-toxcore-c
COPY scripts/ /work/jvm-toxcore-c/scripts/
RUN scripts/build-host "$PWD/_install/host/protobuf.stamp" "-j$(nproc)"
RUN scripts/build-host "$PWD/_install/host/toxcore.stamp" "-j$(nproc)"
COPY lib/src/main/cpp/ /work/jvm-toxcore-c/lib/src/main/cpp/
COPY lib/src/main/proto/ /work/jvm-toxcore-c/lib/src/main/proto/
RUN scripts/build-host "$PWD/_install/host/tox4j.stamp" "-j$(nproc)"
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

org.gradle.parallel=true
org.gradle.caching=true

Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading