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/ByteOutput.java' 41 include 'com/google/protobuf/ByteString.java' 42 include 'com/google/protobuf/BooleanArrayList.java' 43 include 'com/google/protobuf/CodedInputStream.java' 44 include 'com/google/protobuf/CodedOutputStream.java' 45 include 'com/google/protobuf/DoubleArrayList.java' 46 include 'com/google/protobuf/ExperimentalApi.java' 47 include 'com/google/protobuf/ExtensionLite.java' 48 include 'com/google/protobuf/ExtensionRegistryLite.java' 49 include 'com/google/protobuf/FieldSet.java' 50 include 'com/google/protobuf/FloatArrayList.java' 51 include 'com/google/protobuf/GeneratedMessageLite.java' 52 include 'com/google/protobuf/IntArrayList.java' 53 include 'com/google/protobuf/Internal.java' 54 include 'com/google/protobuf/InvalidProtocolBufferException.java' 55 include 'com/google/protobuf/LazyField.java' 56 include 'com/google/protobuf/LazyFieldLite.java' 57 include 'com/google/protobuf/LazyStringArrayList.java' 58 include 'com/google/protobuf/LazyStringList.java' 59 include 'com/google/protobuf/LongArrayList.java' 60 include 'com/google/protobuf/MapFieldLite.java' 61 include 'com/google/protobuf/MessageLite.java' 62 include 'com/google/protobuf/MessageLiteToString.java' 63 include 'com/google/protobuf/MessageLiteOrBuilder.java' 64 include 'com/google/protobuf/MutabilityOracle.java' 65 include 'com/google/protobuf/Parser.java' 66 include 'com/google/protobuf/ProtobufArrayList.java' 67 include 'com/google/protobuf/ProtocolStringList.java' 68 include 'com/google/protobuf/RopeByteString.java' 69 include 'com/google/protobuf/SmallSortedMap.java' 70 include 'com/google/protobuf/TextFormatEscaper.java' 71 include 'com/google/protobuf/UninitializedMessageException.java' 72 include 'com/google/protobuf/UnknownFieldSetLite.java' 73 include 'com/google/protobuf/UnmodifiableLazyStringList.java' 74 include 'com/google/protobuf/Utf8.java' 75 include 'com/google/protobuf/WireFormat.java' 76 } 77 } 78 79 nano { 80 java { 81 srcDirs = [ 82 'javanano/src/main/java/', 83 'javanano/src/device/main/java/' 84 ] 85 include("com/google/protobuf/nano/**") 86 } 87 } 88} 89 90if (project == rootProject) { 91 ext.getAndroidPrebuilt = { apiLevel -> 92 files("$rootDir/../../prebuilts/sdk/$apiLevel/public/android.jar") 93 } 94} 95 96dependencies { 97 compile getAndroidPrebuilt('8') 98 nanoCompile getAndroidPrebuilt('8') 99} 100 101jar { 102 from sourceSets.nano.output, sourceSets.micro.output 103 baseName "libprotobuf" 104 appendix "java" 105 version "3.0" 106 classifier "micronano" 107} 108 109task nanoJar(type: Jar) { 110 from sourceSets.nano.output 111 dependsOn nanoClasses 112 baseName "libprotobuf" 113 appendix "java" 114 version "3.0" 115 classifier "nano" 116} 117 118task microJar(type: Jar) { 119 from sourceSets.micro.output 120 dependsOn microClasses 121 baseName "libprotobuf" 122 appendix "java" 123 version "3.0" 124 classifier "micro" 125} 126 127task liteJar(type: Jar) { 128 from sourceSets.lite.output 129 dependsOn liteClasses 130 baseName "libprotobuf" 131 appendix "java" 132 version "3.0" 133 classifier "lite" 134} 135 136artifacts { 137 micro microJar 138 nano nanoJar 139 lite liteJar 140} 141 142