Skip to content

Commit

Permalink
Bump Gradle to 8.10.2, require Java 11
Browse files Browse the repository at this point in the history
Also bump various plugins, especially error prone, which required some
changes to the code.
  • Loading branch information
Flowdalic committed Oct 20, 2024
1 parent 020e232 commit 4433a70
Show file tree
Hide file tree
Showing 64 changed files with 1,194 additions and 531 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
name: CI

env:
GRADLE_VERSION: 6.7.1

on: [push, pull_request]

jobs:
build:
name: Build MiniDNS

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
java:
- 11
- 15
- 17
- 21
env:
PRIMARY_JAVA_VERSION: 11
PRIMARY_JAVA_VERSION: 21

steps:
- name: Checkout
Expand Down Expand Up @@ -57,11 +54,6 @@ jobs:
android-
# Pre-reqs
- name: Grab gradle wrapper
run: |
wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
unzip gradle-${GRADLE_VERSION}-all.zip
echo "PATH_TO_GRADLE=./gradle-${GRADLE_VERSION}/bin/gradle" >> $GITHUB_ENV
- name: Install Android SDK Manager
uses: android-actions/setup-android@v2
- name: Install Android SDK
Expand All @@ -72,23 +64,28 @@ jobs:
# Testing
- name: Gradle Check
run: ${PATH_TO_GRADLE} check --stacktrace
run: ./gradlew check --stacktrace

# Test local publish
- name: Gradle publish
run: ${PATH_TO_GRADLE} publishToMavenLocal --stacktrace
run: ./gradlew publishToMavenLocal --stacktrace

# Javadoc
- name: Javadoc
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
run: ${PATH_TO_GRADLE} javadocAll --stacktrace
run: ./gradlew javadocAll --stacktrace

# Test Coverage Report
- name: Jacoco Test Coverage
run: ./gradlew minidns-hla:testCodeCoverageReport

# Coveralls
- name: Report coverage stats to Coveralls
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
run: ${PATH_TO_GRADLE} jacocoRootReport coveralls
env:
COVERALLS_REPO_TOKEN: S2ecSJja2cKJa9yv45C8ZFPohXuRrTXKd
uses: coverallsapp/github-action@v2
with:
format: jacoco
file: minidns-hla/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml

# Upload build artifacts
- name: Upload build artifacts
Expand Down
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
GRADLE ?= ./gradlew

.PHONY: all
all: check codecov eclipse javadocAll inttest

.PHONY: codecov
codecov:
$(GRADLE) minidns-hla:testCodeCoverageReport
echo "Code coverage report available at $(PWD)/minidns-hla/build/reports/jacoco/testCodeCoverageReport/html/index.html"

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

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

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

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

repositories {
gradlePluginPortal()
}

dependencies {
implementation "biz.aQute.bnd:biz.aQute.bnd.gradle:7.0.0"
implementation "net.ltgt.gradle:gradle-errorprone-plugin:4.0.1"
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 = 'minidns-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)
}
10 changes: 10 additions & 0 deletions build-logic/src/main/groovy/org.minidns.android-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
id 'ru.vyarus.animalsniffer'
id 'org.minidns.common-conventions'
}
dependencies {
signature "net.sf.androidscents.signature:android-api-level-${minAndroidSdk}:4.4.2_r4@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()
}
36 changes: 36 additions & 0 deletions build-logic/src/main/groovy/org.minidns.common-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ext {
javaVersion = JavaVersion.VERSION_11
javaMajor = javaVersion.getMajorVersion()
minAndroidSdk = 19

androidBootClasspath = getAndroidRuntimeJar(minAndroidSdk)

// Export the function by turning it into a closure.
// https://stackoverflow.com/a/23290820/194894
getAndroidRuntimeJar = this.&getAndroidRuntimeJar
}

repositories {
mavenLocal()
mavenCentral()
}

def getAndroidRuntimeJar(androidApiLevel) {
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 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 4433a70

Please sign in to comment.