Skip to content

build: unify gradle scripts to match kotlin dsl style - #894

Open
altro3 wants to merge 1 commit into
kora-projects:masterfrom
altro3:buld-scripts
Open

altro3 wants to merge 1 commit into
kora-projects:masterfrom
altro3:buld-scripts

Conversation

@altro3

@altro3 altro3 commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

[EN]

Summary

This PR brings a major refactoring to the Gradle build scripts across the entire repository (107 files changed). The goal is to unify the current Groovy DSL into a code style that mirrors Kotlin DSL structure, making it highly readable and easing future migration to .gradle.kts.

Key Changes

  • Type-Safe Project Accessors: Enabled enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") to completely replace hardcoded project strings like project(":core:common") with autogenerated type-safe properties (projects.core.common) inside Groovy scripts.
  • Consistent Syntax: Enforced explicit parentheses for configuration and dependency methods (e.g., id("java-test-fixtures"), api(libs.slf4j.api)).
  • Lazy Task Configuration: Refactored the generateKoraVersion task in :core:common to execute during the execution phase (doLast) rather than configuration. Linked it to srcDir cleanly using the Lazy Providers API.
  • Version Catalog Optimization & Protobuf Fixes:
    • Consolidated duplicate versions (protobuf-java and protobuf-protoc) into a single protobuf = "4.36.2" reference inside libs.versions.toml.
    • Explicitly added the protobuf-kotlin module (com.google.protobuf:protobuf-kotlin) to the catalog. This ensures generated Kotlin protobuf classes compile cleanly and prevent implicit runtime resolution issues.
    • Fixed property evaluation syntax in the root build.gradle file by properly utilizing .asProvider().get().
  • Standardized Dependency Ordering:
    Organized all dependencies blocks into a strict, unified order across all modules. Dependencies are now predictably sorted from compilation/annotation processors down to test fixtures and runtimes:
    • annotationProcessor / compileOnly / api / implementation / runtimeOnly
    • testAnnotationProcessor / testCompileOnly / testApi / testImplementation / testRuntimeOnly
    • testFixturesApi / testFixturesImplementation

No production code was affected. Verified by running local builds.

[RU]

Что сделано

Проведена масштабная унификация и рефакторинг сборочных скриптов Gradle (build.gradle) во всем репозитории (107 файлов). Цель — привести Groovy DSL к единому кодстайлу, визуально и структурно идентичному Kotlin DSL (.gradle.kts). Это упростит поддержку сборки и сделает возможным бесшовный перевод модулей на Kotlin DSL в будущем.

Основные изменения

  • Type-Safe аналоги для проектов: Включена фича enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS"). Это позволило полностью избавиться от хрупкого строкового синтаксиса вида project(":core:common") и перейти на автогенерируемые безопасные аксессоры projects.core.common в Groovy-скриптах.
  • Единый синтаксис функций: Все вызовы конфигураций зависимостей и плагинов обернуты в круглые скобки (), например: id("java-test-fixtures"), api(libs.slf4j.api).
  • Оптимизация :core:common: Логика генерации версии Kora вынесена из этапа конфигурации в task.doLast (этап выполнения). Настроена ленивая конфигурация ресурсов через API провайдеров (generateKoraVersion.map { ... }), что гарантирует правильный граф задач без лишних тормозов при импорте проекта.
  • Оптимизация каталога версий (Version Catalog):
    • Дублирующиеся версии protobuf-java и protobuf-protoc схлопнуты в единую переменную protobuf = "4.36.2".
    • Добавлен модуль protobuf-kotlin (com.google.protobuf:protobuf-kotlin). Он необходим для корректной компиляции сгенерированных Kotlin-классов Protobuf, чтобы избежать скрытых проблем с типами в рантайме.
    • В корневом build.gradle исправлен синтаксис резолва версий через .asProvider().get().
  • Стандартизация и упорядочивание зависимостей:
    Внутри блоков dependencies наведен строгий порядок. Все зависимости теперь выровнены в единой логической последовательности (от процессоров аннотаций до рантайма и фикстур):
    • annotationProcessor / compileOnly / api / implementation / runtimeOnly
    • testAnnotationProcessor / testCompileOnly / testApi / testImplementation / testRuntimeOnly
    • testFixturesApi / testFixturesImplementation

Как проверять

Убедиться, что проект успешно собирается локально через ./gradlew build. Изменений в прикладном коде фреймворка нет.

@github-actions

Copy link
Copy Markdown

Dependency Update Report

Update level: patch

Found 1 dependency updates.

gradle/libs.versions.toml

  • s3client-aws (software.amazon.awssdk:s3, inline:254): 2.55.5 -> 2.55.6

@altro3 altro3 changed the title build: unify gradle scripts to match kotlin dsl style build: 1. unify gradle scripts to match kotlin dsl style Sep 26, 2026
@altro3 altro3 changed the title build: 1. unify gradle scripts to match kotlin dsl style build: unify gradle scripts to match kotlin dsl style Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant