Readme
This commit is contained in:
parent
f27b81dcdd
commit
d1d784872a
119
README.md
Normal file
119
README.md
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
[//]: # ([](https://kotlinlang.org))
|
||||||
|
|
||||||
|
# Gradle buildscript utilities for Kotlin/Multiplatform
|
||||||
|
|
||||||
|
## Getting
|
||||||
|
|
||||||
|
### As library
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://maven.landgrafhomyak.ru/")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath("ru.landgrafhomyak.kotlin:kotlin-mpp-gradle-build-helper:v0.1k2.0.20")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform") version "2.0.20" // version of kotlin must be same as in this library
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
optInContracts()
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
defineAllMultiplatformTargets()
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### As plugin (custom repository)
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://maven.landgrafhomyak.ru/")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath("ru.landgrafhomyak.kotlin:kotlin-mpp-gradle-build:v0.1k2.0.20")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
// kotlin/multiplatorm and other plugins will be lazily enabled by dsl
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
xomrk {
|
||||||
|
// lazily enables kotlin if not yet
|
||||||
|
kotlin {
|
||||||
|
// same as with original kotlin plugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### As plugin (gradle portal)
|
||||||
|
|
||||||
|
This library officially isn't published, so this way wouldn't work
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
plugins {
|
||||||
|
id("ru.landgrafhomyak.kotlin.original-multiplatform-ext") version "v0.1k2.0.20"
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
xomrk {
|
||||||
|
// lazily enables kotlin if not yet
|
||||||
|
kotlin {
|
||||||
|
// same as with original kotlin plugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Functionality
|
||||||
|
```kotlin
|
||||||
|
kotlin {
|
||||||
|
// Configures compilations of all targets
|
||||||
|
configureAllCompilations { }
|
||||||
|
|
||||||
|
// Configures compiler for all targets
|
||||||
|
configureAllCompilersOptions { }
|
||||||
|
|
||||||
|
// Removes warning "expect/actual mechanism is experimental"
|
||||||
|
noWarnExpectActual()
|
||||||
|
|
||||||
|
warningsAsErrors()
|
||||||
|
|
||||||
|
// Opt-ins specified annotation to all targets
|
||||||
|
optIn("org.example.OptIn")
|
||||||
|
|
||||||
|
// optIn("kotlin.contracts.ExperimentalContracts")
|
||||||
|
optInContracts()
|
||||||
|
|
||||||
|
// sets kotlin compatibility (both api and language) for all targets
|
||||||
|
setCompatibilityWithKotlin(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
|
||||||
|
|
||||||
|
// defines all possible targets, useful for 'algorithm' libraries that are not depends on platform
|
||||||
|
defineAllMultiplatformTargets()
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user