aboutsummaryrefslogtreecommitdiffstats
path: root/build.gradle
diff options
context:
space:
mode:
authorJeff Davidson <jpd@google.com>2014-04-22 23:25:53 -0700
committerJeff Davidson <jpd@google.com>2014-04-25 14:34:55 -0700
commit721ea491a8e3e9ea5a130965dc5761fc335c3e61 (patch)
tree195940ae75bbcb5b64f644c5ecfc4074eef34486 /build.gradle
parent829f6c014ce69d04593d30652c8acc2f7a793851 (diff)
downloadexternal_protobuf-721ea491a8e3e9ea5a130965dc5761fc335c3e61.zip
external_protobuf-721ea491a8e3e9ea5a130965dc5761fc335c3e61.tar.gz
external_protobuf-721ea491a8e3e9ea5a130965dc5761fc335c3e61.tar.bz2
Support generation of Parcelable nano messages.
This CL adds the "parcelable_messages" option. When enabled, all generated message classes will conform to the Android Parcelable contract. This is achieved by introducing a new parent class for generated classes which implements the required functionality. Since the store_unknown_fields option also makes use of a superclass, ExtendableMessageNano, we have two versions of the new Parcelable superclass: one extending MessageNano, and one extending ExtendableMessageNano. These classes are otherwise identical. As these classes depend on Android framework jars, they are not included in the host .jar build of the nanoproto library. Finally, add a test suite for running tests of Android-specific functionality, as this cannot be done on a desktop JVM. Change-Id: Icc2a257f03317e947f7078dbb9857c3286857497
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle21
1 files changed, 18 insertions, 3 deletions
diff --git a/build.gradle b/build.gradle
index 1efd4bf..95c9b1d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,3 @@
-=======
/*
* Copyright (C) 2013 The Android Open Source Project
*
@@ -25,17 +24,33 @@ configurations {
sourceSets {
micro {
java {
- srcDirs = ['java/src/main/java/com/google/protobuf/micro']
+ srcDirs = ['java/src/main/java/']
+ include("com/google/protobuf/micro/*")
}
}
nano {
java {
- srcDirs = ['java/src/main/java/com/google/protobuf/nano']
+ srcDirs = [
+ 'java/src/main/java/',
+ 'java/src/device/main/java/'
+ ]
+ include("com/google/protobuf/nano/**")
}
}
}
+if (project == rootProject) {
+ ext.getAndroidPrebuilt = { apiLevel ->
+ files("$rootDir/../../prebuilts/sdk/$apiLevel/android.jar")
+ }
+}
+
+dependencies {
+ compile getAndroidPrebuilt('8')
+ nanoCompile getAndroidPrebuilt('8')
+}
+
jar {
from sourceSets.nano.output, sourceSets.micro.output
baseName "libprotobuf"