Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Commit

Permalink
Split into bolts-tasks and bolts-applinks
Browse files Browse the repository at this point in the history
There are now three Maven artifacts:
* bolts-android - Android, No sources, dependencies on bolts-tasks and bolts-applinks for backwards compatibility
* bolts-tasks - Java, contains TPL
* bolts-applinks - Android, contains AppLinks

Added Travis-CI logcat output
  • Loading branch information
grantland committed Oct 16, 2015
1 parent fb8ced3 commit a6ef7a4
Show file tree
Hide file tree
Showing 37 changed files with 282 additions and 67 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ before_script:
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
- adb logcat -v time > logcat.txt &

script:
- ./gradlew build testDebug connectedCheck --continue --info

after_script:
- travis_fold:start:logcat
- cat logcat.txt
- travis_fold:end:logcat

after_success:
- ./gradlew jacocoTestReport coveralls
- ./scripts/publish_snapshot.sh
Expand Down
47 changes: 6 additions & 41 deletions Bolts/build.gradle → bolts-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import com.android.builder.core.BuilderConstants
apply plugin: 'com.android.library'
apply plugin: 'com.github.kt3k.coveralls'

group = 'com.parse.bolts'
version = '1.2.2-SNAPSHOT'
group = GROUP_NAME
version = VERSION_NAME

android {
compileSdkVersion rootProject.ext.compileSdkVersion
Expand All @@ -25,9 +25,8 @@ android {
}

dependencies {
testCompile 'junit:junit:4.12'

androidTestCompile 'com.android.support:support-v4:23.0.1'
compile project(':bolts-tasks')
compile project(':bolts-applinks')
}

android.libraryVariants.all { variant ->
Expand Down Expand Up @@ -55,6 +54,8 @@ android.libraryVariants.all { variant ->
}
}

//region Maven

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

Expand Down Expand Up @@ -130,40 +131,4 @@ artifacts {
archives androidJavadocsJar
}

//region Code Coverage

apply plugin: 'jacoco'

task jacocoTestReport(type:JacocoReport, dependsOn: "testDebugUnitTest") {
group = "Verification"
description = "Creates unit test coverage reports for the debug variant."

classDirectories = fileTree(
dir: "${buildDir}/intermediates/classes/debug",
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)

sourceDirectories = files("${buildDir.parent}/src/main/java")
additionalSourceDirs = files([
"${buildDir}/generated/source/buildConfig/debug",
"${buildDir}/generated/source/r/debug"
])
executionData = files("${buildDir}/jacoco/testDebugUnitTest.exec")

reports {
xml.enabled = true
html.enabled = true
}
}

//endregion

//region Coveralls

coveralls.jacocoReportPath = "${buildDir}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"

//endregion
136 changes: 136 additions & 0 deletions bolts-applinks/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import com.android.builder.core.BuilderConstants

apply plugin: 'com.android.library'

group = GROUP_NAME
version = VERSION_NAME

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

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName project.version
}

buildTypes {
debug {
testCoverageEnabled = true
}
}
}

dependencies {
compile project(':bolts-tasks')

testCompile 'junit:junit:4.12'

androidTestCompile 'com.android.support:support-v4:23.0.1'
}

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

manifest {
attributes(
"Bundle-Name": 'bolts-applinks',
"Bundle-Version": project.version
)
}

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

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

//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')

uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

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)
}

pom.project {
name 'Bolts-AppLinks'
artifactId = 'bolts-applinks'
packaging 'jar'
description 'Bolts is a collection of low-level libraries designed to make developing mobile apps easier.'
url 'https://github.com/BoltsFramework/Bolts-Android'

scm {
connection 'scm:[email protected]:BoltsFramework/Bolts-Android.git'
developerConnection 'scm:[email protected]:BoltsFramework/Bolts-Android.git'
url 'https://github.com/BoltsFramework/Bolts-Android'
}

licenses {
license {
name 'BSD 2-Clause License'
url 'https://github.com/BoltsFramework/Bolts-Android/blob/master/LICENSE'
distribution 'repo'
}
}

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

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

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

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

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

artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}

//endregion
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

public class AppLinkTest extends InstrumentationTestCase {

private static final String PACKAGE_NAME = "bolts.test";
private static final String PACKAGE_NAME = "bolts.applinks.test";

private List<Intent> openedIntents;
private Context activityInterceptor;
Expand Down
6 changes: 6 additions & 0 deletions bolts-applinks/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<manifest package="bolts.applinks" >

<application>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/**
* Represents a pending request to navigate to an App Link. Most developers will simply use
* {@link #navigateInBackground(android.content.Context, android.net.Uri)} to open a URL, but
* {@link #navigateInBackground(Context, Uri)} to open a URL, but
* developers can build custom requests with additional navigation and app data attached to them
* by creating AppLinkNavigations themselves.
*/
Expand All @@ -45,8 +45,8 @@ public class AppLinkNavigation {
private static AppLinkResolver defaultResolver;

/**
* The result of calling {@link #navigate(android.content.Context)} on an
* {@link bolts.AppLinkNavigation}.
* The result of calling {@link #navigate(Context)} on an
* {@link AppLinkNavigation}.
*/
public static enum NavigationResult {
/**
Expand Down Expand Up @@ -263,7 +263,7 @@ private JSONObject getJSONForBundle(Bundle bundle) throws JSONException {
* Performs the navigation.
*
* @param context the Context from which the navigation should be performed.
* @return the {@link bolts.AppLinkNavigation.NavigationResult} performed by navigating.
* @return the {@link NavigationResult} performed by navigating.
*/
public NavigationResult navigate(Context context) {
PackageManager pm = context.getPackageManager();
Expand Down Expand Up @@ -339,7 +339,7 @@ private void sendAppLinkNavigateEventBroadcast(Context context, Intent intent, N

/**
* Sets the default resolver to be used for App Link resolution. Setting this to null will cause
* the {@link #navigateInBackground(android.content.Context, android.net.Uri)} methods to use the
* the {@link #navigateInBackground(Context, Uri)} methods to use the
* basic, built-in resolver provided by Bolts.
*
* @param resolver the resolver to use by default.
Expand Down Expand Up @@ -367,24 +367,24 @@ private static AppLinkResolver getResolver(Context context) {
}

/**
* Navigates to an {@link bolts.AppLink}.
* Navigates to an {@link AppLink}.
*
* @param context the Context from which the navigation should be performed.
* @param appLink the AppLink being navigated to.
* @return the {@link bolts.AppLinkNavigation.NavigationResult} performed by navigating.
* @return the {@link NavigationResult} performed by navigating.
*/
public static NavigationResult navigate(Context context, AppLink appLink) {
return new AppLinkNavigation(appLink, null, null).navigate(context);
}

/**
* Navigates to an {@link bolts.AppLink} for the given destination using the App Link resolution
* Navigates to an {@link AppLink} for the given destination using the App Link resolution
* strategy specified.
*
* @param context the Context from which the navigation should be performed.
* @param destination the destination URL for the App Link.
* @param resolver the resolver to use for fetching App Link metadata.
* @return the {@link bolts.AppLinkNavigation.NavigationResult} performed by navigating.
* @return the {@link NavigationResult} performed by navigating.
*/
public static Task<NavigationResult> navigateInBackground(final Context context,
Uri destination,
Expand All @@ -399,13 +399,13 @@ public NavigationResult then(Task<AppLink> task) throws Exception {
}

/**
* Navigates to an {@link bolts.AppLink} for the given destination using the App Link resolution
* Navigates to an {@link AppLink} for the given destination using the App Link resolution
* strategy specified.
*
* @param context the Context from which the navigation should be performed.
* @param destination the destination URL for the App Link.
* @param resolver the resolver to use for fetching App Link metadata.
* @return the {@link bolts.AppLinkNavigation.NavigationResult} performed by navigating.
* @return the {@link NavigationResult} performed by navigating.
*/
public static Task<NavigationResult> navigateInBackground(Context context,
URL destination,
Expand All @@ -414,13 +414,13 @@ public static Task<NavigationResult> navigateInBackground(Context context,
}

/**
* Navigates to an {@link bolts.AppLink} for the given destination using the App Link resolution
* Navigates to an {@link AppLink} for the given destination using the App Link resolution
* strategy specified.
*
* @param context the Context from which the navigation should be performed.
* @param destinationUrl the destination URL for the App Link.
* @param resolver the resolver to use for fetching App Link metadata.
* @return the {@link bolts.AppLinkNavigation.NavigationResult} performed by navigating.
* @return the {@link NavigationResult} performed by navigating.
*/
public static Task<NavigationResult> navigateInBackground(Context context,
String destinationUrl,
Expand All @@ -429,12 +429,12 @@ public static Task<NavigationResult> navigateInBackground(Context context,
}

/**
* Navigates to an {@link bolts.AppLink} for the given destination using the default
* Navigates to an {@link AppLink} for the given destination using the default
* App Link resolution strategy.
*
* @param context the Context from which the navigation should be performed.
* @param destination the destination URL for the App Link.
* @return the {@link bolts.AppLinkNavigation.NavigationResult} performed by navigating.
* @return the {@link NavigationResult} performed by navigating.
*/
public static Task<NavigationResult> navigateInBackground(Context context,
Uri destination) {
Expand All @@ -444,12 +444,12 @@ public static Task<NavigationResult> navigateInBackground(Context context,
}

/**
* Navigates to an {@link bolts.AppLink} for the given destination using the default
* Navigates to an {@link AppLink} for the given destination using the default
* App Link resolution strategy.
*
* @param context the Context from which the navigation should be performed.
* @param destination the destination URL for the App Link.
* @return the {@link bolts.AppLinkNavigation.NavigationResult} performed by navigating.
* @return the {@link NavigationResult} performed by navigating.
*/
public static Task<NavigationResult> navigateInBackground(Context context,
URL destination) {
Expand All @@ -459,12 +459,12 @@ public static Task<NavigationResult> navigateInBackground(Context context,
}

/**
* Navigates to an {@link bolts.AppLink} for the given destination using the default
* Navigates to an {@link AppLink} for the given destination using the default
* App Link resolution strategy.
*
* @param context the Context from which the navigation should be performed.
* @param destinationUrl the destination URL for the App Link.
* @return the {@link bolts.AppLinkNavigation.NavigationResult} performed by navigating.
* @return the {@link NavigationResult} performed by navigating.
*/
public static Task<NavigationResult> navigateInBackground(Context context,
String destinationUrl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface AppLinkResolver {
* Asynchronously resolves App Link data for a given URL.
*
* @param url the URL to resolve into an App Link.
* @return the {@link bolts.AppLink} for the given URL.
* @return the {@link AppLink} for the given URL.
*/
public Task<AppLink> getAppLinkFromUrlInBackground(Uri url);
}
Loading

0 comments on commit a6ef7a4

Please sign in to comment.