xref: /aosp_15_r20/external/ksp/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorEnvironment.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
1 /*
2  * Copyright 2022 Google LLC
3  * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package com.google.devtools.ksp.processing
19 
20 class SymbolProcessorEnvironment(
21     /**
22      * passed from command line, Gradle, etc.
23      */
24     val options: Map<String, String>,
25 
26     /**
27      * language version of compilation environment.
28      */
29     val kotlinVersion: KotlinVersion,
30 
31     /**
32      * creates managed files.
33      */
34     val codeGenerator: CodeGenerator,
35 
36     /**
37      * for logging to build output.
38      */
39     val logger: KSPLogger,
40 
41     /**
42      * Kotlin API version of compilation environment.
43      */
44     val apiVersion: KotlinVersion,
45 
46     /**
47      * Kotlin compiler version of compilation environment.
48      */
49     val compilerVersion: KotlinVersion,
50 
51     /**
52      * Information of target platforms
53      *
54      * There can be multiple platforms in a metadata compilation.
55      */
56     val platforms: List<PlatformInfo>,
57 ) {
58     // For compatibility with KSP 1.0.2 and earlier
59     constructor(
60         options: Map<String, String>,
61         kotlinVersion: KotlinVersion,
62         codeGenerator: CodeGenerator,
63         logger: KSPLogger
64     ) : this(
65         options,
66         kotlinVersion,
67         codeGenerator,
68         logger,
69         kotlinVersion,
70         kotlinVersion,
71         emptyList()
72     )
73 }
74