Git Product home page Git Product logo

modern-gradle-template's Introduction

Hi there ๐Ÿ‘‹

This is CXwudi. A Mikufan with some serious coding skills.

Projects

I maintained several personal projects:

  • VocaDB Video Downloader: A set of CLI apps for archiving Vocaloid PVs from various sources, based on VocaDB API and youtube-dl.
  • YouCal: A CLI app for exporting YouTrack issues with dates into one iCalendar file, importable by both Gmail and Outlook.
  • Song Finder VocaDB: A semi-automated GUI app for batch song searches on VocaDB. It's a toy project for experimenting Compose Multiplatform.
  • hoshizora.sql (Originating from VocaDB's archived repo): A dockerized CLI program for loading a VocaDB dump into MariaDB, ideal for frequent and large offline queries, avoiding flooding the official VocaDB API.

I've maintained several libraries, available through JitPack:

  • Kotlin/JVM Inline Logging: A custom SLF4J wrapper for Kotlin, optimized at the bytecode using Kotlin's inline class.
    • To use: implementation("com.github.CXwudi:kotlin-jvm-inline-logging:<version>")
  • Kotlin/JVM Idiomatic Exec: An idiomatic Kotlin DSL for Java's Process API.
    • To use: implementation("com.github.CXwudi:kotlin-jvm-idiomatic-exec:<version>")
  • VocaDB OpenAPI Client Java: A Java Client for the VocaDB API, automatically generated and refined.
    • To use: implementation("com.github.VocaDB:vocadb-openapi-client-java:<version>")

Also some other highlights:

modern-gradle-template's People

Contributors

cxwudi avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

modern-gradle-template's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: renovate.json
Error type: Invalid JSON (parsing failed)
Message: Syntax error: expecting end of expression or separator near } "pack

Some refactor

  1. move kotest-spring-extension to kotest-jvm, done by doing a check. So spring-boot-kotlin-mixin would not deal with kotest
  2. merge spring-boot-mockk-mixin into spring-boot-kotlin-mixin, and create a new extension for choosing mockk vs mockito, default to mockk

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

docker-compose
docker/docker-compose.gradle-test.yml
github-actions
.github/workflows/gradle.yml
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/gradle-build-action v2
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/gradle-build-action v2
gradle
gradle.properties
settings.gradle.kts
build.gradle.kts
gradle/libs.versions.toml
  • org.springframework.boot:spring-boot-dependencies 3.3.0
  • io.kotest:kotest-bom 5.9.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-bom 1.8.1
  • org.jetbrains.kotlin:kotlin-gradle-plugin 2.0.0
  • org.jetbrains.kotlin:kotlin-allopen 2.0.0
  • io.freefair.lombok:io.freefair.lombok.gradle.plugin 8.6
  • org.springframework.boot:spring-boot-gradle-plugin 3.3.0
  • com.gradle.enterprise:com.gradle.enterprise.gradle.plugin 3.17.4
  • org.gradle.toolchains:foojay-resolver 0.8.0
  • com.github.CXwudi:kotlin-jvm-inline-logging 1.0.1
  • io.kotest.extensions:kotest-extensions-spring 1.1.3
  • org.mockito.kotlin:mockito-kotlin 5.3.1
  • io.mockk:mockk 1.13.11
  • com.ninja-squad:springmockk 4.0.2
  • org.graalvm.buildtools.native 0.10.2
  • org.jetbrains.kotlin.jvm 2.0.0
  • com.github.ben-manes.versions 0.51.0
  • nl.littlerobots.version-catalog-update 0.8.4
gradle/platform/settings.gradle.kts
gradle/platform/dev-version-constraints/build.gradle.kts
gradle/plugins/settings.gradle.kts
gradle/plugins/convention/java-app/build.gradle.kts
gradle/plugins/convention/java-app/src/main/kotlin/my.java-app.gradle.kts
gradle/plugins/convention/java-lib/build.gradle.kts
gradle/plugins/convention/java-lib/src/main/kotlin/my.java-lib.gradle.kts
gradle/plugins/convention/kotlin-app/build.gradle.kts
gradle/plugins/convention/kotlin-app/src/main/kotlin/my.kotlin-jvm-app.gradle.kts
gradle/plugins/convention/kotlin-lib/build.gradle.kts
gradle/plugins/convention/kotlin-lib/src/main/kotlin/my.kotlin-jvm-lib.gradle.kts
gradle/plugins/convention/kotlin-spring-app/build.gradle.kts
gradle/plugins/convention/kotlin-spring-app/src/main/kotlin/my.kotlin-spring-app.gradle.kts
gradle/plugins/convention/kotlin-spring-lib/build.gradle.kts
gradle/plugins/convention/kotlin-spring-lib/src/main/kotlin/my.kotlin-spring-lib.gradle.kts
gradle/plugins/convention/spring-app/build.gradle.kts
gradle/plugins/convention/spring-app/src/main/kotlin/my.spring-app.gradle.kts
gradle/plugins/convention/spring-lib/build.gradle.kts
gradle/plugins/convention/spring-lib/src/main/kotlin/my.spring-lib.gradle.kts
gradle/plugins/mixin/app/build.gradle.kts
gradle/plugins/mixin/app/src/main/kotlin/my/mixin/app.gradle.kts
gradle/plugins/mixin/junit5/build.gradle.kts
gradle/plugins/mixin/junit5/src/main/kotlin/my/mixin/junit5.gradle.kts
gradle/plugins/mixin/kotest-jvm/build.gradle.kts
gradle/plugins/mixin/kotest-jvm/src/main/kotlin/my/mixin/kotest-jvm.gradle.kts
gradle/plugins/mixin/kotlin-jvm/build.gradle.kts
gradle/plugins/mixin/kotlin-jvm/src/main/kotlin/my/mixin/kotlin-jvm.gradle.kts
gradle/plugins/mixin/lib/build.gradle.kts
gradle/plugins/mixin/lib/src/main/kotlin/my/mixin/lib.gradle.kts
gradle/plugins/mixin/lombok/build.gradle.kts
gradle/plugins/mixin/lombok/src/main/kotlin/my/mixin/lombok.gradle.kts
gradle/plugins/mixin/spring-boot-app/build.gradle.kts
gradle/plugins/mixin/spring-boot-app/src/main/kotlin/my/mixin/spring-boot-app.gradle.kts
gradle/plugins/mixin/spring-boot-common/build.gradle.kts
gradle/plugins/mixin/spring-boot-common/src/main/kotlin/my/mixin/spring-boot-common.gradle.kts
gradle/plugins/mixin/spring-boot-kotlin/build.gradle.kts
gradle/plugins/mixin/spring-boot-kotlin/src/main/kotlin/my/mixin/spring-boot-kotlin.gradle.kts
gradle/plugins/root/build.gradle.kts
gradle/plugins/root/src/main/kotlin/my/root/jvm.gradle.kts
gradle/settings/settings.gradle.kts
gradle/settings/root-settings-plugins/build.gradle.kts
gradle/settings/root-settings-plugins/src/main/kotlin/my.root-settings-plugins.settings.gradle.kts
sample-java-lib/build.gradle.kts
sample-kotlin-app/build.gradle.kts
sample-kotlin-spring-app/build.gradle.kts
sample-kotlin-spring-lib/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.7

  • Check this box to trigger a request for Renovate to run again on this repository

Platform first or version catalog first for centralized version management

Currently, our centralized version management is done by Gradle platform, inspired from this video. And it also uses version catalog like shown in Gradle doc (we do that mainly just for learning purposes)

This makes adding/removing new dependencies very tedious as it requires modifying 3 places, the catelog, the platform, and finally the build script that uses the dep. It is fine for a precompiled script plugin (due to limitation in gradle/gradle#15383, but I don't like that hack). But for normal main build script, it is very annoying.

By switching version catalog first approach, only the dep-version-constarint platform will be preserved and used by the precompile script plugins, other platforms will be deleted and all gradle/plugins & gradle/settings will use version catalog.

Another choice is just delete version catalog and use platforms only

We now needs `gradle/plugins-plugins`...

We simply just want to apply the version catalog updater plugin into the root build.gradle.kts file in gradle/plugins which itself is a Gradle project defined all our convention plugins

Refactor precompiled script plugins folder structure in `/gradle/plugins`

The current way of structuring is not quite good, because everything is done in 'inheritence', instead of gradle's recommended 'composition'.

E.g. The my-kotlin-jvm-base plugin is the example where it needs to exclude lombok plugin that was added in my-java-base.

What we should do instead is to create something like my-lombok-trait plugin that simply just add the Lombok. Then my-java-app and my-java-lib should add this plugin, but not the my-kotlin-* plugins

Namespace refactoring

So far our precompiled script plugins in gradle/plugins are all stored in root of src/main/kotlin, and everyone has the name like my.xxx-mixin/conversion/root

As we grow and develop more stuff, it is hard to manage them in the root directory.

To be consisted with the gradle/plugins directory structure, we will move these plugins into src/main/kotlin/my/<type> directory. for example:

  1. src/main/kotlin/my.jvm-root.gradle.build.kts -> src/main/kotlin/my/root/jvm.gradle.build.kts
  2. src/main/kotlin/my.spring-boot-mxin.gradle.build.kts -> src/main/kotlin/my/mixin/spring-boot.gradle.build.kts

and etc.

About achieving maximum parallelism in plugins builds

#1 was the success attempt to refactor convention plugins from inheritance way of thinking to composite way of thinking

A further improvement is to achieve maximum parallelism where each convention plugin is one submodule in gradles/plugins,
(make sure org.gradle.parallel=true is in gradle.properties) but then this introduces very high management overhead.

FYI, includeBuild("gradles/plugins") from root settings.gradle.kts will force each module in gradles/plugins to be built as :jar before building the main build, but with caching, most of them should be UP-TO-DATE. Only modules that have changes AND modules that depends on these changed modules will be recompiled, so we want to eliminate the number of recompiled convention plugins but putting each convention plugin to its own submodule in gradles/plugins

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.