Skip to content

Commit

Permalink
Merge pull request #632 from Flowdalic/smack-gradle-bump
Browse files Browse the repository at this point in the history
Bump to Gradle 8.10.2, require Java 11
  • Loading branch information
Flowdalic authored Sep 25, 2024
2 parents d8d066b + 1e5d34e commit f59d7f3
Show file tree
Hide file tree
Showing 136 changed files with 1,155 additions and 1,214 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ jobs:
build:
name: Build Smack

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
java:
- 11
- 17
env:
PRIMARY_JAVA_VERSION: 11
PRIMARY_JAVA_VERSION: 17

steps:
- name: Checkout
Expand Down Expand Up @@ -57,6 +57,17 @@ jobs:
run: |
sdkmanager "platforms;android-21"
# Workaround
- name: Create gradle.properties
run: |
cat <<-EOF > gradle.properties
# Workaround for https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/349
# suggested at https://docs.gradle.org/current/userguide/upgrading_version_8.html#xml_parsing_now_requires_recent_parsers
systemProp.javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
systemProp.javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
systemProp.javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
EOF
# Testing
- name: Gradle Check
run: ./gradlew check --stacktrace
Expand All @@ -72,10 +83,19 @@ jobs:

# Test Coverage Report
- name: Jacoco Test Coverage
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
run: ./gradlew jacocoRootReport coveralls
env:
COVERALLS_REPO_TOKEN: S2ecSJja2cKJa9yv45C8ZFPohXuRrTXKd
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
if: |
${{ matrix.java == env.PRIMARY_JAVA_VERSION }} &&
${{ env.COVERALLS_REPO_TOKEN != '' }}
run: |
if [[ -z ${COVERALLS_REPO_TOKEN} ]]; then
echo WARNING: COVERALLS_REPO_TOKEN is empty
else
echo COVERALLS_REPO_TOKEN is not empty
fi
./gradlew smack-java8-full:testCodeCoverageReport
./gradlew smack-java8-full:coveralls
# Upload build artifacts
- name: Upload build artifacts
Expand Down
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
GRADLE ?= ./gradlew

.PHONY: all
all: check jacocoRootReport javadocAll sinttest

.PHONY: codecov
codecov:
$(GRADLE) smack-java8-full:testCodeCoverageReport
echo "Report available at smack-java8-full/build/reports/jacoco/testCodeCoverageReport/html/index.html"

.PHONY: check
check:
$(GRADLE) $@

.PHONY: eclipse
eclipse:
$(GRADLE) $@

.PHONY: sinttest
sinttest:
$(GRADLE) $@

.PHONY: jacocoRootReport
jacocoRootReport:
$(GRADLE) $@

.PHONY: javadocAll
javadocAll:
$(GRADLE) $@
echo "Smack javadoc available at build/javadoc/index.html"
16 changes: 16 additions & 0 deletions build-logic/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
id 'groovy-gradle-plugin'
}

repositories {
gradlePluginPortal()
}

dependencies {
implementation "biz.aQute.bnd:biz.aQute.bnd.gradle:7.0.0"
implementation "io.freefair.gradle:maven-plugin:8.10" // for io.freefair.agregate-javadoc
implementation "me.champeau.jmh:jmh-gradle-plugin:0.7.2"
implementation "net.ltgt.gradle:gradle-errorprone-plugin:4.0.1"
implementation "gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.2"
implementation "ru.vyarus:gradle-animalsniffer-plugin:1.7.1"
}
1 change: 1 addition & 0 deletions build-logic/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'smack-build-logic'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
compileJava {
options.bootstrapClasspath = files(androidBootClasspath)
}
javadoc {
classpath += files(androidBootClasspath)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
id 'ru.vyarus.animalsniffer'
id 'org.igniterealtime.smack.global-conventions'
}
dependencies {
signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:5.0.1_r2@signature"
}
animalsniffer {
sourceSets = [sourceSets.main]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id 'application'
}

application {
applicationDefaultJvmArgs = ["-enableassertions"]
}

run {
// Pass all system properties down to the "application" run
systemProperties System.getProperties()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
ext {
javaVersion = JavaVersion.VERSION_11
javaMajor = javaVersion.getMajorVersion()
smackMinAndroidSdk = 21

androidBootClasspath = { getAndroidRuntimeJar() }
}

repositories {
mavenLocal()
mavenCentral()
}

def getAndroidRuntimeJar() {
def androidApiLevel = ext.smackMinAndroidSdk
def androidHome = getAndroidHome()
def androidJar = new File("$androidHome/platforms/android-${androidApiLevel}/android.jar")
if (androidJar.isFile()) {
return androidJar
} else {
throw new Exception("Can't find android.jar for API level ${androidApiLevel}. Please install corresponding SDK platform package")
}
}
def getAndroidJavadocOffline() {
def androidHome = getAndroidHome()
return androidHome.toString() + "/docs/reference"
}

def getAndroidHome() {
def androidHomeEnv = System.getenv("ANDROID_HOME")
if (androidHomeEnv == null) {
throw new Exception("ANDROID_HOME environment variable is not set")
}
def androidHome = new File(androidHomeEnv)
if (!androidHome.isDirectory()) throw new Exception("Environment variable ANDROID_HOME is not pointing to a directory")
return androidHome
}
Loading

0 comments on commit f59d7f3

Please sign in to comment.