Skip to content

Package refactor #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 7 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,26 @@
branches:
only:
- master
- /^\d+\.\d+\.\d+$/ # regex
- /^v4-\d+\.\d+\.\d+$/ # regex

language: android
sudo: false
jdk:
- oraclejdk8

android:
components:
- tools # to get the new `repository-11.xml`
- platform-tools
- build-tools-25.0.2
- android-25
- doc-25
- extra-google-m2repository
- extra-android-m2repository
licenses:
- 'android-sdk-license-.+'
jdk:
- oraclejdk8

before_install:
- pip install --user codecov
- mkdir "$ANDROID_HOME/licenses" || true
- echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"

script:
- ./gradlew clean testDebugUnitTest jacocoTestReport --info

after_success:
- ./gradlew coveralls
- codecov
- ./scripts/publish_snapshot.sh

cache:
directories:
- $HOME/.gradle
- $HOME/.m2/repository
deploy:
provider: script
script: ./gradlew bintrayUpload
skip_cleanup: true
on:
branch: master
tags: true
232 changes: 11 additions & 221 deletions ParseLiveQuery/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
import com.android.builder.core.BuilderConstants

apply plugin: 'com.android.library'
apply plugin: 'com.github.kt3k.coveralls'

group = 'com.parse'
version = '1.0.7-SNAPSHOT'

ext {
projDescription = 'A library that gives you access to the powerful Parse cloud platform from your Android app.'
artifact = 'parse-livequery-android'
projName = 'Parse-LiveQuery-Android'
gitLink = 'https://github.com/parse-community/ParseLiveQuery-Android'
}

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.1'
}
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion 27

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName project.version
versionName "1.0"
consumerProguardFiles 'release-proguard.pro'
}

Expand All @@ -47,135 +24,15 @@ android {
}

dependencies {
compile 'com.parse:parse-android:1.14.1'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
testCompile 'org.robolectric:robolectric:3.3.1'
testCompile 'org.skyscreamer:jsonassert:1.5.0'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
}

android.libraryVariants.all { variant ->
def name = variant.buildType.name
def jar = project.tasks.create(name: "jar${name.capitalize()}", type: Jar) {
dependsOn variant.javaCompile
from variant.javaCompile.destinationDir

manifest {
attributes(
"Bundle-Name": 'parse-livequery-android',
"Bundle-Version": project.version
)
}

exclude '**/R.class'
exclude '**/R\$*.class'
exclude '**/Manifest.class'
exclude '**/Manifest\$*.class'
exclude '**/BuildConfig.class'
}

def javadoc = task("javadoc${variant.name.capitalize()}", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)

options.docletpath = [rootProject.file("./gradle/ExcludeDoclet.jar")]
options.doclet = "me.grantland.doclet.ExcludeDoclet"

options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference")
options.links("http://boltsframework.github.io/docs/android/")

exclude '**/BuildConfig.java'
exclude '**/R.java'
exclude '**/internal/**'
}

def javadocJar = task("javadocJar${variant.name.capitalize()}", type: Jar, dependsOn: "javadoc${variant.name.capitalize()}") {
classifier = 'javadoc'
from javadoc.destinationDir
}

if (name.equals(BuilderConstants.RELEASE)) {
artifacts.add('archives', jar);
artifacts.add('archives', javadocJar);
}
}

//region Maven

apply plugin: 'maven'
apply plugin: 'signing'

def isSnapshot = version.endsWith('-SNAPSHOT')
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : System.getenv('CI_NEXUS_USERNAME')
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : System.getenv('CI_NEXUS_PASSWORD')

def pomConfig = {
scm {
connection 'scm:[email protected]:parse-community/ParseLiveQuery-Android.git'
developerConnection 'scm:[email protected]:parse-community/ParseLiveQuery-Android.git'
url gitLink
}

licenses {
license {
name 'BSD License'
url 'https://github.com/parse-community/ParseLiveQuery-Android/blob/master/LICENSE'
distribution 'repo'
}
}

developers {
developer {
id 'parse'
name 'Parse'
}
}
}

uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
api "com.github.parse-community.Parse-SDK-Android:parse:1.18.2"
api 'com.squareup.okhttp3:okhttp:3.11.0'

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

def basePom = {
name projName
artifactId artifact
packaging 'aar'
description projDescription
url gitLink
}

pom.project basePom << pomConfig
}
testImplementation 'org.robolectric:robolectric:3.3.1'
testImplementation 'org.skyscreamer:jsonassert:1.5.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
}

signing {
required { !isSnapshot && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

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

artifacts {
archives androidSourcesJar
}

//endregion

//region Code Coverage

apply plugin: 'jacoco'
Expand Down Expand Up @@ -218,71 +75,4 @@ coveralls.jacocoReportPath = "${buildDir}/reports/jacoco/jacocoTestReport/jacoco

//endregion

// Requires apply plugin: 'com.jfrog.bintray'

apply plugin: 'com.jfrog.bintray'

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_API_KEY')

publications = ["MyPublication"]

publish = true
pkg {
repo = 'maven'
name = 'com.parse:parse-livequery-android'
userOrg = 'parse'
licenses = ['BSD']
vcsUrl = gitLink
version {
name = project.version
desc = projDescription
released = new Date()
vcsTag = project.version

// Sonatype username/passwrod must be set for this operation to happen
mavenCentralSync {
sync = true
user = ossrhUsername
password = ossrhPassword
close = '1' // release automatically
}
}
}
}

// Create the publication with the pom configuration:
apply plugin: 'maven-publish'

publishing {
publications {
MyPublication(MavenPublication) {
groupId group
artifactId artifact
artifacts = [androidSourcesJar, bundleRelease]
version version
pom.withXml {
def root = asNode()
root.appendNode('description', projDescription)
root.appendNode('name', projName)
root.appendNode('url', gitLink)
root.children().last() + pomConfig

// maven-publish workaround to include dependencies
def dependenciesNode = asNode().appendNode('dependencies')

//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.compile.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}

}
}
}
}

// End of Bintray plugin
apply from: 'https://raw.githubusercontent.com/Commit451/gradle-android-javadocs/1.0.0/gradle-android-javadocs.gradle'
4 changes: 1 addition & 3 deletions ParseLiveQuery/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
~ LICENSE file in the root directory of this source tree. An additional grant
~ of patent rights can be found in the PATENTS file in the same directory.
-->
<manifest package="com.parse.livequery">
<application />
</manifest>
<manifest package="com.parse.livequery"/>
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.parse;
package com.parse.livequery;

import org.json.JSONException;
import org.json.JSONObject;

/* package */ abstract class ClientOperation {

abstract class ClientOperation {
abstract JSONObject getJSONObjectRepresentation() throws JSONException;

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.parse;
package com.parse.livequery;

import org.json.JSONException;
import org.json.JSONObject;

/* package */ class ConnectClientOperation extends ClientOperation {
class ConnectClientOperation extends ClientOperation {

private final String applicationId;
private final String sessionToken;

/* package */ ConnectClientOperation(String applicationId, String sessionToken) {
ConnectClientOperation(String applicationId, String sessionToken) {
this.applicationId = applicationId;
this.sessionToken = sessionToken;
}

@Override
/* package */ JSONObject getJSONObjectRepresentation() throws JSONException {
JSONObject getJSONObjectRepresentation() throws JSONException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("op", "connect");
jsonObject.put("applicationId", applicationId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.parse;
package com.parse.livequery;

import java.util.Locale;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.parse;
package com.parse.livequery;

import android.util.Log;

Expand All @@ -12,7 +12,7 @@
import okhttp3.WebSocketListener;
import okio.ByteString;

/* package */ public class OkHttp3SocketClientFactory implements WebSocketClientFactory {
public class OkHttp3SocketClientFactory implements WebSocketClientFactory {

OkHttpClient mClient;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package com.parse;
package com.parse.livequery;

import com.parse.ParseObject;
import com.parse.ParseQuery;

import java.net.URI;
import java.util.concurrent.Executor;
Expand Down Expand Up @@ -38,8 +41,7 @@ public static ParseLiveQueryClient getClient(URI uri, WebSocketClientFactory web
return new ParseLiveQueryClientImpl(uri, webSocketClientFactory);
}

/* package */
static ParseLiveQueryClient getClient(URI uri, WebSocketClientFactory webSocketClientFactory, Executor taskExecutor) {
public static ParseLiveQueryClient getClient(URI uri, WebSocketClientFactory webSocketClientFactory, Executor taskExecutor) {
return new ParseLiveQueryClientImpl(uri, webSocketClientFactory, taskExecutor);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.parse;
package com.parse.livequery;

public interface ParseLiveQueryClientCallbacks {
void onLiveQueryClientConnected(ParseLiveQueryClient client);
Expand Down
Loading