Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version Gradle to 4.10.3 and Robolectric to 4.1 #805

Merged
merged 7 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
language: java

jdk: oraclejdk7
jdk: oraclejdk8

before_install:
- export TERM=dumb
- cp gradle.properties.dist gradle.properties
- sudo apt-get install -qq libstdc++6:i386 lib32z1
- export COMPONENTS=build-tools-19.0.3,android-19,extra-android-m2repository
- export COMPONENTS=build-tools-28.0.3,android-28,extra-android-m2repository
- curl -L https://raw.github.com/embarkmobile/android-sdk-installer/version-1/android-sdk-installer | bash /dev/stdin --install=$COMPONENTS
- source ~/.android-sdk-installer/env
install:
Expand Down
72 changes: 33 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@ def getVersionName = {

buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
url 'https://dl.google.com/dl/android/maven2/'
}
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.1'
//noinspection GradleDependency
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
//noinspection GradleDependency
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
}
}
Expand All @@ -45,23 +42,18 @@ apply plugin: 'com.android.library'
apply from: 'gradle/eclipse.gradle'

allprojects {
version = "${getVersionName()}${isSnapshot == true ? "-SNAPSHOT" : ""}"
version = "${getVersionName()}${isSnapshot ? "-SNAPSHOT" : ""}"
group = "org.altbeacon"

repositories {
google()
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
url 'https://dl.google.com/dl/android/maven2/'
}
}
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.0'
buildToolsVersion '28.0.3'

defaultConfig {
// Unfortunately 'com.android.support:appcompat-v7:26.0.0'
Expand Down Expand Up @@ -92,6 +84,14 @@ android {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
}

testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
animationsDisabled true
unitTests {
includeAndroidResources = true
}
}
}

configurations {
Expand All @@ -101,29 +101,22 @@ configurations {


dependencies {
compile fileTree ( dir: 'libs', include: ['*.jar'] )
compile 'com.android.support:support-v4:28.0.0'
compile 'com.android.support:support-annotations:28.0.0'

testCompile 'com.google.android:android-test:4.1.1.4'
testCompile('junit:junit:4.12') {
exclude group: 'org.hamcrest'
}
testCompile('org.hamcrest:hamcrest-junit:2.0.0.0') {
exclude group: 'junit'
}
testCompile('com.squareup:fest-android:1.0.+@aar')
testCompile('org.robolectric:robolectric:3.0') {
exclude group: 'junit'
}
testCompile('org.mockito:mockito-core:1.10.19') {
exclude group: 'org.hamcrest'
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'org.hamcrest'
})
androidTestCompile 'org.apache.commons:commons-math3:3.6.1'
implementation fileTree ( dir: 'libs', include: ['*.jar'] )
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'

testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.1'
testImplementation 'com.google.android:android-test:4.1.1.4'
testImplementation 'com.squareup:fest-android:1.0.8@aar'
testImplementation 'org.mockito:mockito-core:2.23.4'

androidTestUtil 'com.android.support.test:orchestrator:1.0.2'

androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'org.apache.commons:commons-math3:3.6.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

doclava 'com.google.doclava:doclava:1.0.6'
}

Expand Down Expand Up @@ -162,7 +155,8 @@ android.libraryVariants.all { variant ->
source = variant.javaCompile.source
ext.androidJar =
"${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files, ext.androidJar)
//Refer to https://stackoverflow.com/a/50833438/4068957
doFirst { classpath = files(variant.javaCompile.classpath.files, ext.androidJar)}
options.linksOffline "http://d.android.com/reference/", "${android.sdkDirectory}/docs/reference"
exclude '**/BuildConfig.java'
exclude '**/R.java'
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ machine:
version: openjdk8
dependencies:
pre:
- echo y | android update sdk --no-ui --all --filter "tools,android-27,build-tools-27.0.3,platform-tools,extra-android-m2repository,extra-google-m2repository"
- echo y | android update sdk --no-ui --all --filter "tools,android-28,build-tools-28.0.3,platform-tools,extra-android-m2repository,extra-google-m2repository"
general:
branches:
ignore:
2 changes: 1 addition & 1 deletion eclipse-support/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-18
target=android-28
android.library=true
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ project_connection = scm:git:https://github.com/AltBeacon/android-beacon-library
project_dev_connection = scm:git:git@github.com:AltBeacon/android-beacon-library.git
project_bintray_repo = android
project_bintray_org = altbeacon
android.enableUnitTestBinaryResources=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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.10.3-bin.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.junit.Test;
import org.robolectric.annotation.Config;

@Config(sdk = 18)
@Config(sdk = 28)
@RunWith(RobolectricTestRunner.class)
/*
HOW TO SEE DEBUG LINES FROM YOUR UNIT TESTS:
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/altbeacon/beacon/AltBeaconTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static org.hamcrest.Matchers.hasProperty;
import static org.junit.Assert.assertEquals;

@Config(sdk = 18)
@Config(sdk = 28)

@RunWith(RobolectricTestRunner.class)

Expand Down
26 changes: 8 additions & 18 deletions src/test/java/org/altbeacon/beacon/BeaconParserTest.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
package org.altbeacon.beacon;

import android.annotation.TargetApi;
import android.os.Build;
import android.os.Parcel;

import static android.test.MoreAsserts.assertNotEqual;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import org.altbeacon.beacon.logging.LogManager;
import org.altbeacon.beacon.logging.Loggers;
import org.robolectric.RobolectricTestRunner;

import org.junit.runner.RunWith;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.util.Arrays;

@Config(sdk = 18)
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

@Config(sdk = 28)

@RunWith(RobolectricTestRunner.class)

Expand Down Expand Up @@ -144,7 +137,6 @@ public void testRecognizeBeaconWithFormatSpecifyingManufacturer() {
assertEquals("manufacturer should be parsed", 0x118 ,beacon.getManufacturer());
}

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Test
public void testReEncodesBeacon() {
org.robolectric.shadows.ShadowLog.stream = System.err;
Expand All @@ -157,7 +149,6 @@ public void testReEncodesBeacon() {
assertArrayEquals("beacon advertisement bytes should be the same after re-encoding", expectedMatch, regeneratedBytes);
}

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Test
public void testReEncodesBeaconForEddystoneTelemetry() {
org.robolectric.shadows.ShadowLog.stream = System.err;
Expand Down Expand Up @@ -185,7 +176,6 @@ public void testLittleEndianIdentifierParsing() {
assertEquals("manufacturer should be parsed", 0x118, beacon.getManufacturer());
}

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Test
public void testReEncodesLittleEndianBeacon() {
org.robolectric.shadows.ShadowLog.stream = System.err;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/altbeacon/beacon/BeaconTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;

@Config(sdk = 18)
@Config(sdk = 28)

@RunWith(RobolectricTestRunner.class)

Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/altbeacon/beacon/BeaconTransmitterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowApplication;
import org.robolectric.RuntimeEnvironment;

import java.util.Arrays;

import static junit.framework.Assert.assertEquals;

@Config(sdk = 18)
@Config(sdk = 28)

/**
* Created by dyoung on 7/22/14.
Expand All @@ -25,7 +25,7 @@ public class BeaconTransmitterTest {
@Test
public void testBeaconAdvertisingBytes() {
org.robolectric.shadows.ShadowLog.stream = System.err;
Context context = ShadowApplication.getInstance().getApplicationContext();
Context context = RuntimeEnvironment.application;

Beacon beacon = new Beacon.Builder()
.setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
Expand All @@ -38,7 +38,7 @@ public void testBeaconAdvertisingBytes() {
BeaconParser beaconParser = new BeaconParser()
.setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
byte[] data = beaconParser.getBeaconAdvertisementData(beacon);
BeaconTransmitter beaconTransmitter = new BeaconTransmitter(context, beaconParser);
// BeaconTransmitter beaconTransmitter = new BeaconTransmitter(context, beaconParser);
// TODO: can't actually start transmitter here because Robolectric does not support API 21

assertEquals("Data should be 24 bytes long", 24, data.length);
Expand All @@ -53,7 +53,7 @@ public void testBeaconAdvertisingBytes() {
@Test
public void testBeaconAdvertisingBytesForEddystone() {
org.robolectric.shadows.ShadowLog.stream = System.err;
Context context = ShadowApplication.getInstance().getApplicationContext();
Context context = RuntimeEnvironment.application;

Beacon beacon = new Beacon.Builder()
.setId1("0x2f234454f4911ba9ffa6")
Expand All @@ -64,7 +64,7 @@ public void testBeaconAdvertisingBytesForEddystone() {
BeaconParser beaconParser = new BeaconParser()
.setBeaconLayout("s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19");
byte[] data = beaconParser.getBeaconAdvertisementData(beacon);
BeaconTransmitter beaconTransmitter = new BeaconTransmitter(context, beaconParser);
// BeaconTransmitter beaconTransmitter = new BeaconTransmitter(context, beaconParser);
// TODO: can't actually start transmitter here because Robolectric does not support API 21

String byteString = "";
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/org/altbeacon/beacon/GattBeaconTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowApplication;
import org.robolectric.RuntimeEnvironment;

import java.util.Arrays;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;

@Config(sdk = 18)
@Config(sdk = 28)

/**
* Created by dyoung on 2/6/15.
Expand Down Expand Up @@ -114,7 +114,7 @@ public void testDetectsGattBeaconWithCnn() {
@Test
public void testBeaconAdvertisingBytes() {
org.robolectric.shadows.ShadowLog.stream = System.err;
Context context = ShadowApplication.getInstance().getApplicationContext();
Context context = RuntimeEnvironment.application;


Beacon beacon = new Beacon.Builder()
Expand All @@ -127,7 +127,7 @@ public void testBeaconAdvertisingBytes() {
BeaconParser beaconParser = new BeaconParser()
.setBeaconLayout("s:0-1=0123,m:2-2=00,d:3-3,p:4-4,i:5-14,i:15-20");
byte[] data = beaconParser.getBeaconAdvertisementData(beacon);
BeaconTransmitter beaconTransmitter = new BeaconTransmitter(context, beaconParser);
// BeaconTransmitter beaconTransmitter = new BeaconTransmitter(context, beaconParser);
// TODO: can't actually start transmitter here because Robolectric does not support API 21

assertEquals("Data should be 19 bytes long", 19, data.length);
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/altbeacon/beacon/IdentifierTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Arrays;
import java.util.UUID;

@Config(sdk = 18)
@Config(sdk = 28)
@RunWith(RobolectricTestRunner.class)

/*
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/altbeacon/beacon/RegionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;

@Config(sdk = 18)
@Config(sdk = 28)

@RunWith(RobolectricTestRunner.class)

Expand Down
11 changes: 3 additions & 8 deletions src/test/java/org/altbeacon/beacon/SBeaconTest.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package org.altbeacon.beacon;

import android.annotation.TargetApi;
import android.bluetooth.BluetoothDevice;
import android.os.Build;
import android.os.Parcel;


import org.altbeacon.beacon.logging.LogManager;
import org.altbeacon.beacon.logging.Loggers;
import org.junit.Test;
import org.robolectric.annotation.Config;

import java.util.ArrayList;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import org.robolectric.annotation.Config;

@Config(sdk = 18)
@Config(sdk = 28)

/**
* Created by dyoung on 7/22/14.
Expand Down Expand Up @@ -90,7 +85,7 @@ protected SBeacon(Parcel in) {

class SBeaconParser extends BeaconParser {
private static final String TAG = "SBeaconParser";
@TargetApi(Build.VERSION_CODES.ECLAIR)

@Override
public Beacon fromScanData(byte[] scanData, int rssi, BluetoothDevice device) {
int startByte = 2;
Expand Down
Loading