Skip to content

Commit

Permalink
Merge branch 'release/3.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrimaeon committed Dec 24, 2020
2 parents 56f6f5c + 342a27f commit 3848468
Show file tree
Hide file tree
Showing 28 changed files with 264 additions and 102 deletions.
34 changes: 31 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ executors:
- image: circleci/android:api-29
working_directory: ~/app-rater
environment:
JAVA_TOOL_OPTIONS: "-Xmx2G"
JAVA_TOOL_OPTIONS: "-Xmx3G"
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.workers.max=2 -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false"
TERM: dumb

Expand Down Expand Up @@ -75,6 +75,17 @@ jobs:
- run:
name: Deploy to Bintray
command: ./gradlew bintrayUpload
createRelease:
executor: android-executor
steps:
- checkout
- attach_workspace:
at: .
- restore-gradle-wrapper
- run:
name: Create Github Release notes
command: ./gradlew createGithubRelease

workflows:
version: 2
build-and-test:
Expand All @@ -88,7 +99,7 @@ workflows:
- develop
- master
- /release\/.*/
- hold:
- hold-deploy:
type: approval
requires:
- build-test
Expand All @@ -99,7 +110,24 @@ workflows:
ignore: /.*/
- deploy:
requires:
- hold
- hold-deploy
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- hold-release:
type: approval
requires:
- deploy
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- createRelease:
requires:
- hold-release
filters:
tags:
only: /.*/
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
build/
/captures
/credentials.properties
/GITHUB_TOKEN
11 changes: 10 additions & 1 deletion .idea/codeStyles/Project.xml

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

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

## [Unreleased]
### Added

### Changed

### Deprecated

### Removed

### Fixed
- styling the dialog text


### Security
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Android™ App Rater Dialog [![CircleCI](https://circleci.com/gh/chrimaeon/app-rater.svg?style=svg)](https://circleci.com/gh/chrimaeon/app-rater)

[![License](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg?style=for-the-badge&logo=apache)](http://www.apache.org/licenses/LICENSE-2.0)
[![Bintray](https://www.cmgapps.com/badge/chrimaeon/maven/com.cmgapps.android:app-rater/badge.svg)](https://jcenter.bintray.com/com/cmgapps/android/cmgUtilities/)
[![Bintray](https://www.cmgapps.com/badge/chrimaeon/maven/com.cmgapps.android:app-rater/badge.svg)](https://jcenter.bintray.com/com/cmgapps/android/app-rater/)

__This is a App Rater Dialog to encourage user to rate the app__

Expand All @@ -11,7 +11,7 @@ Add the following dependency to your `build.gradle`.

```groovy
dependencies {
implementation 'com.cmgapps.android:app-rater:3.0.0'
implementation 'com.cmgapps.android:app-rater:3.0.1'
}
```

Expand Down Expand Up @@ -62,7 +62,7 @@ Add the following dependency to your `build.gradle`.

```groovy
dependencies {
implementation 'com.cmgapps.android:app-rater-ktx:3.0.0'
implementation 'com.cmgapps.android:app-rater-ktx:3.0.1'
}
```

Expand Down
78 changes: 75 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@
*/

import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.logging.HttpLoggingInterceptor
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType
import org.json.simple.JSONObject

buildscript {
repositories {
Expand All @@ -25,13 +33,16 @@ buildscript {

}
dependencies {
classpath("com.android.tools.build:gradle:4.0.1")
classpath("com.android.tools.build:gradle:4.1.1")
classpath(kotlin("gradle-plugin", version = Deps.Versions.KOTLIN))
classpath("com.squareup.okhttp3:okhttp:4.9.0")
classpath("com.squareup.okhttp3:logging-interceptor:4.9.0")
}
}

plugins {
id("com.github.ben-manes.versions") version "0.29.0"
id("com.github.ben-manes.versions") version "0.36.0"
id("org.jetbrains.changelog") version "0.6.2"
}

allprojects {
Expand All @@ -58,8 +69,69 @@ tasks {

named<Wrapper>("wrapper") {
distributionType = DistributionType.ALL
gradleVersion = "6.5.1"
gradleVersion = "6.7.1"
}

register("createGithubRelease") {
val versionName: String by project
if (!changelog.has(versionName)) {
dependsOn(patchChangelog)
}
doLast {
val changelog = changelog.get(versionName).toText()
sendCreateReleaseRequest(
versionName,
changelog
)?.let {
logger.lifecycle(it.htmlUrl)
}
}
}
}

changelog {
val versionName: String by project
version = versionName
}

fun sendCreateReleaseRequest(version: String, body: String): Response? {
val request =
Request.Builder().url("https://api.github.com/repos/chrimaeon/app-rater/releases")
.addHeader("Accept", "application/vnd.github.v3+json")
.addHeader(
"Authorization", "token " + rootProject.file("GITHUB_TOKEN").readText().trim()
)
.post(
JSONObject.toJSONString(
mapOf(
"tag_name" to version,
"name" to version,
"draft" to true,
"body" to body
)
).toRequestBody("application/json".toMediaType())
)
.build()

@Suppress("ObjectLiteralToLambda")
val loggingInterceptor: HttpLoggingInterceptor =
HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger {
override fun log(message: String) {
logger.info(message)
}
}).apply {
level = HttpLoggingInterceptor.Level.BODY
}

return OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.build().newCall(request).execute().use { response ->
if (!response.isSuccessful) throw java.io.IOException("Unexpected response: $response")

Gson().fromJson(response.body?.string(), Response::class.java)
}
}

data class Response(@SerializedName("html_url") val htmlUrl: String)


4 changes: 3 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ plugins {
}

repositories {
google()
jcenter()
}

dependencies {
implementation(kotlin("stdlib-jdk8", "1.3.72"))
implementation(kotlin("stdlib-jdk8", "1.4.21"))
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1")
}
22 changes: 11 additions & 11 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@

object Deps {
object Versions {
const val COMPILE_SDK_VERSION = 29
const val BUILD_TOOLS_VERSION = "30.0.1"
const val COMPILE_SDK_VERSION = 30
const val BUILD_TOOLS_VERSION = "30.0.3"
const val MIN_SDK_VERSION: Int = 21
const val TARGET_SDK_VERSION = COMPILE_SDK_VERSION

const val APP_COMPAT = "1.1.0"
const val CORE_KTX = "1.3.1"
const val APP_COMPAT = "1.2.0"
const val CORE_KTX = "1.3.2"
const val DESUGAR_JDK_LIBS = "1.0.10"
const val ESPRESSO_CORE = "3.2.0"
const val ESPRESSO_CORE = "3.3.0"
const val HAMCREST = "2.2"
const val JUNIT = "4.13"
const val JUNIT_KTX = "1.1.1"
const val KOTLIN = "1.3.72"
const val KTLINT = "0.37.2"
const val JUNIT = "4.13.1"
const val JUNIT_KTX = "1.1.2"
const val KOTLIN = "1.4.21"
const val KTLINT = "0.40.0"
const val LIFECYCLE_EXT = "2.2.0"
const val LIFECYCLE_COMMON = "2.2.0"
const val MOCKITO_CORE = "3.4.6"
const val TEST_CORE = "1.2.0"
const val MOCKITO_CORE = "3.6.28"
const val TEST_CORE = "1.3.0"
const val TEST_RUNNER = "1.2.0"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,51 @@ import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.closureOf
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.invoke
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.dokka.gradle.DokkaTask
import java.util.Date

fun Project.configureBintrayPublish(pomName: String, pomDesc: String, pomArtifactId: String) {
apply<DokkaPlugin>()

tasks {

val dokka = named<DokkaTask>("dokka") {
outputFormat = "javadoc"
outputDirectory = "$buildDir/javadoc"
configuration {
moduleName = "app-rater"
}
}

register<Jar>("androidJavadocsJar") {
from(dokka)
archiveClassifier.set("javadoc")
}

register<Jar>("androidSourcesJar") {
archiveClassifier.set("sources")
}
}

apply<MavenPublishPlugin>()

configure<PublishingExtension> {
publications {
register<MavenPublication>("pluginMaven") {

from(components["release"])
artifact(tasks["androidSourcesJar"])
artifact(tasks["androidJavadocsJar"])
artifact(tasks["androidSourcesJar"])

artifactId = pomArtifactId

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
group=com.cmgapps.android
versionName=3.0.0
versionName=3.0.1
pomUrl=https://github.com/chrimaeon/app-rater
pomScmUrl=https://github.com/chrimaeon/app-rater.git
pomScmConnection=scm:git:git@github.com:chrimaeon/app-rater.git
Expand Down
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.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 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 Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*

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%

Expand Down
Loading

0 comments on commit 3848468

Please sign in to comment.