Created
November 28, 2020 01:14
-
-
Save lordcodes/64147f4c72ede78db43868f8a6120cfa to your computer and use it in GitHub Desktop.
Brief demo of using a platform module to constrain dependency versions
This file contains hidden or 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
dependencies { | |
implementation(enforcedPlatform(project(":dependency-constraints"))) | |
implementation("org.jetbrains.kotlin:kotlin-stdlib") | |
implementation("androidx.lifecycle:lifecycle-livedata-ktx") | |
implementation("io.coil-kt:coil") | |
} |
This file contains hidden or 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
plugins { | |
id("java-platform") | |
id("maven-publish") | |
} | |
javaPlatform { | |
allowDependencies() | |
} | |
dependencies { | |
api(enforcedPlatform("org.jetbrains.kotlin:kotlin-bom:1.4.20")) | |
constraints { | |
api("androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-beta01") | |
api("io.coil-kt:coil:1.0.0") | |
} | |
} | |
publishing { | |
publications { | |
create<MavenPublication>("getBusyPlatform") { | |
from(components["javaPlatform"]) | |
} | |
} | |
} |
This file contains hidden or 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
include("dependency-constraints") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exactly I added 'allowDependencies()' in order to allow the platform to specify real dependencies so that I could specify the BOMs for other frameworks.
Also, yes adding a platform for the kotlin-bom simply brings in constraints on the versions. So that you can simply specify Kotlin dependencies throughout your project without the version, then update the Kotlin version only on the BOM.
Haha amazing. Thanks!