1 /*
2  * Copyright (C) 2024 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 aconfig
18 
19 import org.gradle.api.Action
20 import org.gradle.api.DomainObjectSet
21 import org.gradle.api.file.ConfigurableFileCollection
22 import org.gradle.api.model.ObjectFactory
23 import org.gradle.api.provider.Property
24 
25 interface AConfigDeclaration {
26     val packageName: Property<String>
27     val srcFile: ConfigurableFileCollection
28 }
29 
30 open class AConfigExtension(private val objectFactory: ObjectFactory) {
31 
32     val declarations: DomainObjectSet<AConfigDeclaration> = objectFactory.domainObjectSet(
33         AConfigDeclaration::class.java
34     )
35 
aconfigDeclarationnull36     fun aconfigDeclaration(action: Action<AConfigDeclaration>) {
37         val declaration = objectFactory.newInstance(AConfigDeclaration::class.java)
38         action.execute(declaration)
39         declarations.add(declaration)
40     }
41 }
42