Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to kotlin multiplatform plugin. #60

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
bin/
gen/
out/
!/ios/library/keychainwrapper/bin
!/kissme/library/keychainwrapper/bin

# Gradle files
.gradle/
Expand Down Expand Up @@ -96,7 +96,7 @@ fabric.properties
.LSOverride

# ios cinterop .def file
/ios/src/main/c_interop/keychainwrapper.def
/kissme/src/nativeInterop/cinterop/keychainwrapper.def

# Build-time secrets
secret.properties
64 changes: 0 additions & 64 deletions android/build.gradle

This file was deleted.

5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply from: 'versions.gradle'

buildscript {
ext.kotlin_version = '1.3.41'
ext.kotlin_version = '1.3.60'

repositories {
maven { url 'https://dl.bintray.com/jetbrains/kotlin-native-dependencies' }
Expand All @@ -10,8 +10,7 @@ buildscript {
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$kotlin_version"
classpath "com.android.tools.build:gradle:3.4.0"
classpath "com.android.tools.build:gradle:3.5.3"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
}
}
Expand Down
17 changes: 0 additions & 17 deletions common/build.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
36 changes: 0 additions & 36 deletions ios/build.gradle

This file was deleted.

141 changes: 141 additions & 0 deletions kissme/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
plugins {
id("org.jetbrains.kotlin.multiplatform")
}
apply plugin: 'com.android.library'

kotlin {
android {
publishLibraryVariants("release", "debug")
}

iosX64("iosX64") {
compilations.main.cinterops {
keychainwrapper {
packageName "com.netguru.keychainWrapper"
includeDirs {
allHeaders "./library/keychainwrapper/bin"
}
compilerOpts "-F${projectDir}"
}
}
}

iosArm64("iosArm64") {
compilations.main.cinterops {
keychainwrapper {
packageName "com.netguru.keychainWrapper"
includeDirs {
allHeaders "./library/keychainwrapper/bin"
}
compilerOpts "-F${projectDir}"
}
}
}

sourceSets {
commonMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-common"
}
}
commonTest {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-test-annotations-common"
implementation "org.jetbrains.kotlin:kotlin-test-common"
}
}

androidMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "com.github.yandextaxitech:binaryprefs:1.0.1"
}
}
androidTest {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
implementation "io.mockk:mockk:1.9.3"
implementation "androidx.test:core:1.2.0"
implementation "androidx.test.ext:junit:1.1.1"
implementation "org.robolectric:robolectric:4.2"
}
}

iosMain {}
iosArm64Main.dependsOn iosMain
iosX64Main.dependsOn iosMain

iosTest {}
iosArm64Test.dependsOn iosTest
iosX64Test.dependsOn iosTest
}
}

android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName '1.0'
}
buildTypes {
release {
minifyEnabled false
}
}

sourceSets {
main {
manifest.srcFile 'src/androidMain/AndroidManifest.xml'
java.srcDirs = ['src/androidMain/java', 'src/androidMain/kotlin']
res.srcDirs = ['src/androidMain/res']
}
}
}

task generateCinteropConfig(type: Exec) {
workingDir "${projectDir}"
commandLine 'sh', "${projectDir}/generate_cinterop_conf.sh"
}

gradle.taskGraph.beforeTask { Task task ->
if (task.project.name.toLowerCase().contains("ios")) {
"sh ${projectDir}/generate_cinterop_conf.sh ${projectDir}".execute().text
}
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

artifacts {
archives sourcesJar
}
publishing {
publications {
android(MavenPublication) {
artifact("$buildDir/outputs/aar/kissme-release.aar")
artifact sourcesJar
artifactId 'android'
version project.libraryVersion

pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included in the pom.
if (it.name != 'unspecified') {
println(it.name)
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/bash
current_dir=$1
target_file_dir="$1/src/main/c_interop/"
target_file_dir="$1/src/nativeinterop/cinterop/"
target_file_name="keychainwrapper.def"

rm -f "$target_file_dir$target_file_name"
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
enableFeaturePreview('GRADLE_METADATA')
include ':android', ':ios', ':common'
include ':kissme'