sdeleuze
05/25/2018, 10:46 AMval shadowJar by tasks.getting(ShadowJar::class) { ... }
to exclude files with the shadow plugin instead of using shadow { ... }
which provides a useless ShadowExtension
lambda? Is the shadow plugin badly designed ? I see this kind of issue in various plugins so I would like to know what is the rationale behind this and understand that kind of issue and at what level this should be fixed ...mkobit
05/25/2018, 4:11 PMLex Luthra
05/28/2018, 1:38 AM// Groovy DSL
task buildDocker(type: Docker) {
baseImage = 'develar/java:latest'
push = project.hasProperty('push')
tag = 'geowarin/sout-chuck-norris'
addFile {
from jar
rename {'app.jar'}
}
entryPoint(['java', '-Djava.security.egd=file:/dev/./urandom', '-jar', '/app.jar'])
exposePort(8080)
}
buildDocker.dependsOn(build)
// Kotlin DSL
import se.transmode.gradle.plugins.docker.DockerTask
buildscript {
dependencies {
classpath("se.transmode.gradle:gradle-docker:1.2")
}
repositories {
jcenter()
}
}
tasks {
"buildDocker"(DockerTask::class) {
val appJarName = "app.jar"
dependsOn(tasks["build"])
baseImage = "develar/java:latest"
push = project.hasProperty("push")
tag = "geowarin/sout-chuck-norris"
addFile(closureOf<CopySpec> {
from(tasks["jar"] as CopySpec)
rename { appJarName }
})
entryPoint(mutableListOf("java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/$appJarName"))
exposePort(if (project.hasProperty("server.port")) project.property("server.port") as Int else 8080)
}
}
However, when I run the buildDocker task I receive the following error on the console:
What went wrong: Execution failed for task ':buildDocker'. se.transmode.gradle.plugins.docker.DockerTask$_createTarArchive_closure3_closure11_closure12 cannot be cast to org.gradle.api.file.CopySpec
I have worked around it by copying the file using doFirst and then invoking the form of addFile that accepts a path String instead of a Closure but would like to get to the bottom of this issue as it might help others in the future.jlleitschuh
05/31/2018, 12:43 PM"5.+
which means "the highest version of 5.xxxx
that can be found.sdeleuze
05/31/2018, 2:39 PMeskatos
05/31/2018, 2:58 PMAction<T>
predates the Kotlin DSL and I believe was already the recommended way.
But yes, gradle guides will be updated with best practices that work for both DSLs.mkobit
05/31/2018, 3:02 PMjava-gradle-plugin
did some validation for those kinds of APIs as wellsvenjacobs
06/01/2018, 7:24 AMEd M
06/02/2018, 4:39 PMEd M
06/04/2018, 3:47 AMxeno.setSourceSets(project.sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME))
gildor
06/05/2018, 6:34 AMEd M
06/05/2018, 8:12 PMjava-library
in backticks?fred.deschenes
06/05/2018, 8:15 PMapplication
) on the root project?james_bassett
06/06/2018, 12:37 AMIDLE
forever. --debug
just shows the daemon collecting memory stats periodically.Florian Wiesner
06/06/2018, 8:36 AMCzar
06/06/2018, 9:56 PMapplication
plugin instead of configuring manifest manuallyfitzoh
06/07/2018, 10:52 AMvalerie.turlington
06/07/2018, 2:16 PMCzar
06/07/2018, 7:03 PMobject libs {
const val kotlinVersion = "1.2.41"
}
then you can use it in plugins:
import libs
import org.gradle.kotlin.dsl.*
plugins {
kotlin("jvm") version libs.kotlinVersion
}
ianbrandt
06/09/2018, 8:20 AMwrapper
task from the Kotlin DSL than this example (https://github.com/gradle/kotlin-dsl/issues/438#issuecomment-318749893)?:
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType
task<Wrapper>("wrapper") {
gradleVersion = "4.8"
distributionType = DistributionType.ALL
}
It works, but results in a deprecation warning:
$ ./gradlew build --warning-mode=all
> Configure project :
Creating a custom task named 'wrapper' has been deprecated and is scheduled to be removed in Gradle 5.0. You can configure the existing task using the 'wrapper { }' syntax or create your custom task under a different name.'.
sdeleuze
06/13/2018, 10:36 AMinline fun <reified T : Task> task(noinline configuration: T.() -> Unit) = tasks.creating(T::class, configuration)
by default ? (from https://github.com/gradle/kotlin-dsl/blob/master/build.gradle.kts#L149 and found in various projects since it is super useful)ilya.gorbunov
06/15/2018, 12:24 AMkotlinOptions.freeCompilerArgs += ["-Xprogressive"]
dsvoronin
06/15/2018, 3:30 PMbuildSrc/build.gradle.kts
contains plugins { kotlin-dsl}
and
root build.gradle.kts overrides kotlin plugin version with
buildscript {
val kotlinVersion: String by project
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}
getting this warning on kotlin compilation tasks
Compilation with Kotlin compile daemon was not successful
java.lang.NoSuchMethodError: org.jetbrains.kotlin.daemon.common.IncrementalCompilationOptions.<init>(ZLjava/util/List;Ljava/util/List;Ljava/io/File;Ljava/lang/String;ILorg/jetbrains/kotlin/daemon/common/CompilerMode;Lorg/jetbrains/kotlin/daemon/common/CompileService$TargetPlatform;[Ljava/lang/Integer;I[Ljava/lang/Integer;ZLjava/util/List;Lorg/jetbrains/kotlin/daemon/common/MultiModuleICSettings;Lorg/jetbrains/kotlin/daemon/common/IncrementalModuleInfo;)V
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.incrementalCompilationWithDaemon(GradleKotlinCompilerRunner.kt:264)
bissell
06/17/2018, 8:56 PMfreeCompilerArgs
somewhere? kotlinc -help
doesn't mention '-Xprogressive' for examplebissell
06/17/2018, 9:19 PMKotlinCompile
and Kotlin2JsCompile
separately helped. I still can't figure out how to get them to take a common config though, if anyone with good Gradle-fu could take a look it would be much appreciated 🙂 :bissell
06/17/2018, 9:30 PMKotlinCommonCompile
target broken? Whenever I try to use it in my build script in the same spot as KotlinCompile
and Kotlin2JsCompile
I get:
> Could not get unknown property 'org' for project ':common' of type org.gradle.api.Project.
ilya.gorbunov
06/17/2018, 10:03 PMsdeleuze
06/19/2018, 11:34 AMxenoterracide
06/19/2018, 1:07 PMnapperley
06/20/2018, 3:00 AM