Skip to content

Commit

Permalink
Merge pull request #38 from icerockdev/develop
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
Alex009 authored Feb 25, 2022
2 parents 9402189 + b8f4b0f commit 228dce1
Show file tree
Hide file tree
Showing 33 changed files with 767 additions and 354 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ build
*.iml
Pods
xcuserdata
local.properties
local.properties
kotlin-js-store/
6 changes: 6 additions & 0 deletions .idea/copyright/IceRock.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ KSwift give you API for adding your own generator based on KLib metadata informa
# Requirements

- Gradle version 6.0+
- Kotlin 1.5.20
- Kotlin 1.6.10

# Installation

Expand All @@ -62,11 +62,9 @@ buildscript {
mavenCentral()
google()
gradlePluginPortal()
maven("https://jitpack.io")
}
dependencies {
classpath("dev.icerock.moko:kswift-gradle-plugin:0.3.0")
classpath("dev.icerock.moko:kswift-gradle-plugin:0.4.0")
}
}
```
Expand All @@ -89,8 +87,6 @@ pluginManagement {
google()
gradlePluginPortal()
mavenCentral()
maven("https://jitpack.io")
}
}
```
Expand All @@ -99,7 +95,7 @@ project where framework compiles `build.gradle`

```groovy
plugins {
id("dev.icerock.moko.kswift") version "0.3.0"
id("dev.icerock.moko.kswift") version "0.4.0"
}
```

Expand All @@ -119,7 +115,7 @@ project `build.gradle`

```groovy
dependencies {
commonMainApi("dev.icerock.moko:kswift-runtime:0.3.0") // if you want use annotations
commonMainApi("dev.icerock.moko:kswift-runtime:0.4.0") // if you want use annotations
}
```

Expand Down Expand Up @@ -283,7 +279,7 @@ First create `buildSrc`, if you don't. `build.gradle` will contains:

```groovy
plugins {
id("org.jetbrains.kotlin.jvm") version "1.5.21"
id("org.jetbrains.kotlin.jvm") version "1.6.10"
}
repositories {
Expand Down
7 changes: 5 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ buildscript {
mavenCentral()
google()
gradlePluginPortal()

maven("https://jitpack.io")
}

dependencies {
Expand All @@ -23,3 +21,8 @@ allprojects {
version = libs.versions.mokoKSwiftVersion.get()
}
}

// temporary fix for Apple Silicon (remove after 1.6.20 update)
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion = "16.0.0"
}
19 changes: 10 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
[versions]
kotlinVersion = "1.5.20"
androidGradleVersion = "4.1.2"
kotlinVersion = "1.6.10"
androidAppCompatVersion = "1.2.0"
materialDesignVersion = "1.0.0"
androidLifecycleVersion = "2.1.0"
androidCoreTestingVersion = "2.1.0"
coroutinesVersion = "1.5.0-native-mt"
coroutinesVersion = "1.6.0-native-mt"
mokoTestVersion = "0.4.0"
mokoKSwiftVersion = "0.3.0"
mokoKSwiftVersion = "0.4.0"

mokoMvvmVersion = "0.11.0"
mokoResourcesVersion = "0.16.2"

kotlinxMetadataKLibVersion = "0.0.1"

kotlinPoetVersion = "1.6.0"
swiftPoetVersion = "1.1.2"
swiftPoetVersion = "1.3.1"

[libraries]
appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" }
Expand All @@ -31,11 +30,13 @@ mokoMvvmState = { module = "dev.icerock.moko:mvvm-state" , version.ref = "mokoMv
mokoResources = { module = "dev.icerock.moko:resources" , version.ref = "mokoResourcesVersion" }

kotlinPoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinPoetVersion" }
swiftPoet = { module = "com.github.icerockdev:swiftpoet", version.ref = "swiftPoetVersion" }
swiftPoet = { module = "io.outfoxx:swiftpoet", version.ref = "swiftPoetVersion" }

#kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "kotlinVersion" }
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }
androidGradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "androidGradleVersion" }
kotlinCompilerEmbeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlinVersion" }
kotlinxMetadataKLib = { module = "org.jetbrains.kotlinx:kotlinx-metadata-klib", version.ref = "kotlinxMetadataKLibVersion" }
kotlinTestJUnit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlinVersion" }

kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }
mobileMultiplatformGradlePlugin = { module = "dev.icerock:mobile-multiplatform", version = "0.13.0" }
androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "7.0.4" }
detektGradlePlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version = "1.15.0" }
8 changes: 4 additions & 4 deletions kswift-build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ repositories {
}

dependencies {
api("dev.icerock:mobile-multiplatform:0.12.0")
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
api("com.android.tools.build:gradle:4.2.1")
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0")
api(libs.mobileMultiplatformGradlePlugin)
api(libs.kotlinGradlePlugin)
api(libs.androidGradlePlugin)
api(libs.detektGradlePlugin)
}
18 changes: 18 additions & 0 deletions kswift-build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2022 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

enableFeaturePreview("VERSION_CATALOGS")

dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ kotlin {
publishLibraryVariants("release", "debug")
}
ios()
iosSimulatorArm64()

macosX64("macOS")
macosX64()
macosArm64()
tvos()
tvosSimulatorArm64()
watchos()
watchosX86()
watchosSimulatorArm64()

jvm()
js(BOTH) {
Expand Down
9 changes: 8 additions & 1 deletion kswift-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@ dependencies {
testImplementation(libs.kotlinTestJUnit)
}

tasks.withType<Test>().configureEach {
tasks.withType<AbstractTestTask> {
testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
events = setOf(
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED,
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
)
showStandardStreams = true
}
outputs.upToDateWhen { false }
}

gradlePlugin {
Expand Down
2 changes: 0 additions & 2 deletions kswift-gradle-plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ dependencyResolutionManagement {
includeGroup("org.jetbrains.kotlinx")
}
}

maven("https://jitpack.io")
}

versionCatalogs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class KLibProcessor(
return
}

val fileSpecBuilder: FileSpec.Builder = FileSpec.builder(library.nameWithoutExtension)
val fileName: String = metadata.name
.replace("[<>]".toRegex(), "")
.replace("[.:]".toRegex(), "_")
val fileSpecBuilder: FileSpec.Builder = FileSpec.builder(fileName)

val processorContext = ProcessorContext(
fileSpecBuilder = fileSpecBuilder,
Expand All @@ -47,7 +50,12 @@ class KLibProcessor(
processFeatureContext(featureContext, processorContext)
}

val fileSpec: FileSpec = fileSpecBuilder.build()
val fileSpec: FileSpec = fileSpecBuilder
.addComment(
"This file automatically generated by MOKO KSwift " +
"(https://github.com/icerockdev/moko-kswift)\n"
)
.build()
if (fileSpec.members.isNotEmpty()) {
fileSpec.writeTo(outputDir)
}
Expand All @@ -68,7 +76,7 @@ class KLibProcessor(
try {
featureProcessor.process(featureContext, processorContext)
} catch (exc: Exception) {
logger.error("can't process context $featureContext", exc)
logger.info("can't process context $featureContext", exc)
}
}
}
Expand Down
Loading

0 comments on commit 228dce1

Please sign in to comment.