is there any way to tell if a debug build is being...
# kotlin-native
s
is there any way to tell if a debug build is being built or not
o
you could use different source sets in debug and release builds and set anything you want to different values
s
how do i set different arguments for different build tasks
eg, runReleaseExecutableLinux and runDebugExecutableLinux
in
Copy code
linuxX64("linux") {
        binaries {
            executable {
                // Change to specify fully qualified name of your application's entry point:
               entryPoint = 'sample.main'
                // Specify command-line arguments, if necessary:
                runTask?.args('-t')
            }
        }
    }
i
Actually in this example the
executable
call is just a shortcut creating both debug and release executables and configuring them in the same way. But you can create and configure them separately:
Copy code
linuxX64("linux") {
    binaries {
        executable(listOf(DEBUG)) { /* Debug configuration */ }
        executable(listOf(RELEASE)) { /* Release configuration */ }
    }
}
You also can access already created binary and perform additional configurations. The example below uses the
apply
function from the Kotlin DSL but the
getExecutable
is available for Groovy DSL too.
Copy code
linuxX64("linux") {
    binaries {
        getExecutable("DEBUG").apply { /* Additional configurations. */}
    }
}
This example shows how to configure a project with different sources for debug and release build: https://github.com/ilmat192/kotlin-native-gradle-samples/tree/master/debug-logger.
s
ok
so the
getExecutable
will only work if it has actually been built before?
Could not find method listOf() for arguments [DEBUG] on object of type org.jetbrains.kotlin.gradle.dsl.KotlinNativeBinaryContainer.
Copy code
linuxX64("linux") {
        binaries {
            executable(listOf(DEBUG)) {
                entryPoint = 'sample.main'
                runTask?.args('-d -t')
            }
            executable(listOf(RELEASE)) {
                entryPoint = 'sample.main'
                runTask?.args('-t')
            }
        }
    }
Could not find method getExecutable() for arguments [DEBUG, build_3tkhp1jquerlv3sf50lphd823$_run_closure2$_closure3$_closure5$_closure6@e79c3af] on object of type org.jetbrains.kotlin.gradle.dsl.KotlinNativeBinaryContainer.
getExecutable(DEBUG) {
i
Sorry, I used Kotlin DSL here. Use the following snipped for Groovy DSL:
Copy code
linuxX64("linux") {
    binaries {
        executable([DEBUG]) { /* Debug configuration */ }
        executable([RELEASE]) { /* Release configuration */ }
    }
}
s
ok
177 Views