Skip to content

Commit

Permalink
Merge pull request #66 from AppsFlyerSDK/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
morisgateno-appsflyer authored Mar 1, 2023
2 parents d3f36f4 + d99dfda commit 37e743b
Show file tree
Hide file tree
Showing 20 changed files with 699 additions and 110 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI - Tests
on:
push:
branches-ignore:
- 'main'
- 'releases/**'
jobs:
Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Run Tests
run: ./gradlew test
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Results
path: app/build/test-results/testDebugUnitTest/TEST-*.xml # Path to test results
reporter: java-junit # Format of test results
fail-on-error: true
5 changes: 5 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

### 6.10.1
* Update Android SDK to v6.10.1
* Added unit tests.
* Added github workflows.

### 6.8.2
* Update Android SDK to v6.8.2

Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You can track installs, updates and sessions and also track additional in-app ev

---

Built with AppsFlyer Android SDK `v6.8.2`
Built with AppsFlyer Android SDK `v6.10.1`

## Table of content

Expand Down
41 changes: 35 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26
compileSdkVersion 32

defaultConfig {
minSdkVersion 14
targetSdkVersion 26
targetSdkVersion 32
versionCode 1
versionName "1.0"
testApplicationId "com.example.test"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -19,15 +21,42 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

testOptions {
unitTests {
all {
testLogging {
exceptionFormat = "full"
events "PASSED", "FAILED", "SKIPPED"
}
forkEvery 1
}
includeAndroidResources = true
returnDefaultValues = true
}
}
}

dependencies {
implementation 'com.appsflyer:af-android-sdk:6.8.2'
implementation 'androidx.test.ext:junit:1.1.5'
implementation 'com.appsflyer:af-android-sdk:6.10.1'
compileOnly 'com.android.installreferrer:installreferrer:2.1'
compileOnly 'com.segment.analytics.android:analytics:4.+'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.9.2'
testImplementation 'com.android.installreferrer:installreferrer:2.1'
testImplementation 'com.segment.analytics.android:analytics:4.+'
testImplementation 'org.mockito:mockito-core:4.2.0'
testImplementation 'com.segment.analytics.android:analytics-tests:4.+'
}

apply from: file('publish.gradle')
tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
}

apply from:file("publish.gradle")
172 changes: 119 additions & 53 deletions app/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,63 +1,129 @@
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
def isReleaseBuild() {
return !VERSION_NAME.contains("SNAPSHOT")
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

task androidJavadocs(type: Javadoc) {
exclude "**/*.orig" // exclude files created by source control
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
failOnError false
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
archiveClassifier.set("javadoc")

from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
archiveClassifier.set("sources")

from android.sourceSets.main.java.source
}

def logger(log) {
println log
}

def configurePom(pom) {
logger("configurePom")
pom.name = POM_NAME
pom.packaging = POM_PACKAGING
pom.description = POM_DESCRIPTION
pom.url = POM_URL

pom.scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}

pom.licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}

pom.developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
logger("release")
// The coordinates of the library, being set from variables that
// we'll set up in a moment
groupId GROUP
artifactId POM_ARTIFACT_ID
version VERSION_NAME

// Two artifacts, the `aar` and the sources
// artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact bundleReleaseAar
artifact androidSourcesJar
artifact androidJavadocsJar

// Self-explanatory metadata for the most part
pom {
configurePom(pom)
// A slight fix so that the generated POM will include any transitive dependencies
// that the library builds upon
withXml {
def dependenciesNode = asNode().appendNode('dependencies')

project.configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task androidJavadocs(type: Javadoc) {
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) { options.addStringOption('Xdoclint:none', '-quiet') }
repositories {
maven {
name = "sonatype"

// You only need this if you want to publish snapshots, otherwise just set the URL
// to the release repo directly
url = isReleaseBuild() ? getReleaseRepositoryUrl() : getSnapshotRepositoryUrl()

credentials(PasswordCredentials) {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
archiveClassifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts { archives androidJavadocsJar }
}
}

signing {
logger("signing")
sign publishing.publications
}


publish.dependsOn build
publishToMavenLocal.dependsOn build
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.segment.analytics.android.integration.appsflyer;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
//package com.segment.analytics.android.integration.appsflyer;
//
//import android.app.Application;
//import android.test.ApplicationTestCase;
//
///**
// * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
// */
//public class ApplicationTest extends ApplicationTestCase<Application> {
// public ApplicationTest() {
// super(Application.class);
// }
//}
4 changes: 1 addition & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.segment.analytics.android.integrations.appsflyer">

<application />

<application/>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public static void startAppsFlyer(@NonNull Context context){
public static final Factory FACTORY = new Integration.Factory() {
@Override
public Integration<AppsFlyerLib> create(ValueMap settings, Analytics analytics) {
if(settings == null || analytics == null){
return null;
}
Logger logger = analytics.logger(APPSFLYER_KEY);
AppsFlyerLib afLib = AppsFlyerLib.getInstance();

Expand Down
Loading

0 comments on commit 37e743b

Please sign in to comment.