Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
djordjeh committed Feb 26, 2024
2 parents 5a0eac1 + abd4eec commit ffe6dc1
Show file tree
Hide file tree
Showing 80 changed files with 922 additions and 324 deletions.
93 changes: 4 additions & 89 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,91 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.library")
id("kotlin-android")
id("maven-publish")
id("io.gitlab.arturbosch.detekt")
}

android {
compileSdk = ConfigData.targetSdkVersion
defaultConfig {
minSdk = ConfigData.minSdkVersion
ndk {
abiFilters.add("armeabi-v7a")
}
}

buildFeatures {
viewBinding = true
}

buildTypes {
getByName(ConfigData.BuildType.RELEASE) {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}

compileOptions {
sourceCompatibility = ConfigData.JAVA_VERSION
targetCompatibility = ConfigData.JAVA_VERSION
isCoreLibraryDesugaringEnabled = true
}

tasks.withType<Test> {
useJUnitPlatform()
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = ConfigData.JVM_TARGET
freeCompilerArgs = listOf(
"-Xstring-concat=inline"
)
}
}

testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
namespace = "de.tillhub.printengine"
}

dependencies {
// Core Dependencies
implementation(libs.bundles.core)
coreLibraryDesugaring(libs.android.desugarJdkLibs)
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

// Pax Dependencies
implementation(libs.google.zxing)

// Sunmi Dependencies
implementation(libs.sunmi.printer)

// Utils
implementation(libs.timber)
detektPlugins(libs.detekt.formatting)

// Unit tests
testImplementation(libs.bundles.testing)
testImplementation(libs.bundles.robolectric)
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>(ConfigData.artifactId) {
groupId = ConfigData.applicationId
artifactId = ConfigData.artifactId
version = ConfigData.versionName

from(components.getByName("release"))
}
}
}
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.androidLibrary) apply false
}
19 changes: 0 additions & 19 deletions buildSrc/build.gradle.kts

This file was deleted.

12 changes: 0 additions & 12 deletions buildSrc/settings.gradle.kts

This file was deleted.

17 changes: 0 additions & 17 deletions buildSrc/src/main/java/ConfigData.kt

This file was deleted.

53 changes: 47 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
[versions]
# Define the dependency versions
kotlin = "1.8.22"
kotlinCoroutines = "1.7.1"
androidGradlePlugin = "8.1.1"
agp = "8.2.2"
kotlin = "1.9.22"
kotlinCoroutines = "1.7.3"
core = "1.12.0"
zxing = "3.5.0"
sunmiPrinter = "1.0.19"
timber = "5.0.1"
androidDesugarJdkLibs = "1.2.2"
detekt = "1.18.1"
detekt = "1.23.3"

junit = "4.13.2"
mockk = "1.13.7"
mockk = "1.13.8"
robolectric = "4.10"
kotest = "4.6.4"
kotestRobolectric = "0.4.0"
coreTest = "1.5.0"
androidx-test-ext-junit = "1.1.5"
espresso-core = "3.5.1"
appcompat = "1.6.1"
material = "1.11.0"


lifecycle = "2.7.0"
activity-compose = "1.8.2"
compose-bom = "2024.02.00"
material3 = "1.2.0"
uiToolingPreviewAndroid = "1.6.1"

[libraries]
# Define the libraries
Expand All @@ -30,6 +41,15 @@ androidx-core = { group = "androidx.core", name = "core-ktx", version.ref = "cor
google-zxing = { group = "com.google.zxing", name = "core", version.ref = "zxing" }
sunmi-printer = { group = "com.sunmi", name = "printerlibrary", version.ref = "sunmiPrinter" }

activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" }
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
compose-ui = { group = "androidx.compose.ui", name = "ui" }
compose-preview-android = { group = "androidx.compose.ui", name = "ui-tooling-preview-android", version.ref = "uiToolingPreviewAndroid" }
compose-material3 = { group = "androidx.compose.material3", name = "material3",version.ref = "material3" }

androidx-lifecycle-common = { group = "androidx.lifecycle", name = "lifecycle-common", version.ref = "lifecycle" }
androidx-lifecycle-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime", version.ref = "lifecycle" }

# Unit testing
junit = { group = "junit", name = "junit", version.ref = "junit" }
mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
Expand All @@ -45,10 +65,20 @@ kotest-robolectric = { group = "io.kotest.extensions", name = "kotest-extensions
androidx-test-core = { group = "androidx.test", name = "core-ktx", version.ref = "coreTest" }

# Dependencies of the included build-logic
gradlePlugin-android = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
gradlePlugin-android = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" }
gradlePlugin-kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
gradlePlugin-detekt = { group = "io.gitlab.arturbosch.detekt", name = "detekt-gradle-plugin", version.ref = "detekt" }
detekt-formatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }

[bundles]
core = [
Expand All @@ -71,3 +101,14 @@ robolectric = [
"kotest.robolectric",
"androidx.test.core"
]
compose = [
"activity.compose",
"compose.bom",
"compose.ui",
"compose.material3",
"compose-preview-android",
]
lifecycle = [
"androidx.lifecycle.common",
"androidx.lifecycle.runtime",
]
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Oct 28 09:52:12 CEST 2022
#Tue Feb 20 12:51:19 CET 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
93 changes: 93 additions & 0 deletions print-engine/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.detekt)
id("maven-publish")
}

android {
namespace = "de.tillhub.printengine"
compileSdk = 34

defaultConfig {
minSdk = 21
ndk {
abiFilters.add("armeabi-v7a")
}
}

buildFeatures {
viewBinding = true
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}

tasks.withType<Test> {
useJUnitPlatform()
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
freeCompilerArgs = listOf(
"-Xstring-concat=inline"
)
}
}

testOptions {
unitTests {
isIncludeAndroidResources = true
}
}

}

dependencies {
// Core Dependencies
implementation(libs.bundles.core)
coreLibraryDesugaring(libs.android.desugarJdkLibs)
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

// Pax Dependencies
implementation(libs.google.zxing)

// Sunmi Dependencies
implementation(libs.sunmi.printer)

// Utils
implementation(libs.timber)
detektPlugins(libs.detekt.formatting)

// Unit tests
testImplementation(libs.bundles.testing)
testImplementation(libs.bundles.robolectric)
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>("print-engine") {
groupId = "de.tillhub.printengine"
artifactId = "print-engine"
version = "1.7.0"

from(components.getByName("release"))
}
}
}
}
Empty file added print-engine/consumer-rules.pro
Empty file.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions proguard-rules.pro → print-engine/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@
-keep class com.verifone.peripherals.** {
*;
}

-dontwarn com.verifone.peripherals.CashDrawer
-dontwarn com.verifone.peripherals.Scanner
-dontwarn com.verifone.utilities.BaseParcel$ParcelCreator
-dontwarn com.verifone.utilities.BaseParcel
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest/>
<manifest />
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ sealed class PrintCommand {
* the paper needs to be fed out automatically
* But if the Api does not support it, it will be replaced by printing three lines
*/
object FeedPaper : PrintCommand()
data object FeedPaper : PrintCommand()
/**
* Printer cuts paper and throws exception on machines without a cutter
*/
object CutPaper : PrintCommand()
data object CutPaper : PrintCommand()
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class PaxPrinterController(
* Start printer and prints data in buffer.This is synchronous interface.
*/
override fun start() {
printerState.value = PrinterState.Busy
printerService.start()
printerService.init()
fontSize?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ object PaxUtils {
* Centers content in space width.
*/
fun formatCode(content: String, space: Int): String {
return if (space < content.length) content.take(space)
else {
return if (space < content.length) {
content.take(space)
} else {
val padStart = (space - content.length) / 2
(" ".repeat(padStart) + content).padEnd(space)
}
Expand Down
Loading

0 comments on commit ffe6dc1

Please sign in to comment.