Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit dda773e

Browse files
authored
Merge pull request #280 from icerockdev/#278-rework-project-configuration
rework project configuration
2 parents 6e5763d + 9e0b441 commit dda773e

File tree

42 files changed

+271
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+271
-247
lines changed

.github/workflows/compilation-check.yml

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,11 @@ jobs:
1616
uses: actions/setup-java@v1
1717
with:
1818
java-version: 1.8
19-
- name: Cache ~/.m2/repository
20-
uses: actions/cache@v1
21-
with:
22-
path: ~/.m2/repository
23-
key: ${{ runner.os }}-maven-${{ hashFiles('buildSrc/src/main/kotlin/**/*') }}
24-
restore-keys: ${{ runner.os }}-maven
25-
- name: Cache ~/.konan
26-
uses: actions/cache@v1
27-
with:
28-
path: ~/.konan
29-
key: ${{ runner.os }}-kn-${{ hashFiles('buildSrc/build.gradle.kts') }}
30-
restore-keys: ${{ runner.os }}-kn
31-
- name: Check plugin
32-
run: ./gradlew -PpluginPublish publishToMavenLocal
33-
- name: Check core
34-
run: ./gradlew -PcorePublish :widgets:publishToMavenLocal
3519
- name: Cocoapods install
3620
run: (cd sample/ios-app && pod install)
37-
- name: Check additions
38-
run: |
39-
./gradlew -PadditionsPublish \
40-
:widgets-flat:build \
41-
:widgets-bottomsheet:build \
42-
:widgets-sms:build \
43-
:widgets-datetime-picker:build \
44-
:widgets-collection:build \
45-
:widgets-image-network:build \
46-
:widgets-permissions:build \
47-
:widgets-media:build
21+
- name: Check build
22+
run: ./gradlew build
23+
- name: Check plugin publication
24+
run: ./gradlew -p plugin publishToMavenLocal
25+
- name: Check runtime publication
26+
run: ./gradlew publishToMavenLocal

.github/workflows/publish-dev.yml

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,15 @@ jobs:
1717
uses: actions/setup-java@v1
1818
with:
1919
java-version: 1.8
20-
- name: Cache ~/.m2/repository
21-
uses: actions/cache@v1
22-
with:
23-
path: ~/.m2/repository
24-
key: ${{ runner.os }}-maven-${{ hashFiles('buildSrc/src/main/kotlin/**/*') }}
25-
restore-keys: ${{ runner.os }}-maven
26-
- name: Cache ~/.konan
27-
uses: actions/cache@v1
28-
with:
29-
path: ~/.konan
30-
key: ${{ runner.os }}-kn-${{ hashFiles('buildSrc/build.gradle.kts') }}
31-
restore-keys: ${{ runner.os }}-kn
32-
- name: Compile plugin
33-
run: ./gradlew -PdevPublish -PpluginPublish publishToMavenLocal
34-
- name: Compile core
35-
run: ./gradlew -PdevPublish -PcorePublish :widgets:publishToMavenLocal
3620
- name: Cocoapods install
3721
run: (cd sample/ios-app && pod install)
38-
- name: Compile additions
22+
- name: Plugin publication
3923
run: |
40-
./gradlew -PdevPublish -PadditionsPublish \
41-
:widgets-flat:build \
42-
:widgets-bottomsheet:build \
43-
:widgets-sms:build \
44-
:widgets-datetime-picker:build \
45-
:widgets-collection:build \
46-
:widgets-image-network:build \
47-
:widgets-permissions:build \
48-
:widgets-media:build
49-
- name: Publish all to bintray
24+
./gradlew -p plugin -PdevPublish \
25+
publishNoValidationToBintray \
26+
-DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} \
27+
--stacktrace
28+
- name: Runtime publication
5029
run: |
5130
./gradlew -PdevPublish \
5231
publishNoValidationToBintray \

.github/workflows/publish.yml

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,15 @@ jobs:
1414
uses: actions/setup-java@v1
1515
with:
1616
java-version: 1.8
17-
- name: Cache ~/.m2/repository
18-
uses: actions/cache@v1
19-
with:
20-
path: ~/.m2/repository
21-
key: ${{ runner.os }}-maven-${{ hashFiles('buildSrc/src/main/kotlin/**/*') }}
22-
restore-keys: ${{ runner.os }}-maven
23-
- name: Cache ~/.konan
24-
uses: actions/cache@v1
25-
with:
26-
path: ~/.konan
27-
key: ${{ runner.os }}-kn-${{ hashFiles('buildSrc/build.gradle.kts') }}
28-
restore-keys: ${{ runner.os }}-kn
29-
- name: Compile plugin
30-
run: ./gradlew -PpluginPublish publishToMavenLocal
31-
- name: Compile core
32-
run: ./gradlew -PcorePublish :widgets:publishToMavenLocal
3317
- name: Cocoapods install
3418
run: (cd sample/ios-app && pod install)
35-
- name: Compile additions
19+
- name: Plugin publication
3620
run: |
37-
./gradlew -PadditionsPublish \
38-
:widgets-flat:build \
39-
:widgets-bottomsheet:build \
40-
:widgets-sms:build \
41-
:widgets-datetime-picker:build \
42-
:widgets-collection:build \
43-
:widgets-image-network:build \
44-
:widgets-permissions:build \
45-
:widgets-media:build
46-
- name: Publish all to bintray
21+
./gradlew -p plugin \
22+
publishNoValidationToBintray \
23+
-DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} \
24+
--stacktrace
25+
- name: Runtime publication
4726
run: |
4827
./gradlew \
4928
publishNoValidationToBintray \

build.gradle.kts

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
buildscript {
66
repositories {
7-
mavenLocal()
8-
97
jcenter()
108
google()
119

@@ -16,17 +14,13 @@ buildscript {
1614

1715
maven { url = uri("https://dl.bintray.com/icerockdev/plugins-dev") }
1816
}
19-
if (!properties.containsKey("pluginPublish")) {
20-
dependencies {
21-
Deps.plugins.values.forEach { classpath(it) }
22-
}
17+
dependencies {
18+
Deps.plugins.values.forEach { classpath(it) }
2319
}
2420
}
2521

2622
allprojects {
2723
repositories {
28-
mavenLocal()
29-
3024
google()
3125
jcenter()
3226

@@ -47,18 +41,21 @@ allprojects {
4741
val uniqueName = "${project.group}.${project.name}"
4842

4943
kotlinExtension.targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java) {
50-
compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-module-name", uniqueName)
44+
compilations["main"].kotlinOptions.freeCompilerArgs += listOf(
45+
"-module-name",
46+
uniqueName
47+
)
5148
}
5249
}
5350

54-
afterEvaluate {
55-
dependencies {
56-
if (configurations.map { it.name }.contains("compileOnly")) {
51+
configurations
52+
.matching { it.name == "compileOnly" }
53+
.configureEach {
54+
dependencies {
5755
// fix of package javax.annotation does not exist import javax.annotation.Generated in DataBinding code
5856
"compileOnly"("javax.annotation:jsr250-api:1.0")
5957
}
6058
}
61-
}
6259

6360
val project = this
6461
val bintrayPath: Pair<String, String>?
@@ -80,19 +77,6 @@ allprojects {
8077
}
8178
}
8279
}
83-
this.name.endsWith("-plugin") -> {
84-
bintrayPath = "plugins" to "moko-widgets-generator"
85-
86-
this.group = "dev.icerock.moko.widgets"
87-
this.version = Versions.Plugins.mokoWidgets
88-
89-
this.plugins.withType<JavaPlugin> {
90-
this@allprojects.configure<JavaPluginExtension> {
91-
sourceCompatibility = JavaVersion.VERSION_1_6
92-
targetCompatibility = JavaVersion.VERSION_1_6
93-
}
94-
}
95-
}
9680
else -> {
9781
bintrayPath = null
9882
}
@@ -105,7 +89,8 @@ allprojects {
10589
val artifact = bintrayPath.second
10690
val isDevPublish = project.properties.containsKey("devPublish")
10791
val fullRepoName = if (isDevPublish) "$repo-dev" else repo
108-
val mavenUrl = "https://api.bintray.com/maven/icerockdev/$fullRepoName/$artifact/;publish=1"
92+
val mavenUrl =
93+
"https://api.bintray.com/maven/icerockdev/$fullRepoName/$artifact/;publish=1"
10994

11095
repositories.maven(mavenUrl) {
11196
this.name = "bintray"

buildSrc/build.gradle.kts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
import java.io.ByteArrayOutputStream
5+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
56

67
plugins {
78
kotlin("jvm") version "1.3.72"
@@ -29,8 +30,8 @@ buildConfigKotlin {
2930

3031
dependencies {
3132
implementation("dev.icerock:mobile-multiplatform:0.6.1")
32-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71")
33-
implementation("com.android.tools.build:gradle:3.6.1")
33+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
34+
implementation("com.android.tools.build:gradle:3.6.4")
3435
}
3536

3637
fun getGitCommit(): String {
@@ -41,3 +42,12 @@ fun getGitCommit(): String {
4142
}
4243
return stdout.toString().trim()
4344
}
45+
46+
val compileKotlin: KotlinCompile by tasks
47+
compileKotlin.kotlinOptions {
48+
jvmTarget = "1.8"
49+
}
50+
val compileTestKotlin: KotlinCompile by tasks
51+
compileTestKotlin.kotlinOptions {
52+
jvmTarget = "1.8"
53+
}

buildSrc/src/main/kotlin/Deps.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ object Deps {
9898
iosX64 = "dev.icerock.moko:widgets-media-iosx64:${Versions.Libs.MultiPlatform.mokoWidgets}",
9999
iosArm64 = "dev.icerock.moko:widgets-media-iosarm64:${Versions.Libs.MultiPlatform.mokoWidgets}"
100100
)
101+
val mokoWidgetsSms = MultiPlatformLibrary(
102+
common = "dev.icerock.moko:widgets-sms:${Versions.Libs.MultiPlatform.mokoWidgets}",
103+
iosX64 = "dev.icerock.moko:widgets-sms-iosx64:${Versions.Libs.MultiPlatform.mokoWidgets}",
104+
iosArm64 = "dev.icerock.moko:widgets-sms-iosarm64:${Versions.Libs.MultiPlatform.mokoWidgets}"
105+
)
101106
val mokoResources = MultiPlatformLibrary(
102107
common = "dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}",
103108
iosX64 = "dev.icerock.moko:resources-iosx64:${Versions.Libs.MultiPlatform.mokoResources}",

kotlin-native-plugin/build.gradle.kts

Lines changed: 0 additions & 40 deletions
This file was deleted.

kotlin-plugin/build.gradle.kts

Lines changed: 0 additions & 41 deletions
This file was deleted.

plugin/build.gradle.kts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
allprojects {
6+
repositories {
7+
google()
8+
jcenter()
9+
10+
maven { url = uri("https://kotlin.bintray.com/kotlin") }
11+
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
12+
maven { url = uri("https://dl.bintray.com/icerockdev/moko") }
13+
maven { url = uri("https://dl.bintray.com/icerockdev/plugins") }
14+
}
15+
16+
val bintrayPath = "plugins" to "moko-widgets-generator"
17+
val project = this
18+
19+
project.group = "dev.icerock.moko.widgets"
20+
project.version = Versions.Plugins.mokoWidgets
21+
22+
project.plugins.withType<JavaPlugin> {
23+
project.configure<JavaPluginExtension> {
24+
sourceCompatibility = JavaVersion.VERSION_1_6
25+
targetCompatibility = JavaVersion.VERSION_1_6
26+
}
27+
}
28+
29+
project.plugins.withType<MavenPublishPlugin> {
30+
project.configure<PublishingExtension> {
31+
val repo = bintrayPath.first
32+
val artifact = bintrayPath.second
33+
val isDevPublish = project.properties.containsKey("devPublish")
34+
val fullRepoName = if (isDevPublish) "$repo-dev" else repo
35+
val mavenUrl = "https://api.bintray.com/maven/icerockdev/$fullRepoName/$artifact/;publish=1"
36+
37+
repositories.maven(mavenUrl) {
38+
this.name = "bintray"
39+
40+
credentials {
41+
username = System.getProperty("BINTRAY_USER")
42+
password = System.getProperty("BINTRAY_KEY")
43+
}
44+
}
45+
}
46+
}
47+
48+
apply<dev.icerock.moko.widgets.gradle.BintrayPublishingPlugin>()
49+
}
50+
51+
tasks.register("clean", Delete::class).configure {
52+
group = "build"
53+
delete(rootProject.buildDir)
54+
}

plugin/buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../buildSrc/build.gradle.kts

0 commit comments

Comments
 (0)