forked from agraebe/rides-android-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Gradle Release Plugin] - pre tag commit: 'v0.1.0'.
- Loading branch information
Alex Texter
committed
Nov 23, 2015
1 parent
66744c9
commit dcdbb4e
Showing
60 changed files
with
2,986 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.classpath | ||
.project | ||
.settings | ||
eclipsebin | ||
|
||
bin | ||
gen | ||
build | ||
out | ||
lib | ||
|
||
target | ||
pom.xml.* | ||
release.properties | ||
local.properties | ||
.gradle | ||
|
||
.idea | ||
*.iml | ||
classes | ||
|
||
obj | ||
|
||
.DS_Store | ||
log.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
v0.1.0 - 11/24/2015 | ||
------------------ | ||
- Initial version. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2015 Uber Technologies, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,120 @@ | ||
Readme | ||
# Uber Rides Android SDK | ||
|
||
Official Android SDK (beta) to support Uber’s deeplinks. | ||
|
||
This library allows you to integrate Uber into your Android app. | ||
|
||
At a minimum, this SDK is designed to work with Android SDK 16. | ||
|
||
## Before you begin | ||
|
||
Before using this SDK, register your application on the [Uber Developer Site](https://developer.uber.com/). | ||
|
||
## Installation | ||
|
||
To use the Uber Rides Android SDK, add the compile dependency with the latest version of the Uber SDK. | ||
|
||
### Gradle | ||
|
||
Add the Uber Rides Android SDK to your `build.gradle`: | ||
```gradle | ||
dependencies { | ||
compile 'com.uber.sdk:rides-android:0.1.0' | ||
} | ||
``` | ||
|
||
### Maven | ||
|
||
In the `pom.xml` file: | ||
```xml | ||
<dependency> | ||
<groupId>com.uber.sdk</groupId> | ||
<artifactId>rides-android</artifactId> | ||
<version>0.1.0/version> | ||
</dependency> | ||
``` | ||
|
||
## How to use | ||
|
||
You can add a Ride Request Button to your View like you would any other View: | ||
```java | ||
RequestButton requestButton = new RequestButton(context); | ||
requestButton.setClientId("your_client_id"); | ||
layout.addView(requestButton); | ||
``` | ||
|
||
This will create a request button with default behavior, with pickup pin set to the user’s current location. The user will need to select a product and input additional information when they are switched over to the Uber application. | ||
|
||
You can also add your button through XML: | ||
```xml | ||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:uber="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<com.uber.sdk.android.rides.RequestButton | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
uber:client_id="clientId" | ||
uber:style="black"/> | ||
|
||
</LinearLayout> | ||
``` | ||
|
||
To use the `uber` custom attribute be sure to add `xmlns:uber="http://schemas.android.com/apk/res-auto"` to your root view element. | ||
|
||
### Adding Parameters | ||
|
||
We suggest passing additional parameters to make the Uber experience even more seamless for your users. For example, dropoff location parameters can be used to automatically pass the user’s destination information over to the driver: | ||
```java | ||
RequestButton requestButton = RequestButton(context); | ||
requestButton.setClientId(“your_client_id”); | ||
RideParameters rideParams = new RideParameters.Builder() | ||
.setProductID(“abc123-productID”) | ||
.setPickupLocation(latitude: “37.770”, longitude: “-122.466”, nickname: “California Academy of Sciences”) | ||
.setDropoffLocation(latitude: “37.791”, longitude: “-122.405”, nickname: “Pier 39”) | ||
.build(); | ||
requestButton.setRideParameters(rideParams); | ||
layout.addView(requestButton); | ||
``` | ||
With all the necessary parameters set, pressing the button will seamlessly prompt a ride request confirmation screen. | ||
|
||
### Color Style | ||
|
||
The default color has a black background with white text: | ||
```xml | ||
<com.uber.sdk.android.rides.RequestButton | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
uber:client_id="clientId"/> | ||
``` | ||
For a button with a white background and black text: | ||
```xml | ||
<com.uber.sdk.android.rides.RequestButton | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
uber:client_id="clientId" | ||
uber:style="white"/> | ||
``` | ||
|
||
## Sample Apps | ||
|
||
|
||
A sample app can be found in the `samples` folder. Alternatively, you can also download a sample from the [releases page](https://github.com/uber/rides-android-sdk/releases/tag/v0.1.0). | ||
|
||
Don’t forget to configure the appropriate `res/values/strings.xml` file and add your client ID. | ||
|
||
To install the sample app from your IDE, File > New > Import Project and select the extracted folder from the downloaded sample. | ||
|
||
## Getting help | ||
|
||
Uber developers actively monitor the Uber Tag on StackOverflow. If you need help installing or using the library, you can ask a question there. Make sure to tag your question with `uber-api` and `android`! | ||
|
||
For full documentation about our API, visit our Developer Site. | ||
|
||
## Contributing | ||
|
||
We love contributions. If you’ve found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo. Write a test to show your bug was fixed or the feature works as expected. | ||
|
||
## MIT Licensed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
apply plugin: 'distribution' | ||
apply plugin: 'net.researchgate.release' | ||
apply plugin: 'co.riiid.gradle' | ||
|
||
import groovy.text.GStringTemplateEngine | ||
import org.codehaus.groovy.runtime.DateGroovyMethods | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:1.3.1' | ||
classpath 'net.researchgate:gradle-release:2.2.2' | ||
classpath 'co.riiid:gradle-github-plugin:0.3.1' | ||
} | ||
} | ||
|
||
allprojects { | ||
apply plugin: 'checkstyle' | ||
apply plugin: 'maven' | ||
|
||
["githubToken", "ossrhUsername", "ossrhPassword", | ||
"signing.keyId", "signing.password", "signing.secretKeyRingFile",].each {checkAndDefaultProperty(it)} | ||
|
||
ext.set("unsnapshottedVersion", version.replaceAll("-SNAPSHOT", "")) | ||
ext.set("samples", project(":samples").subprojects.collect {it.path}) | ||
ext.set("isReleaseVersion", !version.endsWith("SNAPSHOT")) | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
|
||
checkstyle { | ||
toolVersion = "6.11.2" | ||
} | ||
|
||
task checkstyleMain(type: Checkstyle, overwrite: true) { | ||
configFile = new File("{$project.projectDir}/config/checkstyle/checkstyle-main.xml") | ||
} | ||
|
||
task checkstyleTest(type: Checkstyle, overwrite: true) { | ||
configFile = new File("{$project.projectDir}/config/checkstyle/checkstyle-test.xml") | ||
} | ||
} | ||
|
||
def generateReleaseNotes() { | ||
def changelogSnippet = generateChangelogSnippet() | ||
def model = [title: "Uber Rides Android SDK (Beta) v${unsnapshottedVersion}", | ||
date: DateGroovyMethods.format(new Date(), 'MM/dd/yyyy'), | ||
snippet: changelogSnippet, | ||
assets: project.samples.collect {[ | ||
title: project(it).name, | ||
download: githubDownloadPrefix + "v${unsnapshottedVersion}/" | ||
+ project(it).name + "-v${unsnapshottedVersion}.zip", | ||
description: project(it).description, | ||
]}] | ||
def engine = new GStringTemplateEngine() | ||
def template = engine.createTemplate(rootProject.file('releasenotes.gtpl')).make(model) | ||
return template.toString() | ||
} | ||
|
||
def generateChangelogSnippet() { | ||
def changelog = rootProject.file('CHANGELOG.md').text | ||
def snippet = "" | ||
def stop = false | ||
changelog.eachLine {line, count -> | ||
if (count >= 2) { | ||
stop = stop || line.startsWith("v"); | ||
if (!stop) { | ||
snippet += line + "\n"; | ||
} | ||
} | ||
} | ||
return " " + snippet.trim(); | ||
} | ||
|
||
def checkAndDefaultProperty(prop) { | ||
if (!project.hasProperty(prop)) { | ||
logger.warn("Add " + prop + " to your ~/.gradle/gradle.properties file.") | ||
rootProject.ext.set(prop, prop) | ||
} | ||
} | ||
|
||
def checkForChangelogUpdates(task) { | ||
def changelogtext = rootProject.file('CHANGELOG.md').text | ||
if (!changelogtext.startsWith("v${unsnapshottedVersion} -")) { | ||
throw new AssertionError( | ||
"Changelog must be updated with v{$unsnapshottedVersion} before release. Please check " + | ||
rootProject.file('CHANGELOG.md').absolutePath) | ||
} | ||
} | ||
|
||
gradle.taskGraph.afterTask { Task task, TaskState state -> | ||
if (task.path.endsWith("release") || task.path.endsWith("githubReleaseZip") | ||
|| task.path.endsWith("publicrepoDistZip")) { | ||
checkForChangelogUpdates(task) | ||
} | ||
} | ||
|
||
// Skip signing archives on Jenkins when -SNAPSHOT is being checked in. | ||
gradle.taskGraph.beforeTask { Task task -> | ||
if (task.path.contains("sign") && !ext.isReleaseVersion) { | ||
task.enabled = false | ||
} | ||
} | ||
|
||
afterReleaseBuild.dependsOn ":sdk:uploadArchives" | ||
updateVersion.dependsOn ":githubRelease" | ||
githubRelease.dependsOn project(":samples").subprojects.collect {it.path + ":githubReleaseZip"} | ||
|
||
release { | ||
failOnCommitNeeded = false | ||
failOnPublishNeeded = false | ||
failOnSnapshotDependencies = false | ||
revertOnFail = true | ||
tagTemplate = "v${unsnapshottedVersion}" | ||
} | ||
|
||
github { | ||
owner = 'uber' | ||
repo = 'rides-android-sdk' | ||
token = "${githubToken}" | ||
tagName = "v${unsnapshottedVersion}" | ||
targetCommitish = 'master' | ||
name = "v${unsnapshottedVersion}" | ||
body = generateReleaseNotes() | ||
assets = project.samples.collect { | ||
project(it).buildDir.absolutePath + "/distributions/" + project(it).name + | ||
"-v${unsnapshottedVersion}.zip" | ||
} | ||
} | ||
|
||
distributions { | ||
publicrepo { | ||
baseName = 'publicrepo' | ||
contents { | ||
from(rootDir) { | ||
include 'build.gradle' | ||
include 'CHANGELOG.md' | ||
include 'gradle.properties' | ||
include 'gradlew' | ||
include 'gradlew.bat' | ||
include 'LICENSE' | ||
include 'releasenotes.gtpl' | ||
include 'settings.gradle' | ||
include 'gradle/' | ||
} | ||
|
||
from(rootDir) { | ||
include 'README.md' | ||
filter { String line -> | ||
line.replaceAll("_version_", unsnapshottedVersion) | ||
} | ||
} | ||
|
||
from('sdk') { | ||
filesNotMatching("**/*.png") { | ||
filter { String line -> | ||
line.replaceAll("_version_", unsnapshottedVersion) | ||
} | ||
} | ||
exclude 'build' | ||
exclude '*.iml' | ||
into 'sdk' | ||
} | ||
|
||
from('samples') { | ||
exclude '**/build' | ||
exclude '**/*.iml' | ||
into 'samples' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
group=com.uber.sdk | ||
groupId=com.uber.sdk | ||
artifactId=rides-android | ||
githubDownloadPrefix=https://github.com/uber/rides-android-sdk/releases/download/ | ||
version=0.1.0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Mon Oct 12 19:04:32 PDT 2015 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip |
Oops, something went wrong.