Skip to content

Commit 1f6a5ed

Browse files
committed
Release 1.0.0
1 parent 0a7c97c commit 1f6a5ed

File tree

20 files changed

+1486
-69
lines changed

20 files changed

+1486
-69
lines changed

.github/workflows/android.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Android CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: set up JDK 1.8
13+
uses: actions/setup-java@v1
14+
with:
15+
java-version: 1.8
16+
- name: Run CI
17+
run: make ci
18+
- name: Upload artifact
19+
if: github.ref == 'refs/heads/master'
20+
uses: actions/upload-artifact@v1
21+
with:
22+
name: atinternet-dispatcher.zip
23+
path: release/

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
/captures
77
.externalNativeBuild
88
.cxx
9+
release/
10+
911

1012
/.idea/*
11-
!/.idea/runConfigurations/
13+
!/.idea/runConfigurations/
14+
/batch-maven-secret-gpg.key
15+
/maven.properties

.idea/runConfigurations/build_aar.xml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/dispatcher_test.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1.0
2+
-----
3+
4+
* Dispatcher release.

LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Copyright (c) 2014-Present, Batch.com
2+
3+
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:
4+
5+
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
- Use of copies, substantial portions or binaries contained within Batch's SDK is only permitted to enable use of the Batch platform.
8+
9+
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.

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
all: aar
2+
3+
aar: clean
4+
./gradlew assembleRelease --no-build-cache && \
5+
mkdir -p release/ && \
6+
cp atinternet-dispatcher/build/outputs/aar/atinternet-dispatcher-release.aar release/ && \
7+
cp LICENSE release/
8+
9+
clean:
10+
./gradlew clean
11+
12+
test:
13+
./gradlew testDebugUnitTest
14+
15+
test-coverage:
16+
./gradlew testDebugCoverageUnitTest && \
17+
awk -F"," '{ instructions += $$4 + $$5; covered += $$5 } END { print covered, "/", instructions, "instructions covered"; print "Total", 100*covered/instructions "% covered" }' atinternet-dispatcher/build/test-results/jacoco.csv
18+
19+
lint:
20+
./gradlew lintDebug
21+
22+
ci: lint test-coverage aar

README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1-
# Android At Internet Dispatcher for Batch SDK
1+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.batch.android/atinternet-dispatcher/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.batch.android/atinternet-dispatcher)
2+
[![Github Action](https://github.com/BatchLabs/android-atinternet-dispatcher/workflows/Android%20CI/badge.svg)](https://github.com/BatchLabs/android-atinternet-dispatcher/actions?query=workflow%3A%22Android+CI%22)
3+
4+
Batch.com Android AT Internet Dispatcher
5+
==================
6+
7+
![Logo](http://batch-doc.s3.amazonaws.com/logo_batch_192.gif)
8+
9+
# About
210

311
A "ready-to-go" dispatcher that reflect event from the Batch SDK to the At Internet dashboard using XTOR tag.
412

5-
## SDK dependencies
13+
# Requirements
14+
- Android Studio 3.0+
15+
- Android 15+
16+
- Batch Android SDK 1.15.0+
17+
- AT Internet SDK 2.13.2+
18+
19+
# Installation
20+
Gradle (recommended)
21+
22+
```
23+
implementation 'com.batch.android:atinternet-dispatcher:1.0+'
24+
```
25+
26+
Read our [setup documentation](https://doc.batch.com/) to follow a step by step tutorial for integrating Batch features into your app.
27+
28+
# Documentation
29+
30+
- [Technical](https://batch.com/doc)
31+
- [FAQ](https://batch.com/doc/faq/general.html)
32+
- [Developer FAQ](https://batch.com/developers)
633

7-
To update the Batch SDK, simply replace the atinternet-dispatcher/libs/Batch.arr file.
34+
Copyright 2020 - Batch.com

atinternet-dispatcher/build.gradle

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
apply plugin: 'com.android.library'
22

33
ext {
4-
playServicesVersion = '11.8.0'
4+
mavenGroupId = 'com.batch.android'
5+
mavenArtifact = 'atinternet-dispatcher'
6+
atInternetVersion = '2.14.0'
57
androidXLibraryVersion = '1.0.0'
6-
atInternetVersion = '2.13.2'
78
}
89

910
android {
1011
compileSdkVersion 29
1112
buildToolsVersion "29.0.2"
1213

13-
1414
defaultConfig {
1515
minSdkVersion 15
1616
targetSdkVersion 29
1717
versionCode 1
18-
versionName "1.0"
18+
versionName "1.0.0"
1919

2020
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2121
consumerProguardFiles 'consumer-rules.pro'
@@ -26,40 +26,35 @@ android {
2626
targetCompatibility JavaVersion.VERSION_1_8
2727
}
2828

29-
flavorDimensions "target-backend"
30-
31-
productFlavors {
32-
production {
33-
dimension "target-backend"
34-
}
35-
36-
staging {
37-
dimension "target-backend"
38-
}
39-
}
40-
4129
testOptions {
4230
unitTests {
4331
includeAndroidResources = true
32+
all {
33+
testLogging {
34+
events "started", "passed", "skipped", "failed"
35+
}
36+
}
4437
}
4538
}
46-
4739
}
4840

4941
dependencies {
50-
implementation fileTree(include: ['Batch.aar'], dir: 'libs')
51-
compileOnly "com.atinternet:Tracker:$atInternetVersion"
52-
compileOnly "androidx.core:core:$androidXLibraryVersion"
42+
api 'com.batch.android:batch-sdk:1.15.0'
43+
api "com.atinternet:Tracker:$atInternetVersion"
44+
implementation "androidx.annotation:annotation:$androidXLibraryVersion"
5345

5446
testImplementation 'junit:junit:4.12'
5547
testImplementation 'androidx.test.ext:junit:1.1.1'
56-
testImplementation 'org.mockito:mockito-core:2.25.1'
57-
testImplementation 'org.robolectric:robolectric:4.3'
48+
testImplementation 'org.mockito:mockito-core:3.2.4'
49+
testImplementation 'org.robolectric:robolectric:4.3.1'
5850
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
5951

60-
// We use PowerMock to mock FirebaseAnalytics in tests
61-
testImplementation "org.powermock:powermock-module-junit4:2.0.2"
62-
testImplementation "org.powermock:powermock-module-junit4-rule:2.0.2"
63-
testImplementation "org.powermock:powermock-api-mockito2:2.0.2"
64-
testImplementation "org.powermock:powermock-classloading-xstream:2.0.2"
52+
// We use PowerMock to mock AT Internet Tracker in tests
53+
testImplementation "org.powermock:powermock-module-junit4:2.0.4"
54+
testImplementation "org.powermock:powermock-module-junit4-rule:2.0.4"
55+
testImplementation "org.powermock:powermock-api-mockito2:2.0.4"
56+
testImplementation "org.powermock:powermock-classloading-xstream:2.0.4"
6557
}
58+
59+
apply from: 'maven-publish.gradle'
60+
apply from: 'jacoco.gradle'

atinternet-dispatcher/jacoco.gradle

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
apply plugin: 'jacoco'
2+
3+
configurations {
4+
jacocoAnt
5+
jacocoRuntime
6+
}
7+
8+
jacoco {
9+
toolVersion = '0.8.5'
10+
}
11+
12+
def offline_instrumented_outputDir = "$buildDir.path/intermediates/classes-instrumented/debug"
13+
14+
tasks.withType(Test) {
15+
jacoco.includeNoLocationClasses = true
16+
}
17+
18+
/* This task is used to create offline instrumentation of classes for on-the-fly instrumentation coverage tool like Jacoco. See jacoco classId
19+
* and Offline Instrumentation from the jacoco site for more info.
20+
*
21+
* In this case, some classes mocked using PowerMock were reported as 0% coverage on jacoco & Sonarqube. The issue between PowerMock and jacoco
22+
* is well documented, and a possible solution is offline Instrumentation (not so well documented for gradle).
23+
*
24+
* In a nutshell, this task:
25+
* - Pre-instruments the original *.class files
26+
* - Puts the instrumented classes path at the beginning of the task's classpath (for report purposes)
27+
* - Runs test & generates a new exec file based on the pre-instrumented classes -- as opposed to on-the-fly instrumented class files generated by jacoco.
28+
*
29+
* It is currently not implemented to run prior to any other existing tasks (like test, jacocoTestReport, etc...), therefore, it should be called
30+
* explicitly if Offline Instrumentation report is needed.
31+
*
32+
* Usage: gradle clean & gradle testDebugCoverageUnitTest
33+
*/
34+
task testDebugCoverageUnitTest(dependsOn: ['instrument', 'testDebugUnitTest']) {
35+
doLast {
36+
ant.taskdef(name: 'report',
37+
classname: 'org.jacoco.ant.ReportTask',
38+
classpath: configurations.jacocoAnt.asPath)
39+
ant.report() {
40+
executiondata {
41+
ant.file(file: "$buildDir.path/jacoco/testDebugUnitTest.exec")
42+
}
43+
structure(name: 'DispatcherCoverage') {
44+
classfiles {
45+
fileset(
46+
dir: "$buildDir/intermediates/javac/debug/classes",
47+
excludes: '**/R.class,**/R$*.class,**/BuildConfig.*'
48+
)
49+
}
50+
sourcefiles {
51+
fileset(dir: 'src/main/java')
52+
}
53+
}
54+
55+
//html(destdir: "$buildDir.path/test-results/jacocoHtml")
56+
csv(destfile: "$buildDir.path/test-results/jacoco.csv")
57+
xml(destfile: "$buildDir.path/test-results/jacoco.xml")
58+
}
59+
}
60+
}
61+
62+
/*
63+
* Part of the Offline Instrumentation process is to add the jacoco runtime to the class path along with the path of the instrumented files.
64+
*/
65+
gradle.taskGraph.whenReady { graph ->
66+
if (graph.hasTask(instrument)) {
67+
tasks.withType(Test) {
68+
doFirst {
69+
systemProperty 'jacoco-agent.destfile', buildDir.path + '/jacoco/testDebugUnitTest.exec'
70+
classpath = files(offline_instrumented_outputDir) + classpath + configurations.jacocoRuntime
71+
}
72+
}
73+
}
74+
}
75+
76+
/*
77+
* Instruments the classes per se
78+
*/
79+
task instrument(dependsOn:'compileDebugUnitTestSources') {
80+
doLast {
81+
ant.taskdef(name: 'instrument',
82+
classname: 'org.jacoco.ant.InstrumentTask',
83+
classpath: configurations.jacocoAnt.asPath)
84+
85+
ant.instrument(destdir: offline_instrumented_outputDir) {
86+
fileset(dir: "$buildDir.path/intermediates/javac/debug/classes")
87+
}
88+
}
89+
}

atinternet-dispatcher/libs/Batch.aar

-604 KB
Binary file not shown.

0 commit comments

Comments
 (0)