Skip to content

Commit

Permalink
fix #11: implemented support for maven central publishing and dropped…
Browse files Browse the repository at this point in the history
… Bintray
  • Loading branch information
gotev committed Apr 17, 2021
1 parent 8da5872 commit a959cb8
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ build
.externalNativeBuild
.idea
.iml
*.apk
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Android Cookie Store
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20Cookie%20Store-green.svg?style=flat)](https://android-arsenal.com/details/1/8000) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-394-green)](https://androidweekly.net/issues/issue-394) [![ktlint](https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg)](https://ktlint.github.io/) [ ![Download](https://api.bintray.com/packages/gotev/maven/android-cookie-store/images/download.svg) ](https://bintray.com/gotev/maven/android-cookie-store/_latestVersion) [ ![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.gotev/cookie-store/badge.svg) ](https://search.maven.org/search?q=g:net.gotev) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20Cookie%20Store-green.svg?style=flat)](https://android-arsenal.com/details/1/8000) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-394-green)](https://androidweekly.net/issues/issue-394) [![ktlint](https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg)](https://ktlint.github.io/) [ ![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.gotev/cookie-store/badge.svg) ](https://search.maven.org/search?q=g:net.gotev) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

Android InMemory and persistent Cookie Store for `HttpURLConnection` and `OkHttp`, with extensions to easily sync cookies in Android WebViews.

Expand All @@ -21,7 +21,7 @@ Add this to your dependencies:
```groovy
implementation "net.gotev:cookie-store:x.y.z"
```
Replace `x.y.z` with [![Download](https://api.bintray.com/packages/gotev/maven/android-cookie-store/images/download.svg) ](https://bintray.com/gotev/maven/android-cookie-store/_latestVersion)
Replace `x.y.z` with [ ![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.gotev/cookie-store/badge.svg) ](https://search.maven.org/search?q=g:net.gotev)

## Usage
Create your Cookie Manager:
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:$gradle_version"
classpath "com.github.ben-manes:gradle-versions-plugin:$gradle_versions_plugin_version"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_plugin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:$kotlin_lint_version"

Expand Down
36 changes: 3 additions & 33 deletions cookie-store-okhttp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: "org.jlleitschuh.gradle.ktlint"

Properties properties = new Properties()
if (project.rootProject.file("local.properties").exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}

// start - module specific overrides of default values written in manifest.gradle
def bintray_project_name = "android-cookie-store-okhttp"
def library_description = "OkHttp Cookie Jar implementation for java.net.CookieManager"
def library_keywords = ['android', 'cookie', 'store', 'okhttp', 'stack']
// end - module specific overrides

// start - do not modify this if your project is on github
project.ext {
mavDevelopers = [(properties.getProperty("bintray.user")): (maintainer)]
mavDevelopers = [(github_username): (maintainer)]
mavSiteUrl = "https://github.com/${github_username}/${github_repository_name}"
mavGitUrl = mavSiteUrl + '.git'
bugTrackerUrl = mavSiteUrl + '/issues/'
mavProjectName = bintray_project_name
mavProjectName = "android-cookie-store-okhttp"
mavLibraryLicenses = ["Apache-2.0": 'http://www.apache.org/licenses/LICENSE-2.0.txt']
mavLibraryDescription = library_description
mavLibraryDescription = "OkHttp Cookie Jar implementation for java.net.CookieManager"
mavVersion = library_version
}
// end - do not modify this if your project is on github
Expand All @@ -41,24 +29,6 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp:4.9.1"
}

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
publications = ['mavenPublish']
pkg {
repo = "maven"
name = mavProjectName
desc = library_description
websiteUrl = mavSiteUrl
vcsUrl = mavGitUrl
issueTrackerUrl = bugTrackerUrl
licenses = library_licenses
labels = library_keywords
publicDownloadNumbers = true
publish = true
}
}

test {
useJUnit()
maxHeapSize = '1G'
Expand Down
30 changes: 3 additions & 27 deletions cookie-store/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: "org.jlleitschuh.gradle.ktlint"

Properties properties = new Properties()
if (project.rootProject.file("local.properties").exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}

// start - do not modify this if your project is on github
project.ext {
mavDevelopers = [(properties.getProperty("bintray.user")): (maintainer)]
mavDevelopers = [(github_username): (maintainer)]
mavSiteUrl = "https://github.com/${github_username}/${github_repository_name}"
mavGitUrl = mavSiteUrl + '.git'
bugTrackerUrl = mavSiteUrl + '/issues/'
mavProjectName = bintray_project_name
mavProjectName = "android-cookie-store"
mavLibraryLicenses = ["Apache-2.0": 'http://www.apache.org/licenses/LICENSE-2.0.txt']
mavLibraryDescription = library_description
mavLibraryDescription = "Android InMemory and persistent Cookie Store for HttpURLConnection and OkHttp, with extensions to easily sync cookies in Android WebViews."
mavVersion = library_version
}
// end - do not modify this if your project is on github
Expand Down Expand Up @@ -78,22 +72,4 @@ dependencies {
implementation "com.google.code.gson:gson:2.8.6"
}

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
publications = ['mavenPublish']
pkg {
repo = "maven"
name = mavProjectName
desc = library_description
websiteUrl = mavSiteUrl
vcsUrl = mavGitUrl
issueTrackerUrl = bugTrackerUrl
licenses = library_licenses
labels = library_keywords
publicDownloadNumbers = true
publish = true
}
}

apply from: 'https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/master/gradle-mavenizer.gradle'
1 change: 0 additions & 1 deletion example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ buildscript {

//classpath dependencies to import library project
classpath "com.github.ben-manes:gradle-versions-plugin:$gradle_versions_plugin_version"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_plugin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:$kotlin_lint_version"

Expand Down
4 changes: 4 additions & 0 deletions generate-debug-apk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -e
cd example
./gradlew clean assembleDebug
cp app/build/outputs/apk/debug/app-debug.apk ../cookie-store-demo-debug.apk
8 changes: 2 additions & 6 deletions manifest.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ ext {

maintainer = 'Aleksandar Gotev'

bintray_project_name = 'android-cookie-store'
library_description = 'Android InMemory and persistent Cookie Store for HttpURLConnection and OkHttp, with extensions to easily sync cookies in Android WebViews.'
library_keywords = ['android', 'cookie', 'store', 'httpurlconnection', 'okhttp', 'webview', 'library', 'kotlin']
library_licenses = ["Apache-2.0"]
library_licenses_url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
library_project_group = 'net.gotev'
library_version = '1.3.4'
version_code = 2
library_version = '1.3.5'
version_code = 3
min_sdk = 16
target_sdk = 30
demo_app_id = 'net.gotev.cookiestoredemo'
Expand All @@ -22,7 +19,6 @@ ext {
kotlin_version = '1.4.0'
gradle_version = '4.1.2'
gradle_versions_plugin_version = '0.28.0'
bintray_plugin_version = '1.8.4'
kotlin_lint_version = '9.0.0'

// Library and app testing dependencies versions
Expand Down
18 changes: 13 additions & 5 deletions release
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ then
version=$(cat manifest.gradle | grep library_version | awk '{print $3}' | tr "'" "\n" | head -n 2 | tail -n 1)
echo "released local version $version"
else
echo "Bintray release..."
./gradlew clean test publish bintrayUpload
fi
echo "Releasing on Maven Central ..."
./gradlew clean test publish -PmavSigning=true -PmavPublishToRemoteRepo=true --max-workers 1

echo "Generating Demo Apk ..."
./generate-debug-apk

version=$(cat manifest.gradle | grep "library_version" | tr "'" '\n' | head -n 2 | tail -n 1)
hub release create -m "$version" "$version"
echo "Creating GitHub Release ..."
version=$(cat manifest.gradle | grep "library_version" | tr "'" '\n' | head -n 2 | tail -n 1)
hub release create -a cookie-store-demo-debug.apk -m "$version" "$version"

echo
echo "Done!"
echo "Visit https://oss.sonatype.org/#stagingRepositories and confirm the release"
fi

0 comments on commit a959cb8

Please sign in to comment.