-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the project structure to work with kotlin-master
- Loading branch information
Showing
30 changed files
with
97 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
gradle-conventions-settings/src/main/kotlin/util/KotlinVersionActions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package util | ||
|
||
import org.gradle.api.plugins.ExtensionAware | ||
import org.gradle.kotlin.dsl.extra | ||
import org.gradle.kotlin.dsl.provideDelegate | ||
|
||
|
||
enum class ActionApplied { | ||
Applied, NotApplied; | ||
} | ||
|
||
@Suppress("unused") | ||
inline fun ExtensionAware.whenKotlinIsAtLeast( | ||
major: Int, | ||
minor: Int, | ||
patch: Int = 0, | ||
action: () -> Unit = {}, | ||
): ActionApplied { | ||
val kotlinVersion: KotlinVersion by extra | ||
|
||
if (kotlinVersion.isAtLeast(major, minor, patch)) { | ||
action() | ||
|
||
return ActionApplied.Applied | ||
} | ||
|
||
return ActionApplied.NotApplied | ||
} | ||
|
||
inline fun ExtensionAware.whenKotlinLatest(action: () -> Unit): ActionApplied { | ||
val isLatestKotlinVersion: Boolean by extra | ||
|
||
if (isLatestKotlinVersion) { | ||
action() | ||
return ActionApplied.Applied | ||
} | ||
|
||
return ActionApplied.NotApplied | ||
} | ||
|
||
infix fun ActionApplied.otherwise(body: () -> Unit) { | ||
if (this == ActionApplied.NotApplied) { | ||
body() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import util.defaultConventionConfiguration | ||
|
||
plugins { | ||
alias(libs.plugins.gradle.kotlin.dsl) | ||
} | ||
|
||
defaultConventionConfiguration() | ||
|
||
val isLatestKotlinVersion: Boolean by extra | ||
|
||
dependencies { | ||
implementation(":gradle-conventions-settings") | ||
|
||
api(libs.kotlin.gradle.plugin) | ||
api(libs.detekt.gradle.plugin) | ||
api(libs.binary.compatibility.validator.gradle.plugin) | ||
|
||
if (isLatestKotlinVersion) { | ||
api(libs.kover.gradle.plugin) | ||
} | ||
|
||
// https://stackoverflow.com/questions/76713758/use-version-catalog-inside-precompiled-gradle-plugin | ||
api(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) | ||
} |
5 changes: 5 additions & 0 deletions
5
gradle-conventions/common/src/main/kotlin/build-util.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* | ||
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
// empty |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.