159 lines
3.6 KiB
Groovy
159 lines
3.6 KiB
Groovy
|
plugins {
|
||
|
id 'org.jetbrains.kotlin.multiplatform'
|
||
|
// id 'java-library'
|
||
|
id "com.android.library" // TODO: get rid off, use java-library instead
|
||
|
id "maven-publish"
|
||
|
}
|
||
|
|
||
|
|
||
|
ext.artifactName = "epc-qr-code-parser"
|
||
|
|
||
|
def frameworkName = "EpcQrCodeParser"
|
||
|
|
||
|
|
||
|
kotlin {
|
||
|
|
||
|
targets {
|
||
|
final def iOSTarget = iOSIsRealDevice ? presets.iosArm64 : presets.iosX64
|
||
|
|
||
|
fromPreset(iOSTarget, 'ios') {
|
||
|
binaries {
|
||
|
framework {
|
||
|
baseName = frameworkName
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
jvm()
|
||
|
|
||
|
js {
|
||
|
|
||
|
nodejs {
|
||
|
testTask {
|
||
|
enabled = false
|
||
|
}
|
||
|
}
|
||
|
|
||
|
browser {
|
||
|
testTask {
|
||
|
enabled = false
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
sourceSets {
|
||
|
commonMain {
|
||
|
dependencies {
|
||
|
implementation kotlin('stdlib-common')
|
||
|
}
|
||
|
}
|
||
|
commonTest {
|
||
|
dependencies {
|
||
|
implementation kotlin('test-common')
|
||
|
implementation kotlin('test-annotations-common')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
jvmMain {
|
||
|
dependencies {
|
||
|
implementation kotlin('stdlib-jdk8')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
jvmTest {
|
||
|
dependencies {
|
||
|
implementation kotlin('test')
|
||
|
implementation kotlin('test-junit')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
jsMain {
|
||
|
dependencies {
|
||
|
implementation kotlin('stdlib-js')
|
||
|
}
|
||
|
}
|
||
|
jsTest {
|
||
|
dependencies {
|
||
|
implementation kotlin('test-js')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
iosMain {
|
||
|
}
|
||
|
iosTest {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
// Task to generate iOS framework for xcode projects.
|
||
|
task packForXcode(type: Sync) {
|
||
|
|
||
|
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
|
||
|
|
||
|
|
||
|
// TODO: get rid of this
|
||
|
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
|
||
|
}
|
||
|
|
||
|
}
|