Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to gradle 8.3, AnyEscapableString hierarchy #36

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
32 changes: 24 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs: # a collection of steps
- run:
name: Run tests
command: |
./gradlew build test $GRADLE_ARGS
./gradlew build test allBoms $GRADLE_ARGS
- save_cache:
paths:
- ~/.gradle/wrapper
Expand All @@ -34,26 +34,42 @@ jobs: # a collection of steps
- store_test_results:
# Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: build/test-results/test
- store_artifacts: # Upload test results for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
- store_artifacts:
# Upload test results for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: build/test-results/test
when: always
- persist_to_workspace: # Pass artifact over to next job via workspace.
root: build/libs
- persist_to_workspace:
# Pass artifact over to next job via workspace.
root: build/
paths:
- "*.jar"
# See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples
- "libs/*.jar"
- "reports/cyclonedx/*"
- "reports/tests/test/*"

# See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples
publish-github-release: # https://circleci.com/blog/publishing-to-github-releases-via-circleci/
docker:
- image: cibuilds/github:0.13
resource_class: small
steps:
- attach_workspace:
at: build/libs
at: build/
- run:
name: "Publish Release on GitHub"
command: |
VERSION=$(ls ./build/libs/*.jar | sed -r 's/.*RoddyToolLib-([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-.+)?).jar/\1/')
ghr -t "$GITHUB_TOKEN" -u "$CIRCLE_PROJECT_USERNAME" -r "$CIRCLE_PROJECT_REPONAME" -c "$CIRCLE_SHA1" -n "$VERSION" -delete "$VERSION" ./build/libs/*.jar
tar -C build/reports/tests/ -cvzf test-report.tgz test/
tar -C build/reports/ -cvzf cyclonedx-sbom.tgz cyclonedx/
ghr \
-t "$GITHUB_TOKEN" \
-u "$CIRCLE_PROJECT_USERNAME" \
-r "$CIRCLE_PROJECT_REPONAME" \
-c "$CIRCLE_SHA1" \
-n "$VERSION" \
-delete "$VERSION" \
./build/libs/*.jar \
./cyclonedx-sbom.tgz \
./test-report.tgz

workflows:
version: 2
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ToolLib
# RoddyToolLib

[![CircleCI](https://circleci.com/gh/TheRoddyWMS/RoddyToolLib/tree/master.svg?style=svg)](https://circleci.com/gh/TheRoddyWMS/RoddyToolLib/tree/master)

Expand All @@ -25,6 +25,13 @@ where you substitute the correct proxies and ports required for your environment

## Changelog

* 2.5.0

- minor: Added `AnyEscapableString` hierarchy to model shell-escapable strings and escaping.
- patch: Upgrade to Gradle 8.3
- patch: Added `listConfigurations`, `allBoms`, and a `...Bom` task for every Gradle configuration set. The `allBoms` and `...Bom` tasks generate JSON CycloneDX SBOMs in `gradleBuild/reports/cyclonedx`.
vinjana marked this conversation as resolved.
Show resolved Hide resolved
- patch: Added cyclonedx SBOM and test-report tarballs to GitHub releases

* 2.4.1

- Patch: Library update
Expand Down
91 changes: 70 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@
* Distributed under the MIT License (license terms are at https://www.github.com/theroddywms/Roddy/LICENSE.txt).
*/

import org.cyclonedx.gradle.CycloneDxTask

plugins {
id 'org.ajoberstar.grgit' version '1.7.2'
id 'org.ajoberstar.grgit' version '4.1.1'
id 'org.cyclonedx.bom' version '1.8.2'
id 'maven-publish'
}

apply plugin: 'groovy'
apply plugin: 'maven'

group = "com.github.theroddywms"

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}


/*
* Gets the version name from the current Git tag. If the current commit is not tagged,
Expand All @@ -30,44 +39,52 @@ repositories {
}

dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.21'
testCompile 'junit:junit:4.13.1'
testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
compile group: 'commons-codec', name: 'commons-codec', version: '1.13'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
implementation 'org.codehaus.groovy:groovy-all:2.4.21'
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.spockframework:spock-core:1.1-groovy-2.4'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.13'
implementation group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.11.0'
implementation 'com.google.guava:guava:32.0.0-android'

// Runtime retention of @NotNull and annotations.
implementation 'com.github.bbottema:jetbrains-runtime-annotations:1.0.1'
}

// Fix Java Version
ext.langLevel = 1.8
model {
tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/pom.xml")
}
}

task writePom {
doLast {
pom {
project {
version rootProject.version
inceptionYear '2017'
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'RoddyToolLib'
url = "https://www.github.com/theroddywms/RoddyToolLib"
licenses {
license {
name 'MIT License'
url 'https://raw.githubusercontent.com/eilslabs/RoddyToolLib/master/LICENSE'
distribution 'repo'
name = 'MIT License'
url = 'https://raw.githubusercontent.com/eilslabs/RoddyToolLib/master/LICENSE'
}
}
}
}.writeTo("$buildDir/pom.xml")
}
}
}

jar {
version = getVersionName()
manifest {
attributes("Implementation-Vendor": "German Cancer Research Center (DKFZ)")
attributes("Implementation-Title": baseName)
attributes("Implementation-Title": archiveBaseName.get())
attributes 'Implementation-Version': rootProject.version
}

dependsOn writePom
into("META-INF/maven/$project.group/$project.name") {
from generatePomFileForMavenJavaPublication
from "$buildDir/pom.xml"
}
}
Expand All @@ -86,3 +103,35 @@ test {
setShowStandardStreams true
}
}

task listConfigurations {
group = "reporting"
description = "List all configurations, as needed for discerning development and production configurations by the SBOM tasks."
doLast {
configurations.each { Configuration c ->
println c.name
}
}
}

task allBoms() {
// a grouping task to execute the CycloneDxTask for each configuration
group = "reporting"
}

rootProject.configurations.each { configuration ->
String name = configuration.name
task "${name}Bom"(type: CycloneDxTask) {
group = "reporting"
description = "Creates a CycloneDX SBOM for the configuration ${name}."

destination = file("${project.buildDir}/reports/cyclonedx")
outputName = name
includeConfigs = [name]
schemaVersion = "1.5"
outputFormat="json"
includeLicenseText = false
projectType = "application"
}
allBoms.dependsOn tasks.getByName("${name}Bom")
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading