Skip to content

Commit 3b7f5e3

Browse files
Change the package to com.squareup.zstd (#8)
Co-authored-by: Jesse Wilson <[email protected]>
1 parent 3e6ace0 commit 3b7f5e3

File tree

29 files changed

+66
-60
lines changed

29 files changed

+66
-60
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Okio Zstd
1+
# Zstd-KMP
22

3-
Build the native libraries:
3+
The [ZStandard compression library (zstd)][zstd], packaged for [Kotlin multiplatform (kmp)][kmp].
4+
5+
6+
## Building
47

58
# Git Submodules
69

@@ -15,13 +18,13 @@ git submodule update
1518
brew install cmake
1619
```
1720

18-
# macOS
21+
# Build JNI libraries on macOS
1922

2023
```
2124
./zstd-kmp/src/jvmMain/build-mac.sh
2225
```
2326

24-
# Linux
27+
# Build JNI libraries on Linux
2528

2629
```
2730
./zstd-kmp/src/jvmMain/build-linux.sh
@@ -32,3 +35,6 @@ brew install cmake
3235
```
3336
./gradlew zstd-kmp:jvmTest
3437
```
38+
39+
[kmp]: https://kotlinlang.org/docs/multiplatform.html
40+
[zstd]: https://github.com/facebook/zstd

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ configure<SpotlessExtension> {
5353
}
5454

5555
allprojects {
56-
group = "com.squareup.okio-zstd"
56+
group = "com.squareup.zstd"
5757
version = project.property("VERSION_NAME") as String
5858

5959
repositories {
@@ -74,7 +74,7 @@ subprojects {
7474
}
7575

7676
tasks.named("dokkaHtmlMultiModule", DokkaMultiModuleTask::class.java).configure {
77-
moduleName.set("Okio-Zstd")
77+
moduleName.set("Zstd-Kmp")
7878
}
7979

8080
allprojects {
@@ -160,7 +160,7 @@ allprojects {
160160
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
161161
signAllPublications()
162162
pom {
163-
description.set("ZStandard for Okio")
163+
description.set("ZStandard for Kotlin Multiplatform")
164164
name.set(project.name)
165165
url.set("https://github.com/square/okio-zstd/")
166166
licenses {

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
rootProject.name = "okio-zstd-root"
1+
rootProject.name = "zstd-kmp-root"
22

33
include(":zstd-kmp")
44

zstd-kmp/api/android/zstd-kmp.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public final class okio/zstd/Zstd {
1+
public final class com/squareup/zstd/Zstd {
22
public static final fun zstdCompress (Lokio/Sink;)Lokio/Sink;
33
public static final fun zstdDecompress (Lokio/Source;)Lokio/Source;
44
}

zstd-kmp/api/jvm/zstd-kmp.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public final class okio/zstd/Zstd {
1+
public final class com/squareup/zstd/Zstd {
22
public static final fun zstdCompress (Lokio/Sink;)Lokio/Sink;
33
public static final fun zstdDecompress (Lokio/Source;)Lokio/Source;
44
}

zstd-kmp/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ kotlin {
7878
main.cinterops {
7979
create("zstd") {
8080
header(file("../zstd/lib/zstd.h"))
81-
packageName("okio.zstd.internal")
81+
packageName("com.squareup.zstd.internal")
8282
}
8383
}
8484
}
@@ -127,7 +127,7 @@ cklib {
127127
}
128128

129129
android {
130-
namespace = "okio.zstd"
130+
namespace = "com.squareup.zstd"
131131
compileSdk = libs.versions.compileSdk.get().toInt()
132132

133133
defaultConfig {

zstd-kmp/native/OkioZstd.cpp renamed to zstd-kmp/native/ZstdKmp.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,35 +39,35 @@ JniZstd::JniZstd(JNIEnv *env, jclass zstdCompressorClass, jclass zstdDecompresso
3939
}
4040

4141
extern "C" JNIEXPORT jstring JNICALL
42-
Java_okio_zstd_JniZstd_getErrorName(JNIEnv* env, jobject type, jlong code) {
42+
Java_com_squareup_zstd_JniZstd_getErrorName(JNIEnv* env, jobject type, jlong code) {
4343
auto codeSizeT = static_cast<size_t>(code);
4444
if (!ZSTD_isError(codeSizeT)) return NULL;
4545
auto errorString = ZSTD_getErrorName(codeSizeT);
4646
return env->NewStringUTF(errorString);
4747
}
4848

4949
extern "C" JNIEXPORT jlong JNICALL
50-
Java_okio_zstd_JniZstd_createJniZstd(JNIEnv* env, jclass type) {
51-
auto zstdCompressorClass = env->FindClass("okio/zstd/ZstdCompressor");
52-
auto zstdDecompressorClass = env->FindClass("okio/zstd/ZstdDecompressor");
50+
Java_com_squareup_zstd_JniZstd_createJniZstd(JNIEnv* env, jclass type) {
51+
auto zstdCompressorClass = env->FindClass("com/squareup/zstd/ZstdCompressor");
52+
auto zstdDecompressorClass = env->FindClass("com/squareup/zstd/ZstdDecompressor");
5353
auto jniZstd = new JniZstd(env, zstdCompressorClass, zstdDecompressorClass);
5454
return reinterpret_cast<jlong>(jniZstd);
5555
}
5656

5757
extern "C" JNIEXPORT jlong JNICALL
58-
Java_okio_zstd_JniZstd_createZstdCompressor(JNIEnv* env, jclass type) {
58+
Java_com_squareup_zstd_JniZstd_createZstdCompressor(JNIEnv* env, jclass type) {
5959
ZSTD_CCtx* cctx = ZSTD_createCCtx(); // Could be NULL.
6060
return reinterpret_cast<jlong>(cctx);
6161
}
6262

6363
extern "C" JNIEXPORT jlong JNICALL
64-
Java_okio_zstd_JniZstdCompressor_setParameter(JNIEnv* env, jobject type, jlong cctxPointer, jint param, jint value) {
64+
Java_com_squareup_zstd_JniZstdCompressor_setParameter(JNIEnv* env, jobject type, jlong cctxPointer, jint param, jint value) {
6565
auto cctx = reinterpret_cast<ZSTD_CCtx*>(cctxPointer);
6666
return ZSTD_CCtx_setParameter(cctx, static_cast<ZSTD_cParameter>(param), value);
6767
}
6868

6969
extern "C" JNIEXPORT jlong JNICALL
70-
Java_okio_zstd_JniZstdCompressor_compressStream2(JNIEnv* env, jobject type, jlong jniZstdPointer, jlong cctxPointer, jbyteArray outputByteArray, jint outputEnd, jint outputStart, jbyteArray inputByteArray, jint inputEnd, jint inputStart, jint mode) {
70+
Java_com_squareup_zstd_JniZstdCompressor_compressStream2(JNIEnv* env, jobject type, jlong jniZstdPointer, jlong cctxPointer, jbyteArray outputByteArray, jint outputEnd, jint outputStart, jbyteArray inputByteArray, jint inputEnd, jint inputStart, jint mode) {
7171
auto jniZstd = reinterpret_cast<JniZstd*>(jniZstdPointer);
7272
auto cctx = reinterpret_cast<ZSTD_CCtx*>(cctxPointer);
7373

@@ -95,19 +95,19 @@ Java_okio_zstd_JniZstdCompressor_compressStream2(JNIEnv* env, jobject type, jlon
9595
}
9696

9797
extern "C" JNIEXPORT void JNICALL
98-
Java_okio_zstd_JniZstdCompressor_close(JNIEnv* env, jobject type, jlong cctxPointer) {
98+
Java_com_squareup_zstd_JniZstdCompressor_close(JNIEnv* env, jobject type, jlong cctxPointer) {
9999
auto cctx = reinterpret_cast<ZSTD_CCtx*>(cctxPointer);
100100
ZSTD_freeCCtx(cctx);
101101
}
102102

103103
extern "C" JNIEXPORT jlong JNICALL
104-
Java_okio_zstd_JniZstd_createZstdDecompressor(JNIEnv* env, jclass type) {
104+
Java_com_squareup_zstd_JniZstd_createZstdDecompressor(JNIEnv* env, jclass type) {
105105
ZSTD_DCtx* dctx = ZSTD_createDCtx(); // Could be NULL.
106106
return reinterpret_cast<jlong>(dctx);
107107
}
108108

109109
extern "C" JNIEXPORT jlong JNICALL
110-
Java_okio_zstd_JniZstdDecompressor_decompressStream(JNIEnv* env, jobject type, jlong jniZstdPointer, jlong dctxPointer, jbyteArray outputByteArray, jint outputEnd, jint outputStart, jbyteArray inputByteArray, jint inputEnd, jint inputStart) {
110+
Java_com_squareup_zstd_JniZstdDecompressor_decompressStream(JNIEnv* env, jobject type, jlong jniZstdPointer, jlong dctxPointer, jbyteArray outputByteArray, jint outputEnd, jint outputStart, jbyteArray inputByteArray, jint inputEnd, jint inputStart) {
111111
auto jniZstd = reinterpret_cast<JniZstd*>(jniZstdPointer);
112112
auto dctx = reinterpret_cast<ZSTD_DCtx*>(dctxPointer);
113113

@@ -134,7 +134,7 @@ Java_okio_zstd_JniZstdDecompressor_decompressStream(JNIEnv* env, jobject type, j
134134
}
135135

136136
extern "C" JNIEXPORT void JNICALL
137-
Java_okio_zstd_JniZstdDecompressor_close(JNIEnv* env, jobject type, jlong dctxPointer) {
137+
Java_com_squareup_zstd_JniZstdDecompressor_close(JNIEnv* env, jobject type, jlong dctxPointer) {
138138
auto dctx = reinterpret_cast<ZSTD_DCtx*>(dctxPointer);
139139
ZSTD_freeDCtx(dctx);
140140
}

zstd-kmp/src/androidMain/kotlin/okio/zstd/AndroidZstd.kt renamed to zstd-kmp/src/androidMain/kotlin/com/squareup/zstd/AndroidZstd.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package okio.zstd
16+
package com.squareup.zstd
1717

1818
internal actual fun loadNativeLibrary() {
1919
System.loadLibrary("zstd-kmp")

zstd-kmp/src/commonMain/kotlin/okio/zstd/Zstd.kt renamed to zstd-kmp/src/commonMain/kotlin/com/squareup/zstd/Zstd.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@file:Suppress("ktlint:standard:property-naming")
1717
@file:JvmName("Zstd")
1818

19-
package okio.zstd
19+
package com.squareup.zstd
2020

2121
import kotlin.jvm.JvmName
2222
import okio.IOException

zstd-kmp/src/commonMain/kotlin/okio/zstd/ZstdCompressSink.kt renamed to zstd-kmp/src/commonMain/kotlin/com/squareup/zstd/ZstdCompressSink.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package okio.zstd
16+
package com.squareup.zstd
1717

1818
import kotlin.jvm.JvmField
1919
import okio.Buffer

0 commit comments

Comments
 (0)