1 /*
2  * Copyright 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 @file:Suppress("unused") // used by gson
18 
19 package androidx.build.dackka
20 
21 import com.google.gson.annotations.SerializedName
22 import java.io.File
23 import org.gradle.api.file.FileCollection
24 import org.gradle.api.tasks.Classpath
25 import org.gradle.api.tasks.Input
26 import org.gradle.api.tasks.InputDirectory
27 import org.gradle.api.tasks.InputFiles
28 import org.gradle.api.tasks.Nested
29 import org.gradle.api.tasks.PathSensitive
30 import org.gradle.api.tasks.PathSensitivity
31 
32 // These are models used to invoke dokka from the command line.
33 // Most of these models are identical to
34 // https://github.com/Kotlin/dokka/blob/master/core/src/main/kotlin/configuration.kt
35 // with the caveat that they have Gradle task input annotations when necessary.
36 
37 internal object DokkaInputModels {
38     class SourceSet(
39         @get:Input val displayName: String,
40         @get:Nested @SerializedName("sourceSetID") val id: SourceSetId,
41         @Classpath val classpath: FileCollection,
42         @get:InputFiles @PathSensitive(PathSensitivity.RELATIVE) val sourceRoots: FileCollection,
43         @get:InputFiles @PathSensitive(PathSensitivity.RELATIVE) val samples: FileCollection,
44         @get:InputFiles @PathSensitive(PathSensitivity.RELATIVE) val includes: FileCollection,
45         @get:Input val analysisPlatform: String,
46         @get:Input val documentedVisibilities: List<String> = listOf("PUBLIC", "PROTECTED"),
47         @get:Input val noStdlibLink: Boolean,
48         @get:Input val noJdkLink: Boolean,
49         @get:Input val noAndroidSdkLink: Boolean,
50         @Nested val dependentSourceSets: List<SourceSetId>,
51         @Nested val externalDocumentationLinks: List<GlobalDocsLink>,
52         @Nested val sourceLinks: List<SrcLink>
53     )
54 
55     class SourceSetId(
56         @get:Input val sourceSetName: String,
57         @get:Input val scopeId: String,
58     )
59 
60     class SrcLink(
61         @get:InputDirectory @PathSensitive(PathSensitivity.RELATIVE) val localDirectory: File,
62         @get:Input val remoteUrl: String,
63         @get:Input val remoteLineSuffix: String = ";l="
64     )
65 
66     class GlobalDocsLink(@get:Input val url: String, @get:Input val packageListUrl: String?)
67 }
68