Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
28 changes: 28 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Verify

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Unit tests
run: ./gradlew test --stacktrace
66 changes: 0 additions & 66 deletions FlagsmithClient/build.gradle

This file was deleted.

141 changes: 141 additions & 0 deletions FlagsmithClient/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import groovy.time.TimeCategory
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.util.Date

plugins {
id("com.android.library")
kotlin("android")
id("maven-publish")
}

android {
compileSdk = 33

defaultConfig {
minSdk = 21
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
version = "1.0.0"
namespace = "com.flagsmith.kotlin"
}

buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}

testOptions {
unitTests.isReturnDefaultValues = true
}
}

dependencies {
implementation("com.google.code.gson:gson:2.10")
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
implementation("com.github.kittinunf.fuel:fuel-gson:2.3.1")

testImplementation("junit:junit:4.13.2")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
testImplementation("org.mock-server:mockserver-netty-no-dependencies:5.14.0")
androidTestImplementation("androidx.test.ext:junit:1.1.4")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
}

tasks.withType(Test::class) {
testLogging {
events(
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
)
showExceptions = true
showCauses = true
showStackTraces = true
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL

debug {
events(
TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
}

afterSuite(KotlinClosure2({ desc: TestDescriptor, result: TestResult ->
if (desc.parent == null) {
val summary = "Results: ${result.resultType} " +
"(" +
"${result.testCount} tests, " +
"${result.successfulTestCount} passed, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped" +
")"
val fullSummaryLine = summary.contentLine(summary.length)
val lineLength = fullSummaryLine.length
val suiteDescription = "${this.project.name}:${this.name}"
val duration = "in ${TimeCategory.minus(Date(result.endTime), Date(result.startTime))}"
val separator = tableLine(lineLength, "│", "│")
println("""
${tableLine(lineLength, "┌", "┐")}
${suiteDescription.contentLine(lineLength)}
$separator
$fullSummaryLine
$separator
${duration.contentLine(lineLength)}
${tableLine(lineLength, "└", "┘")}
Report file: ./${this.reports.html.entryPoint.relativeTo(rootProject.rootDir)}
""".trimIndent()
)
}
}))
}

fun String.padToLength(length: Int) =
this + " ".repeat(maxOf(length - this.length, 0))

fun String.wrapWith(leading: String, trailing: String = leading) =
"$leading$this$trailing"

fun String.contentLine(length: Int, extraPadding: String = " ") =
"$extraPadding$this$extraPadding".padToLength(length - 2)
.wrapWith("│")

fun tableLine(length: Int, leading: String, trailing: String) =
"─".repeat(length - 2).wrapWith(leading, trailing)

publishing {
publications {
register<MavenPublication>("release") {
groupId = "com.github.Flagsmith"
artifactId = "flagsmith-kotlin-android-client"
version = "1.0.0"

afterEvaluate {
from(components["release"])
}
}
}
}
10 changes: 0 additions & 10 deletions build.gradle

This file was deleted.

9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
id("com.android.application").version("7.3.1").apply(false)
id("com.android.library").version("7.3.1").apply(false)
kotlin("android").version("1.8.0").apply(false)
}

val clean by tasks.registering(Delete::class) {
delete(rootProject.buildDir)
}
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Jan 02 04:33:47 GMT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
6 changes: 4 additions & 2 deletions settings.gradle → settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ pluginManagement {
mavenCentral()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}

rootProject.name = "Flagsmith"
include ':FlagsmithClient'

include(":FlagsmithClient")