Skip to content

Commit

Permalink
Dependency updates (gradle etc.).
Browse files Browse the repository at this point in the history
Improved build process (fixed leaking dependencies).
Removed extra dependency on appcompat.
  • Loading branch information
d4rken committed Apr 27, 2018
1 parent 62024b3 commit 2835724
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 26 deletions.
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
def versionMajor = 1
def versionMinor = 0
def versionPatch = 5
def versionPatch = 6

ext.versions = [
'versionCode' : versionMajor * 10000 + versionMinor * 100 + versionPatch,
Expand All @@ -12,7 +12,7 @@ buildscript {
'sourceCompatibility': JavaVersion.VERSION_1_8,
'targetCompatibility': JavaVersion.VERSION_1_8,
'supportLibrary' : '27.1.1',
'buildTools' : '27.0.1'
'buildTools' : '27.0.3'
]

def credentialsFile = new File(System.properties['user.home'], ".bintray/bintray.properties")
Expand Down Expand Up @@ -50,9 +50,9 @@ buildscript {
'annotations': "com.android.support:support-annotations:${versions.supportLibrary}",
'appcompat' : "com.android.support:appcompat-v7:${versions.supportLibrary}"
],
androidPlugin: 'com.android.tools.build:gradle:3.0.1',
timber : "com.jakewharton.timber:timber:4.6.1",
rxJava : "io.reactivex.rxjava2:rxjava:2.1.6",
androidPlugin: 'com.android.tools.build:gradle:3.1.2',
timber : "com.jakewharton.timber:timber:4.7.0",
rxJava : "io.reactivex.rxjava2:rxjava:2.1.12",
rxJavaReplay : "com.jakewharton.rx2:replaying-share:2.0.1",
jUnit : "junit:junit:4.12",
mockito : "org.mockito:mockito-core:2.8.9",
Expand All @@ -65,8 +65,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
//noinspection GradleDependency
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
Expand Down
8 changes: 3 additions & 5 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ afterEvaluate {
})
}
dependencies {
api deps.support.annotations
api deps.support.appcompat
implementation deps.support.annotations

api deps.timber
implementation deps.timber

implementation deps.rxJava
implementation deps.rxJava
api deps.rxJava
api deps.rxJavaReplay

testImplementation deps.jUnit
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/eu/darken/rxshell/cmd/RxCmdShell.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package eu.darken.rxshell.cmd;

import android.support.v4.util.Pair;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -11,6 +9,7 @@
import java.util.Map;

import eu.darken.rxshell.extra.HasEnvironmentVariables;
import eu.darken.rxshell.extra.Pair;
import eu.darken.rxshell.extra.RXSDebug;
import eu.darken.rxshell.process.DefaultProcessFactory;
import eu.darken.rxshell.process.ProcessFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package eu.darken.rxshell.extra;


import android.support.v4.util.Pair;

import java.util.Collection;

public interface HasEnvironmentVariables {
Expand Down
88 changes: 88 additions & 0 deletions core/src/main/java/eu/darken/rxshell/extra/Pair.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.darken.rxshell.extra;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

/**
* Container to ease passing around a tuple of two objects. This object provides a sensible
* implementation of equals(), returning true if equals() is true on each of the contained
* objects.
*/
public class Pair<F, S> {
public final @Nullable F first;
public final @Nullable S second;

/**
* Constructor for a Pair.
*
* @param first the first object in the Pair
* @param second the second object in the pair
*/
public Pair(@Nullable F first, @Nullable S second) {
this.first = first;
this.second = second;
}

/**
* Checks the two objects for equality by delegating to their respective
* {@link Object#equals(Object)} methods.
*
* @param o the {@link Pair} to which this one is to be checked for equality
* @return true if the underlying objects of the Pair are both considered
* equal
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Pair)) return false;

Pair<?, ?> p = (Pair<?, ?>) o;
return objectsEqual(p.first, first) && objectsEqual(p.second, second);
}

private static boolean objectsEqual(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}

/**
* Compute a hash code using the hash codes of the underlying objects
*
* @return a hashcode of the Pair
*/
@Override
public int hashCode() {
return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
}

@Override
public String toString() {
return "Pair{" + String.valueOf(first) + " " + String.valueOf(second) + "}";
}

/**
* Convenience method for creating an appropriately typed pair.
*
* @param a the first object in the Pair
* @param b the second object in the pair
* @return a Pair that is templatized with the types of a and b
*/
@NonNull
public static <A, B> Pair<A, B> create(@Nullable A a, @Nullable B b) {
return new Pair<>(a, b);
}
}
7 changes: 5 additions & 2 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ dependencies {
implementation project(':core')
implementation project(':root')

implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation deps.support.appcompat

implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

implementation 'com.jakewharton.timber:timber:4.7.0'

implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'

testImplementation deps.jUnit
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 06 20:03:29 CET 2017
#Fri Apr 27 02:03:03 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
4 changes: 3 additions & 1 deletion publish-to-bintray.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
apply plugin: 'com.github.dcendents.android-maven'

group = bintrayConfig.publishedGroupId
version = bintrayConfig.libraryVersion

install {
repositories.mavenInstaller {
pom.project {
Expand Down Expand Up @@ -50,7 +53,6 @@ artifacts {
archives javadocJar
archives sourcesJar
}
version = bintrayConfig.libraryVersion

// https://github.com/bintray/gradle-bintray-plugin#buildgradle
bintray {
Expand Down
7 changes: 3 additions & 4 deletions root/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ android {
dependencies {
implementation project(':core')

api deps.support.annotations
implementation deps.support.annotations
implementation deps.timber

api deps.timber

implementation deps.rxJava
api deps.rxJava

testImplementation deps.jUnit
testImplementation deps.mockito
Expand Down

0 comments on commit 2835724

Please sign in to comment.