Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasKypta committed Jan 2, 2024
2 parents 8e1ed26 + 205f9a0 commit 4f89a24
Show file tree
Hide file tree
Showing 56 changed files with 1,797 additions and 1,325 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Build and check

on:
push:
branches:
- develop
- master
- release/*
pull_request:

jobs:
buildJob:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'

- name: Assemble Library
run: ./gradlew library:assemble

lintJob:
name: Lint
runs-on: ubuntu-latest
needs: [buildJob]
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'

- name: Lint
run: ./gradlew library:lint

- name: Upload lint results artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: lint-results-debug
path: library/build/reports/lint-results-debug.html
retention-days: 5

unitTestJob:
name: Unit Test
runs-on: ubuntu-latest
needs: [buildJob]
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'

- name: Unit Test
run: ./gradlew library:test

- name: Upload unit test results artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-test-results-debug
path: library/build/reports/tests/testDebugUnitTest/
retention-days: 5

intrTestJob:
name: Instrumentation Test
runs-on: macos-latest
needs: [buildJob]
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'

- name: Run instrumentation tests on emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: >
./gradlew library:connectedAndroidTest
-Ptest.sslPinning.baseUrl=${{ secrets.SSL_PINNING_TEST_BASE_URL }}
-Ptest.sslPinning.appName=${{ secrets.SSL_PINNING_TEST_APP_NAME }}
- name: Upload instrumentation test results artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: instrumentation-test-results-debug
path: library/build/reports/androidTests/connected/
retention-days: 5
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# jEnv
.java-version
276 changes: 100 additions & 176 deletions README.md

Large diffs are not rendered by default.

55 changes: 0 additions & 55 deletions build.gradle

This file was deleted.

31 changes: 31 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2018 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*/

buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath("com.android.tools.build:gradle:${Constants.BuildScript.androidPluginVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Constants.BuildScript.kotlinVersion}")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:${Constants.BuildScript.dokkaVersion}")
}
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
1 change: 1 addition & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
32 changes: 32 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2023 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*/

plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
google()
}

val androidPluginVersion: String by System.getProperties()
val kotlinVersion: String by System.getProperties()

dependencies {
implementation("com.android.tools.build", "gradle", androidPluginVersion)
implementation(kotlin("gradle-plugin", kotlinVersion))
}
19 changes: 19 additions & 0 deletions buildSrc/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright 2023 Wultra s.r.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions
# and limitations under the License.
#

systemProp.kotlinVersion=1.8.20
systemProp.androidPluginVersion=7.4.2
systemProp.dokkaVersion=1.8.10
44 changes: 44 additions & 0 deletions buildSrc/src/main/kotlin/Constants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2023 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*/

import org.gradle.api.JavaVersion

object Constants {
object BuildScript {
// These have to be defined in buildSrc/gradle.properties
// It's the only way to make them available in buildSrc/build.gradle.kts.kts
val androidPluginVersion: String by System.getProperties()
val kotlinVersion: String by System.getProperties()
val dokkaVersion: String by System.getProperties()
}

object Java {
val sourceCompatibility = JavaVersion.VERSION_1_8
val targetCompatibility = JavaVersion.VERSION_1_8
const val kotlinJvmTarget = "1.8"
}

object Android {
const val compileSdkVersion = 33
const val targetSdkVersion = 33
const val minSdkVersion = 19
const val buildToolsVersion = "33.0.2"
}

object Dependencies {
const val powerAuthSdkVersion = "1.8.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2023 Wultra s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*/

package com.wultra.gradle.sslpinning

import com.android.build.gradle.BaseExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType

/**
* Plugin for handling server configurations for instrumentation tests.
*/
class WultraSslPinningTestPlugin : Plugin<Project> {

override fun apply(target: Project) {
target.loadPropertiesFromGradleProps()
target.addInstrumentationArgumentsToDefaultConfig()
}

private val instrumentationArgumentKeys = setOf("test.sslPinning.baseUrl", "test.sslPinning.appName")
private val instrumentationArguments = mutableMapOf<String, String>()

private fun Project.loadPropertiesFromGradleProps() {
for (key in instrumentationArgumentKeys) {
project.properties[key]?.let {
instrumentationArguments[key] = it.toString()
}
}
}

private fun Project.addInstrumentationArgumentsToDefaultConfig() {
project.extensions.getByType<BaseExtension>().let {
it.defaultConfig {
for (entry in instrumentationArguments) {
this.testInstrumentationRunnerArguments[entry.key] = entry.value
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
implementation-class=com.wultra.gradle.sslpinning.WultraSslPinningTestPlugin
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Oct 07 12:28:27 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 4f89a24

Please sign in to comment.