Skip to content

Commit 9cc1425

Browse files
committed
Merge pull request #88 from d-kunin/master
Separate module for library. Parcelable models
2 parents 625c345 + c2f016a commit 9cc1425

File tree

132 files changed

+2004
-494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+2004
-494
lines changed

.utility/publish-javadoc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if [ "$TRAVIS_REPO_SLUG" == "kaaes/spotify-web-api-android" ] && [ "$TRAVIS_PULL
44

55
echo -e "Merged new code into master branch. Publishing Javadoc to GH Pages...\n"
66

7-
cp -R build/docs $HOME/javadoc-latest
7+
cp -R spotify-api/build/docs $HOME/javadoc-latest
88

99
cd $HOME
1010
git config --global user.email "[email protected]"

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,20 @@
55
This project is a wrapper for the [Spotify Web API](https://developer.spotify.com/web-api/).
66
It uses [Retrofit](http://square.github.io/retrofit/) to create Java interfaces from API endpoints.
77

8-
## Building
8+
## <a name="building"></a>Building
99
This project is built using [Gradle](https://gradle.org/):
1010

1111
1. Clone the repository: `git clone https://github.com/kaaes/spotify-web-api-android.git`
1212
2. Build: `./gradlew assemble`
13-
3. Grab the `aar` that can be found in `build/outputs/aar/spotify-web-api-android-0.1.0.aar` and put it in the `libs` folder in your application
13+
3. Grab the `aar` that can be found in `spotify-api/build/outputs/aar/spotify-web-api-android-0.1.1.aar` and put it in the `libs` folder in your application
1414

15-
#### Dependencies
15+
## Integration into your project
1616

17-
This project depends on `Retrofit 1.9.0` and `OkHttp 2.2.0`. When you build it, it creates an `aar`
17+
This project depends on `Retrofit 1.9.0` and `OkHttp 2.2.0`. When you [build it](#building), it creates an `aar`
1818
that doesn't contain Retrofit and OkHttp files. To make your app work you'll need to include these
19-
dependencies in your app's `gradle.build` file.
19+
dependencies in your app's `build.gradle` file.
2020

21-
The `repositories` section tells your application to look for the `spotify-web-api-android-0.1.0.aar`
22-
in the local repository in the `libs` folder.
23-
24-
Add following to the `gradle.build` file in your app:
21+
Add following to the `build.gradle` file in your app:
2522

2623
```groovy
2724
repositories {
@@ -40,10 +37,12 @@ dependencies {
4037
}
4138
```
4239

40+
The `repositories` section tells your application to look for the `spotify-web-api-android-0.1.1.aar`
41+
in the local repository in the `libs` folder.
4342

4443
## Usage
4544

46-
Out of the box it uses [OkHttp](http://square.github.io/okhttp/) HTTP client and a [single thread executor](https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html#newSingleThreadExecutor()).
45+
Out of the box it uses [OkHttp](http://square.github.io/okhttp/) HTTP client and a [single thread executor](https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html).
4746

4847
```java
4948
SpotifyApi api = new SpotifyApi();

build.gradle

Lines changed: 11 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -2,110 +2,20 @@ buildscript {
22
repositories {
33
jcenter()
44
}
5-
65
dependencies {
7-
classpath 'com.android.tools.build:gradle:1.2.3'
8-
classpath 'org.robolectric:robolectric-gradle-plugin:1.1.0'
9-
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
10-
}
11-
}
6+
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_PLUGIN_VERSION}"
7+
classpath "org.robolectric:robolectric-gradle-plugin:${ROBOLECTRIC_GRADLE_PLUGIN_VERSION}"
8+
classpath "com.jakewharton.sdkmanager:gradle-plugin:${SDKMANAGER_GRADLE_PLUGIN_VERSION}"
129

13-
apply plugin: 'android-sdk-manager'
14-
apply plugin: 'com.android.library'
15-
apply plugin: 'org.robolectric'
16-
17-
repositories {
18-
jcenter()
19-
}
20-
21-
archivesBaseName="spotify-web-api-android"
22-
version="0.1.0"
23-
24-
android {
25-
compileSdkVersion 22
26-
buildToolsVersion '22.0.1'
27-
28-
buildTypes {
29-
debug {
30-
testCoverageEnabled = true
31-
}
10+
// NOTE: Do not place your application dependencies here; they belong
11+
// in the individual module build.gradle files
3212
}
33-
34-
// make proper name for 'aar' file
35-
libraryVariants.all { variant ->
36-
variant.outputs.each { output ->
37-
def outputFile = output.outputFile
38-
if (outputFile != null && outputFile.name.endsWith('.aar')) {
39-
def fileName = "${archivesBaseName}-${version}.aar"
40-
output.outputFile = new File(outputFile.parent, fileName)
41-
}
42-
}
43-
}
44-
45-
lintOptions {
46-
warning 'InvalidPackage'
47-
}
48-
}
49-
50-
dependencies {
51-
compile('com.squareup.retrofit:retrofit:1.9.0') {
52-
transitive = true
53-
}
54-
compile('com.squareup.okhttp:okhttp:2.2.0') {
55-
transitive = true
56-
}
57-
58-
testCompile 'junit:junit:4.12'
59-
testCompile 'org.robolectric:robolectric:2.4'
60-
testCompile 'org.mockito:mockito-core:1.9.5'
6113
}
6214

63-
// javadoc { The name will be 'generateReleaseJavadoc' }
64-
android.libraryVariants.all { variant ->
65-
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
66-
67-
title = "Spotify Web API Android Client - API Reference"
68-
destinationDir = file("./build/docs/")
69-
options.links("http://docs.oracle.com/javase/7/docs/api/");
70-
options.links("http://square.github.io/retrofit/javadoc/");
71-
72-
source = variant.javaCompile.source
73-
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
74-
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
75-
}
76-
}
77-
78-
/* jacoco {`./gradlew check` generates report `build/reports/jacoco` } */
79-
apply plugin: 'jacoco'
80-
81-
jacoco {
82-
toolVersion = "0.7.1.201405082137"
83-
}
84-
85-
def coverageSourceDirs = ['src/main/java' ]
86-
87-
task jacocoTestReport(type:JacocoReport, dependsOn: "testDebug") {
88-
group = "Reporting"
89-
description = "Generate Jacoco coverage reports"
90-
91-
classDirectories = fileTree(
92-
dir: 'build/intermediates/classes/debug',
93-
excludes: ['**/R.class',
94-
'**/R$*.class',
95-
'**/*$ViewInjector*.*',
96-
'**/BuildConfig.*',
97-
'**/Manifest*.*']
98-
)
99-
100-
additionalSourceDirs = files(coverageSourceDirs)
101-
sourceDirectories = files(coverageSourceDirs)
102-
executionData = files('build/jacoco/testDebug.exec')
103-
104-
reports {
105-
xml.enabled = true
106-
html.enabled = true
15+
subprojects {
16+
repositories {
17+
mavenLocal()
18+
jcenter()
19+
mavenCentral()
10720
}
108-
109-
}
110-
check.dependsOn jacocoTestReport
111-
/* !jacoco */
21+
}

gradle.properties

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
# Project-wide Gradle settings.
1+
org.gradle.daemon=true
22

3-
# IDE (e.g. Android Studio) users:
4-
# Settings specified in this file will override any Gradle settings
5-
# configured through the IDE.
3+
BASE_NAME=spotify-web-api-android
4+
VERSION_NAME=0.1.1
5+
GROUP=com.spotify.android
66

7-
# For more details on how to configure your build environment visit
8-
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Deps for gradle
8+
ANDROID_GRADLE_PLUGIN_VERSION=1.2.3
9+
ROBOLECTRIC_GRADLE_PLUGIN_VERSION=1.1.0
10+
SDKMANAGER_GRADLE_PLUGIN_VERSION=0.12.+
911

10-
# Specifies the JVM arguments used for the daemon process.
11-
# The setting is particularly useful for tweaking memory settings.
12-
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13-
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14-
15-
# When configured, Gradle will run in incubating parallel mode.
16-
# This option should only be used with decoupled projects. More details, visit
17-
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
12+
# Deps for libraries
13+
FEST_ASSERT_CORE_VERSION=2.0M10
14+
GUAVA_VERSION=18.0
15+
JUNIT_VERSION=4.12
16+
MOCKITO_CORE_VERSION=1.+
17+
ROBOLECTRIC_VERSION=2.4
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Jun 04 23:00:13 CEST 2015
1+
#Mon Jun 15 22:15:36 CEST 2015
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

release.gradle

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// javadoc { The name will be 'generateReleaseJavadoc' }
2+
android.libraryVariants.all { variant ->
3+
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
4+
5+
title = "Spotify Web API Android Client - API Reference"
6+
destinationDir = file("./build/docs/")
7+
options.links("http://docs.oracle.com/javase/7/docs/api/");
8+
options.links("http://square.github.io/retrofit/javadoc/");
9+
10+
source = variant.javaCompile.source
11+
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
12+
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
13+
}
14+
}
15+
16+
// make proper name for 'aar' file
17+
android.libraryVariants.all { variant ->
18+
variant.outputs.each { output ->
19+
def outputFile = output.outputFile
20+
if (outputFile != null && outputFile.name.endsWith('.aar')) {
21+
def fileName = "${BASE_NAME}-${version}.aar"
22+
output.outputFile = new File(outputFile.parent, fileName)
23+
}
24+
}
25+
}
26+
27+
/* jacoco {`./gradlew check` generates report `build/reports/jacoco` } */
28+
apply plugin: 'jacoco'
29+
30+
jacoco {
31+
toolVersion = "0.7.1.201405082137"
32+
}
33+
34+
def coverageSourceDirs = ['src/main/java' ]
35+
36+
task jacocoTestReport(type:JacocoReport, dependsOn: "testDebug") {
37+
group = "Reporting"
38+
description = "Generate Jacoco coverage reports"
39+
40+
classDirectories = fileTree(
41+
dir: 'build/intermediates/classes/debug',
42+
excludes: ['**/R.class',
43+
'**/R$*.class',
44+
'**/*$ViewInjector*.*',
45+
'**/BuildConfig.*',
46+
'**/Manifest*.*']
47+
)
48+
49+
additionalSourceDirs = files(coverageSourceDirs)
50+
sourceDirectories = files(coverageSourceDirs)
51+
executionData = files('build/jacoco/testDebug.exec')
52+
53+
reports {
54+
xml.enabled = true
55+
html.enabled = true
56+
}
57+
58+
}
59+
check.dependsOn jacocoTestReport
60+
/* !jacoco */

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ':spotify-api'

spotify-api/build.gradle

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apply plugin: 'android-sdk-manager'
2+
apply plugin: 'com.android.library'
3+
apply plugin: 'org.robolectric'
4+
5+
project.group = GROUP
6+
version = VERSION_NAME
7+
8+
dependencies {
9+
compile('com.squareup.retrofit:retrofit:1.9.0')
10+
compile('com.squareup.okhttp:okhttp:2.2.0')
11+
12+
testCompile("org.robolectric:robolectric:${ROBOLECTRIC_VERSION}") {
13+
exclude group: 'com.android.support', module: 'support-v4'
14+
exclude group: 'commons-logging', module: 'commons-logging'
15+
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
16+
}
17+
testCompile "com.google.guava:guava:${GUAVA_VERSION}"
18+
testCompile "junit:junit:${JUNIT_VERSION}"
19+
testCompile "org.easytesting:fest-assert-core:${FEST_ASSERT_CORE_VERSION}"
20+
testCompile "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
21+
}
22+
23+
apply from: rootProject.file('release.gradle')
24+
25+
android {
26+
compileSdkVersion 22
27+
buildToolsVersion '22.0.1'
28+
29+
lintOptions {
30+
disable 'InvalidPackage' // for okio-1.2.0
31+
}
32+
33+
buildTypes {
34+
debug {
35+
testCoverageEnabled = true
36+
}
37+
}
38+
}
39+
40+
android.testOptions.unitTests.all {
41+
// Configure includes / excludes
42+
include '**/*Test.class'
43+
exclude '**/espresso/**/*.class'
44+
45+
maxHeapSize = '2048m'
46+
jvmArgs '-XX:MaxPermSize=512m', '-XX:-UseSplitVerifier'
47+
maxParallelForks = 4
48+
forkEvery = 150
49+
50+
afterTest { descriptor, result ->
51+
println "Executing test for ${descriptor.name} with result: ${result.resultType}"
52+
}
53+
}
54+
55+

0 commit comments

Comments
 (0)