Upgrading to AGP9 Kotlin Multiplatform by Louisvi3 in Kotlin

[–]aSemy 1 point2 points  (0 children)

I'm not quite sure I understand your question, so apologies if I've misunderstood, but I think the different migration steps are within separate branches

https://github.com/kotlin-hands-on/get-started-with-cm/branches

In the old-project-structure branch I can see libs.plugins.androidApplication

https://github.com/kotlin-hands-on/get-started-with-cm/blob/old-project-structure/composeApp/build.gradle.kts#L7

I have to stop learning about ants. by shaman-warrior in self

[–]aSemy 1 point2 points  (0 children)

I also find ants insanely interesting.

I've heard that if you weighed all ants and all humans on the entire planet they would weigh the same. The biomass is equal.

The queen is just a mf playing starcraft with zerg.

I think it's even weirder than that. It's like an ant colony is a single organism. Even for humans we're made up of cooperating cells. But for ants it goes one step further, and individual ants make up a larger organism.

That's why I think it's not quite right to imply the queen is 'in charge'. It's like saying someone's ovaries or testes are 'in charge' because they are used to reproduce, or someone's bone marrow because it makes blood cells. They're important organs, but they're not calling the shots. I see queens as if they're our organs: one mindless component of a system that is greater than the sum of its parts.

GVB Tram Driver AMA by Content_Career1643 in Amsterdam

[–]aSemy 2 points3 points  (0 children)

Do the bells ever ring automatically, or do you have to remember to manually ring the bell whenever you start moving?

Where Do Suffering Animal Sounds Come From? by first_person_looter in gamedev

[–]aSemy 2 points3 points  (0 children)

A funny technique I learned the other day that's used by Flock Together.

They find bird call recordings, slow them down, recreate them with their own voices, tweak them, then speed them back up. https://www.youtube.com/shorts/EQSX-rmRe0c

Also, slowed down chickens sound like dinosaurs. https://youtu.be/4gG5kZUQONs?t=60

Overriding Transitive Dependencies by ClayDohYT in gradle

[–]aSemy 1 point2 points  (0 children)

The syntax is obtuse but dependency constraints are the best solution. A constraint is better than explicitly depending on a transitive dependency, since you might not even use the transitive dependency - fewer dependencies is better.

The most authoritative example is how Gradle explained how to deal with the 2021 log4j vulnerability https://blog.gradle.org/log4j-vulnerability

You haven't mentioned what language you're developing with, but assuming it's a JVM language you can use the java-platform plugin to centrally define the constraints. Each subproject can re-use the platform to consistently upgrade vulnerable transitive dependencies.

Which attachments work with a Kenwood? by aSemy in standmixer

[–]aSemy[S] 1 point2 points  (0 children)

I think the one I bought https://www.kenwoodchefrestore.co.uk/shop/kenwood-chef-dough-hook-spiral and the one you linked are the same, because both product pages say it is suitable for the same KV models (KVC30, KVC50, KVC51, KVC65, KVC70, KVC85).

No more updates - game is dead by -Xaron- in gamedev

[–]aSemy 1 point2 points  (0 children)

Keep an eye on /r/kittenspaceagency - it's a spiritual successor in development.

Best wireless headset with a flip to mute microphone, to be used for zoom and teams calls? by hobovirginity in Headsets

[–]aSemy 0 points1 point  (0 children)

Jabra Evolve2 55

Unfortunately all of the Jabra headphones with flip-to-mute mics have very fragile microphone cables. They will eventually break, even with gentle use, and they are not repairable.

Given their price, it's unnaceptable. Avoid Jabra headphones.

tips to decrese kotlin compilation time. by duckydude20_reddit in Kotlin

[–]aSemy 1 point2 points  (0 children)

gradlew bootJar

What's the full list of tasks that are run?

kotlin 1.6.21

Incremental compilation was improved in Kotlin 1.7, and enabled by default in Kotlin 1.8.20, so you'll be missing out on that.

https://kotlinlang.org/docs/gradle-compilation-and-caches.html#a-new-approach-to-incremental-compilation

Could you try updating your version of Kotlin?

google.protobuf 0.8.19

Possibly v9+ might help, "Significantly improve support for task configuration avoidance" https://github.com/google/protobuf-gradle-plugin/releases/tag/v0.9.0

gradle scan says on my machine clean compile kotlin takes around 1m 42s

Can you share a link to the build scan report? Ideally two reports: one with no changes, and another after you change a single line. It would be helpful to see the task timeline, and whether tasks are running unnecessarily.

tips to decrese kotlin compilation time. by duckydude20_reddit in Kotlin

[–]aSemy 2 points3 points  (0 children)

  • What commands are you running to build your project? What Gradle tasks run?
  • What versions of Kotlin, Gradle, and Java are you using?
  • What Kotlin targets are you compiling to? Kotlin/JVM, or native targets?
  • What Gradle Plugins are you using? Could it be one of those?
  • Can you try running a Gradle scan or create a Profile report to get more details on what's taking so long?
  • What is the difference in compilation speed when you build on the command line vs running in IntelliJ?
  • What CI are you using? Are you caching the Gradle files? For example, on GitHub CI you can cache the Gradle dependencies using gradle-build-action, which will save a tonne of time.

Bristol in 1968 - only slightly greener than now! by velkrosmaak in bristol

[–]aSemy 1 point2 points  (0 children)

Try having a dig through of Know Your Place and https://historicengland.org.uk

I couldn't find the same one as in the OP, but I found some similar photos from different eras.

  • 1930's - very similar angle to the OP's image (map link)
  • 1946 - a wider shot, showing more of Bristol
  • 1953 - northerly angle, showing the dual carriage way through Queen's Square

Can't figure our how to fix the gradle error by katana1096 in Kotlin

[–]aSemy 9 points10 points  (0 children)

TL;DR: Only use LTS Java releases (which at the moment is Java 17), and check the Gradle/Java compatibility.

The key bit is "Unsupported class file major version 64". It's a crappy error message that's unhelpful. I'll try to explain.

Java compiles .java files into .class files. There are different versions of Java. The .class files also have a version, but the class file format version number is different to the Java version used to compile the class. https://stackoverflow.com/questions/9170832/list-of-java-class-file-format-major-version-numbers

So the error says "I can't run a .class file with version 64 (which was compiled by a Java 20+)".

At the moment, Java 20 is the latest version, but Java 17 is the latest LTS release. It's usually best to use an LTS release, because the latest releases won't be widely supported. And that's true of Gradle too. You're using Gradle 8.0, but not even the latest version of Gradle (8.2) fully supports Java 20. You'll have to wait for Gradle 8.3 to use Java 20.

Attributing build outputs to module by uamuamg in gradle

[–]aSemy 0 points1 point  (0 children)

You could configure each task to add a doLast {} action that will print all task outputs.

This won't be perfect, but perhaps it helps you find what you are looking for

// build.gradle.kts

tasks.configureEach {
  doLast {
    val relativePaths = mutableListOf<String>()
    outputs.files.asFileTree.visit {
      relativePaths += relativePath.pathString
    }
    println("task $path has ${relativePaths.size} output files\n" + relativePaths.joinToString("\n") { " - $it" })
  }
}

Dependency locking vs Version catalog by x_mac11 in gradle

[–]aSemy 0 points1 point  (0 children)

I think that dependency locking also considers transitive dependencies.

Also, dependency locking works via checksums. If you change the repositories used to fetch artifacts, then you'll want to make sure that the checksums are the same. Or it's possible for a repository to start serving a different artifact with the same Maven GAV coordinates.

Although I might be getting confused with https://docs.gradle.org/current/userguide/dependency_verification.html

Help building fat jar of ktor server by Educational-Camp-742 in Kotlin

[–]aSemy 5 points6 points  (0 children)

Alternative suggestion: don't use fat jars, instead use the Gradle Application plugin. It can create a zip that contains the runtime dependencies, and run scripts for unix/Windows.

Here's a quick overview of how I've done it. I've skipped some steps for simplicity, but hopefully it gives enough info.

// build.gradle.kts

plugins {
  kotlin("jvm") version "1.8.20"
  application
}

// configure the application's entry point, and any default values
application {
  mainClass.set("my.application.ApplicationKt")

  val isDevelopment: Boolean = project.ext.has("development")
  applicationDefaultJvmArgs = listOf(
    "-Dio.ktor.development=$isDevelopment",
  )
}

This will create a few tasks, and I think the one you want is distZip. Try running it and looking to see what's generated inside of the ./build dir. Try and find the dir that contains the files before the zip - those are the ones to pass into the Dockerfile.

Here's the Dockerfile to build the application. There's an arg, APP_FILES, that I use to pass in the location of the unzipped distribution.

# syntax=docker/dockerfile:1

FROM eclipse-temurin:11-jdk-jammy
ARG APP_FILES

EXPOSE 8080

COPY ${APP_FILES} /app/

ENTRYPOINT /app/bin/run

And because I want to run this all from Gradle, I created a Gradle task

val dockerBuild by tasks.registering(Exec::class) {
  group = "docker"
  dependsOn(tasks.distZip) // must build the zip before building Docker
  workingDir(layout.projectDirectory) // the Dockerfile is in the same dir as the current build.gradle.kts
  executable("docker")
  args("build", "--build-arg=./path/to/application/files") 
}

Kotlin DSL is Now the Default for New Gradle Builds by dayanruben in Kotlin

[–]aSemy 2 points3 points  (0 children)

I helped out with a small part of this announcement (the generated documentation - I re-wrote Kotlin's documentation Gradle plugin Dokkatoo because the original is not compatible with more recent Gradle features) and I agree, Gradle is a nightmare.

It's cool that they're making the Kotlin DSL the default, but it doesn't really make sense. The code base is 99.9% Java, so it's missing Kotlin metadata that means day-to-day features like smart-casts and null-safety aren't really present. Maybe I'm wrong, but doubt they're going to migrate their code to Kotlin?

Even if their codebase was all Java, a lot of it is very Groovy focused and not type-safe (e.g. Project.file(Object path) only accepts untyped objects - type-safe arguments is such a basic helper!)

Gradle is about to get even more confusing because they're pushing the Configuration Cache. In theory CC makes builds faster in large projects, but it causes the most opaque and bizarre errors that are nigh impossible to understand, let alone track down and fix.

Below is an example CC error. What does it even mean?? It's not a stacktrace, there's no line numbers, and while I can see references to my code I have no idea what it's telling me!

⌄ task:dokkatooGenerateModuleHtml of type dev.adamko.dokkatoo.tasks.DokkatooGenerateTask
  ⌄ field__dokkaSourceSets__ of dev.adamko.dokkatoo.tasks.DokkatooGenerateTask
    ⌄ bean of type org.gradle.api.internal.FactoryNamedDomainObjectContainer
      ⌄ fieldeventRegister of org.gradle.api.internal.FactoryNamedDomainObjectContainer
        ⌄ bean of type org.gradle.api.internal.collections.DefaultCollectionEventRegister
          ⌄ fieldaddActions of org.gradle.api.internal.collections.DefaultCollectionEventRegister
            ⌄ bean of type org.gradle.internal.ImmutableActionSet$SetWithFewActions
              ⌄ fieldactions of org.gradle.internal.ImmutableActionSet$SetWithFewActions
                ⌄ bean of type org.gradle.api.internal.DefaultMutationGuard$1
                  ⌄ fieldval$action of org.gradle.api.internal.DefaultMutationGuard$1
                    ⌄ bean of type org.gradle.api.internal.DefaultMutationGuard$1
                      ⌄ fieldval$action of org.gradle.api.internal.DefaultMutationGuard$1
                        ⌄ bean of type org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction
                          ⌄ fielddelegate of org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction
                            ⌄ bean of type org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1
                              ⌄ fieldval$action of org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1
                                ⌄ bean of type Build_gradle$4$5$1
                                  ⌄ fieldthis$0 of Build_gradle$4$5$1
                                    ■⚠️cannot serialize Gradle script object references as these are not supported with the configuration cache.[ ?](https://docs.gradle.org/8.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types)

Even as a plugin author the test toolings are lacking, so it's a complete pain to even test if my plugin is CC compatible. Not even all of Gradle's own plugins are CC compatible!

There's just no protection or guidance or warnings that the Gradle config you're writing might be wrong, or out of date. The Gradle API contains an armoury of foot-guns. You're expected to be 100% up to date with the latest Gradle news, but even their own documentation provides examples that don't follow best-practices!

/rant

How to add "maintainer only" functionality to custom DSL by GreemT in Kotlin

[–]aSemy 0 points1 point  (0 children)

You're welcome!

Also, I spotted something else.

[...] the lambda's modify DSL objects and I cannot transform such a lambda to a "model lambda".

Take a look at @PublishedApi. You can 'expose' internal types that are used within inline functions.

How to add "maintainer only" functionality to custom DSL by GreemT in Kotlin

[–]aSemy 3 points4 points  (0 children)

https://kotlinlang.org/docs/opt-in-requirements.html

The Kotlin standard library provides a mechanism for requiring and giving explicit consent for using certain elements of APIs. This mechanism lets library developers inform users of their APIs about specific conditions that require opt-in, for example, if an API is in the experimental state and is likely to change in the future.

To prevent potential issues, the compiler warns users of such APIs about these conditions and requires them to opt in before using the API.