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
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[versions]
agp = "8.13.1"
kotlin = "2.2.21"
protobufVersion = "4.33.1"

[libraries]
junit = { module = "junit:junit", version = "4.13.2" }
Expand All @@ -9,8 +10,11 @@ androidx-test-rules = { module = "androidx.test:rules", version = "1.7.0" }
androidx-test-ext = { module = "androidx.test.ext:junit", version = "1.3.0" }
androidx-annotations = { module = "androidx.annotation:annotation", version = "1.9.1" }
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version = "1.9.0" }
protoc = { module = "com.google.protobuf:protoc", version.ref = "protobufVersion" }
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobufVersion" }

[plugins]
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
protobuf-compiler = { id = "com.google.protobuf", version = "0.9.5" }
31 changes: 27 additions & 4 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import com.google.protobuf.gradle.id
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlinx.serialization)
id("maven-publish")

alias(libs.plugins.protobuf.compiler)
}

group = "org.sessionfoundation"
Expand All @@ -20,10 +23,10 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

externalNativeBuild {
cmake {
arguments += listOf("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON")
targets("session_util")
}
cmake {
arguments += listOf("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON")
targets("session_util")
}
}
}

Expand Down Expand Up @@ -76,6 +79,22 @@ kotlin {
}
}

protobuf {
protoc {
artifact = libs.protoc.get().toString()
}

plugins {
generateProtoTasks {
all().forEach { task ->
task.builtins {
create("java") {}
}
}
}
}
}

publishing {
publications {
create<MavenPublication>("release") {
Expand Down Expand Up @@ -121,4 +140,8 @@ dependencies {

implementation(libs.androidx.annotations)
implementation(libs.kotlinx.serialization.core)

api(libs.protobuf.java)

protobuf(files("../libsession-util/proto/SessionProtos.proto"))
}
10 changes: 10 additions & 0 deletions library/src/main/proto/Utils.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto2";

package signalservice;

option java_package = "org.session.libsignal.protos";
option java_outer_classname = "UtilProtos";

message ByteArrayList {
repeated bytes content = 1;
}
40 changes: 40 additions & 0 deletions library/src/main/proto/WebSocketResources.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (C) 2014-2016 Open Whisper Systems
*
* Licensed according to the LICENSE file in this repository.
*/

syntax = "proto2";

package signalservice;

option java_package = "org.session.libsignal.protos";
option java_outer_classname = "WebSocketProtos";

message WebSocketRequestMessage {
optional string verb = 1;
optional string path = 2;
optional bytes body = 3;
repeated string headers = 5;
optional uint64 id = 4;
}

message WebSocketResponseMessage {
optional uint64 id = 1;
optional uint32 status = 2;
optional string message = 3;
repeated string headers = 5;
optional bytes body = 4;
}

message WebSocketMessage {
enum Type {
UNKNOWN = 0;
REQUEST = 1;
RESPONSE = 2;
}

optional Type type = 1;
optional WebSocketRequestMessage request = 2;
optional WebSocketResponseMessage response = 3;
}
1 change: 1 addition & 0 deletions library/src/main/proto/deprecated_notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The proto files under this folder are deprecated and will be removed in future releases.