Category "gradle-kotlin-dsl"

Why copy task delete stale output on first build?

I have this kotlin gradle build script representing my use case. I am working with Gradle 6.7. This is my kotlin gradle build file: plugins { java } tasks

Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources

I get the following warning when I want to use @AndroidEntryPoint which is a property of hilt in my project. Expected @AndroidEntryPoint to have a value. Did y

Conditionally Change a Gradle Property Based on a Provider Value

I'm writing a Gradle convention plugin that uses Gradle's Lazy Configuration APIs to configure tasks. In one case, the plugin needs to conditionally change the

Read value from local.properties via Kotlin DSL

I want to retreive key from local.properties file that looks like : sdk.dir=C\:\\Users\\i30mb1\\AppData\\Local\\Android\\Sdk key="xxx" and save this value in m

How to access variant.outputFileName in Kotlin

We've been using a snippet like this one to rename the APK file generated by our Gradle build: android.applicationVariants.all { variant -> variant.outp

Using "project.setProperty" vs a regular variable in Gradle Kotlin DSL?

What is the difference between these two approaches in a Gradle Kotlin build script? Specifically, I wanted to know what is the advantage (if any) of using setP

How to set global variables in gradle.kts?

My app uses several gradle.kts scripts. I want to set one variable which would be global for everyone. object Versions{ val kotlin_version = "1.3.60-eap-25"

Databinding unresolved after move to Gradle Kotlin DSL build scripts

I had a working build, including databinding, but after migrating my Gradle build scripts to Kotlin DSL, I now have unresolved symbol errors for every use of im

gradle kotlindsl extract logic to outer scripts

What is the recommended way to extract gradle build code blocks to external scripts? Notice these scripts should support references to the gradle project, extra

How to run a command line command with Kotlin DSL in Gradle 6.1.1?

I am trying to run the code block below, after reading multiple posts on the topic and the Gradle manual. I run the below and get the following error: execComma

Failed to apply plugin 'no.nils.wsdl2java'. Configuration with name 'compile' not found

when migrating to gradle 7.x getting below error * What went wrong: An exception occurred applying plugin request [id: 'no.nils.wsdl2java', version: '0.12'] &g

How to pass command line argument to Gradle Kotlin DSL

Here's an example from Groovy that represents exactly what I would like to achieve: Command line: ./gradlew jib -PmyArg=hello build.gradle.kts task myTask

Gradle problems of adding koin test dependencies

I'm a beginner with gradle and would like to use koin in my Kotlin project. However, I get the following error Execution failed for task ':compileTestKotlin'. &

What's the difference between .kt and .kts files in Kotlin. When should we use .kts file over .kt file?

What is the purpose of using .kts files in Kotlin? Are these files included in the app bundle when releasing the app?

Gradle 6+ : compile groovy before kotlin

I'm working on a project combining groovy and kotlin. My Kotlin classes require objects from groovy part, how can i make gradle compile groovy before kotlin ?

How to create a fat JAR with Gradle Kotlin script?

As titled, I'd like to know how to modify the gradle.build.kts in order to have a task to create a unique jar with all the dependencies (kotlin lib included) in