-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gradle] Add DSL to configure compose resources
Example: compose.resources { publicResClass = true resourceProjectId = "me.sample.library.resources" generateResClass = auto }
- Loading branch information
Showing
9 changed files
with
141 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/ResourcesExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.jetbrains.compose.resources | ||
|
||
abstract class ResourcesExtension { | ||
/** | ||
* Whether the generated resources accessors class should be public or not. | ||
* | ||
* Default is false. | ||
*/ | ||
var publicResClass: Boolean = false | ||
|
||
/** | ||
* The unique identifier of the resources in the current project. | ||
* Uses as package for the generated Res class and for isolation resources in a final artefact. | ||
* | ||
* If it is empty then `{group name}.{module name}.generated.resources` will be used. | ||
* | ||
*/ | ||
var resourceProjectId: String = "" | ||
|
||
enum class ResourceClassGeneration { Auto, Always } | ||
|
||
//to support groovy DSL | ||
val auto = ResourceClassGeneration.Auto | ||
val always = ResourceClassGeneration.Always | ||
|
||
/** | ||
* The mode of resource class generation. | ||
* | ||
* - `auto`: The Res class will be generated if the current project has an explicit "implementation" or "api" dependency on the resource's library. | ||
* - `always`: Unconditionally generate the Res class. This may be useful when the resources library is available transitively. | ||
*/ | ||
var generateResClass: ResourceClassGeneration = auto | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters