Skip to content

Commit

Permalink
Feat/new gradle8 (#17)
Browse files Browse the repository at this point in the history
* Upgrade gradle wrapper to 8

- The build now requires Java11 or later
- Modified Jacoco configurations and update depenedencies
- Fix outdated github action and doc
- Fix small warnings and typos
  • Loading branch information
hayarobi authored Dec 16, 2024
1 parent 0bcea46 commit a102b72
Show file tree
Hide file tree
Showing 22 changed files with 388 additions and 524 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ jobs:
submodules: 'recursive'

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

- name: Build with Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
arguments: build allcoverage

# run unit test with code coverage report if action is triggered by push of master branch
# since Code Climate only evaluate code coverages of default branch.
- name: Unit Tests with publishing code coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{github.workspace}}/build/reports/jacoco/report.xml # optional
files: ${{github.workspace}}/report/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![LoC](https://tokei.rs/b1/github/aergoio/heraj)](https://github.com/aergoio/heraj)
[![github build](https://github.com/aergoio/heraj/actions/workflows/gradle.yml/badge.svg)](https://github.com/aergoio/aergo/actions/workflows/gradle.yml/badge.svg)
[![codecov.io](http://codecov.io/github/aergoio/heraj/coverage.svg?branch=develop)](http://codecov.io/github/aergoio/heraj?branch=develop)
[![codecov.io](https://codecov.io/github/aergoio/heraj/coverage.svg?branch=develop)](https://codecov.io/github/aergoio/heraj?branch=develop)

The hera is the client-side framework for the aergo.
This repository, heraj is java implementation for hera.
Expand Down
10 changes: 5 additions & 5 deletions assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @copyright defined in LICENSE.txt
*/
plugins {
id 'io.aergo.heraj.java-common-conventions'
id 'io.aergo.heraj.java-library-conventions'
id 'java-library'
id 'com.github.johnrengelman.shadow' version "${shadowJarVersion}"
id 'com.gradleup.shadow' version "${shadowJarVersion}"
id "me.champeau.jmh" version "${jmhPluginVersion}" // micro bmt
}

Expand All @@ -21,8 +21,8 @@ dependencies {
}

shadowJar {
baseName = project.rootProject.name
classifier = 'all'
archiveBaseName = "${project.rootProject.name}"
// classifier = 'all'

// remove all classes of dependencies that are not used by the project
minimize()
Expand All @@ -38,4 +38,4 @@ shadowJar {
doLast {
println "Shadow jar is generated in '${project.buildDir}/libs'"
}
}
}
28 changes: 5 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
plugins {
id 'io.aergo.heraj.java-common-conventions'
id 'jacoco'
// id 'jacoco-report-aggregation'
}

def javaLibraryProjects = [
Expand All @@ -15,10 +16,6 @@ def javaLibraryProjects = [
project('client:wallet'),
project('client:smart-contract')
]
subprojects {
apply plugin: 'java'
}


// root project
project(":") {
Expand All @@ -29,26 +26,11 @@ project(":") {
javadoc.enabled = false
sourceJar.enabled = false

task allcoverage(type: JacocoReport) {
def targetProjects = javaLibraryProjects.findAll {
it.name != 'annotation' && it.name != 'protobuf'
tasks.register('allcoverage') {
dependsOn ':report:testCodeCoverageReport'
group = 'verification'
description = 'Runs the testCodeCoverageReport task in the report submodule.'
}
dependsOn = targetProjects.collect{it.getTasksByName('coverage',false)}
getSourceDirectories().setFrom(targetProjects.sourceSets.main.allSource.srcDirs)
getClassDirectories().setFrom(targetProjects.sourceSets.main.output.classesDirs)
getExecutionData().setFrom(targetProjects.collect{it.getTasksByName('jacocoTestReport', false).executionData})
reports {
html.required = true
xml.required = true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
csv.required = false
}
afterEvaluate {
getClassDirectories().setFrom(classDirectories.files.collect {
fileTree(dir: it, exclude: ['types/**'])
})
}
}

task alljavadoc(type: Javadoc, group: 'Documentation') {
def targetProjects = javaLibraryProjects.findAll {
Expand Down
Loading

0 comments on commit a102b72

Please sign in to comment.