Skip to content

Commit bb805e4

Browse files
SessionHero01SessionHero01
authored andcommitted
Run protobuf compiler
1 parent b029430 commit bb805e4

File tree

6 files changed

+82
-5
lines changed

6 files changed

+82
-5
lines changed

gradle/libs.versions.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[versions]
22
agp = "8.13.1"
33
kotlin = "2.2.21"
4+
protobufVersion = "4.33.1"
45

56
[libraries]
67
junit = { module = "junit:junit", version = "4.13.2" }
@@ -9,8 +10,11 @@ androidx-test-rules = { module = "androidx.test:rules", version = "1.7.0" }
910
androidx-test-ext = { module = "androidx.test.ext:junit", version = "1.3.0" }
1011
androidx-annotations = { module = "androidx.annotation:annotation", version = "1.9.1" }
1112
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version = "1.9.0" }
13+
protoc = { module = "com.google.protobuf:protoc", version = "4.33.1" }
14+
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobufVersion" }
1215

1316
[plugins]
1417
android-library = { id = "com.android.library", version.ref = "agp" }
1518
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
1619
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
20+
protobuf-compiler = { id = "com.google.protobuf", version = "0.9.5" }

library/build.gradle.kts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ plugins {
55
alias(libs.plugins.kotlin.android)
66
alias(libs.plugins.kotlinx.serialization)
77
id("maven-publish")
8+
9+
alias(libs.plugins.protobuf.compiler)
810
}
911

1012
group = "org.sessionfoundation"
@@ -20,10 +22,10 @@ android {
2022
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2123

2224
externalNativeBuild {
23-
cmake {
24-
arguments += listOf("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON")
25-
targets("session_util")
26-
}
25+
cmake {
26+
arguments += listOf("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON")
27+
targets("session_util")
28+
}
2729
}
2830
}
2931

@@ -76,6 +78,22 @@ kotlin {
7678
}
7779
}
7880

81+
protobuf {
82+
protoc {
83+
artifact = libs.protoc.get().toString()
84+
}
85+
86+
plugins {
87+
generateProtoTasks {
88+
all().forEach { task ->
89+
task.builtins {
90+
create("java") {}
91+
}
92+
}
93+
}
94+
}
95+
}
96+
7997
publishing {
8098
publications {
8199
create<MavenPublication>("release") {
@@ -121,4 +139,8 @@ dependencies {
121139

122140
implementation(libs.androidx.annotations)
123141
implementation(libs.kotlinx.serialization.core)
142+
143+
compileOnly(libs.protobuf.java)
144+
145+
protobuf(files("../libsession-util/proto/SessionProtos.proto"))
124146
}

library/src/main/proto/Utils.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax = "proto2";
2+
3+
package signalservice;
4+
5+
option java_package = "org.session.libsignal.protos";
6+
option java_outer_classname = "UtilProtos";
7+
8+
message ByteArrayList {
9+
repeated bytes content = 1;
10+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright (C) 2014-2016 Open Whisper Systems
3+
*
4+
* Licensed according to the LICENSE file in this repository.
5+
*/
6+
7+
syntax = "proto2";
8+
9+
package signalservice;
10+
11+
option java_package = "org.session.libsignal.protos";
12+
option java_outer_classname = "WebSocketProtos";
13+
14+
message WebSocketRequestMessage {
15+
optional string verb = 1;
16+
optional string path = 2;
17+
optional bytes body = 3;
18+
repeated string headers = 5;
19+
optional uint64 id = 4;
20+
}
21+
22+
message WebSocketResponseMessage {
23+
optional uint64 id = 1;
24+
optional uint32 status = 2;
25+
optional string message = 3;
26+
repeated string headers = 5;
27+
optional bytes body = 4;
28+
}
29+
30+
message WebSocketMessage {
31+
enum Type {
32+
UNKNOWN = 0;
33+
REQUEST = 1;
34+
RESPONSE = 2;
35+
}
36+
37+
optional Type type = 1;
38+
optional WebSocketRequestMessage request = 2;
39+
optional WebSocketResponseMessage response = 3;
40+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The proto files under this folder are deprecated and will be removed in future releases.

0 commit comments

Comments
 (0)