Skip to content

Commit

Permalink
chore(Maven) Add publication to Bintray
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-tgl committed Sep 3, 2018
1 parent e3bd45e commit dd3c788
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ jobs:
- run:
name: Run Tests
command: ./gradlew lint test
- run:
name: Publish on Maven
command: |
VERSION=$(git tag --points-at HEAD) # Get current tag if any
# Check correct tag format, strip leading "v" and publish
if [[ $VERSION =~ ^v(.*)$ ]]; then
VERSION=${BASH_REMATCH[1]}
./gradlew bintrayUpload -PgitVersion=$VERSION
fi
- store_artifacts:
path: build/reports
destination: reports
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# sardine-android

[![Build Status](https://circleci.com/gh/thegrizzlylabs/sardine-android.svg?&style=shield)](https://circleci.com/gh/thegrizzlylabs/sardine-android)
[![Version number](https://img.shields.io/bintray/v/guillaume-tgl/maven/sardine-android.svg) ](https://bintray.com/guillaume-tgl/maven/sardine-android/_latestVersion)

A WebDAV client for Android, using [OkHttp](https://github.com/square/okhttp) as HTTP client.

## Getting started

- Check out this repository and add it to your Android project
- Include this Android library into your app by editing your `build.gradle`:
- Edit your app-level `build.gradle` (see top of this page for the latest version):

```
dependencies {
...
implementation project(':sardine-android')
implementation 'com.thegrizzlylabs.sardine-android:sardine-android:<VERSION_NUMBER>'
}
```

- Create a `Sardine` client:
```
Sardine sardine = new OkHttpSardine();
sardine.setCredentials("username", "password");
```

- Use the client to make requests to your WebDAV server:
```
List<DavResource> resources = sardine.list("http://webdav.server.com");
Expand All @@ -32,5 +34,3 @@ Originally forked from [Sardine](https://github.com/lookfirst/sardine)
[Apache HTTP Client](http://hc.apache.org/) was replaced by [OkHttp](https://github.com/square/okhttp)

JAXB was replaced by [SimpleXml](http://simple.sourceforge.net/)


67 changes: 62 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
}
}

Expand All @@ -14,18 +15,15 @@ repositories {
}

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

android {
compileSdkVersion 27

defaultConfig {
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

consumerProguardFiles 'proguard-rules.pro'
}
}
Expand All @@ -42,3 +40,62 @@ dependencies {

testImplementation 'junit:junit:4.12'
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

publishing {
publications {
MyPublication(MavenPublication) {
if (project.hasProperty('gitVersion')) {
version "$gitVersion"
}
groupId 'com.thegrizzlylabs.sardine-android'
artifactId 'sardine-android'

artifact bundleRelease
artifact sourcesJar

pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}

bintray {
// Get Bintray credential from environment variable
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_API_KEY')
dryRun = false
override = false
publish = true
pkg {
repo = 'maven'
name = 'sardine-android'
userOrg = user
licenses = ['Apache-2.0']
desc = 'A WebDAV library for Android'
vcsUrl = 'https://github.com/thegrizzlylabs/sardine-android.git'

version {
if (project.hasProperty('gitVersion')) {
name = "$gitVersion" //Bintray logical version name
vcsTag = "v$gitVersion"
}
}
}
publications = ['MyPublication']
}

0 comments on commit dd3c788

Please sign in to comment.