Skip to content

Commit

Permalink
Update to latest dependencies (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmook authored Feb 21, 2021
1 parent a5d9855 commit 2190767
Show file tree
Hide file tree
Showing 42 changed files with 444 additions and 382 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

61 changes: 23 additions & 38 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Main

on:
push:
Expand All @@ -10,12 +10,16 @@ on:
branches:
- main

env:
CI: "true"

jobs:
build:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1

build:
needs: [validation]
runs-on: ubuntu-latest

steps:
Expand All @@ -26,44 +30,25 @@ jobs:
with:
java-version: 1.8

- name: gradle cache
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: gradle wrapper cache
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper/dists
key: ${{ runner.os }}-gradlewrapper
- name: Build with Gradle
run: ./gradlew assemble check --stacktrace

- name: NVD CVE cache
uses: actions/cache@v1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.6
with:
path: ~/.gradle/dependency-check-data
key: ${{ runner.os }}-dependency-check-data

- name: Assemble
run: ./gradlew assemble --stacktrace

- name: Check
run: ./gradlew check --stacktrace
token: ${{secrets.CODECOV_TOKEN}}

- name: Set tag version
run: echo ::set-env name=CIRCLE_TAG::$(echo ${GITHUB_REF:10})
- name: Prepare tag properties
run: |
echo "${{secrets.GPG_SIGNING_SECRET_KEY_RING_FILE_BASE64}}" > ~/.gradle/sonatype-appmattus-keys.gpg.b64
base64 -d ~/.gradle/sonatype-appmattus-keys.gpg.b64 > ~/.gradle/sonatype-appmattus-keys.gpg
echo "${{secrets.GPG_GRADLE_PROPERTIES}}" > ~/.gradle/gradle.properties
if: startsWith(github.ref, 'refs/tags/')

- name: Upload tag
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
run: ./gradlew bintrayUpload
run: ./gradlew publish --no-daemon --no-parallel -Psigning.secretKeyRingFile=$(echo ~/.gradle/sonatype-appmattus-keys.gpg)
if: startsWith(github.ref, 'refs/tags/')

- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{secrets.CODECOV_TOKEN}}
- name: Close and release tag
run: ./gradlew closeAndReleaseRepository
if: startsWith(github.ref, 'refs/tags/')
7 changes: 2 additions & 5 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: "UI Tests"

on:
push:
Expand All @@ -10,9 +10,6 @@ on:
branches:
- main

env:
CI: "true"

jobs:
test:
runs-on: macos-latest
Expand All @@ -24,7 +21,7 @@ jobs:
uses: actions/checkout@v2

- name: run tests
uses: reactivecircus/android-emulator-runner@v2.11.0
uses: reactivecircus/android-emulator-runner@v2.14.3
with:
api-level: ${{ matrix.api-level }}
script: ./gradlew connectedCheck
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ or watch the talk from [droidcon London 2017](https://skillsmatter.com/skillscas
### Base module

```kotlin
implementation("com.appmattus:layercache:<latest-version>")
implementation("com.appmattus.layercache:layercache:<latest-version>")
```

#### Composing two caches
Expand Down Expand Up @@ -89,7 +89,7 @@ val valueTransform: Cache<Key, MappedValue> = cache.valueTransform(OneWayTransfo
##### Encrypting values

```kotlin
implementation("com.appmattus:layercache-android-encryption:<latest-version>")
implementation("com.appmattus.layercache:layercache-android-encryption:<latest-version>")
```

There is support for encrypting string keys and string values (in any cache) on
Expand Down Expand Up @@ -141,7 +141,7 @@ val newCache: Cache<Key, Value> = cache.reuseInflight()
### Serializer module

```kotlin
implementation("com.appmattus:layercache-serializer:<latest-version>")
implementation("com.appmattus.layercache:layercache-serializer:<latest-version>")
```

Configures a transformation from JSON to a serialisable data class and
Expand All @@ -161,7 +161,7 @@ val objectCache: Cache<Key, Value> = cache.jsonSerializer(Value::class.serialize
### Android base module

```kotlin
implementation("com.appmattus:layercache-android:<latest-version>")
implementation("com.appmattus.layercache:layercache-android:<latest-version>")
```

#### LruCache
Expand Down Expand Up @@ -259,7 +259,7 @@ val longValueCache: Cache<String, Long> =
### Android LiveData module

```kotlin
implementation("com.appmattus:layercache-android-livedata:<latest-version>")
implementation("com.appmattus.layercache:layercache-android-livedata:<latest-version>")
```

Given a cache we can convert it for use with LiveData. This makes the getter
Expand All @@ -284,31 +284,29 @@ liveDataCache.get("key").observe(owner) { liveDataResult ->

```

## Download [![Download](https://api.bintray.com/packages/appmattus/maven/layercache/images/download.svg)](https://bintray.com/appmattus/maven/layercache/_latestVersion)

Available from jcenter()
## Download [![Maven Central](https://img.shields.io/maven-central/v/com.appmattus.layercache/layercache)](https://search.maven.org/search?q=g:com.appmattus.layercache)

```kotlin
dependencies {
implementation("com.appmattus:layercache:<latest-version>")
implementation("com.appmattus.layercache:layercache:<latest-version>")

// To use with the Kotlin serializer
implementation("com.appmattus:layercache-serializer:<latest-version>")
implementation("com.appmattus.layercache:layercache-serializer:<latest-version>")

// Provides support for ehcache
implementation("com.appmattus:layercache-ehcache:<latest-version>")
implementation("com.appmattus.layercache:layercache-ehcache:<latest-version>")

// Provides support for cache2k
implementation("com.appmattus:layercache-cache2k:<latest-version>")
implementation("com.appmattus.layercache:layercache-cache2k:<latest-version>")

// Provides LruCache & DiskLruCache support for Android
implementation("com.appmattus:layercache-android:<latest-version>")
implementation("com.appmattus.layercache:layercache-android:<latest-version>")

// Provides one-line String encryption for Android
implementation("com.appmattus:layercache-android-encryption:<latest-version>")
implementation("com.appmattus.layercache:layercache-android-encryption:<latest-version>")

// Provides conversion from Cache into LiveData for Android
implementation("com.appmattus:layercache-android-livedata:<latest-version>")
implementation("com.appmattus.layercache:layercache-android-livedata:<latest-version>")
}
```

Expand Down
66 changes: 41 additions & 25 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 Appmattus Limited
* Copyright 2021 Appmattus Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,26 +14,28 @@
* limitations under the License.
*/

import com.android.build.gradle.internal.tasks.factory.dependsOn
import com.appmattus.markdown.rules.LineLengthRule
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URL

plugins {
kotlin("jvm") version "1.4.10" apply false
kotlin("plugin.serialization") version "1.4.10"
id("org.jetbrains.dokka") version "1.4.10"
id("com.appmattus.markdown") version "0.6.0"
kotlin("jvm") version Versions.kotlin apply false
kotlin("plugin.serialization") version Versions.kotlin
id("com.vanniktech.maven.publish") version Versions.gradleMavenPublishPlugin apply false
id("org.jetbrains.dokka") version Versions.dokkaPlugin
id("com.appmattus.markdown") version Versions.markdownlintGradlePlugin
}

buildscript {
repositories {
google()
}
dependencies {
classpath("com.android.tools.build:gradle:4.0.2")
classpath("com.android.tools.build:gradle:${Versions.androidGradlePlugin}")
}
}

Expand All @@ -44,24 +46,44 @@ subprojects {
mavenCentral()
}

plugins.withType<KotlinPluginWrapper> {
configure<KotlinProjectExtension> {
if (project.name != "testutils") {
explicitApi()
}
}
}

plugins.withType<KotlinAndroidPluginWrapper> {
configure<KotlinProjectExtension> {
if (project.name != "testutils") {
explicitApi()
}
}
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_1_8.toString()
allWarningsAsErrors = true
}
}

tasks.withType<DokkaTask> {
outputDirectory.set(buildDir.resolve("reports/dokka"))
version = System.getenv("GITHUB_REF")?.substring(10) ?: System.getProperty("GITHUB_REF")?.substring(10) ?: "unknown"

dokkaSourceSets {
configureEach {
skipDeprecated.set(true)
plugins.withType<DokkaPlugin> {
tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets {
configureEach {
if (name.startsWith("ios")) {
displayName.set("ios")
}

sourceLink {
localDirectory.set(rootDir)
remoteUrl.set(URL("https://github.com/appmattus/layercache/blob/main/"))
remoteLineSuffix.set("#L")
sourceLink {
localDirectory.set(rootDir)
remoteUrl.set(java.net.URL("https://github.com/appmattus/layercache/blob/main"))
remoteLineSuffix.set("#L")
}
}
}
}
Expand All @@ -75,12 +97,6 @@ tasks.register<Delete>("clean") {
apply(from = "$rootDir/gradle/scripts/detekt.gradle.kts")
apply(from = "$rootDir/gradle/scripts/dependencyUpdates.gradle.kts")

val dokka = tasks.named<DokkaMultiModuleTask>("dokkaHtmlMultiModule") {
outputDirectory.set(buildDir.resolve("dokkaCustomMultiModuleOutput"))
}

tasks.register("check").dependsOn(dokka)

markdownlint {
rules {
+LineLengthRule(codeBlocks = false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 Appmattus Limited
* Copyright 2021 Appmattus Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,22 @@
* limitations under the License.
*/

tasks.register<Jar>("dokkaJar") {
dependsOn(tasks.named("dokkaJavadoc"))
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

archiveClassifier.set("javadoc")
from("$buildDir/reports/dokka")
plugins {
`kotlin-dsl`
}

repositories {
jcenter()
}

kotlinDslPluginOptions {
experimentalWarning.set(false)
}

tasks.withType(KotlinCompile::class.java).all {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
Loading

0 comments on commit 2190767

Please sign in to comment.