1/* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17apply plugin: 'java' 18 19configurations { 20 micro 21 nano 22 lite 23} 24 25sourceSets { 26 27 micro { 28 java { 29 srcDirs = ['javamicro/src/main/java/'] 30 include("com/google/protobuf/micro/*") 31 } 32 } 33 34 lite { 35 java { 36 srcDirs = ['java/core/src/main/java/'] 37 include 'com/google/protobuf/AbstractMessageLite.java' 38 include 'com/google/protobuf/AbstractParser.java' 39 include 'com/google/protobuf/AbstractProtobufList.java' 40 include 'com/google/protobuf/AllocatedBuffer.java' 41 include 'com/google/protobuf/Android.java' 42 include 'com/google/protobuf/ArrayDecoders.java' 43 include 'com/google/protobuf/BinaryReader.java' 44 include 'com/google/protobuf/BinaryWriter.java' 45 include 'com/google/protobuf/BooleanArrayList.java' 46 include 'com/google/protobuf/BufferAllocator.java' 47 include 'com/google/protobuf/ByteBufferWriter.java' 48 include 'com/google/protobuf/ByteOutput.java' 49 include 'com/google/protobuf/ByteString.java' 50 include 'com/google/protobuf/CodedInputStream.java' 51 include 'com/google/protobuf/CodedInputStreamReader.java' 52 include 'com/google/protobuf/CodedOutputStream.java' 53 include 'com/google/protobuf/CodedOutputStreamWriter.java' 54 include 'com/google/protobuf/DoubleArrayList.java' 55 include 'com/google/protobuf/ExperimentalApi.java' 56 include 'com/google/protobuf/ExtensionLite.java' 57 include 'com/google/protobuf/ExtensionRegistryFactory.java' 58 include 'com/google/protobuf/ExtensionRegistryLite.java' 59 include 'com/google/protobuf/ExtensionSchema.java' 60 include 'com/google/protobuf/ExtensionSchemaLite.java' 61 include 'com/google/protobuf/ExtensionSchemas.java' 62 include 'com/google/protobuf/FieldInfo.java' 63 include 'com/google/protobuf/FieldSet.java' 64 include 'com/google/protobuf/FieldType.java' 65 include 'com/google/protobuf/FloatArrayList.java' 66 include 'com/google/protobuf/GeneratedMessageInfoFactory.java' 67 include 'com/google/protobuf/GeneratedMessageLite.java' 68 include 'com/google/protobuf/IntArrayList.java' 69 include 'com/google/protobuf/Internal.java' 70 include 'com/google/protobuf/InvalidProtocolBufferException.java' 71 include 'com/google/protobuf/IterableByteBufferInputStream.java' 72 include 'com/google/protobuf/JavaType.java' 73 include 'com/google/protobuf/LazyField.java' 74 include 'com/google/protobuf/LazyFieldLite.java' 75 include 'com/google/protobuf/LazyStringArrayList.java' 76 include 'com/google/protobuf/LazyStringList.java' 77 include 'com/google/protobuf/ListFieldSchema.java' 78 include 'com/google/protobuf/LongArrayList.java' 79 include 'com/google/protobuf/ManifestSchemaFactory.java' 80 include 'com/google/protobuf/MapEntryLite.java' 81 include 'com/google/protobuf/MapFieldLite.java' 82 include 'com/google/protobuf/MapFieldSchema.java' 83 include 'com/google/protobuf/MapFieldSchemaLite.java' 84 include 'com/google/protobuf/MapFieldSchemas.java' 85 include 'com/google/protobuf/MessageInfo.java' 86 include 'com/google/protobuf/MessageInfoFactory.java' 87 include 'com/google/protobuf/MessageLite.java' 88 include 'com/google/protobuf/MessageLiteOrBuilder.java' 89 include 'com/google/protobuf/MessageLiteToString.java' 90 include 'com/google/protobuf/MessageSchema.java' 91 include 'com/google/protobuf/MessageSetSchema.java' 92 include 'com/google/protobuf/MutabilityOracle.java' 93 include 'com/google/protobuf/NewInstanceSchema.java' 94 include 'com/google/protobuf/NewInstanceSchemaLite.java' 95 include 'com/google/protobuf/NewInstanceSchemas.java' 96 include 'com/google/protobuf/NioByteString.java' 97 include 'com/google/protobuf/OneofInfo.java' 98 include 'com/google/protobuf/Parser.java' 99 include 'com/google/protobuf/PrimitiveNonBoxingCollection.java' 100 include 'com/google/protobuf/ProtoSyntax.java' 101 include 'com/google/protobuf/Protobuf.java' 102 include 'com/google/protobuf/ProtobufArrayList.java' 103 include 'com/google/protobuf/ProtobufLists.java' 104 include 'com/google/protobuf/ProtocolStringList.java' 105 include 'com/google/protobuf/RawMessageInfo.java' 106 include 'com/google/protobuf/Reader.java' 107 include 'com/google/protobuf/RopeByteString.java' 108 include 'com/google/protobuf/Schema.java' 109 include 'com/google/protobuf/SchemaFactory.java' 110 include 'com/google/protobuf/SchemaUtil.java' 111 include 'com/google/protobuf/SmallSortedMap.java' 112 include 'com/google/protobuf/StructuralMessageInfo.java' 113 include 'com/google/protobuf/TextFormatEscaper.java' 114 include 'com/google/protobuf/UninitializedMessageException.java' 115 include 'com/google/protobuf/UnknownFieldSchema.java' 116 include 'com/google/protobuf/UnknownFieldSetLite.java' 117 include 'com/google/protobuf/UnknownFieldSetLiteSchema.java' 118 include 'com/google/protobuf/UnmodifiableLazyStringList.java' 119 include 'com/google/protobuf/UnsafeUtil.java' 120 include 'com/google/protobuf/Utf8.java' 121 include 'com/google/protobuf/WireFormat.java' 122 include 'com/google/protobuf/Writer.java' 123 } 124 } 125 126 nano { 127 java { 128 srcDirs = [ 129 'javanano/src/main/java/', 130 'javanano/src/device/main/java/' 131 ] 132 include("com/google/protobuf/nano/**") 133 } 134 } 135} 136 137if (project == rootProject) { 138 ext.getAndroidPrebuilt = { apiLevel -> 139 files("$rootDir/../../prebuilts/sdk/$apiLevel/public/android.jar") 140 } 141} 142 143dependencies { 144 compile getAndroidPrebuilt('8') 145 nanoCompile getAndroidPrebuilt('8') 146} 147 148jar { 149 from sourceSets.nano.output, sourceSets.micro.output 150 baseName "libprotobuf" 151 appendix "java" 152 version "3.0" 153 classifier "micronano" 154} 155 156task nanoJar(type: Jar) { 157 from sourceSets.nano.output 158 dependsOn nanoClasses 159 baseName "libprotobuf" 160 appendix "java" 161 version "3.0" 162 classifier "nano" 163} 164 165task microJar(type: Jar) { 166 from sourceSets.micro.output 167 dependsOn microClasses 168 baseName "libprotobuf" 169 appendix "java" 170 version "3.0" 171 classifier "micro" 172} 173 174task liteJar(type: Jar) { 175 from sourceSets.lite.output 176 dependsOn liteClasses 177 baseName "libprotobuf" 178 appendix "java" 179 version "3.0" 180 classifier "lite" 181} 182 183artifacts { 184 micro microJar 185 nano nanoJar 186 lite liteJar 187} 188 189