Skip to content

Commit

Permalink
Bump Gradle to 8.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Nov 17, 2024
1 parent ad65b1d commit d86a36a
Show file tree
Hide file tree
Showing 29 changed files with 846 additions and 269 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: CI

on: [push, pull_request]

jobs:
build:
name: Build Java Pinning

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

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

# Caches
- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/build.gradle') }}
restore-keys: |
maven-
- name: Cache Gradle
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: gradle-caches-${{ hashFiles('**/build.gradle') }}
restore-keys:
gradle-caches
- name: Cache Android SDK
uses: actions/cache@v2
with:
path: |
~/.android/sdk
key: android-${{ hashFiles('build.gradle') }}
restore-keys: |
android-
# Pre-reqs
- name: Install Android SDK Manager
uses: android-actions/setup-android@v2
- name: Install Android SDK
run: |
sdkmanager "platforms;android-15" "platforms;android-30"
# Testing
- name: Gradle Check
run: ./gradlew check --stacktrace

# Test local publish
- name: Gradle publish
run: ./gradlew publishToMavenLocal --stacktrace

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

# Test Coverage Report
- name: Jacoco Test Coverage
run: ./gradlew java-pinning-java11:testCodeCoverageReport

# Coveralls
- name: Report coverage stats to Coveralls
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }}
uses: coverallsapp/github-action@v2
with:
format: jacoco
file: java-pinning-java11/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml

# Upload build artifacts
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: java-pinning-java-${{ matrix.java }}
path: |
java-pinning-*/build/libs/*.jar
!**/*-test-fixtures.jar
!**/*-tests.jar
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 show-dependency-updates

.PHONY: codecov
codecov:
$(GRADLE) java-pinning-java11:testCodeCoverageReport
echo "Code coverage report available at file://$(PWD)/java-pinnging-java11/build/reports/jacoco/testCodeCoverageReport/html/index.html"

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

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

.PHONY: javadocAll
javadocAll:
$(GRADLE) $@
echo "javadoc available at file://$(PWD)/build/javadoc/index.html"

.PHONY: show-dependency-updates
show-dependency-updates:
$(GRADLE) dependencyUpdates
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()
google()
}

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"
implementation "com.github.ben-manes:gradle-versions-plugin:0.51.0"
implementation 'com.android.tools.build:gradle:8.7.0'
}
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 = 'javapinning-build-logic'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id 'ru.vyarus.animalsniffer'
id 'eu.geekplace.javapinning.common-conventions'
}

dependencies {
signature "net.sf.androidscents.signature:android-api-level-${minAndroidSdk}:4.0.3_r5@signature"
}
animalsniffer {
sourceSets = [sourceSets.main]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
ext {
javaVersion = JavaVersion.VERSION_11
javaMajor = javaVersion.getMajorVersion()
minAndroidSdk = 15

androidBootClasspath = getAndroidRuntimeJar(minAndroidSdk)

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

repositories {
mavenCentral()
google()
mavenLocal()
}

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 d86a36a

Please sign in to comment.