beginnings of protobufs

pull/8/head
geeksville 2020-01-22 18:32:21 -08:00
rodzic 397640151f
commit 73371d6183
4 zmienionych plików z 58 dodań i 1 usunięć

Wyświetl plik

@ -1,9 +1,12 @@
* test reg reading/writing directly via bt to device
* fix bluetooth update
* add real messaging code/protobufs
* use https://codelabs.developers.google.com/codelabs/jetpack-compose-basics/#4 to show service state
* connect to bluetooth device automatically using minimum power
protoc -I=. --java_out /tmp ./mesh.proto
# Medium priority
* remove secret google settings json before open sourcing

Wyświetl plik

@ -6,6 +6,9 @@ apply plugin: 'com.google.gms.google-services'
// Apply the Crashlytics Gradle plugin
apply plugin: 'com.google.firebase.crashlytics'
// protobuf
apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
@ -41,6 +44,22 @@ android {
}
}
// per protobuf-gradle-plugin docs, this is recommended for android
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.9.0'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option "lite"
}
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
@ -52,6 +71,9 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// You need to depend on the lite runtime library, not protobuf-java
implementation 'com.google.protobuf:protobuf-javalite:3.8.0'
// You also need to include the following Compose toolkit dependencies.
implementation("androidx.compose:compose-runtime:$compose_version")
implementation("androidx.ui:ui-framework:$compose_version")

Wyświetl plik

@ -0,0 +1,29 @@
syntax = "proto2";
package tutorial;
option java_package = "com.geeksville.meshutil";
option java_outer_classname = "MeshProtos";
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phones = 4;
}
message AddressBook {
repeated Person people = 1;
}

Wyświetl plik

@ -6,7 +6,7 @@ buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0-alpha09'
@ -19,6 +19,9 @@ buildscript {
// (if not, add it).
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta01'
// protobuf plugin - docs here https://github.com/google/protobuf-gradle-plugin
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.11'
}
}