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
35 changes: 0 additions & 35 deletions .github/workflows/deploy.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/instrumented.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
name: Instrumented tests

on:
pull_request:
branches:
- 'development'
- '*_baseline'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: SonarCloud Analysis

on:
pull_request:
branches:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
sonarcloud:
name: SonarCloud Scan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for better relevancy of analysis

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

- name: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: Configure Gradle memory settings
run: |
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError" >> gradle.properties
echo "android.enableJetifier=false" >> gradle.properties
echo "android.enableR8.fullMode=false" >> gradle.properties
cat gradle.properties

- name: Build project and run tests with coverage
run: |
# Build the project
./gradlew assembleDebug --stacktrace

# Run tests with coverage - allow test failures
./gradlew testDebugUnitTest jacocoTestReport --stacktrace
TEST_RESULT=$?
if [ $TEST_RESULT -ne 0 ]; then
echo "Some tests failed, but continuing to check for coverage data..."
# Even if tests fail, JaCoCo should generate a report with partial coverage
# from the tests that did pass
fi

- name: Prepare class files for SonarQube analysis
run: |
echo "Searching for compiled class files..."

# Create the target directory
mkdir -p build/intermediates/runtime_library_classes_dir/debug

# Find all directories containing class files
CLASS_DIRS=$(find build -name "*.class" -type f -exec dirname {} \; | sort -u)

if [ -z "$CLASS_DIRS" ]; then
echo "WARNING: No class files found in the build directory!"
else
echo "Found class files in the following directories:"
echo "$CLASS_DIRS"

# Copy classes from the first directory with classes
FIRST_CLASS_DIR=$(echo "$CLASS_DIRS" | head -1)
echo "Copying classes from $FIRST_CLASS_DIR to build/intermediates/runtime_library_classes_dir/debug"
cp -r $FIRST_CLASS_DIR/* build/intermediates/runtime_library_classes_dir/debug/ || echo "Failed to copy from $FIRST_CLASS_DIR"

# Verify the target directory now has class files
CLASS_COUNT=$(find build/intermediates/runtime_library_classes_dir/debug -name "*.class" | wc -l)
echo "Target directory now contains $CLASS_COUNT class files"
fi

# Update sonar-project.properties with all found class directories as a fallback
echo "\n# Additional binary paths found during build" >> sonar-project.properties
echo "sonar.java.binaries=build/intermediates/runtime_library_classes_dir/debug,$CLASS_DIRS" >> sonar-project.properties

echo "Checking for JaCoCo report files..."
find build -name "*.xml" | grep jacoco || echo "No XML files found"
find build -name "*.exec" | grep jacoco || echo "No exec files found"
echo "Contents of JaCoCo report directory:"
ls -la build/reports/jacoco/jacocoTestReport/ || echo "Directory not found"

echo "\nChecking test execution results:"
find build -name "TEST-*.xml" | xargs cat | grep -E 'tests|failures|errors|skipped' || echo "No test result files found"

echo "\nChecking JaCoCo report content:"
if [ -f build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml ]; then
echo "Report file size: $(wc -c < build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml) bytes"
echo "First 500 chars of report:"
head -c 500 build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml
echo "\n\nCounting coverage elements:"
grep -c "<package" build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No packages found"
grep -c "<class" build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No classes found"
grep -c "<method" build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No methods found"
grep -c "<line" build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No lines found"
grep -c 'ci="1"' build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No covered lines found"
else
echo "JaCoCo report file not found"
fi

echo "\nChecking binary directories specified in sonar-project.properties:"
echo "build/intermediates/runtime_library_classes_dir/debug:"
ls -la build/intermediates/runtime_library_classes_dir/debug || echo "Directory not found"

echo "\nChecking all available class directories:"
find build -path "*/build/*" -name "*.class" | head -n 5 || echo "No class files found"

- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
5.3.1 (Jul 30, 2025)
- Fixed race condition in database initialization.
- Fixed increased ANRs when pausing task executor.

5.3.0 (May 28, 2025)
- Added support for rule-based segments. These segments determine membership at runtime by evaluating their configured rules against the user attributes provided to the SDK.
- Added support for feature flag prerequisites. This allows customers to define dependency conditions between flags, which are evaluated before any allowlists or targeting rules.
Expand Down
127 changes: 40 additions & 87 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,34 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.7.3'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0'
classpath "com.vanniktech:gradle-maven-publish-plugin:0.33.0"
}
}

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'kotlin-android'
apply plugin: 'com.vanniktech.maven.publish'
apply from: 'spec.gradle'
apply from: 'jacoco.gradle'

ext {
splitVersion = '5.3.0'
splitVersion = '5.3.1'
jacocoVersion = '0.8.8'
}

// Define exclusions for JaCoCo coverage
def coverageExclusions = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*'
]

android {
compileSdk 33
targetCompatibility = '1.8'
Expand Down Expand Up @@ -63,6 +76,14 @@ android {

testOptions {
unitTests.returnDefaultValues = true

// Configure JaCoCo for all test tasks
unitTests.all {
jacoco {
includeNoLocationClasses = true
excludes = ['jdk.internal.*']
}
}
}

sourceSets {
Expand Down Expand Up @@ -98,6 +119,12 @@ repositories {
mavenCentral()
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {

def roomVersion = '2.4.3'
Expand Down Expand Up @@ -168,7 +195,6 @@ dependencies {

def splitPOM = {
name = 'Split Android SDK'
packaging = 'aar'
description = 'Official Split Android SDK'
url = 'https://github.com/splitio/android-client'

Expand All @@ -181,15 +207,8 @@ def splitPOM = {

developers {
developer {
id = 'sarrubia'
name = 'Sebastian Arrubia'
email = 'sebastian@split.io'
}

developer {
id = 'fernando'
name = 'Fernando Martin'
email = 'fernando@split.io'
id = 'sdks'
email = 'sdks@split.io'
}
}

Expand All @@ -200,86 +219,17 @@ def splitPOM = {
}
}

def releaseRepo = {
name = "ReleaseRepo"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}

def devRepo = {
name = "DevelopmentRepo"
url = 'https://splitio.jfrog.io/artifactory/maven-all-virtual'
credentials {
username = System.getenv('ARTIFACTORY_USER')
password = System.getenv('ARTIFACTORY_TOKEN')
}
}

afterEvaluate {
android.sourceSets.all { sourceSet ->
if (!sourceSet.name.startsWith("test")) {
sourceSet.kotlin.setSrcDirs([])
}
}

publishing {
publications {
release(MavenPublication) {
from components.release
mavenPublishing {
coordinates("io.split.client", "android-client", splitVersion)
pom(splitPOM)

artifactId = 'android-client'
groupId = 'io.split.client'
version = splitVersion
artifact sourcesJar
artifact javadocJar

pom splitPOM

repositories {
maven releaseRepo
maven devRepo
}
}

development(MavenPublication) {
from components.release

artifactId = 'android-client'
groupId = 'io.split.client'
version = splitVersion
artifact sourcesJar
artifact javadocJar

pom splitPOM
}
}
}

task publishRelease(type: PublishToMavenRepository) {
publication = publishing.publications.getByName("release")
repository = publishing.repositories.ReleaseRepo
}

task publishDev(type: PublishToMavenRepository) {
publication = publishing.publications.getByName("development")
repository = publishing.repositories.DevelopmentRepo
}

signing {
sign publishing.publications.getByName("release")
}
publishToMavenCentral(false)
signAllPublications()
}


task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from android.sourceSets.main.java.srcDirs
// archiveClassifier = "sources"
}

task javadoc(type: Javadoc) {
Expand Down Expand Up @@ -334,3 +284,6 @@ tasks.withType(Test) {
forkEvery = 100
maxHeapSize = "1024m"
}



2 changes: 1 addition & 1 deletion deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ releaseRuntimeClasspath - Runtime classpath of compilation 'release' (target (a
| \--- com.google.android.gms:play-services-basement:18.1.0 (*)
\--- androidx.multidex:multidex:2.0.1

(*) - dependencies omitted (listed previously)
(*) - Indicates repeated occurrences of a transitive dependency subtree. Gradle expands transitive dependency subtrees only once per project; repeat occurrences only display the root of the subtree, followed by this annotation.

A web-based, searchable dependency report is available by adding the --scan option.
17 changes: 15 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
ossrhUsername=
ossrhPassword=
mavenCentralUsername=
mavenCentralPassword=

android.useAndroidX=true

android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
kotlin.stdlib.default.dependency=false

# Last 8 digits of the key's ID. Can be obtained with gpg --list-secret-keys
signing.keyId=

# Password that was set on key creation.
signing.password=

# Path to the file created in the previous step.
signing.secretKeyRingFile=
Loading
Loading