78 questions
0
votes
1
answer
63
views
Flutter Gradle KTS: "Unresolved reference: flutterRoot" in settings.gradle.kts when adding local maven repository for pluginManagement
I've been stuck on a Gradle issue for most of the day trying to get Flutter's Deferred Components working and could really use some help.
After a long battle with the old "v1 embedding" ...
0
votes
0
answers
63
views
How to run unit tests for teamcity BuildTypes created by Teamcity Kotlin DSL
We are using Teamcity Kotlin DSL to create our buildings in TeamCity and writing some unit tests for the build types. In the build.gradle.kts , we have added the dependencies as followed:
dependencies ...
0
votes
0
answers
119
views
Type mismatch and unresolved reference errors in build.gradle.kts while building Flutter app
I am working on a Flutter application and trying to build it for Android. However, I encountered a Gradle build error related to my build.gradle.kts file. The error messages indicate type mismatches ...
1
vote
1
answer
87
views
Valid targets for @MyDslMarker annotations for Kotlin DSLs and the purpose of annotating functions and properties
Preconditions
The @DslMarker annotation can only be applied to annotation class by design. However, once our own annotation is defined (e.g., annotation class MyDslMarker), it can be applied to any ...
1
vote
1
answer
84
views
In Kotlin DSL is there a way for compiler to enforce function call ordering?
I'm looking into Kotlin DSL for a project, and I'm wondering if there is a way to weave constraints into the DSL. I'd like these to be compilation constraints if possible, I'm aware that it's possible ...
1
vote
1
answer
1k
views
How to access org.jetbrains.kotlin.gradle.dsl.JvmTarget in buildSrc folder?
In my Android/Gradle project in the buildSrc folder I like to provide a property which returns the data type org.jetbrains.kotlin.gradle.dsl.JvmTarget in the buildSrc folder. The build configuration ...
0
votes
1
answer
1k
views
Spring Security & Kotlin Dsl for HttpSecurity - Cannot permit h2-console
I am using spring boot and security with kotlin with maven. Here is my SecurityFilterChain
@Bean
fun securityFilterChainDSL(http: HttpSecurity): SecurityFilterChain {
http {
cors { disable(...
0
votes
0
answers
64
views
HTML DSL placeholder insert cannot be called with argument supplied
I am building a few Html Templates using Kotlin DSL templating: https://ktor.io/docs/html-dsl.html#templates
But, something doesn't make sense in my approach:
class LayoutTemplate() : Template<HTML&...
0
votes
1
answer
2k
views
How to set Manifest's attributes in Gradle 8.x and Kotlin DSL
Recently I created a project in Kotlin that used Kotlin DSL for the build.gradle.kts file and I used Gradle 7.4.2 but after upgrading to 8.0.2 I'm unable to set attributes for manifest. I did that to ...
0
votes
1
answer
784
views
Can't pass password from credentialsJSON to commitStatusPublisher (bitbucket server) Teamcity
It seems that i have an old version of commitStatusPublisher plugin and it can't convert credentialsJSON string to its value. In any other situation I can access password with
params.findRawParam(&...
2
votes
1
answer
3k
views
Use FlatDir in Gradle DependencyResolutionManagement
I wanted to use a local dependency (a jar file) relative to my root project directory in my main module as a buildscript classpath via dependencyResolutionManagement in settings.gradle.kts.
Here's my ...
0
votes
0
answers
768
views
Android - Conditional execution of externalNativeBuild possible?
Using Kotlin DSL, does anyone know how I can tell Gradle to only execute the instructions in my library module's externalNativeBuild block if
a) CMakeLists.txt is present? or
b) based on buildType (...
5
votes
1
answer
4k
views
Adding Kotlin plugins using plugins DSL
It looks like there are two ways of declaring some Kotlin plugins using plugins DSL: Using the id() method and the kotlin() method. For example, the android plugin can be added using either id("...
3
votes
1
answer
421
views
Does Android Jetpack Navigation Kotlin DSL support bottom navigation with multiple stack?
I am using latest Jetpack Navigation with native support of multiple stack for bottom navigation: https://medium.com/androiddevelopers/navigation-multiple-back-stacks-6c67ba41952f and it works fine. ...
1
vote
1
answer
792
views
Android Studio: adding build.gradle.kts (Kotlin DSL script) while creating new module
Recently I've migrated all my build scripts to Kotlin DSL.
When I'm adding a new module in Android Studio I've got autogenerated build script written in Groovy.
How can I update Android Studio new ...
0
votes
1
answer
586
views
In kotlin what is this syntax: "fun ClassName.funcName(): (Type ) -> Type = {fun body}"
Edited: What and how it work? This is a kotlin dsl language.
fun ClassName.funcName(): (Type ) -> Type = {func body}
um this is one of the implementation I found, and also see the concrete syntax ...
5
votes
0
answers
1k
views
WARNING: Unsupported Kotlin plugin version
The embedded-kotlin and kotlin-dsl plugins rely on features of Kotlin 1.4.31 that might work differently than in the requested version 1.5.21
How to set embedded-kotlin and kotlin-dsl to version 1.5....
2
votes
0
answers
366
views
How to call a Gradle task with arguments from another with Kotlin DSL?
I want to call default run task that needs arguments, from another task defined in build.gradle.kts. I can call run from another task but I do not know how to pass parameters.
2
votes
1
answer
3k
views
How to assign value to kotlin variable from script step of TeamCity kotlin DSL?
I have several script steps in Kotlin DSL for TeamCity.
For example here I update the parameter that was changed in previous buildTypes.
script {
scriptContent = """
...
1
vote
1
answer
571
views
Infix function in Kotlin DSL does not work without this keyword in parent context
I am writing a sample DSL to create an infra-as-code library. The basic structure would be as below:
class Employee internal constructor (private val init: Employee.() -> Unit) {
var name:...
0
votes
2
answers
455
views
Using "property" in HTML meta data with kotlin DSL
Hey how can i use html content like:
<meta property="og:locale" content="en"/>
with the Kotlin HTML Type Safe builder? I cannot find something like the property variable in ...
0
votes
1
answer
583
views
Kotlin lambdas with receivers: seeking clarification on my mental model
I'm trying to build a good mental model for lambdas with receivers in Kotlin, and how DSLs work. The simples ones are easy, but my mental model falls apart for the complex ones.
Part 1
Say we have a ...
0
votes
1
answer
2k
views
How to apply plugin from root directory in kotlin dsl
I have a plugin with the name of jacoco-report.gradle.kts in root directory of project(ProjectName/jacoco-report.gradle.kts). Now I want to add this plugin inside the plugins block of submodules.
...
6
votes
0
answers
1k
views
How do you split large kotlin based Gradle build files with variables?
I have a large gradle.build.kts file and I'm trying to break it into smaller pieces using apply(from = "xxx") (I'm open to better solutions if one exists).
The problem is that I've run into ...
0
votes
2
answers
454
views
Kotlin DSL automatically add/generate to MutableList
I've been struggling making DSL to work like this. I'd like to add items inside the lambda to the mutableList inside the persons. Can anybody help with this?
persons {
Person("name")
...