Tucker Barbour
10/20/2020, 10:25 AMTucker Barbour
10/20/2020, 1:30 PMshadowJar
task using the gradle kotlin dsl. So far I’ve had no success after reading through the shadow and maven-publish documentation. Has anyone solved this issue?bitkid
10/20/2020, 5:06 PMwakingrufus
10/23/2020, 10:12 PMfun PluginDependenciesSpecScope.libraryPlugins(){
id("java-library")
id("io.freefair.lombok")
}
which could then be called in a project like
plugins {
libraryPlugins()
}
or better yet, an extension method that could be invoked at the root in the project script that could add plugins and dependencies all at once? For some reason, I just get unresolved references, even though my IDE thinks it is finekenkyee
10/25/2020, 11:47 PMnikunjsakhrelia
10/27/2020, 10:26 AMversionCode = majorVersion * 10000 + minorVersion * 100 + patchVersion
in build.gradle.ktsGabriel
10/29/2020, 9:14 AMExpression 'android' cannot be invoked as a function. The function 'invoke()' is not found
a brief view of my gradle file is this:
plugins {
id("com.android.application")
kotlin("android")
}
android {
compileSdkVersion(TARGET_SDK_VERSION)
defaultConfig {
minSdkVersion(MIN_SDK_VERSION)
targetSdkVersion(TARGET_SDK_VERSION)
testInstrumentationRunner("androidx.test.runner.AndroidJUnitRunner")
consumerProguardFiles("<http://consumer-rules.pro|consumer-rules.pro>")
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"<http://proguard-rules.pro|proguard-rules.pro>"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = COMPOSE_VERSION
kotlinCompilerVersion = KOTLIN_VERSION
}
}
Roman Konstantynovskyi
10/29/2020, 1:54 PMA -> S1 -> S2 -> L
In my starter (S1) I can use all classes from the library (L). But if I add my starter (S1) as a dependency to my application (A) then I can't use classes from the library and from the second starter (S2), because they aren't in compileClasspath
.
In my starter (S1) I'm adding second starter as implementation
. And also I use this configuration for adding my starter to application.
I've read that to expose dependency I should use ``java-library`` plugin for gradle and use api
configuration in my starter (S1), but this didn't help me 😞
And if I add S2 to my S1 using deprecated compile
configuration all works well. 🤔
build.gradle.kts (starter S1)
plugins {
// other plugins
`java-library`
}
dependencies {
// other dependencies
api("some:starter:1.0.0") // starter S2
}
build.gradle.kts (application A)
dependencies {
// other dependencies
implementation("own:starter:1.0.0") // starter S1
}
eekboom
10/29/2020, 4:31 PMgradle.ext.token = "foo"
This is in settings.gradle, so rootProject is not available. (I think?!)
In Kotlin "gradle" is also available in settings.xml, but it seems it does not implement "ExtensionAware", so the "extra" properties do not seem to work here.
val token: String by gradle.extra("foo")
=> Unresolved reference (on "extra")PHondogo
10/29/2020, 8:49 PMkenkyee
10/31/2020, 10:20 PMtasks.withType(KotlinCompile::class.java).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
But there's no KaptCompile?bodo
11/02/2020, 9:57 AMclass MyPlugin : Plugin<Project> {
fun apply(project: Project) {
project.addImport("import com.foo.Foo") // i need the command for this
}
}
so when i use it build.gradle i can directly access it
import com.foo.Foo // i want to get rid of this import
plugins {
id("MyPlugin")
}
dependencies {
// use Foo here directly without the need to add the import on top of every build.gradle.kts file when adding the "MyPlugin" plugin
}
bodo
11/03/2020, 3:13 PMMitchell Syer
11/06/2020, 4:00 AMandylamax
11/06/2020, 9:39 AMbuild.gradle.script
?christophsturm
11/06/2020, 4:12 PMpackage r2dbcfun
object ProjectConfig {
const val eap = false
val kotlinVersion = if (eap) "1.4.20-RC" else "1.4.10"
}
in my normal build file i have an import for it:
import r2dbcfun.ProjectConfig
still in the plugins block i have to specify the whole package:
kotlin("jvm").version(r2dbcfun.ProjectConfig.kotlinVersion)
probably because the plugins block is treated separately from the build file.
idea shows the package as grayed out and wants to remove it, which results in an invalid build fileHossain
11/07/2020, 12:11 AMandylamax
11/07/2020, 12:48 AMGabriel
11/07/2020, 9:39 PM"Cannot access 'java.lang.Comparable' which is a supertype of 'org.gradle.kotlin.dsl.KotlinBuildScript'. Check your module classpath for missing or conflicting dependencies"
fmd
11/09/2020, 4:01 PMkotlin
plugin automatically add dependencies to the Kotlin standard library when adding the plugin to a Java project? I just had the case, where our Android build's custom linter rules module leaked the standard library (as public module dependency), since the kotlin-stdlib
dependency implicitly came from "somewhere". Explicitly stating the standard library as compileOnly
dependency, configured Gradle to filter it away from the API/metadata configurations, and stopped leaking it.Joao Birk
11/10/2020, 6:28 PMbuild.gradle
using plugin id 'com.android.dynamic-feature'
and `plugin id `kotlin-android``Im able to set : buildFeatures.dataBinding = true
converting it to Kotlin DSL build.gradle.kts
and using buildFeatures.dataBinding = true
says dataBinding
is non existent, I only see viewBinding
: https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/BuildFeatures
Does that mean I still need to use the deprecated way (dataBinding.isEnabled = true
) on DSL? WARNING: DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'.
basher
11/11/2020, 12:23 AMnapperley
11/15/2020, 11:51 PMNaoki Hidaka
11/19/2020, 8:17 AMBrady Aiello
11/19/2020, 7:03 PMtieskedh
11/19/2020, 8:45 PMclass PropsToObjectPlugin : Plugin<Project> {
override fun apply(target: Project) {
val extension: PropsToObjectExtension = target
.extensions
.create("propsToObject")
val buildDir = target.file(
"${target.buildDir}/generated/source/props"
)
val taskProvider = target.tasks
.register<PropertyObjectGeneratingTask>(
"generatePropertyObject"
) {
fileName = target.file(extension.propFileName)
this.genDir = buildDir
}
target.tasks.withType<KotlinCompile> {
//<https://youtrack.jetbrains.com/issue/KT-42241>
val srcTask = this as SourceTask
srcTask.dependsOn(taskProvider)
val srcSet = target
.objects
.sourceDirectorySet("nl.devhaan.props", "generatedPropertyObject")
.srcDir(buildDir)
srcTask.source(srcSet)
}
}
}
almibe
11/20/2020, 3:26 AMgradle init
start creating a lib
subdirectory to put src
in when you create a library instead of just putting src
in the current project directory? Did they just start doing that in 6.7? That seems really obnoxious to me. Is there a reason for this?Pacane
11/20/2020, 4:00 PMgradle-kotlin-dsl-extensions-6.7.jar
to a plugin project? I'm trying to access some extension functions in there like
fun DependencyHandler.`implementation`(dependencyNotation: Any): Dependency? =
add("implementation", dependencyNotation)
bjonnh
11/20/2020, 8:18 PMMohamed Daif
11/21/2020, 2:30 PMMohamed Daif
11/21/2020, 2:30 PMVampire
11/21/2020, 4:37 PMMohamed Daif
11/22/2020, 6:00 PMimport flashcards.Main;
instead of
import flashcards.MainKt;
every time after submit must be edit it again