https://github.com/huanshankeji/gradle-common
Huanshankeji's common Gradle code (in and for Kotlin)
https://github.com/huanshankeji/gradle-common
gradle gradle-kotlin-dsl gradle-plugin kotlin kotlin-library kotlin-multiplatform
Last synced: 21 days ago
JSON representation
Huanshankeji's common Gradle code (in and for Kotlin)
- Host: GitHub
- URL: https://github.com/huanshankeji/gradle-common
- Owner: huanshankeji
- License: apache-2.0
- Created: 2022-05-03T13:54:53.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-17T21:44:41.000Z (3 months ago)
- Last Synced: 2025-03-31T11:51:12.175Z (about 2 months ago)
- Topics: gradle, gradle-kotlin-dsl, gradle-plugin, kotlin, kotlin-library, kotlin-multiplatform
- Language: Kotlin
- Homepage: https://huanshankeji.github.io/gradle-common/
- Size: 558 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Huanshankeji Gradle Common (in and for Kotlin)
[](https://plugins.gradle.org/search?term=com.huanshankeji)
[](https://plugins.gradle.org/plugin/com.huanshankeji.common-gradle-dependencies-dummy-plugin)Huanshankeji's Gradle common code in Kotlin, mainly for common projects in Kotlin
## Project status and guide
This library currently mainly serves our use, and the APIs are experimental and subject to change. There are currently no detailed docs or tutorials on how to use the plugins. [Check out the API documentation here.](https://huanshankeji.github.io/gradle-common/.) See the build scripts in [kotlin-common](https://github.com/huanshankeji/kotlin-common) for examples. Browse the plugins in [the `kotlin-common-gradle-plugins` module](kotlin-common-gradle-plugins) and [the `architecture-common-gradle-plugins` module](architecture-common-gradle-plugins) as references. Instead of adding this library to your build dependencies, you can also copy the plugins to your own projects and adapt them to your own needs.
## Gradle version and Kotlin version
See [gradle/wrapper/gradle-wrapper.properties](gradle/wrapper/gradle-wrapper.properties) for the current dependency Gradle version and [buildSrc/build.gradle.kts](buildSrc/build.gradle.kts) for the current dependency Kotlin version. These versions are tested against and used by us. There might be compatibility issues when you use other versions of Gradle or Kotlin, especially versions with different [MAJOR](https://semver.org/) versions.
### About the version of the Kotlin Gradle plugins
The projects and plugins depend on a certain version of the Kotlin Gradle plugins. Sometimes it's needed to specify your own version of the Kotlin Gradle plugins when using the plugins in your project. For example, a version of [Compose Multiplatform](https://www.jetbrains.com/lp/compose-mpp/) currently supports only a certain version of the Kotlin Gradle plugins. Especially, if your desired Kotlin version is lower than this project's dependency Kotlin version, you need to exclude the transitive Kotlin dependencies.
For example, with Compose 1.3.1 in `buildSrc/build.gradle.kts`:
```kotlin
dependencies {
implementation(kotlin("gradle-plugin", "1.8.10"))
implementation("org.jetbrains.compose:compose-gradle-plugin:1.3.1")api("com.huanshankeji:common-gradle-dependencies:0.5.0-20230310") { exclude("org.jetbrains.kotlin") }
implementation("com.huanshankeji:kotlin-common-gradle-plugins:0.4.0") { exclude("org.jetbrains.kotlin") }
implementation("com.huanshankeji:architecture-common-gradle-plugins:0.4.0") { exclude("org.jetbrains.kotlin") }
}
```Or:
```kotlin
dependencies {
implementation(kotlin("gradle-plugin", "1.8.10"))
implementation("org.jetbrains.compose:compose-gradle-plugin:1.3.1")api("com.huanshankeji:common-gradle-dependencies:0.5.0-20230310")
implementation("com.huanshankeji:kotlin-common-gradle-plugins:0.4.0")
implementation("com.huanshankeji:architecture-common-gradle-plugins:0.4.0")
}configurations.all {
resolutionStrategy {
force("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10")
}
}
```## Common Gradle dependencies
The `common-gradle-dependenicies` module includes dependencies and their versions that we use in our projects.
Please note that this project often has breaking/incompatible changes, and the Gradle plugin modules depend on a certain version of `common-gradle-dependenicies` as its library dependency. If you use both the Gradle plugins and `common-gradle-dependenicies` in your project and encounter `java.lang.NoClassDefFoundError` when loading your Gradle build, please consider updating them to matching versions.
## Developer notices
1. IntelliJ IDEA doesn't work well with applying plugins to script plugins in project sources. If a script plugin's code does not resolve, try restarting IntelliJ IDEA.
1. `./gradlew build` (and tasks depending on it) somehow has to run twice to work. I haven't identified the cause yet.
1. IntelliJ IDEA 2024.3 doesn't load this project, which is reported at [IDEA-363846](https://youtrack.jetbrains.com/issue/IDEA-363846/Loading-a-Gradle-project-of-Gradle-plugins-changes-a-final-Kotlin-freeCompilerArgs-since-IntelliJ-IDEA-2024.3).