Skip to content

Commit

Permalink
Merge pull request #281 from icerockdev/develop
Browse files Browse the repository at this point in the history
Release 0.1.0 dev 20
  • Loading branch information
Alex009 authored Aug 30, 2020
2 parents 751235e + 6ac144a commit b72f0be
Show file tree
Hide file tree
Showing 370 changed files with 4,269 additions and 2,786 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/compilation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,11 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Check plugin
run: ./gradlew -PpluginPublish publishPluginPublicationToMavenLocal
- name: Check core
run: ./gradlew -PcorePublish :widgets:publishToMavenLocal
- name: Cocoapods install
run: (cd sample/ios-app && pod install)
- name: Check flat
run: ./gradlew -PadditionsPublish :widgets-flat:publishToMavenLocal
- name: Check bottomsheet
run: ./gradlew -PadditionsPublish :widgets-bottomsheet:publishToMavenLocal
- name: Check sms
run: ./gradlew -PadditionsPublish :widgets-sms:publishToMavenLocal
- name: Check datetime-picker
run: ./gradlew -PadditionsPublish :widgets-datetime-picker:publishToMavenLocal
- name: Check collection
run: ./gradlew -PadditionsPublish :widgets-collection:publishToMavenLocal
- name: Check build
run: ./gradlew build
- name: Check plugin publication
run: ./gradlew -p plugin publishToMavenLocal
- name: Check runtime publication
run: ./gradlew publishToMavenLocal
33 changes: 33 additions & 0 deletions .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: KMP library publish dev version

on:
push:
branches:
- develop
paths-ignore:
- '**/*.md'

jobs:
build:
runs-on: macOS-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cocoapods install
run: (cd sample/ios-app && pod install)
- name: Plugin publication
run: |
./gradlew -p plugin -PdevPublish \
publishNoValidationToBintray \
-DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} \
--stacktrace
- name: Runtime publication
run: |
./gradlew -PdevPublish \
publishNoValidationToBintray \
-DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} \
--stacktrace
28 changes: 13 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: KMP library publish
name: KMP library publish production version

on:
release:
Expand All @@ -14,19 +14,17 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Publish plugin
run: ./gradlew -PpluginPublish publishPluginPublicationToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }}
- name: Publish core
run: ./gradlew -PcorePublish :widgets:publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }}
- name: Cocoapods install
run: (cd sample/ios-app && pod install)
- name: Publish flat
run: ./gradlew -PadditionsPublish :widgets-flat:publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }}
- name: Publish bottomsheet
run: ./gradlew -PadditionsPublish :widgets-bottomsheet:publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }}
- name: Publish sms
run: ./gradlew -PadditionsPublish :widgets-sms:publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }}
- name: Publish datetime-picker
run: ./gradlew -PadditionsPublish :widgets-datetime-picker:publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }}
- name: Publish collection
run: ./gradlew -PadditionsPublish :widgets-collection:publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }}
- name: Plugin publication
run: |
./gradlew -p plugin \
publishNoValidationToBintray \
-DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} \
--stacktrace
- name: Runtime publication
run: |
./gradlew \
publishNoValidationToBintray \
-DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} \
--stacktrace
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ allprojects {

project build.gradle
```groovy
apply plugin: "dev.icerock.mobile.multiplatform-widgets-generator"
apply plugin: "dev.icerock.mobile.multiplatform-widgets-generator" // must apply before kotlin-multiplatform plugin
```

## Usage
Expand Down
96 changes: 92 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

allprojects {
buildscript {
repositories {
mavenLocal()
jcenter()
google()

maven { url = uri("https://dl.bintray.com/kotlin/kotlin") }
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
maven { url = uri("https://plugins.gradle.org/m2/") }
maven { url = uri("https://dl.bintray.com/icerockdev/plugins") }

maven { url = uri("https://dl.bintray.com/icerockdev/plugins-dev") }
}
dependencies {
Deps.plugins.values.forEach { classpath(it) }
}
}

allprojects {
repositories {
google()
jcenter()

Expand All @@ -14,12 +29,85 @@ allprojects {
maven { url = uri("https://dl.bintray.com/icerockdev/moko") }
maven { url = uri("https://dl.bintray.com/icerockdev/plugins") }
maven { url = uri("http://dl.bintray.com/lukaville/maven") }

maven { url = uri("https://dl.bintray.com/icerockdev/moko-dev") }
maven { url = uri("https://dl.bintray.com/icerockdev/plugins-dev") }
}

// workaround for https://youtrack.jetbrains.com/issue/KT-27170
configurations.create("compileClasspath")
// Workaround for https://youtrack.jetbrains.com/issue/KT-36721.
pluginManager.withPlugin("kotlin-multiplatform") {
val kotlinExtension = project.extensions.getByName("kotlin")
as org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
val uniqueName = "${project.group}.${project.name}"

kotlinExtension.targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java) {
compilations["main"].kotlinOptions.freeCompilerArgs += listOf(
"-module-name",
uniqueName
)
}
}

configurations
.matching { it.name == "compileOnly" }
.configureEach {
dependencies {
// fix of package javax.annotation does not exist import javax.annotation.Generated in DataBinding code
"compileOnly"("javax.annotation:jsr250-api:1.0")
}
}

val project = this
val bintrayPath: Pair<String, String>?
when {
this.name.startsWith("widgets") -> {
bintrayPath = "moko" to "moko-widgets"

this.group = "dev.icerock.moko"
this.version = Versions.Libs.MultiPlatform.mokoWidgets

this.plugins.withType<com.android.build.gradle.LibraryPlugin> {
this@allprojects.configure<com.android.build.gradle.LibraryExtension> {
compileSdkVersion(Versions.Android.compileSdk)

defaultConfig {
minSdkVersion(Versions.Android.minSdk)
targetSdkVersion(Versions.Android.targetSdk)
}
}
}
}
else -> {
bintrayPath = null
}
}

if (bintrayPath != null) {
project.plugins.withType<MavenPublishPlugin> {
project.configure<PublishingExtension> {
val repo = bintrayPath.first
val artifact = bintrayPath.second
val isDevPublish = project.properties.containsKey("devPublish")
val fullRepoName = if (isDevPublish) "$repo-dev" else repo
val mavenUrl =
"https://api.bintray.com/maven/icerockdev/$fullRepoName/$artifact/;publish=1"

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

credentials {
username = System.getProperty("BINTRAY_USER")
password = System.getProperty("BINTRAY_KEY")
}
}
}
}

apply<dev.icerock.moko.widgets.gradle.BintrayPublishingPlugin>()
}
}

tasks.register("clean", Delete::class).configure {
group = "build"
delete(rootProject.buildDir)
}
41 changes: 35 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/*
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
import java.io.ByteArrayOutputStream
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl`
kotlin("jvm") version "1.3.72"
id("com.github.kukuhyoniatmoko.buildconfigkotlin") version "1.0.5"
}

repositories {
Expand All @@ -13,12 +16,38 @@ repositories {
maven { url = uri("https://dl.bintray.com/icerockdev/plugins") }
}

val devPublishing: Boolean = properties.containsKey("devPublish")
val mokoWidgetsVersion: String = when (devPublishing) {
true -> getGitCommit()
false -> "0.1.0-dev-20"
}

buildConfigKotlin {
sourceSet("main") {
buildConfig(name = "widgetsVersion", value = mokoWidgetsVersion)
}
}

dependencies {
implementation("dev.icerock:mobile-multiplatform:0.6.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.70")
implementation("com.android.tools.build:gradle:3.6.1")
implementation("dev.icerock:mobile-multiplatform:0.6.1")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
implementation("com.android.tools.build:gradle:3.6.4")
}

fun getGitCommit(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine = listOf("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
}
return stdout.toString().trim()
}

kotlinDslPluginOptions {
experimentalWarning.set(false)
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "1.8"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "1.8"
}
25 changes: 25 additions & 0 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,26 @@ object Deps {
iosX64 = "dev.icerock.moko:widgets-datetime-picker-iosx64:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosArm64 = "dev.icerock.moko:widgets-datetime-picker-iosarm64:${Versions.Libs.MultiPlatform.mokoWidgets}"
)
val mokoWidgetsImageNetwork = MultiPlatformLibrary(
common = "dev.icerock.moko:widgets-image-network:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosX64 = "dev.icerock.moko:widgets-image-network-iosx64:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosArm64 = "dev.icerock.moko:widgets-image-network-iosarm64:${Versions.Libs.MultiPlatform.mokoWidgets}"
)
val mokoWidgetsPermissions = MultiPlatformLibrary(
common = "dev.icerock.moko:widgets-permissions:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosX64 = "dev.icerock.moko:widgets-permissions-iosx64:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosArm64 = "dev.icerock.moko:widgets-permissions-iosarm64:${Versions.Libs.MultiPlatform.mokoWidgets}"
)
val mokoWidgetsMedia = MultiPlatformLibrary(
common = "dev.icerock.moko:widgets-media:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosX64 = "dev.icerock.moko:widgets-media-iosx64:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosArm64 = "dev.icerock.moko:widgets-media-iosarm64:${Versions.Libs.MultiPlatform.mokoWidgets}"
)
val mokoWidgetsSms = MultiPlatformLibrary(
common = "dev.icerock.moko:widgets-sms:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosX64 = "dev.icerock.moko:widgets-sms-iosx64:${Versions.Libs.MultiPlatform.mokoWidgets}",
iosArm64 = "dev.icerock.moko:widgets-sms-iosarm64:${Versions.Libs.MultiPlatform.mokoWidgets}"
)
val mokoResources = MultiPlatformLibrary(
common = "dev.icerock.moko:resources:${Versions.Libs.MultiPlatform.mokoResources}",
iosX64 = "dev.icerock.moko:resources-iosx64:${Versions.Libs.MultiPlatform.mokoResources}",
Expand All @@ -108,6 +128,11 @@ object Deps {
iosX64 = "dev.icerock.moko:media-iosx64:${Versions.Libs.MultiPlatform.mokoMedia}",
iosArm64 = "dev.icerock.moko:media-iosarm64:${Versions.Libs.MultiPlatform.mokoMedia}"
)
val mokoPermissions = MultiPlatformLibrary(
common = "dev.icerock.moko:permissions:${Versions.Libs.MultiPlatform.mokoPermissions}",
iosX64 = "dev.icerock.moko:permissions-iosx64:${Versions.Libs.MultiPlatform.mokoPermissions}",
iosArm64 = "dev.icerock.moko:permissions-iosarm64:${Versions.Libs.MultiPlatform.mokoPermissions}"
)
val mokoGraphics = MultiPlatformLibrary(
common = "dev.icerock.moko:graphics:${Versions.Libs.MultiPlatform.mokoGraphics}",
iosX64 = "dev.icerock.moko:graphics-iosx64:${Versions.Libs.MultiPlatform.mokoGraphics}",
Expand Down
11 changes: 6 additions & 5 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ object Versions {
const val minSdk = 16
}

const val kotlin = "1.3.70"
private const val mokoWidgets = "0.1.0-dev-19"
private const val mokoResources = "0.9.0"
const val kotlin = "1.3.72"
private const val mokoWidgets = BuildConfig.widgetsVersion
private const val mokoResources = "0.11.0"

object Plugins {
const val mokoWidgets = Versions.mokoWidgets
Expand Down Expand Up @@ -39,10 +39,11 @@ object Versions {

const val mokoWidgets = Versions.mokoWidgets
const val mokoResources = Versions.mokoResources
const val mokoMvvm = "0.6.0"
const val mokoMvvm = "0.7.1"
const val mokoFields = "0.3.0"
const val mokoUnits = "0.3.1"
const val mokoMedia = "0.4.0"
const val mokoMedia = "0.4.1"
const val mokoPermissions = "0.5.0"
const val mokoGraphics = "0.3.0"
const val mokoParcelize = "0.3.0"
const val klock = "1.9.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

package dev.icerock.moko.widgets.gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.publish.plugins.PublishingPlugin

class BintrayPublishingPlugin : Plugin<Project> {
override fun apply(target: Project) {
// schedule after evaluate action...but no guarantee that our action will be last.
// so we just shedule another afterEvaluate in our action to set action at end of evaluation :)
target.afterEvaluate {
target.afterEvaluate { setupNoValidationPublish(target) }
}
}

private fun setupNoValidationPublish(project: Project) {
val publishNoValidationTasks = project.tasks.filterIsInstance<PublishToMavenRepository>()
.map { publishTask ->
val newName = publishTask.name.replace("publish", "publishNoValidation")
val newTask: PublishToBintrayRepository =
project.tasks.create(newName, PublishToBintrayRepository::class.java)

newTask.group = PublishingPlugin.PUBLISH_TASK_GROUP + " no validation"
newTask.publication = publishTask.publication
newTask.repository = publishTask.repository
newTask.setDependsOn(publishTask.dependsOn)

newTask
}

publishNoValidationTasks
.groupBy { it.repository }
.forEach { (repo, publishTasks) ->
val repoName = repo.name.capitalize()
project.tasks.create("publishNoValidationTo$repoName") {
it.group = PublishingPlugin.PUBLISH_TASK_GROUP + " no validation"
it.setDependsOn(publishTasks)
}
}
}
}
Loading

0 comments on commit b72f0be

Please sign in to comment.