andylamax
11/22/2020, 8:43 PMcreate
and register
in this sytax?
create<MavenPublication>("main") {
// . . .
}
// and
register<MavenPublication>("main") {
// . . .
}
andylamax
11/22/2020, 8:48 PMplugins { kotlin("js") }
val sourcesJarTaskProvider = tasks.register("sourcesJar", Jar::class.java) {
archiveClassifier.set("sources")
val kotlin = extensions.findByType<KotlinJsProjectExtension>() ?: return@register
from(kotlin.sourceSets["main"].kotlin.srcDirs)
}
create<MavenPublication>("main") {
from(components["kotlin"])
artifact(sourcesJarTaskProvider.get())
}
Results in the following gradle error
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':publishMainPublicationToMavenLocal'.
> Cannot query the value of this property because it has no value available.
The error isn't descriptive as much, but it has to do with publishing. What am I doing wrong? All I need is to publish a pure js klib to maven centralSourabh Rawat
11/24/2020, 5:19 PMobject.property()
. Which package do I need to include?
val greeting: Property<String> = objects.property()
Sourabh Rawat
11/24/2020, 5:20 PMConorG
11/25/2020, 7:43 AMbuildSrc
folder set up, with some kotlin Tasks.
But is it possible to put this into a script like bundle.gradle.kts
and use it alongside my Groovy scripts with apply from: file(…)
?Benjamin AIMONE
11/25/2020, 9:39 AMEugen Martynov
11/25/2020, 3:17 PMandylamax
11/26/2020, 9:15 PMio.codearte.nexus-staging
is so flaky. i get timeouts which hinders Continuous Delivery a lotnanodeath
11/27/2020, 4:12 PMdependencies {
implementation(kotlin("stdlib"))
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
}
}
rocketraman
11/30/2020, 7:02 PM[... some compiler warnings (no errors)...]
The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=c8792bd7-5af3-4c02-bf85-cfcc33bfdd87, currentDir=/Users/raman/source/foo/iosApp/Pods}
Attempting to read last messages from the daemon log...
Daemon pid: 6471
log file: /Users/raman/.gradle/daemon/6.7.1/daemon-6471.out.log
----- Last 20 lines from daemon log file - daemon-6471.out.log -----
[...same warnings as above, no other useful errors]
----- End of the daemon log -----
Hai Tran
12/01/2020, 9:32 AMplugins {
id("kotlin-platform-jvm")
id("kotlin")
application
}
group = "xxx"
version = "1.0-SNAPSHOT"
repositories {
jcenter()
}
dependencies {
implementation(project(":shared", "default"))
//…
}
application {
mainClass.set("ServerKt")
}
build.gradle.kts(shared)
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
id("com.android.library")
id("kotlin-android-extensions")
}
group = "xxx"
version = "1.0-SNAPSHOT"
repositories {
gradlePluginPortal()
google()
jcenter()
mavenCentral()
maven(url = "<https://kotlin.bintray.com/kotlinx/>")
}
kotlin {
android()
ios {
binaries {
framework {
baseName = "shared"
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
//Serialization
implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1")
//Coroutine
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
//Time
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val androidMain by getting {
dependencies {
implementation("com.google.android.material:material:1.2.0")
}
}
val androidTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.12")
}
}
val iosMain by getting
val iosTest by getting
}
}
android {
compileSdkVersion(29)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(24)
targetSdkVersion(29)
versionCode = 1
versionName = "1.0"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
}
val packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
val framework = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByName("build").dependsOn(packForXcode)
Chilli
12/02/2020, 9:15 PMDeprecated Gradle features
thing, and IntelliJ idea shows me a lot of warnings despite it technically compiles. Is there any way to fix all of this?kartikpatodi
12/03/2020, 6:00 AMkartikpatodi
12/03/2020, 6:06 AMKuba Petržílka
12/03/2020, 1:49 PMval myTask by tasks.getting
vs
val myTask = tasks.getByName("myTask")
or
val myProp: String by project
vs
val myProp = project.property("myProp")
Marc Knaup
12/03/2020, 4:26 PMbuild
. But when I publish
I get “Unresolved references” for subproject dependencies.
Anyone else having that and knows a workaround?Kuba Petržílka
12/04/2020, 10:31 PMDependencies were resolved during project configuration
Dependency resolution during project configuration may reduce build speed by resolving dependencies unnecessarily.
:frontend-war:additionalJsLibs
even though I turned the task configuration to configuration avoidance api:
tasks {
...
named("war", War::class) {
additionalJsLibs.files.forEach { from(zipTree(it)) { into("script") } }
}
...
}
The problem is obviously the iteration over the additionalJsLibs
but what is the right way to avoid that being done in the configuration phase?birdsofparadise
12/06/2020, 10:26 PMplugins {
id("com.android.application") version "4.0.1" //works
kotlin("android") version "$kotlin_version" //doesn't work, I've tried everything
}
birdsofparadise
12/06/2020, 10:54 PMSystem.getProperty
like:
gradle.properties
systemProp.kotlin_version=1.4.20
build.gradle.kts
plugins {
id("com.android.application") version "4.0.1"
kotlin("android") version System.getProperty("kotlin_version")
}
Javier
12/07/2020, 12:23 AMTask `:apps:desktop:allTests` of type `org.jetbrains.kotlin.gradle.testing.internal.KotlinTestReport`: cannot deserialize object of type 'org.gradle.api.Project' as these are not supported with the configuration cache.
Javier
12/07/2020, 8:13 PMmoduleA
and moduleB
I have a normal configuration for maven-publish
that works to publish my project to MavenCentral
but that was working when I had only one module. After adding the moduleB
to my project which depends on moduleA
, I can't build my project. This is the stack trace I get: https://pastebin.com/9cR34djMtim
12/08/2020, 2:53 PM~/.gradle
and project/.gradle
folders but the issue seems to persist. Its getting stuck during some kapt dependent tasks which get called from gradle :core:classes
Anyone else experiencing similar?tateisu
12/09/2020, 6:16 AMtasks.withType(AbstractCompile)*.options*.encoding = tasks.withType(GroovyCompile)*.groovyOptions*.encoding = 'UTF-8'
to Kotlin ?Christopher Elías
12/10/2020, 12:50 PMwakingrufus
12/10/2020, 6:24 PMJakub Gwóźdź
12/11/2020, 1:19 PM@Override
public Property<Duration> getTimeout() {
return super.getTimeout();
}
neat, right? But to set it, I need to construct Duration object:
timeout.set(java.time.Duration.ofSeconds(10))
legit, right?
Unfortunately, because gradle exposes the top level property named `java`(plugin extension). I simply cannot create such Duration object (Unresolved reference: time
)
What is the best-practice here, how to work around it?Saul Wiggin
12/13/2020, 11:14 AMExecution failed for task ':app:checkDebugDuplicateClasses'.
Davide Giuseppe Farella
12/15/2020, 6:57 AMGradle [6.7.1-all] -> [6.8-rc-1-all]
( Kotlin multiplatform )
A problem occurred configuring project ‘:database’.
> Configuration with name ‘testApi’ not found.
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ‘:database’.
at …Any clue?
jean
12/15/2020, 1:26 PMpublications {
create<MavenPublication>("maven") {
groupId = "org.my.company"
artifactId = "our-project"
version = "0.1"
}
}
repositories {
maven {
url = uri("<https://org.my.company/api/v4/projects/1/packages/maven>")
name = "GitLab"
credentials(HttpHeaderCredentials::class) {
name = extra["gitlab.name"].toString()
value = extra["gitlab.token"].toString()
}
authentication {
register("header", HttpHeaderAuthentication::class.java)
}
}
}
But that’s what being uploaded <https://org.my.company/api/v4/projects/1/packages/maven/org/mycompany/OurProject-jvm/0.1/OurProject-jvm-0.1.jar>
, where OurProject
comes from settings.gradle.kts
rootProject.name = "TeliaTrackingMixpanel"
How can I force it to be org.my.company:our-project:01
?jean
12/15/2020, 1:26 PMpublications {
create<MavenPublication>("maven") {
groupId = "org.my.company"
artifactId = "our-project"
version = "0.1"
}
}
repositories {
maven {
url = uri("<https://org.my.company/api/v4/projects/1/packages/maven>")
name = "GitLab"
credentials(HttpHeaderCredentials::class) {
name = extra["gitlab.name"].toString()
value = extra["gitlab.token"].toString()
}
authentication {
register("header", HttpHeaderAuthentication::class.java)
}
}
}
But that’s what being uploaded <https://org.my.company/api/v4/projects/1/packages/maven/org/mycompany/OurProject-jvm/0.1/OurProject-jvm-0.1.jar>
, where OurProject
comes from settings.gradle.kts
rootProject.name = "TeliaTrackingMixpanel"
How can I force it to be org.my.company:our-project:01
?mazorius
12/15/2020, 1:42 PMsettings.gradle,kts
rootProject.name = "our-project"
gradle.allprojects {
group = "<http://org.company.my|org.company.my>"
version = "0.1"
}
jean
12/15/2020, 1:46 PMgroup = "<http://org.company.my|org.company.my>"
version = "0.1
In the build.gradle.kts but it does not seem to change anythingmazorius
12/15/2020, 1:48 PMfrom("java")
jean
12/16/2020, 11:41 AMfrom(component["kotlin"])
but it did not change anythingmazorius
12/16/2020, 12:05 PM-jvm
?jvm
is defined inside classifier
.
Maybe you can set classifier = ""
?afterEvaluation
… maybe you can try afterEvaluate
which is not really a good workaround but helps you for nowjean
12/16/2020, 1:45 PMTeliaTrackingMixpanel
from rootProject.name = "TeliaTrackingMixpanel"
. It is not overwritten by artifactId = "our-project"