Skip to content

Commit

Permalink
Merge pull request #9 from btrautmann/develop
Browse files Browse the repository at this point in the history
Kotlin support and updated publication strategy
  • Loading branch information
Brandon Trautmann authored May 5, 2018
2 parents f4dc5c6 + 907717b commit e9214b7
Show file tree
Hide file tree
Showing 18 changed files with 363 additions and 123 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,40 @@ RxFirestore is an RxJava2 wrapper for [Cloud Firestore](https://firebase.google.

[ ![Download](https://api.bintray.com/packages/oakwoodsc/maven/RxFirestore/images/download.svg) ](https://bintray.com/oakwoodsc/maven/RxFirestore/_latestVersion)

#### How to use it:
### How to use it:

**Kotlin or Java:**

- In your project's `build.gradle`, add the following in the `allProjects` `repositories` block:
```
maven {
// Required until published to Jcenter
url "http://dl.bintray.com/oakwoodsc/maven"
}
```

**Java:**
- Add implementation statement in your app module's `build.gradle`:
```
implementation 'com.oakwoodsc.rxfirestore:rxfirestore:${latestVersion}'
```
- You're all set!

**Kotlin:**
- Add implementation statement in your app module's `build.gradle`:
```
implementation 'com.oakwoodsc.rxfirestore:rxfirestorekt:${latestVersion}'
```

**Current Status:** In Development

**Currently developed with:**
- Firestore 16.0.0
- RxJava 2.1.5
- RxJava 2.1.8

___

### Contributions welcome
I won't be working on this full-time, rather fast enough to support my own needs. With that said, please feel free to contribute as much as you'd like. Tests are encouraged (though there are none yet).

**Simply:**
- Clone the repo
- Add features
- Manually test by running assembleDebug or assembleRelease on the rxfirestore module and use that aar in your Android project
- Unit test

### Thank You
Thank you in advance to [kunny](https://github.com/kunny) for his [RxFirebase](https://github.com/kunny/RxFirebase) database implementation, as I'll be mainly porting that to support Cloud Firestore.
120 changes: 120 additions & 0 deletions bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

version = libraryVersion

/*
* Comment the following part if you only want to distribute .aar files.
* (For example, your source code is obfuscated by Proguard and is not shown to outside developers)
* Without source code .jar files, you only can publish on bintray repository but not jcenter.
*/

if (project.hasProperty("android")) {
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
} else { // Java libraries
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}

// Create the pom configuration:
def pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
}
}

scm {
url "https://github.com/yourgithubaccount/example"
}
}

publishing {
publications {
MyPublication(MavenPublication) {
artifact sourcesJar
artifact javadocJar
groupId publishedGroupId
artifactId artifact
version libraryVersion
pom.withXml {
def root = asNode()
root.appendNode('description', libraryDescription)
root.appendNode('name', libraryName)
root.appendNode('url', siteUrl)
root.children().last() + pomConfig
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
def dependenciesNode = asNode()
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
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
publications = ['MyPublication']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
userOrg = organization
// If the repository is hosted by an organization instead of personal account.
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
publish = true
publicDownloadNumbers = true
version {
name = libraryVersionName
desc = libraryDescription
released = new Date()
vcsTag = libraryVersion
gpg {
sign = true
passphrase = properties.getProperty("bintray.gpg.password")
}
}
}
}
15 changes: 12 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
apply from: file('dependencies.gradle')
apply from: file('publishing-config.gradle')

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "com.android.tools.build:gradle:${androidPluginVersion}"
// Two necessary plugins
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:${bintrayPluginVersion}"
classpath "com.github.dcendents:android-maven-gradle-plugin:${mavenGradlePluginVersion}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -22,6 +25,12 @@ allprojects {
google()
jcenter()
}
tasks.withType(Javadoc) {
excludes = ['**/*.kt'] // < ---- Exclude all kotlin files from javadoc file.
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
}

task clean(type: Delete) {
Expand Down
17 changes: 17 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ext {
// Libraries
supportLibraryVersion = '27.1.1'
firebaseVersion = '16.0.0'
junitVersion = '4.12'
kotlinVersion = '1.2.41'
rxJavaVersion = '2.1.8'

// Build plugins
androidPluginVersion = '3.1.2'
bintrayPluginVersion = '1.8.0'
mavenGradlePluginVersion = '2.1'

// Build SDK versions
minSdkVersion = 14
compileSdkVersion = 27
}
File renamed without changes.
19 changes: 19 additions & 0 deletions publishing-config.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ext {
// Publishing
libraryVersion = '1.0.2'
libraryVersionName = '1.0.2'
bintrayRepo = 'maven'
publishedGroupId = 'com.oakwoodsc.rxfirestore'
libraryDescription = 'An RxJava2 wrapper for Cloud Firestore'
siteUrl = 'https://github.com/btrautmann/RxFirestore'
gitUrl = 'https://github.com/btrautmann/RxFirestore.git'
// Developer
developerId = 'oakwoodsc'
developerName = 'Oakwood Software Consulting, Inc.'
developerEmail = '[email protected]'
organization = 'oakwoodsc' // Correlates to URL
// Licensing
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
1 change: 0 additions & 1 deletion rxfirestore/.gitignore

This file was deleted.

67 changes: 0 additions & 67 deletions rxfirestore/bintray.gradle

This file was deleted.

Loading

0 comments on commit e9214b7

Please sign in to comment.