Skip to content

Instantly share code, notes, and snippets.

@mohsenoid
Last active February 4, 2018 16:19
Show Gist options
  • Save mohsenoid/754c72f84d5b6e01a3392540a5adb040 to your computer and use it in GitHub Desktop.
Save mohsenoid/754c72f84d5b6e01a3392540a5adb040 to your computer and use it in GitHub Desktop.
apply plugin: 'java-library'
apply plugin: 'com.google.protobuf'
sourceSets {
main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.protobuf:protobuf-lite:3.0.0'
}
protobuf {
protoc {
// You still need protoc like in the non-Android case
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins {
javalite {
// The codegen for lite comes as a separate artifact
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
// In most cases you don't need the full Java output
// if you use the lite output.
remove java
}
task.plugins {
javalite {}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment