admin管理员组文章数量:1335127
I have a gradle task which generates a json file containing all libraries used in my Kotlin Multiplatform Application. The output file will be parsed, and rendered in the UI.
./gradlew features:about:exportLibraryDefinitions - PaboutLibraries.exportPath=src/commonMain/composeResources/files -PaboutLibraries.exportVariant=release
Now, this task is quite long to type, and it requires the exact exportPath
to be the same as the one that my file reader expects. Therefor, I would like to wrap it in another gradle (simpler) task:
tasks updateLicenseInformation = tasks.register("updateLicenseInformation"){
group = "Entreco"
description = "Update all license information json file"
// How to execute
//"gradle features:about:exportLibraryDefinitions - PaboutLibraries.exportPath=src/commonMain/composeResources/files -PaboutLibraries.exportVariant=release"
// here?
}
How can I execute my gradle command here? I am using Android Studio + Gradle with Kotlin
I have a gradle task which generates a json file containing all libraries used in my Kotlin Multiplatform Application. The output file will be parsed, and rendered in the UI.
./gradlew features:about:exportLibraryDefinitions - PaboutLibraries.exportPath=src/commonMain/composeResources/files -PaboutLibraries.exportVariant=release
Now, this task is quite long to type, and it requires the exact exportPath
to be the same as the one that my file reader expects. Therefor, I would like to wrap it in another gradle (simpler) task:
tasks updateLicenseInformation = tasks.register("updateLicenseInformation"){
group = "Entreco"
description = "Update all license information json file"
// How to execute
//"gradle features:about:exportLibraryDefinitions - PaboutLibraries.exportPath=src/commonMain/composeResources/files -PaboutLibraries.exportVariant=release"
// here?
}
How can I execute my gradle command here? I am using Android Studio + Gradle with Kotlin
Share Improve this question asked Nov 20, 2024 at 15:20 EntrecoEntreco 12.9k8 gold badges78 silver badges98 bronze badges1 Answer
Reset to default 1I expect the below to work.
However it is not guaranteed because there appears to be a bug setting project properties in Kotlin build scripts and accessing them in other build scripts which I encountered in testing. I have logged this as a Gradle issue with a reproducible project so we can see what the Gradle team say.
tasks.register("updateLicenseInformation"){
group = "Entreco"
description = "Update all license information json file"
extra["aboutLibraries.exportPath"] = "src/commonMain/composeResources/files"
extra["aboutLibraries.exportVariant"] = "release"
/**
* The following, setting properties on the "ext" object, should not be necessary
* per the documentation, but in testing the properties were not
* accessible by Groovy scripts without these
* See https://docs.gradle./current/userguide/migrating_from_groovy_to_kotlin_dsl.html
*/
ext["aboutLibraries.exportPath"] = "src/commonMain/composeResources/files"
ext["aboutLibraries.exportVariant"] = "release"
dependsOn("features:about:exportLibraryDefinitions")
}
本文标签: androidWrap a gradle task in a simpler oneStack Overflow
版权声明:本文标题:android - Wrap a gradle task in a simpler one? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742349993a2458295.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论