22 * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
33 */
44
5- allprojects {
5+ buildscript {
66 repositories {
7- mavenLocal()
7+ jcenter()
8+ google()
89
10+ maven { url = uri(" https://dl.bintray.com/kotlin/kotlin" ) }
11+ maven { url = uri(" https://kotlin.bintray.com/kotlinx" ) }
12+ maven { url = uri(" https://plugins.gradle.org/m2/" ) }
13+ maven { url = uri(" https://dl.bintray.com/icerockdev/plugins" ) }
14+
15+ maven { url = uri(" https://dl.bintray.com/icerockdev/plugins-dev" ) }
16+ }
17+ dependencies {
18+ Deps .plugins.values.forEach { classpath(it) }
19+ }
20+ }
21+
22+ allprojects {
23+ repositories {
924 google()
1025 jcenter()
1126
@@ -14,12 +29,85 @@ allprojects {
1429 maven { url = uri(" https://dl.bintray.com/icerockdev/moko" ) }
1530 maven { url = uri(" https://dl.bintray.com/icerockdev/plugins" ) }
1631 maven { url = uri(" http://dl.bintray.com/lukaville/maven" ) }
32+
33+ maven { url = uri(" https://dl.bintray.com/icerockdev/moko-dev" ) }
34+ maven { url = uri(" https://dl.bintray.com/icerockdev/plugins-dev" ) }
1735 }
1836
19- // workaround for https://youtrack.jetbrains.com/issue/KT-27170
20- configurations.create(" compileClasspath" )
37+ // Workaround for https://youtrack.jetbrains.com/issue/KT-36721.
38+ pluginManager.withPlugin(" kotlin-multiplatform" ) {
39+ val kotlinExtension = project.extensions.getByName(" kotlin" )
40+ as org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
41+ val uniqueName = " ${project.group} .${project.name} "
42+
43+ kotlinExtension.targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget ::class .java) {
44+ compilations[" main" ].kotlinOptions.freeCompilerArgs + = listOf (
45+ " -module-name" ,
46+ uniqueName
47+ )
48+ }
49+ }
50+
51+ configurations
52+ .matching { it.name == " compileOnly" }
53+ .configureEach {
54+ dependencies {
55+ // fix of package javax.annotation does not exist import javax.annotation.Generated in DataBinding code
56+ " compileOnly" (" javax.annotation:jsr250-api:1.0" )
57+ }
58+ }
59+
60+ val project = this
61+ val bintrayPath: Pair <String , String >?
62+ when {
63+ this .name.startsWith(" widgets" ) -> {
64+ bintrayPath = " moko" to " moko-widgets"
65+
66+ this .group = " dev.icerock.moko"
67+ this .version = Versions .Libs .MultiPlatform .mokoWidgets
68+
69+ this .plugins.withType< com.android.build.gradle.LibraryPlugin > {
70+ this @allprojects.configure< com.android.build.gradle.LibraryExtension > {
71+ compileSdkVersion(Versions .Android .compileSdk)
72+
73+ defaultConfig {
74+ minSdkVersion(Versions .Android .minSdk)
75+ targetSdkVersion(Versions .Android .targetSdk)
76+ }
77+ }
78+ }
79+ }
80+ else -> {
81+ bintrayPath = null
82+ }
83+ }
84+
85+ if (bintrayPath != null ) {
86+ project.plugins.withType<MavenPublishPlugin > {
87+ project.configure<PublishingExtension > {
88+ val repo = bintrayPath.first
89+ val artifact = bintrayPath.second
90+ val isDevPublish = project.properties.containsKey(" devPublish" )
91+ val fullRepoName = if (isDevPublish) " $repo -dev" else repo
92+ val mavenUrl =
93+ " https://api.bintray.com/maven/icerockdev/$fullRepoName /$artifact /;publish=1"
94+
95+ repositories.maven(mavenUrl) {
96+ this .name = " bintray"
97+
98+ credentials {
99+ username = System .getProperty(" BINTRAY_USER" )
100+ password = System .getProperty(" BINTRAY_KEY" )
101+ }
102+ }
103+ }
104+ }
105+
106+ apply< dev.icerock.moko.widgets.gradle.BintrayPublishingPlugin > ()
107+ }
21108}
22109
23110tasks.register(" clean" , Delete ::class ).configure {
111+ group = " build"
24112 delete(rootProject.buildDir)
25113}
0 commit comments