1 /*
2  * Copyright (C) 2023 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 
17 package com.android.tools.metalava
18 
19 import com.android.tools.metalava.cli.common.newFile
20 import com.android.tools.metalava.cli.signature.SIGNATURE_FORMAT_OUTPUT_GROUP
21 import com.github.ajalt.clikt.parameters.groups.OptionGroup
22 import com.github.ajalt.clikt.parameters.options.option
23 
24 const val ARG_API = "--api"
25 const val ARG_REMOVED_API = "--removed-api"
26 
27 class SignatureFileOptions :
28     OptionGroup(
29         name = "Signature File Output",
30         help =
31             """
32                 Options controlling the signature file output. The format of the generated file is
33                 determined by the options in the `$SIGNATURE_FORMAT_OUTPUT_GROUP` section.
34             """
35                 .trimIndent()
36     ) {
37 
38     /** If set, a file to write an API file to. */
39     val apiFile by
40         option(
41                 ARG_API,
42                 help =
43                     """
44                         Output file into which the API signature will be generated. If this is not
45                         specified then no API signature file will be created.
46                     """
47                         .trimIndent()
48             )
49             .newFile()
50 
51     /** If set, a file to write an API file containing APIs that have been removed. */
52     val removedApiFile by
53         option(
54                 ARG_REMOVED_API,
55                 help =
56                     """
57                         Output file into which the API signatures for removed APIs will be
58                         generated. If this is not specified then no removed API signature file will
59                         be created.
60                     """
61                         .trimIndent()
62             )
63             .newFile()
64 }
65