Skip to content
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
72 changes: 72 additions & 0 deletions android-library.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.sonarqube'
apply from: "$projectDir/config/jacoco-settings.gradle"

android {
compileSdkVersion compileVersion
defaultConfig {
minSdkVersion minVersion
targetSdkVersion targetVersion
versionCode codeVersion
versionName version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument "listener", "com.squareup.leakcanary.FailTestOnLeakRunListener"
}

sourceSets {
androidTest {
resources.srcDirs += ['src/test/resources']
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}

lintOptions {
abortOnError true
warningsAsErrors true
lintConfig file("config/lint.xml")
}
}

task javadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
failOnError false
}

task javadocsJar(type: Jar, dependsOn: javadocs) {
classifier = 'javadoc'
from javadocs.destinationDir
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

dependencies {
implementation "com.google.android.material:material:$androidMaterialVersion"
api "com.hyperwallet.android:core-sdk:$hyperwalletCoreVersion"

implementation "androidx.test.espresso:espresso-idling-resource:$espressoVersion"

androidTestImplementation "androidx.test.ext:junit:$extJunitVerson"
androidTestImplementation "androidx.test:runner:$testRunnerVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"

testImplementation group: 'org.mockito', name: 'mockito-core', version: "$mockitoVersion"
testImplementation group: 'pl.pragmatists', name: 'JUnitParams', version: "$junitParamsVersion"
}



41 changes: 37 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ buildscript {
google()
jcenter()
mavenLocal()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -21,12 +21,45 @@ allprojects {
google()
jcenter()
mavenLocal()

}

project.version = "1.0.0-beta03-SNAPSHOT"

}

subprojects {

ext {
hyperwalletGroupId = 'com.hyperwallet.android'

compileVersion = 28
minVersion = 21
targetVersion = 28
codeVersion = 1

hyperwalletCoreVersion = '1.0.0-beta03-SNAPSHOT'
//
androidMaterialVersion = '1.0.0'
appcompatVersion = '1.0.2'
constraintlayoutVersion = '1.1.3'
legacySupportV4Version = '1.0.0'
recycleViewVersion = '1.0.0'
//Testing
extJunitVerson = '1.1.1'
testRunnerVersion = '1.2.0'
testRulesVersion = '1.2.0'
espressoVersion = '3.2.0'
mockServerVersion = '3.11.0'
leakcanaryVersion = '1.6.3'
mockitoVersion = '2.27.0'
junitParamsVersion = '1.1.1'
robolectricVersion = '4.1'
mockWebServerVersion = '3.11.0'
}

}

task clean(type: Delete) {
delete rootProject.buildDir
}
}
1 change: 1 addition & 0 deletions common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
88 changes: 88 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apply from: "$rootProject.projectDir/android-library.gradle"


def aarFile = file("$buildDir/outputs/aar/common-$version" + ".aar")
def aarArtifact = artifacts.add('archives', aarFile) {
type 'aar'
}

def isReleaseVersion = !version.endsWith('SNAPSHOT')

publishing {

repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}

publications {
hyperwalletCommonUi(MavenPublication) {
groupId = hyperwalletGroupId
artifactId = 'common'
version = version

artifact(sourcesJar)
artifact(javadocsJar)
artifact(aarArtifact)

pom {
name = 'Hyperwallet Android Common UI SDK'
description = 'Hyperwallet Common UI SDK for Android to integrate with Hyperwallet Platform'
url = 'https://github.com/hyperwallet/hyperwallet-android-ui-sdk'
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
licenses {
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'devs'
name = 'Hyperwallet Developers'
}
}
scm {
connection = 'scm:git:git://github.com/hyperwallet/hyperwallet-android-ui-sdk.git'
developerConnection = 'scm:git:git://github.com/hyperwallet/hyperwallet-android-ui-sdk.git'
url = 'https://github.com/hyperwallet/hyperwallet-android-ui-sdk'
}
}
}
}
}

tasks.withType(Sign) {
onlyIf {
isReleaseVersion && sonatypeUsername?.trim() && sonatypePassword?.trim()
}
}

signing {
sign publishing.publications.hyperwalletCommonUi
}

sonarqube {
properties {
def libraries = project.android.sdkDirectory.getPath() + "/platforms/android-28/android.jar"
property "sonar.sources", "src/main/java"
property "sonar.binaries", "build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/hyperwallet/android"
property "sonar.libraries", libraries
property "sonar.projectName", "android-ui-sdk-common"
}
}
79 changes: 79 additions & 0 deletions common/config/jacoco-settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apply plugin: 'jacoco'

final def jacocoVersion = "0.8.2"

jacoco {
toolVersion = jacocoVersion
}

android {
testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}
}
}

def fileFilter = ['**/BuildConfig.*']

def debugClassPaths = [
'**/intermediates/javac/dev/*/classes/**'
]

final def coverageSourceDirs = ["$project.projectDir/src/main/java/*"]

task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {

group = 'Reporting'
description = 'Generate Jacoco coverage reports.'

reports {
html {
enabled = true
destination file("$buildDir/reports/jacoco")
}
}

classDirectories = fileTree(
dir: "${buildDir}",
includes: debugClassPaths,
excludes: fileFilter
)

additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files("${buildDir}/jacoco/testDevUnitTest.exec")
}

task jacocoTestCoverageVerification(type: JacocoCoverageVerification, dependsOn: 'jacocoTestReport') {

group = 'Verification'
classDirectories = fileTree(
dir: "${buildDir}",
includes: debugClassPaths,
excludes: fileFilter
)
additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files("${buildDir}/jacoco/testDebugUnitTest.exec")

violationRules {
setFailOnViolation(true)

rule {
element = 'CLASS'
limit {
value = 'COVEREDRATIO'
counter = 'BRANCH'
minimum = 0.65
}
}
}
}

7 changes: 7 additions & 0 deletions common/config/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="VectorPath" severity="ignore"/>
<issue id="RtlEnabled">
<ignore regexp="(AndroidManifest).xml"/>
</issue>
</lint>
21 changes: 21 additions & 0 deletions common/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 2 additions & 0 deletions common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest
package="com.hyperwallet.android.common"/>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hyperwallet.android.ui.util;
package com.hyperwallet.android.common.util;

import androidx.test.espresso.IdlingResource;
import androidx.test.espresso.idling.CountingIdlingResource;
Expand Down
Loading