Skip to content

Commit 508b9a0

Browse files
authored
Package refactor (#88)
* Repackage into com.parse.livequery * Add jitpack to build config
1 parent 4fb2aed commit 508b9a0

23 files changed

+117
-365
lines changed

.travis.yml

+7-23
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,26 @@
11
branches:
22
only:
33
- master
4-
- /^\d+\.\d+\.\d+$/ # regex
4+
- /^v4-\d+\.\d+\.\d+$/ # regex
5+
56
language: android
6-
sudo: false
7-
jdk:
8-
- oraclejdk8
97

10-
android:
11-
components:
12-
- tools # to get the new `repository-11.xml`
13-
- platform-tools
14-
- build-tools-25.0.2
15-
- android-25
16-
- doc-25
17-
- extra-google-m2repository
18-
- extra-android-m2repository
19-
licenses:
20-
- 'android-sdk-license-.+'
8+
jdk:
9+
- oraclejdk8
2110

2211
before_install:
2312
- pip install --user codecov
13+
- mkdir "$ANDROID_HOME/licenses" || true
14+
- echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
2415

2516
script:
2617
- ./gradlew clean testDebugUnitTest jacocoTestReport --info
2718

2819
after_success:
20+
- ./gradlew coveralls
2921
- codecov
30-
- ./scripts/publish_snapshot.sh
3122

3223
cache:
3324
directories:
3425
- $HOME/.gradle
3526
- $HOME/.m2/repository
36-
deploy:
37-
provider: script
38-
script: ./gradlew bintrayUpload
39-
skip_cleanup: true
40-
on:
41-
branch: master
42-
tags: true

ParseLiveQuery/build.gradle

+11-221
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,14 @@
1-
import com.android.builder.core.BuilderConstants
2-
31
apply plugin: 'com.android.library'
42
apply plugin: 'com.github.kt3k.coveralls'
53

6-
group = 'com.parse'
7-
version = '1.0.7-SNAPSHOT'
8-
9-
ext {
10-
projDescription = 'A library that gives you access to the powerful Parse cloud platform from your Android app.'
11-
artifact = 'parse-livequery-android'
12-
projName = 'Parse-LiveQuery-Android'
13-
gitLink = 'https://github.com/parse-community/ParseLiveQuery-Android'
14-
}
15-
16-
buildscript {
17-
repositories {
18-
jcenter()
19-
}
20-
21-
dependencies {
22-
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.1'
23-
}
24-
}
25-
264
android {
27-
compileSdkVersion rootProject.ext.compileSdkVersion
28-
buildToolsVersion rootProject.ext.buildToolsVersion
5+
compileSdkVersion 27
296

307
defaultConfig {
31-
minSdkVersion rootProject.ext.minSdkVersion
32-
targetSdkVersion rootProject.ext.targetSdkVersion
8+
minSdkVersion 15
9+
targetSdkVersion 27
3310
versionCode 1
34-
versionName project.version
11+
versionName "1.0"
3512
consumerProguardFiles 'release-proguard.pro'
3613
}
3714

@@ -47,135 +24,15 @@ android {
4724
}
4825

4926
dependencies {
50-
compile 'com.parse:parse-android:1.14.1'
51-
compile 'com.squareup.okhttp3:okhttp:3.6.0'
52-
compile 'com.parse.bolts:bolts-tasks:1.4.0'
53-
testCompile 'org.robolectric:robolectric:3.3.1'
54-
testCompile 'org.skyscreamer:jsonassert:1.5.0'
55-
testCompile 'junit:junit:4.12'
56-
testCompile 'org.mockito:mockito-core:1.10.19'
57-
}
58-
59-
android.libraryVariants.all { variant ->
60-
def name = variant.buildType.name
61-
def jar = project.tasks.create(name: "jar${name.capitalize()}", type: Jar) {
62-
dependsOn variant.javaCompile
63-
from variant.javaCompile.destinationDir
64-
65-
manifest {
66-
attributes(
67-
"Bundle-Name": 'parse-livequery-android',
68-
"Bundle-Version": project.version
69-
)
70-
}
71-
72-
exclude '**/R.class'
73-
exclude '**/R\$*.class'
74-
exclude '**/Manifest.class'
75-
exclude '**/Manifest\$*.class'
76-
exclude '**/BuildConfig.class'
77-
}
78-
79-
def javadoc = task("javadoc${variant.name.capitalize()}", type: Javadoc) {
80-
description "Generates Javadoc for $variant.name."
81-
source = variant.javaCompile.source
82-
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
83-
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
84-
85-
options.docletpath = [rootProject.file("./gradle/ExcludeDoclet.jar")]
86-
options.doclet = "me.grantland.doclet.ExcludeDoclet"
87-
88-
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference")
89-
options.links("http://boltsframework.github.io/docs/android/")
90-
91-
exclude '**/BuildConfig.java'
92-
exclude '**/R.java'
93-
exclude '**/internal/**'
94-
}
95-
96-
def javadocJar = task("javadocJar${variant.name.capitalize()}", type: Jar, dependsOn: "javadoc${variant.name.capitalize()}") {
97-
classifier = 'javadoc'
98-
from javadoc.destinationDir
99-
}
100-
101-
if (name.equals(BuilderConstants.RELEASE)) {
102-
artifacts.add('archives', jar);
103-
artifacts.add('archives', javadocJar);
104-
}
105-
}
106-
107-
//region Maven
108-
109-
apply plugin: 'maven'
110-
apply plugin: 'signing'
111-
112-
def isSnapshot = version.endsWith('-SNAPSHOT')
113-
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : System.getenv('CI_NEXUS_USERNAME')
114-
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : System.getenv('CI_NEXUS_PASSWORD')
115-
116-
def pomConfig = {
117-
scm {
118-
connection 'scm:[email protected]:parse-community/ParseLiveQuery-Android.git'
119-
developerConnection 'scm:[email protected]:parse-community/ParseLiveQuery-Android.git'
120-
url gitLink
121-
}
122-
123-
licenses {
124-
license {
125-
name 'BSD License'
126-
url 'https://github.com/parse-community/ParseLiveQuery-Android/blob/master/LICENSE'
127-
distribution 'repo'
128-
}
129-
}
130-
131-
developers {
132-
developer {
133-
id 'parse'
134-
name 'Parse'
135-
}
136-
}
137-
}
138-
139-
uploadArchives {
140-
repositories.mavenDeployer {
141-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
27+
api "com.github.parse-community.Parse-SDK-Android:parse:1.18.2"
28+
api 'com.squareup.okhttp3:okhttp:3.11.0'
14229

143-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
144-
authentication(userName: ossrhUsername, password: ossrhPassword)
145-
}
146-
147-
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
148-
authentication(userName: ossrhUsername, password: ossrhPassword)
149-
}
150-
151-
def basePom = {
152-
name projName
153-
artifactId artifact
154-
packaging 'aar'
155-
description projDescription
156-
url gitLink
157-
}
158-
159-
pom.project basePom << pomConfig
160-
}
30+
testImplementation 'org.robolectric:robolectric:3.3.1'
31+
testImplementation 'org.skyscreamer:jsonassert:1.5.0'
32+
testImplementation 'junit:junit:4.12'
33+
testImplementation 'org.mockito:mockito-core:1.10.19'
16134
}
16235

163-
signing {
164-
required { !isSnapshot && gradle.taskGraph.hasTask("uploadArchives") }
165-
sign configurations.archives
166-
}
167-
168-
task androidSourcesJar(type: Jar) {
169-
classifier = 'sources'
170-
from android.sourceSets.main.java.sourceFiles
171-
}
172-
173-
artifacts {
174-
archives androidSourcesJar
175-
}
176-
177-
//endregion
178-
17936
//region Code Coverage
18037

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

21976
//endregion
22077

221-
// Requires apply plugin: 'com.jfrog.bintray'
222-
223-
apply plugin: 'com.jfrog.bintray'
224-
225-
bintray {
226-
user = System.getenv('BINTRAY_USER')
227-
key = System.getenv('BINTRAY_API_KEY')
228-
229-
publications = ["MyPublication"]
230-
231-
publish = true
232-
pkg {
233-
repo = 'maven'
234-
name = 'com.parse:parse-livequery-android'
235-
userOrg = 'parse'
236-
licenses = ['BSD']
237-
vcsUrl = gitLink
238-
version {
239-
name = project.version
240-
desc = projDescription
241-
released = new Date()
242-
vcsTag = project.version
243-
244-
// Sonatype username/passwrod must be set for this operation to happen
245-
mavenCentralSync {
246-
sync = true
247-
user = ossrhUsername
248-
password = ossrhPassword
249-
close = '1' // release automatically
250-
}
251-
}
252-
}
253-
}
254-
255-
// Create the publication with the pom configuration:
256-
apply plugin: 'maven-publish'
257-
258-
publishing {
259-
publications {
260-
MyPublication(MavenPublication) {
261-
groupId group
262-
artifactId artifact
263-
artifacts = [androidSourcesJar, bundleRelease]
264-
version version
265-
pom.withXml {
266-
def root = asNode()
267-
root.appendNode('description', projDescription)
268-
root.appendNode('name', projName)
269-
root.appendNode('url', gitLink)
270-
root.children().last() + pomConfig
271-
272-
// maven-publish workaround to include dependencies
273-
def dependenciesNode = asNode().appendNode('dependencies')
274-
275-
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
276-
configurations.compile.allDependencies.each {
277-
def dependencyNode = dependenciesNode.appendNode('dependency')
278-
dependencyNode.appendNode('groupId', it.group)
279-
dependencyNode.appendNode('artifactId', it.name)
280-
dependencyNode.appendNode('version', it.version)
281-
}
282-
283-
}
284-
}
285-
}
286-
}
287-
288-
// End of Bintray plugin
78+
apply from: 'https://raw.githubusercontent.com/Commit451/gradle-android-javadocs/1.0.0/gradle-android-javadocs.gradle'

ParseLiveQuery/src/main/AndroidManifest.xml

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77
~ LICENSE file in the root directory of this source tree. An additional grant
88
~ of patent rights can be found in the PATENTS file in the same directory.
99
-->
10-
<manifest package="com.parse.livequery">
11-
<application />
12-
</manifest>
10+
<manifest package="com.parse.livequery"/>
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
package com.parse;
1+
package com.parse.livequery;
22

33
import org.json.JSONException;
44
import org.json.JSONObject;
55

6-
/* package */ abstract class ClientOperation {
7-
6+
abstract class ClientOperation {
87
abstract JSONObject getJSONObjectRepresentation() throws JSONException;
9-
108
}

ParseLiveQuery/src/main/java/com/parse/ConnectClientOperation.java renamed to ParseLiveQuery/src/main/java/com/parse/livequery/ConnectClientOperation.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
package com.parse;
1+
package com.parse.livequery;
22

33
import org.json.JSONException;
44
import org.json.JSONObject;
55

6-
/* package */ class ConnectClientOperation extends ClientOperation {
6+
class ConnectClientOperation extends ClientOperation {
77

88
private final String applicationId;
99
private final String sessionToken;
1010

11-
/* package */ ConnectClientOperation(String applicationId, String sessionToken) {
11+
ConnectClientOperation(String applicationId, String sessionToken) {
1212
this.applicationId = applicationId;
1313
this.sessionToken = sessionToken;
1414
}
1515

1616
@Override
17-
/* package */ JSONObject getJSONObjectRepresentation() throws JSONException {
17+
JSONObject getJSONObjectRepresentation() throws JSONException {
1818
JSONObject jsonObject = new JSONObject();
1919
jsonObject.put("op", "connect");
2020
jsonObject.put("applicationId", applicationId);

ParseLiveQuery/src/main/java/com/parse/LiveQueryException.java renamed to ParseLiveQuery/src/main/java/com/parse/livequery/LiveQueryException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.parse;
1+
package com.parse.livequery;
22

33
import java.util.Locale;
44

ParseLiveQuery/src/main/java/com/parse/OkHttp3SocketClientFactory.java renamed to ParseLiveQuery/src/main/java/com/parse/livequery/OkHttp3SocketClientFactory.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.parse;
1+
package com.parse.livequery;
22

33
import android.util.Log;
44

@@ -12,7 +12,7 @@
1212
import okhttp3.WebSocketListener;
1313
import okio.ByteString;
1414

15-
/* package */ public class OkHttp3SocketClientFactory implements WebSocketClientFactory {
15+
public class OkHttp3SocketClientFactory implements WebSocketClientFactory {
1616

1717
OkHttpClient mClient;
1818

ParseLiveQuery/src/main/java/com/parse/ParseLiveQueryClient.java renamed to ParseLiveQuery/src/main/java/com/parse/livequery/ParseLiveQueryClient.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
package com.parse;
1+
package com.parse.livequery;
2+
3+
import com.parse.ParseObject;
4+
import com.parse.ParseQuery;
25

36
import java.net.URI;
47
import java.util.concurrent.Executor;
@@ -38,8 +41,7 @@ public static ParseLiveQueryClient getClient(URI uri, WebSocketClientFactory web
3841
return new ParseLiveQueryClientImpl(uri, webSocketClientFactory);
3942
}
4043

41-
/* package */
42-
static ParseLiveQueryClient getClient(URI uri, WebSocketClientFactory webSocketClientFactory, Executor taskExecutor) {
44+
public static ParseLiveQueryClient getClient(URI uri, WebSocketClientFactory webSocketClientFactory, Executor taskExecutor) {
4345
return new ParseLiveQueryClientImpl(uri, webSocketClientFactory, taskExecutor);
4446
}
4547

ParseLiveQuery/src/main/java/com/parse/ParseLiveQueryClientCallbacks.java renamed to ParseLiveQuery/src/main/java/com/parse/livequery/ParseLiveQueryClientCallbacks.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.parse;
1+
package com.parse.livequery;
22

33
public interface ParseLiveQueryClientCallbacks {
44
void onLiveQueryClientConnected(ParseLiveQueryClient client);

0 commit comments

Comments
 (0)