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 = ['java/src/main/java/'] 30 include("com/google/protobuf/micro/*") 31 } 32 } 33 34 lite { 35 java { 36 srcDirs = ['java/src/main/java/'] 37 include 'com/google/protobuf/UninitializedMessageException.java' 38 include 'com/google/protobuf/MessageLite.java' 39 include 'com/google/protobuf/InvalidProtocolBufferException.java' 40 include 'com/google/protobuf/CodedOutputStream.java' 41 include 'com/google/protobuf/ByteString.java' 42 include 'com/google/protobuf/CodedInputStream.java' 43 include 'com/google/protobuf/ExtensionRegistryLite.java' 44 include 'com/google/protobuf/AbstractMessageLite.java' 45 include 'com/google/protobuf/AbstractParser.java' 46 include 'com/google/protobuf/FieldSet.java' 47 include 'com/google/protobuf/Internal.java' 48 include 'com/google/protobuf/WireFormat.java' 49 include 'com/google/protobuf/GeneratedMessageLite.java' 50 include 'com/google/protobuf/BoundedByteString.java' 51 include 'com/google/protobuf/LazyField.java' 52 include 'com/google/protobuf/LazyFieldLite.java' 53 include 'com/google/protobuf/LazyStringList.java' 54 include 'com/google/protobuf/LazyStringArrayList.java' 55 include 'com/google/protobuf/UnmodifiableLazyStringList.java' 56 include 'com/google/protobuf/LiteralByteString.java' 57 include 'com/google/protobuf/MessageLiteOrBuilder.java' 58 include 'com/google/protobuf/Parser.java' 59 include 'com/google/protobuf/ProtocolStringList.java' 60 include 'com/google/protobuf/RopeByteString.java' 61 include 'com/google/protobuf/SmallSortedMap.java' 62 include 'com/google/protobuf/Utf8.java' 63 } 64 } 65 66 nano { 67 java { 68 srcDirs = [ 69 'java/src/main/java/', 70 'java/src/device/main/java/' 71 ] 72 include("com/google/protobuf/nano/**") 73 } 74 } 75} 76 77if (project == rootProject) { 78 ext.getAndroidPrebuilt = { apiLevel -> 79 files("$rootDir/../../prebuilts/sdk/$apiLevel/android.jar") 80 } 81} 82 83dependencies { 84 compile getAndroidPrebuilt('8') 85 nanoCompile getAndroidPrebuilt('8') 86} 87 88jar { 89 from sourceSets.nano.output, sourceSets.micro.output 90 baseName "libprotobuf" 91 appendix "java" 92 version "2.6" 93 classifier "micronano" 94} 95 96task nanoJar(type: Jar) { 97 from sourceSets.nano.output 98 dependsOn nanoClasses 99 baseName "libprotobuf" 100 appendix "java" 101 version "2.6" 102 classifier "nano" 103} 104 105task microJar(type: Jar) { 106 from sourceSets.micro.output 107 dependsOn microClasses 108 baseName "libprotobuf" 109 appendix "java" 110 version "2.6" 111 classifier "micro" 112} 113 114task liteJar(type: Jar) { 115 from sourceSets.lite.output 116 dependsOn liteClasses 117 baseName "libprotobuf" 118 appendix "java" 119 version "2.3" 120 classifier "lite" 121} 122 123artifacts { 124 micro microJar 125 nano nanoJar 126 lite liteJar 127} 128 129