Skip to content
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
11 changes: 3 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Create secrets file
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
- name: Release build and source jar generation
run: ./gradlew :krate:assembleRelease :krate-gson:assembleRelease :krate-moshi-stub:assembleRelease :krate-moshi-core:assembleRelease :krate-moshi-reflect:assembleRelease :krate-moshi-codegen:assembleRelease :krate-kotlinx:assembleRelease :krate:androidSourcesJar :krate-gson:androidSourcesJar :krate-moshi-stub:androidSourcesJar :krate-moshi-core:androidSourcesJar :krate-moshi-reflect:androidSourcesJar :krate-moshi-codegen:androidSourcesJar :krate-kotlinx:androidSourcesJar
run: ./gradlew assembleRelease androidSourcesJar -x :app:assembleRelease
- name: Publish to MavenCentral
run: ./gradlew publishReleasePublicationToSonatypeRepository closeAndReleaseRepository
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Log.d("LOGIN_COUNT", "Count: ${settings.loginCount}")
You can include _Krate_ in your project from the `mavenCentral()` repository, like so:

```groovy
implementation 'hu.autsoft:krate:1.0.0'
implementation 'hu.autsoft:krate:1.1.0'
```

# Optionals vs defaults
Expand Down Expand Up @@ -152,7 +152,7 @@ class CustomMoshiKrate(context: Context) : SimpleKrate(context) {
If you only want to use Moshi adapters that you generate via Moshi's [codegen facilities](https://github.com/square/moshi#codegen), you can use the following Krate artifact in your project to make use of these adapters:

```groovy
implementation 'hu.autsoft:krate-moshi-codegen:1.0.0'
implementation 'hu.autsoft:krate-moshi-codegen:1.1.0'
```

This will give you a default `Moshi` instance created by a call to `Moshi.Builder().build()`. This instance will find and use any of the adapters generated by Moshi's codegen automatically.
Expand All @@ -162,7 +162,7 @@ This will give you a default `Moshi` instance created by a call to `Moshi.Builde
If you rely on [reflection](https://github.com/square/moshi#reflection) for your Moshi serialization, and therefore need a `KotlinJsonAdapterFactory` included in your `Moshi` instance, use the following Krate Moshi dependency:

```groovy
implementation 'hu.autsoft:krate-moshi-reflect:1.0.0'
implementation 'hu.autsoft:krate-moshi-reflect:1.1.0'
```

The default `Moshi` instance from this dependency will include the aforementioned factory, and be able to serialize any Kotlin class. Note that this approach relies on the `kotlin-reflect` library, which is a large dependency.
Expand All @@ -174,7 +174,7 @@ You may choose to use Moshi's codegen for some classes in your project, and seri
The `krate-kotlinx` artifact provides a `kotlinxPref` delegate which can store any arbitrary type, as long as Kotlinx.serializazion can serialize and deserialize it. This addon, like the base library, is available from `mavenCentral()`:

```groovy
implementation 'hu.autsoft:krate-kotlinx:1.0.0'
implementation 'hu.autsoft:krate-kotlinx:1.1.0'
```

Its usage is the same as with any of the base library's delegates:
Expand Down Expand Up @@ -206,7 +206,7 @@ class CustomKotlinxKrate(context: Context) : SimpleKrate(context) {
The `krate-gson` artifact provides a `gsonPref` delegate which can store any arbitrary type, as long as Gson can serialize and deserialize it. This addon, like the base library, is available from `mavenCentral()`:

```groovy
implementation 'hu.autsoft:krate-gson:1.0.0'
implementation 'hu.autsoft:krate-gson:1.1.0'
```

Its basic usage is the same as with any of the base library's delegates:
Expand Down
19 changes: 10 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
buildscript {
ext.kotlin_version = '1.4.20'
ext.krate_version = '1.0.0'
ext.kotlin_version = '1.5.20'
ext.krate_version = '1.1.0'

ext.moshi_version = '1.9.3'
ext.junit_version = '4.13'
ext.moshi_version = '1.12.0'
ext.junit_version = '4.13.2'
ext.robolectric_version = '4.5.1'

ext.min_sdk = 15
ext.compile_sdk = 29
Expand All @@ -13,21 +14,20 @@ buildscript {
google()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.0"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
}
}

allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}

Expand All @@ -40,4 +40,5 @@ task clean(type: Delete) {
delete rootProject.buildDir
}

apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'io.github.gradle-nexus.publish-plugin'
apply from: "${rootProject.projectDir}/scripts/publish-root.gradle"
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
31 changes: 14 additions & 17 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 7 additions & 18 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions krate-gson/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

buildFeatures {
buildConfig false
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand All @@ -29,10 +33,10 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
dependencies {
implementation project(':krate')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'com.google.code.gson:gson:2.8.5'
api 'com.google.code.gson:gson:2.8.7'

testImplementation "junit:junit:$junit_version"
testImplementation 'org.robolectric:robolectric:4.3.1'
testImplementation "org.robolectric:robolectric:$robolectric_version"
}

// Publishing
Expand All @@ -42,4 +46,4 @@ ext {
PUBLISH_VERSION = android.defaultConfig.versionName
}

apply from: "${rootProject.projectDir}/scripts/publish-mavencentral.gradle"
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
10 changes: 7 additions & 3 deletions krate-kotlinx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

buildFeatures {
buildConfig false
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand All @@ -31,10 +35,10 @@ dependencies {
implementation project(':krate')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"

testImplementation "junit:junit:$junit_version"
testImplementation 'org.robolectric:robolectric:4.3.1'
testImplementation "org.robolectric:robolectric:$robolectric_version"
}

// Publishing
Expand All @@ -44,4 +48,4 @@ ext {
PUBLISH_VERSION = android.defaultConfig.versionName
}

apply from: "${rootProject.projectDir}/scripts/publish-mavencentral.gradle"
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
8 changes: 6 additions & 2 deletions krate-moshi-codegen/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

buildFeatures {
buildConfig false
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand All @@ -35,7 +39,7 @@ dependencies {
kaptTest "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"

testImplementation "junit:junit:$junit_version"
testImplementation 'org.robolectric:robolectric:4.3.1'
testImplementation "org.robolectric:robolectric:$robolectric_version"
}

// Publishing
Expand All @@ -45,4 +49,4 @@ ext {
PUBLISH_VERSION = android.defaultConfig.versionName
}

apply from: "${rootProject.projectDir}/scripts/publish-mavencentral.gradle"
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
6 changes: 5 additions & 1 deletion krate-moshi-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

buildFeatures {
buildConfig false
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand Down Expand Up @@ -42,4 +46,4 @@ ext {
PUBLISH_VERSION = android.defaultConfig.versionName
}

apply from: "${rootProject.projectDir}/scripts/publish-mavencentral.gradle"
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
8 changes: 6 additions & 2 deletions krate-moshi-reflect/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

buildFeatures {
buildConfig false
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand All @@ -34,7 +38,7 @@ dependencies {
api "com.squareup.moshi:moshi-kotlin:$moshi_version"

testImplementation "junit:junit:$junit_version"
testImplementation 'org.robolectric:robolectric:4.3.1'
testImplementation "org.robolectric:robolectric:$robolectric_version"
}

// Publishing
Expand All @@ -44,4 +48,4 @@ ext {
PUBLISH_VERSION = android.defaultConfig.versionName
}

apply from: "${rootProject.projectDir}/scripts/publish-mavencentral.gradle"
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
6 changes: 5 additions & 1 deletion krate-moshi-stub/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

buildFeatures {
buildConfig false
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand All @@ -39,4 +43,4 @@ ext {
PUBLISH_VERSION = android.defaultConfig.versionName
}

apply from: "${rootProject.projectDir}/scripts/publish-mavencentral.gradle"
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
Loading