KOTLIN MULTIPLATFORM NETWORKING · INSTALLATION
KitsuneNET
Przenośny klient Ktor oraz warstwa zgodności OkHttp dla Androida/JVM.
A portable Ktor client with the Android/JVM OkHttp compatibility layer.
1. Dodaj repozytorium pakietów1. Add the package repository
Dodaj repozytorium do dependencyResolutionManagement w pliku settings.gradle.kts. Dane dostępowe są pobierane wyłącznie ze zmiennych środowiskowych — dokumentacja celowo nie zawiera żadnych wartości kluczy.
Add the repository to dependencyResolutionManagement in settings.gradle.kts. Credentials are read only from environment variables—this documentation intentionally contains no key values.
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/nerdrip/kitsune-net")
credentials {
username = providers.environmentVariable("GITHUB_ACTOR").orNull
password = providers.environmentVariable("GITHUB_TOKEN").orNull
}
}
}
}
GITHUB_ACTOR i GITHUB_TOKEN w lokalnym środowisku lub magazynie sekretów CI. Token do pobierania pakietów wymaga uprawnienia read:packages. Nie zapisuj jego wartości w repozytorium.
Set GITHUB_ACTOR and GITHUB_TOKEN in your local environment or CI secret store. Package downloads require read:packages. Never store the token value in the repository.
2. Wybierz kanał i dodaj zależność2. Choose a channel and add the dependency
Kotlin Multiplatform Stable 3.x
Dodaj logiczną współrzędną kitsunenet-core do commonMain. Gradle wybierze Ktor Android, CIO dla JVM/Desktop, Darwin dla iOS lub JS dla Wasm. Nie dodawaj ręcznie wygenerowanych artefaktów -android, -jvm, -iosarm64, -iossimulatorarm64, -iosx64 ani -wasm-js.
Add the logical kitsunenet-core coordinate to commonMain. Gradle selects Ktor Android, CIO for JVM/Desktop, Darwin for iOS or JS for Wasm. Do not declare generated -android, -jvm, -iosarm64, -iossimulatorarm64, -iosx64 or -wasm-js artifacts.
kotlin {
sourceSets {
commonMain.dependencies {
implementation("rip.nerd.kitsunenet:kitsunenet-core:3.0.0")
}
androidMain.dependencies {
// Optional legacy OkHttp/WebSocket/GraphQL compatibility API:
implementation("rip.nerd.kitsunenet:kitsunenet:3.0.0")
}
}
}
Next 3.0.1-SNAPSHOT
commonMain.dependencies {
implementation("rip.nerd.kitsunenet:kitsunenet-core:3.0.1-SNAPSHOT")
}
Katalog artefaktówArtifact catalog
| Artifact | Funkcja i zakresFunction and scope | Platforms |
|---|---|---|
kitsunenet-core | Ktor text/binary transport, typed results, retry and circuit breaker, interceptors, auth, deduplication, rate limiting, cache contracts, persistent queue contracts and SSE parser. | Android, JVM, iOS, Wasm |
kitsunenet | Legacy OkHttp API with Android network monitoring, WebSocket, GraphQL, streaming, pin rotation, resumable transfer and compatibility facade. It exports core on Android. | Android only |
Funkcje zależne od hosta są otwarte: własny transport implementuje NetTransport, trwałą kolejkę NetQueueStorage, a cache ResponseCache. Pozwala to użyć IndexedDB, NSURLCache, SQL lub innego magazynu bez wymuszania jednego dostawcy.
Host-dependent functions remain open: implement NetTransport for another transport, NetQueueStorage for a durable queue and ResponseCache for caching. This permits IndexedDB, NSURLCache, SQL or another store without forcing one provider.
3. Zsynchronizuj i sprawdź projekt3. Sync and verify the project
Po zmianie zależności wykonaj synchronizację Gradle, a następnie zbuduj wariant debug aplikacji:
After changing the dependency, sync Gradle and build the app's debug variant:
./gradlew :app:assembleDebug
W systemie Windows użyj gradlew.bat zamiast ./gradlew.
On Windows, use gradlew.bat instead of ./gradlew.
Ręczna publikacja wersjiManual version publishing
Poniższe polecenia są przeznaczone dla opiekuna biblioteki. Wartości poświadczeń pozostają w środowisku lub magazynie sekretów i nie są częścią komendy.
The commands below are for library maintainers. Credential values remain in the environment or secret store and are never part of the command.
Snapshot z gałęzi developSnapshot from the develop branch
./gradlew :kitsunenet:publishAarPublicationToGitHubPackagesRepository :kitsunenet-core:publishAllPublicationsToGitHubPackagesRepository -Psnapshot=true --no-daemon
Buduje wariant deweloperski i publikuje wersję z sufiksem -SNAPSHOT.
Builds the development variant and publishes a version carrying the -SNAPSHOT suffix.
Wersja stabilna z main lub taga wydaniaStable version from main or a release tag
./gradlew :kitsunenet:publishAarPublicationToGitHubPackagesRepository :kitsunenet-core:publishAllPublicationsToGitHubPackagesRepository -Psnapshot=false --no-daemon
Buduje wariant release bez sufiksu. Uruchamiaj wyłącznie z czystego commita przeznaczonego do wydania.
Builds the release variant without a suffix. Run it only from a clean commit intended for release.
Lokalny snapshot do pracyLocal development snapshot
./gradlew :kitsunenet:publishAarPublicationToMavenLocal :kitsunenet-core:publishAllPublicationsToMavenLocal -Psnapshot=true --no-daemon
Zadanie Maven Local publikuje linię 3.x z sufiksem -local-SNAPSHOT.
The Maven Local task publishes the 3.x line with the -local-SNAPSHOT suffix.
Lokalna wersja produkcyjnaLocal production build
./gradlew :kitsunenet:publishAarPublicationToMavenLocal :kitsunenet-core:publishAllPublicationsToMavenLocal -Psnapshot=false --no-daemon
Publikuje wariant release jako rip.nerd.kitsunenet:kitsunenet:3.0.0-local. Wersja produkcyjna lokalna nie ma sufiksu -SNAPSHOT.
Publishes the release variant as rip.nerd.kitsunenet:kitsunenet:3.0.0-local. A local production build never carries the -SNAPSHOT suffix.
mavenLocal() i używać dokładnej wersji -local. Dzięki osobnym współrzędnym lokalny artefakt nie może zasłonić zdalnego Stable ani Snapshot.The test project must enable mavenLocal() and request the exact -local version. Separate coordinates prevent a local artifact from shadowing remote Stable or Snapshot builds.repositories { mavenLocal() }
dependencies {
implementation("rip.nerd.kitsunenet:kitsunenet:3.0.1-local-SNAPSHOT")
}
ZasadyRules
*MavenLocal*zawsze dodaje-local; opcja-Plocal=truesłuży tylko do podglądu wersji, np. przezprintPublicationVersion.*MavenLocal*always adds-local;-Plocal=trueis only needed to inspect the version, for example withprintPublicationVersion.- Artefaktów
-localnie wolno wysyłać do współdzielonego repozytorium; build zdalnej publikacji jest przed tym zabezpieczony.-localartifacts must never be uploaded to a shared repository; remote publishing fails fast if this is attempted. -local-SNAPSHOTjest nadpisywalny. Przed opublikowaniem zmienionej wersji-localbez Snapshot należy podnieśćbaseVersion.-local-SNAPSHOTis replaceable. BumpbaseVersionbefore publishing changed-localcontent without Snapshot.- Gałąź
developpublikuje3.0.1-SNAPSHOT; stabilne wydania powstają wyłącznie z tagów.developpublishes3.0.1-SNAPSHOT; stable releases are created only from tags.