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
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
25 changes: 7 additions & 18 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand All @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -61,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
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