Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some updates #10

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Dependency update:
- [Android Gradle Plugin 7.2.2](https://developer.android.com/studio/releases/gradle-plugin#7-2-0)
- [Gradle-7.5.1](https://docs.gradle.org/7.5.1/release-notes.html)
- [Kotlin 1.9.10](https://github.com/JetBrains/kotlin/releases/tag/v1.9.10)

## [1.0.6] - 2022-07-31
- Dependency update:
Expand Down
31 changes: 6 additions & 25 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
plugins {
kotlin("jvm") version "1.7.10" apply false
kotlin("jvm") version "1.9.10"
id("com.android.library") version "7.2.2" apply false
id("com.diffplug.spotless") version "6.9.0"
id("com.github.ben-manes.versions") version "0.42.0"
id("com.diffplug.spotless") version "6.21.0"
id("com.github.ben-manes.versions") version "0.47.0"
}

spotless {
format("misc") {
target("**/*.gradle", "*.md", "**/.gitignore")
trimTrailingWhitespace()
endWithNewline()
}
freshmark {
target("*.md")
target("**/*.md")
propertiesFile("gradle.properties")
}
kotlin {
target("source/**/src/**/*.kt")
targetExclude("**/build/**/*.kt")
ktlint().editorConfigOverride(
mapOf("disabled_rules" to "filename,no-wildcard-imports", "insert_final_newline" to false)
)
ktlint()
}
kotlinGradle {
target("**/*.gradle.kts")
ktlint().editorConfigOverride(mapOf("insert_final_newline" to false))
ktlint()
}
}

tasks {
withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
rejectVersionIf {
fun isStable(version: String) = Regex("^[0-9,.v-]+(-r)?$").matches(version)
!isStable(candidate.version) && isStable(currentVersion)
}
}
}
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Gradle
file.encoding=utf-8
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.vfs.watch=true

# Kotlin
kotlin.code.style=official
kotlin.mpp.stability.nowarn=true
kotlin.native.ignoreDisabledTargets=true

# Android
android.enableJetifier=true
Expand Down
11 changes: 2 additions & 9 deletions kase64/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

kotlin {
android { publishAllLibraryVariants() }
androidTarget { publishAllLibraryVariants() }
ios()
iosSimulatorArm64()
js {
Expand All @@ -29,15 +29,8 @@ kotlin {
sourceSets["iosSimulatorArm64Main"].dependsOn(sourceSets["iosMain"])
sourceSets["iosSimulatorArm64Test"].dependsOn(sourceSets["iosTest"])

sourceSets { // https://issuetracker.google.com/issues/152187160
remove(sourceSets["androidAndroidTestRelease"])
remove(sourceSets["androidTestFixtures"])
remove(sourceSets["androidTestFixturesDebug"])
remove(sourceSets["androidTestFixturesRelease"])
}

targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithSimulatorTests::class.java) {
testRuns["test"].deviceId = "iPhone 13"
testRuns["test"].deviceId = "iPhone 14"
}
}

Expand Down
Binary file not shown.
18 changes: 9 additions & 9 deletions kase64/src/commonTest/kotlin/saschpe/kase64/Base64Test.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ class Base64Test {
byteArrayOf(
-94, 124, -26, -112, -72, -84, 16, 11, 67, -45, 107, 38, -99, 79, 62, -49, 83, 26, -85, -70, -122, 53,
67, 42, -94, -87, 61, -74, 66, 0, 80, -125, -17, -11, -125, 63, 109, -15, 56, -95, -33, 18, 110, 47,
47, -20, -72, -34, 53, -69, 49, -45, 54, 53, -21, 43, 9, -84, -125, 72, -61, 76, 31, -46
47, -20, -72, -34, 53, -69, 49, -45, 54, 53, -21, 43, 9, -84, -125, 72, -61, 76, 31, -46,
),
"onzmkLisEAtD02smnU8+z1Maq7qGNUMqoqk9tkIAUIPv9YM/bfE4od8Sbi8v7LjeNbsx0zY16ysJrINIw0wf0g==".base64DecodedBytes
"onzmkLisEAtD02smnU8+z1Maq7qGNUMqoqk9tkIAUIPv9YM/bfE4od8Sbi8v7LjeNbsx0zY16ysJrINIw0wf0g==".base64DecodedBytes,
)
}

@Test
fun byteArray_base64Encoded() {
assertEquals(
"xvrp9DBWlei2mG0ov9MN+A==", // value1
byteArrayOf(-58, -6, -23, -12, 48, 86, -107, -24, -74, -104, 109, 40, -65, -45, 13, -8).base64Encoded
byteArrayOf(-58, -6, -23, -12, 48, 86, -107, -24, -74, -104, 109, 40, -65, -45, 13, -8).base64Encoded,
)
assertEquals(
"IkYJxF8nIQD9RY7Yk6r26A==", // value222
byteArrayOf(34, 70, 9, -60, 95, 39, 33, 0, -3, 69, -114, -40, -109, -86, -10, -24).base64Encoded
byteArrayOf(34, 70, 9, -60, 95, 39, 33, 0, -3, 69, -114, -40, -109, -86, -10, -24).base64Encoded,
)
assertEquals(
"U0GeVBi2dNcdL2IO0nJo5Q==", // value555
byteArrayOf(83, 65, -98, 84, 24, -74, 116, -41, 29, 47, 98, 14, -46, 114, 104, -27).base64Encoded
byteArrayOf(83, 65, -98, 84, 24, -74, 116, -41, 29, 47, 98, 14, -46, 114, 104, -27).base64Encoded,
)
}

Expand All @@ -58,12 +58,12 @@ class Base64Test {
assertEquals("Hello, world!", "SGVsbG8sIHdvcmxkIQ==".base64Decoded)
assertEquals(
Encoding.Standard.alphabet,
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==".base64Decoded
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==".base64Decoded,
)
assertEquals("abcd", "YWJjZA==".base64Decoded)
assertEquals(
"1234567890-=!@#\$%^&*()_+qwertyuiop[];'\\,./?><|\":}{P`~",
"MTIzNDU2Nzg5MC09IUAjJCVeJiooKV8rcXdlcnR5dWlvcFtdOydcLC4vPz48fCI6fXtQYH4=".base64Decoded
"MTIzNDU2Nzg5MC09IUAjJCVeJiooKV8rcXdlcnR5dWlvcFtdOydcLC4vPz48fCI6fXtQYH4=".base64Decoded,
)
assertEquals("saschpe", "c2FzY2hwZQ==".base64Decoded)
}
Expand All @@ -78,12 +78,12 @@ class Base64Test {
assertEquals("SGVsbG8sIHdvcmxkIQ==", "Hello, world!".encodeToByteArray().base64Encoded)
assertEquals(
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
Encoding.Standard.alphabet.base64Encoded
Encoding.Standard.alphabet.base64Encoded,
)
assertEquals("YWJjZA==", "abcd".base64Encoded)
assertEquals(
"MTIzNDU2Nzg5MC09IUAjJCVeJiooKV8rcXdlcnR5dWlvcFtdOydcLC4vPz48fCI6fXtQYH4=",
"1234567890-=!@#\$%^&*()_+qwertyuiop[];'\\,./?><|\":}{P`~".base64Encoded
"1234567890-=!@#\$%^&*()_+qwertyuiop[];'\\,./?><|\":}{P`~".base64Encoded,
)
assertEquals("c2FzY2hwZQ==", "saschpe".base64Encoded)
}
Expand Down
18 changes: 9 additions & 9 deletions kase64/src/commonTest/kotlin/saschpe/kase64/Base64UrlTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ class Base64UrlTest {
byteArrayOf(
-94, 124, -26, -112, -72, -84, 16, 11, 67, -45, 107, 38, -99, 79, 62, -49, 83, 26, -85, -70, -122, 53,
67, 42, -94, -87, 61, -74, 66, 0, 80, -125, -17, -11, -125, 63, 109, -15, 56, -95, -33, 18, 110, 47,
47, -20, -72, -34, 53, -69, 49, -45, 54, 53, -21, 43, 9, -84, -125, 72, -61, 76, 31, -46
47, -20, -72, -34, 53, -69, 49, -45, 54, 53, -21, 43, 9, -84, -125, 72, -61, 76, 31, -46,
),
"onzmkLisEAtD02smnU8-z1Maq7qGNUMqoqk9tkIAUIPv9YM_bfE4od8Sbi8v7LjeNbsx0zY16ysJrINIw0wf0g==".base64UrlDecodedBytes
"onzmkLisEAtD02smnU8-z1Maq7qGNUMqoqk9tkIAUIPv9YM_bfE4od8Sbi8v7LjeNbsx0zY16ysJrINIw0wf0g==".base64UrlDecodedBytes,
)
}

@Test
fun byteArray_base64UrlEncoded() {
assertEquals(
"xvrp9DBWlei2mG0ov9MN-A", // value1
byteArrayOf(-58, -6, -23, -12, 48, 86, -107, -24, -74, -104, 109, 40, -65, -45, 13, -8).base64UrlEncoded
byteArrayOf(-58, -6, -23, -12, 48, 86, -107, -24, -74, -104, 109, 40, -65, -45, 13, -8).base64UrlEncoded,
)
assertEquals(
"IkYJxF8nIQD9RY7Yk6r26A", // value222
byteArrayOf(34, 70, 9, -60, 95, 39, 33, 0, -3, 69, -114, -40, -109, -86, -10, -24).base64UrlEncoded
byteArrayOf(34, 70, 9, -60, 95, 39, 33, 0, -3, 69, -114, -40, -109, -86, -10, -24).base64UrlEncoded,
)
assertEquals(
"U0GeVBi2dNcdL2IO0nJo5Q", // value555
byteArrayOf(83, 65, -98, 84, 24, -74, 116, -41, 29, 47, 98, 14, -46, 114, 104, -27).base64UrlEncoded
byteArrayOf(83, 65, -98, 84, 24, -74, 116, -41, 29, 47, 98, 14, -46, 114, 104, -27).base64UrlEncoded,
)
}

Expand All @@ -59,14 +59,14 @@ class Base64UrlTest {
assertEquals("Hello, world!", "SGVsbG8sIHdvcmxkIQ==".base64UrlDecoded)
assertEquals(
Encoding.Standard.alphabet,
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==".base64UrlDecoded
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==".base64UrlDecoded,
)
assertEquals("Salt", "U2FsdA==".base64UrlDecoded)
assertEquals("Pepper", "UGVwcGVy".base64UrlDecoded)
assertEquals("abcd", "YWJjZA".base64UrlDecoded)
assertEquals(
"1234567890-=!@#\$%^&*()_+qwertyuiop[];'\\,./?><|\":}{P`~",
"MTIzNDU2Nzg5MC09IUAjJCVeJiooKV8rcXdlcnR5dWlvcFtdOydcLC4vPz48fCI6fXtQYH4".base64UrlDecoded
"MTIzNDU2Nzg5MC09IUAjJCVeJiooKV8rcXdlcnR5dWlvcFtdOydcLC4vPz48fCI6fXtQYH4".base64UrlDecoded,
)
assertEquals("saschpe", "c2FzY2hwZQ".base64UrlDecoded)
}
Expand All @@ -81,14 +81,14 @@ class Base64UrlTest {
assertEquals("SGVsbG8sIHdvcmxkIQ", "Hello, world!".encodeToByteArray().base64UrlEncoded)
assertEquals(
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw",
Encoding.Standard.alphabet.base64UrlEncoded
Encoding.Standard.alphabet.base64UrlEncoded,
)
assertEquals("U2FsdA", "Salt".base64UrlEncoded)
assertEquals("UGVwcGVy", "Pepper".base64UrlEncoded)
assertEquals("YWJjZA", "abcd".base64UrlEncoded)
assertEquals(
"MTIzNDU2Nzg5MC09IUAjJCVeJiooKV8rcXdlcnR5dWlvcFtdOydcLC4vPz48fCI6fXtQYH4",
"1234567890-=!@#\$%^&*()_+qwertyuiop[];'\\,./?><|\":}{P`~".base64UrlEncoded
"1234567890-=!@#\$%^&*()_+qwertyuiop[];'\\,./?><|\":}{P`~".base64UrlEncoded,
)
assertEquals("c2FzY2hwZQ", "saschpe".base64UrlEncoded)
}
Expand Down
5 changes: 3 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositories {
mavenCentral()
Expand All @@ -14,4 +15,4 @@ dependencyResolutionManagement {

rootProject.name = "Kase64"

include(":kase64")
include(":kase64")