-
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.
- Loading branch information
1 parent
e92d981
commit 596f3aa
Showing
19 changed files
with
564 additions
and
143 deletions.
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,23 @@ | ||
name: Android CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Run CI | ||
run: make ci | ||
- name: Upload artifact | ||
if: github.ref == 'refs/heads/master' | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: google-analytics-dispatcher.zip | ||
path: release/ |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
1.0 | ||
----- | ||
|
||
* Dispatcher release. |
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,9 @@ | ||
Copyright (c) 2014-Present, Batch.com | ||
|
||
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. | ||
|
||
- Use of copies, substantial portions or binaries contained within Batch's SDK is only permitted to enable use of the Batch platform. | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
all: aar | ||
|
||
aar: clean | ||
./gradlew assembleRelease --no-build-cache && \ | ||
mkdir -p release/ && \ | ||
cp google-analytics-dispatcher/build/outputs/aar/google-analytics-dispatcher-release.aar release/ && \ | ||
cp LICENSE release/ | ||
|
||
clean: | ||
./gradlew clean | ||
|
||
test: | ||
./gradlew testDebugUnitTest | ||
|
||
test-coverage: | ||
./gradlew testDebugCoverageUnitTest && \ | ||
awk -F"," '{ instructions += $$4 + $$5; covered += $$5 } END { print covered, "/", instructions, "instructions covered"; print "Total", 100*covered/instructions "% covered" }' google-analytics-dispatcher/build/test-results/jacoco.csv | ||
|
||
lint: | ||
./gradlew lintDebug | ||
|
||
ci: lint test-coverage aar |
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,34 @@ | ||
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.batch.android/google-analytics-dispatcher/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.batch.android/google-analytics-dispatcher) | ||
[![Github Action](https://github.com/BatchLabs/android-google-analytics-dispatcher/workflows/Android%20CI/badge.svg)](https://github.com/BatchLabs/android-google-analytics-dispatcher/actions?query=workflow%3A%22Android+CI%22) | ||
|
||
Batch.com Android Google Analytics Dispatcher | ||
================== | ||
|
||
![Logo](http://batch-doc.s3.amazonaws.com/logo_batch_192.gif) | ||
|
||
# About | ||
|
||
A "ready-to-go" dispatcher that reflect event from the Batch SDK to the Google Analytics dashboard using UTM tags. | ||
|
||
# Requirements | ||
- Android Studio 3.0+ | ||
- Android 15+ | ||
- Batch Android SDK 1.15.0+ | ||
- Play Services Analytics 17.0.0+ | ||
|
||
# Installation | ||
Gradle (recommended) | ||
|
||
``` | ||
implementation 'com.batch.android:google-analytics-dispatcher:1.0+' | ||
``` | ||
|
||
Read our [setup documentation](https://doc.batch.com/) to follow a step by step tutorial for integrating Batch features into your app. | ||
|
||
# Documentation | ||
|
||
- [Technical](https://batch.com/doc) | ||
- [FAQ](https://batch.com/doc/faq/general.html) | ||
- [Developer FAQ](https://batch.com/developers) | ||
|
||
Copyright 2020 - Batch.com |
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
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
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,89 @@ | ||
apply plugin: 'jacoco' | ||
|
||
configurations { | ||
jacocoAnt | ||
jacocoRuntime | ||
} | ||
|
||
jacoco { | ||
toolVersion = '0.8.5' | ||
} | ||
|
||
def offline_instrumented_outputDir = "$buildDir.path/intermediates/classes-instrumented/debug" | ||
|
||
tasks.withType(Test) { | ||
jacoco.includeNoLocationClasses = true | ||
} | ||
|
||
/* This task is used to create offline instrumentation of classes for on-the-fly instrumentation coverage tool like Jacoco. See jacoco classId | ||
* and Offline Instrumentation from the jacoco site for more info. | ||
* | ||
* In this case, some classes mocked using PowerMock were reported as 0% coverage on jacoco & Sonarqube. The issue between PowerMock and jacoco | ||
* is well documented, and a possible solution is offline Instrumentation (not so well documented for gradle). | ||
* | ||
* In a nutshell, this task: | ||
* - Pre-instruments the original *.class files | ||
* - Puts the instrumented classes path at the beginning of the task's classpath (for report purposes) | ||
* - 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. | ||
* | ||
* It is currently not implemented to run prior to any other existing tasks (like test, jacocoTestReport, etc...), therefore, it should be called | ||
* explicitly if Offline Instrumentation report is needed. | ||
* | ||
* Usage: gradle clean & gradle testDebugCoverageUnitTest | ||
*/ | ||
task testDebugCoverageUnitTest(dependsOn: ['instrument', 'testDebugUnitTest']) { | ||
doLast { | ||
ant.taskdef(name: 'report', | ||
classname: 'org.jacoco.ant.ReportTask', | ||
classpath: configurations.jacocoAnt.asPath) | ||
ant.report() { | ||
executiondata { | ||
ant.file(file: "$buildDir.path/jacoco/testDebugUnitTest.exec") | ||
} | ||
structure(name: 'DispatcherCoverage') { | ||
classfiles { | ||
fileset( | ||
dir: "$buildDir/intermediates/javac/debug/classes", | ||
excludes: '**/R.class,**/R$*.class,**/BuildConfig.*' | ||
) | ||
} | ||
sourcefiles { | ||
fileset(dir: 'src/main/java') | ||
} | ||
} | ||
|
||
//html(destdir: "$buildDir.path/test-results/jacocoHtml") | ||
csv(destfile: "$buildDir.path/test-results/jacoco.csv") | ||
xml(destfile: "$buildDir.path/test-results/jacoco.xml") | ||
} | ||
} | ||
} | ||
|
||
/* | ||
* Part of the Offline Instrumentation process is to add the jacoco runtime to the class path along with the path of the instrumented files. | ||
*/ | ||
gradle.taskGraph.whenReady { graph -> | ||
if (graph.hasTask(instrument)) { | ||
tasks.withType(Test) { | ||
doFirst { | ||
systemProperty 'jacoco-agent.destfile', buildDir.path + '/jacoco/testDebugUnitTest.exec' | ||
classpath = files(offline_instrumented_outputDir) + classpath + configurations.jacocoRuntime | ||
} | ||
} | ||
} | ||
} | ||
|
||
/* | ||
* Instruments the classes per se | ||
*/ | ||
task instrument(dependsOn:'compileDebugUnitTestSources') { | ||
doLast { | ||
ant.taskdef(name: 'instrument', | ||
classname: 'org.jacoco.ant.InstrumentTask', | ||
classpath: configurations.jacocoAnt.asPath) | ||
|
||
ant.instrument(destdir: offline_instrumented_outputDir) { | ||
fileset(dir: "$buildDir.path/intermediates/javac/debug/classes") | ||
} | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.