Updated to Kotlin version 1.6.10

This commit is contained in:
dankito 2022-03-13 21:40:26 +01:00
parent 8d9de1a4cd
commit 06a1ac0b95
4 changed files with 15 additions and 104 deletions

View File

@ -1,8 +1,5 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
id("com.android.library")
}
@ -11,10 +8,12 @@ kotlin {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
android()
ios {
binaries {
framework {
@ -23,9 +22,11 @@ kotlin {
}
}
js {
js(IR) {
browser {
testTask {
this.isEnabled = false
useKarma {
useChromeHeadless()
webpackConfig.cssSupport.enabled = true
@ -50,7 +51,11 @@ kotlin {
sourceSets {
val commonMain by getting
val commonMain by getting {
dependencies {
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
@ -69,14 +74,6 @@ kotlin {
}
}
val androidMain by getting {
dependencies {
implementation("com.google.zxing:core:3.3.0")
implementation("com.google.zxing:android-core:3.3.0")
implementation("com.google.zxing:android-integration:3.3.0")
}
}
val iosMain by getting
val iosTest by getting
@ -86,48 +83,10 @@ kotlin {
implementation(kotlin("test-js"))
}
}
val nodeJsMain by getting
val nodeJsTest by getting
val nativeMain by getting
val nativeTest by getting
}
}
android {
compileSdkVersion(29)
defaultConfig {
minSdkVersion(24)
targetSdkVersion(29)
versionCode = 1
versionName = "1.0.0"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
lintOptions {
isCheckReleaseBuilds = false
//If you want to continue even if errors found use following line
isAbortOnError = false
}
}
val packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
val framework = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByName("build").dependsOn(packForXcode)
}

View File

@ -1,42 +0,0 @@
package net.codinux.banking.epcqrcode
import android.graphics.Bitmap
import android.graphics.Bitmap.CompressFormat
import android.graphics.Color
import com.google.zxing.BarcodeFormat
import com.google.zxing.qrcode.QRCodeWriter
import java.io.ByteArrayOutputStream
class QrCodeGenerator {
fun generateQrCodeAsByteArray(informationToEncode: String, config: EncodeToQrCodeConfig = EncodeToQrCodeConfig()): ByteArray {
val bitMatrix = QRCodeWriter().encode(informationToEncode, BarcodeFormat.QR_CODE, config.width, config.height)
val bitmap = Bitmap.createBitmap(config.width, config.height, Bitmap.Config.RGB_565)
for (x in 0 until config.width) {
for (y in 0 until config.height) {
bitmap.setPixel(x, y, if (bitMatrix.get(x, y)) Color.BLACK else Color.WHITE)
}
}
val blob = ByteArrayOutputStream()
bitmap.compress(if (config.format == ImageFormat.JPEG) CompressFormat.JPEG else CompressFormat.PNG, 100 /* Ignored for PNGs */, blob)
return blob.toByteArray()
}
fun generateQrCode(informationToEncode: String, config: EncodeToQrCodeConfig = EncodeToQrCodeConfig()): Bitmap {
val bitMatrix = QRCodeWriter().encode(informationToEncode, BarcodeFormat.QR_CODE, config.width, config.height)
val bitmap = Bitmap.createBitmap(config.width, config.height, Bitmap.Config.RGB_565)
for (x in 0 until config.width) {
for (y in 0 until config.height) {
bitmap.setPixel(x, y, if (bitMatrix.get(x, y)) Color.BLACK else Color.WHITE)
}
}
return bitmap
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="net.codinux.banking.epcqrcode">
</manifest>

View File

@ -3,6 +3,6 @@ kotlin.js.generate.executable.default=false
xcodeproj=./EpcQrCodeiOSApp
kotlinVersion=1.4.10
kotlinVersion=1.6.10
quarkusVersion=1.8.2.Final