diff --git a/EpcQrCode/build.gradle.kts b/EpcQrCode/build.gradle.kts index 1dd0425..7f6548b 100644 --- a/EpcQrCode/build.gradle.kts +++ b/EpcQrCode/build.gradle.kts @@ -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(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) \ No newline at end of file +} \ No newline at end of file diff --git a/EpcQrCode/src/androidMain/kotlin/net/codinux/banking/epcqrcode/QrCodeGenerator.kt b/EpcQrCode/src/androidMain/kotlin/net/codinux/banking/epcqrcode/QrCodeGenerator.kt deleted file mode 100644 index 3ae909f..0000000 --- a/EpcQrCode/src/androidMain/kotlin/net/codinux/banking/epcqrcode/QrCodeGenerator.kt +++ /dev/null @@ -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 - } - -} \ No newline at end of file diff --git a/EpcQrCode/src/main/AndroidManifest.xml b/EpcQrCode/src/main/AndroidManifest.xml deleted file mode 100644 index 4b154e5..0000000 --- a/EpcQrCode/src/main/AndroidManifest.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 19903dc..462404e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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