1/* 2 * Copyright (C) 2016 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 17package android.support.checkapi 18 19import org.gradle.api.tasks.JavaExec 20import org.gradle.api.tasks.InputFile 21import org.gradle.api.tasks.ParallelizableTask 22import org.gradle.api.tasks.OutputFile 23 24@ParallelizableTask 25public class ApiXmlConversionTask extends JavaExec { 26 27 @InputFile 28 File inputApiFile 29 30 @OutputFile 31 File outputApiXmlFile 32 33 public ApiXmlConversionTask() { 34 maxHeapSize = "1024m" 35 36 // Despite this tool living in ApiCheck, its purpose more fits with doclava's "purposes", 37 // generation of api files in this case. Thus, I am putting this in the doclava package. 38 setMain('com.google.doclava.apicheck.ApiCheck') 39 } 40 41 /** 42 * "Configures" this ApiXmlConversionTask with parameters that might not be at their final 43 * values until this task is run. 44 */ 45 private configureApiXmlConversionTask() { 46 setArgs([ 47 '-convert2xml', 48 getInputApiFile().absolutePath, 49 getOutputApiXmlFile().absolutePath 50 ]) 51 } 52 53 @Override 54 public void exec() { 55 configureApiXmlConversionTask() 56 super.exec() 57 } 58} 59