1// Copyright (C) 2017 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14apply from: "${buildscript.sourceFile.parentFile}/javadoc_util.gradle" 15 16android.libraryVariants.all { variant -> 17 def name = variant.buildType.name 18 if (!name.equals("release")) { 19 return; // Skip non-release builds. 20 } 21 def allSourceDirs = variant.sourceSets.inject ([]) { 22 acc, val -> acc << val.javaDirectories 23 } 24 task("generateJavadoc", type: Javadoc) { 25 description = "Generates Javadoc for the ${javadocTitle}." 26 title = "ExoPlayer ${javadocTitle}" 27 source = allSourceDirs 28 options { 29 links "https://developer.android.com/reference" 30 encoding = "UTF-8" 31 } 32 exclude "**/BuildConfig.java" 33 exclude "**/R.java" 34 doFirst { 35 classpath = 36 files( 37 variant.javaCompileProvider.get().classpath.files, 38 project.android.getBootClasspath()) 39 } 40 doLast { 41 copy { 42 from "src/main/javadoc" 43 into "$buildDir/docs/javadoc" 44 } 45 project.fixJavadoc() 46 } 47 } 48} 49