1/* 2 * Copyright (C) 2017 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 17import javax.tools.ToolProvider 18 19plugins { 20 id("java") 21 id("maven-publish") 22} 23 24group = 'com.android' 25version = '1.0.6' 26 27if (System.env.OUT_DIR != null) { 28 buildDir = file("${System.env.OUT_DIR}/gradle/external/doclava/build").getCanonicalFile() 29} else { 30 buildDir = file('../../out/host/gradle/external/doclava/build') 31} 32 33repositories { 34 maven { url file('../../prebuilts/androidx/external').absolutePath } 35} 36 37dependencies { 38 implementation("org.antlr:antlr:3.5.2") 39 implementation("com.google.jsilver:jsilver:1.0.0") 40 implementation("org.ccil.cowan.tagsoup:tagsoup:1.2.1") 41 42 // tools.jar required for com.sun.javadoc 43 def toolsJar 44 if (JavaVersion.current().getMajorVersion() == "8") { 45 toolsJar = ((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs() 46 } else if (System.env.JAVA_TOOLS_JAR != null) { 47 toolsJar = System.env.JAVA_TOOLS_JAR 48 } else { 49 throw new Exception("If you are not using Java 8, JAVA_TOOLS_JAR env variable " + 50 "needs to be set to tools.jar from a Java 8 installation to build Doclava") 51 } 52 implementation(files(toolsJar)) 53 54 testImplementation("junit:junit:4.12") 55} 56 57sourceSets { 58 main { 59 java.srcDirs = ['src/'] 60 resources.srcDirs = ['res/'] 61 } 62 test { 63 java.srcDirs = ['test/'] 64 resources.srcDirs = ['test/api'] 65 } 66} 67 68tasks.withType(JavaCompile) { 69 // Suppress build warnings that we're not interested in: b/154755010 70 options.warnings = false 71} 72 73tasks.withType(Jar) { task -> 74 task.reproducibleFileOrder = true 75 task.preserveFileTimestamps = false 76} 77