fints4k/common/build.gradle

175 lines
4.5 KiB
Groovy
Raw Normal View History

2020-07-11 10:03:28 +00:00
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "com.android.library"
id "maven-publish"
}
ext.artifactName = "multiplatform-utils"
def frameworkName = "MultiplatformUtils"
2020-07-11 10:03:28 +00:00
kotlin {
jvm {
compilations.main.kotlinOptions {
jvmTarget = "1.6"
}
}
targets {
final def iOSTarget = iOSIsRealDevice ? presets.iosArm64 : presets.iosX64
fromPreset(iOSTarget, 'ios') {
binaries {
framework {
baseName = frameworkName
embedBitcode(embedBitcodeValue)
2020-07-11 10:03:28 +00:00
}
}
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin("stdlib-common")
}
}
commonTest {
dependencies {
implementation kotlin("test-common")
implementation kotlin("test-annotations-common")
implementation "ch.tutteli.atrium:atrium-fluent-en_GB-common:$atriumVersion"
2020-07-11 10:03:28 +00:00
}
}
jvmMain {
dependencies {
api kotlin("stdlib-jdk7")
compileOnly "org.slf4j:slf4j-api:$slf4jVersion"
compileOnly "com.fasterxml.jackson.core:jackson-databind:2.9.9"
2020-07-11 10:03:28 +00:00
}
}
jvmTest {
dependencies {
implementation kotlin("test-junit")
implementation "org.junit.jupiter:junit-jupiter:$junit5Version"
runtimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit5Version"
implementation "org.assertj:assertj-core:$assertJVersion"
implementation "org.mockito:mockito-core:$mockitoVersion"
implementation "ch.tutteli.atrium:atrium-fluent-en_GB:$atriumVersion"
2020-07-11 10:03:28 +00:00
implementation "org.slf4j:slf4j-simple:$slf4jVersion"
}
}
iosMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
}
}
}
}
2020-10-22 23:28:17 +00:00
task copyFramework {
def buildType = project.findProperty('kotlin.build.type') ?: 'DEBUG'
def target = project.findProperty('kotlin.target') ?: 'ios'
def framework = kotlin.targets."$target".binaries.getFramework(buildType)
dependsOn framework.linkTask
doLast {
def srcFile = framework.outputFile
def targetDir = getProperty('configuration.build.dir')
copy {
from srcFile.parent
into targetDir
include "${frameworkName}.framework/**"
include "${frameworkName}.framework.dSYM"
}
}
}
2020-07-11 10:03:28 +00:00
// Task to generate iOS framework for xcode projects.
task packForXcode(type: Sync) {
2020-07-11 10:03:28 +00:00
final File frameworkDir = new File(buildDir, "xcode-frameworks")
final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'
final def framework = kotlin.targets.ios.binaries.getFramework("", mode)
inputs.property "mode", mode
dependsOn framework.linkTask
from { framework.outputFile.parentFile }
into frameworkDir
doLast {
new File(frameworkDir, 'gradlew').with {
text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
setExecutable(true)
}
}
}
// Run packForXcode when building.
tasks.build.dependsOn packForXcode
2020-07-11 10:03:28 +00:00
android {
compileSdkVersion androidCompileSdkVersion
defaultConfig {
minSdkVersion androidMinSdkVersion
targetSdkVersion androidTargetSdkVersion
versionName version
versionCode appVersionCode
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
pickFirst 'META-INF/ktor-http.kotlin_module'
pickFirst 'META-INF/kotlinx-io.kotlin_module'
pickFirst 'META-INF/atomicfu.kotlin_module'
pickFirst 'META-INF/ktor-utils.kotlin_module'
pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
pickFirst 'META-INF/ktor-client-core.kotlin_module'
pickFirst 'META-INF/DEPENDENCIES'
pickFirst 'META-INF/NOTICE'
pickFirst 'META-INF/LICENSE'
pickFirst 'META-INF/LICENSE.txt'
pickFirst 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
}