Skip to content
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
53 changes: 29 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: build

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
types: [ opened, labeled, unlabeled, synchronize ]

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"
Expand All @@ -13,38 +18,39 @@ jobs:
fail-fast: false
matrix:
java-version:
- 1.8
- 8

steps:
- name: Checkout Project
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1.0.4

- name: Cache Gradle dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper/
~/.android/build-cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Checkout Project
uses: actions/checkout@v2

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Configure JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3.1.0
with:
distribution: temurin
java-version: ${{ matrix.java-version }}

- name: Run Build
run: ./gradlew clean build jar docsJar sourcesJar testsJar reportsZip generatePomFileForMavenPublication -s --scan
run: ./gradlew clean build -s

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3.0.0
if: always()
with:
name: gradle-checker-framework-plugin-${{ github.workflow }}-${{ github.run_id }}
name: gradle-license-plugin-${{ github.workflow }}-${{ github.run_id }}
path: |
build/libs
build/outputs
Expand All @@ -62,20 +68,19 @@ jobs:

steps:
- name: Checkout Project
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v1.0.4

- name: Configure JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3.1.0
with:
java-version: 1.8
distribution: temurin
java-version: 8

- name: Publish
run: ./gradlew clean artifactoryPublish -s --scan
run: ./gradlew clean publish -s
env:
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
BINTRAY_USERNAME: ${{ secrets.BINTRAY_USERNAME }}
GRADLE_KEY: ${{ secrets.GRADLE_KEY }}
GRADLE_SECRET: ${{ secrets.GRADLE_SECRET }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gradle Checker Framework Plugin

[![License](https://img.shields.io/badge/license-apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
[![Build](https://github.com/jaredsburrows/gradle-checker-framework-plugin/workflows/build/badge.svg)](https://github.com/jaredsburrows/gradle-checker-framework-plugin/actions)
[![Build](https://github.com/jaredsburrows/gradle-checker-framework-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/jaredsburrows/gradle-checker-framework-plugin/actions/workflows/build.yml)
[![Twitter Follow](https://img.shields.io/twitter/follow/jaredsburrows.svg?style=social)](https://twitter.com/jaredsburrows)

This plugin configures `JavaCompile` tasks to use the [Checker Framework](https://checkerframework.org).
Expand All @@ -17,7 +17,7 @@ This plugin configures `JavaCompile` tasks to use the [Checker Framework](https:
```groovy
buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
Expand All @@ -27,13 +27,13 @@ buildscript {

apply plugin: 'com.jaredsburrows.checkerframework'
```
Release versions are available in the [JFrog Bintray repository](https://jcenter.bintray.com/com/jaredsburrows/gradle-checker-framework-plugin/).
Release versions are available in the [Sonatype's release repository](https://repo1.maven.org/maven2/com/jaredsburrows/gradle-checker-framework-plugin/).

**Snapshot:**
```groovy
buildscript {
repositories {
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

dependencies {
Expand All @@ -43,7 +43,7 @@ buildscript {

apply plugin: 'com.jaredsburrows.checkerframework'
```
Snapshot versions are available in the [JFrog Artifactory repository](https://oss.jfrog.org/artifactory/libs-snapshot/com/jaredsburrows/gradle-checker-framework-plugin/).
Snapshot versions are available in the [Sonatype's snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/com/jaredsburrows/gradle-checker-framework-plugin/).

## Configuration

Expand All @@ -65,17 +65,18 @@ By default, only the `NullnessChecker` is enabled.
You can find out what checkers are available in the [Checker Framework Manual](https://checkerframework.org/manual/#introduction).

## License
```
Copyright (C) 2017 Jared Burrows

Copyright (C) 2017 Jared Burrows

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
98 changes: 66 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,45 +1,79 @@
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter

plugins {
id 'com.jfrog.artifactory' version '4.18.3'
id 'com.jfrog.bintray' version '1.8.5'
id 'com.github.ben-manes.versions' version '0.36.0'
id 'com.gradle.plugin-publish' version '0.12.0'
alias(libs.plugins.maven.publish) apply false
alias(libs.plugins.plugin.publish) apply false
alias(libs.plugins.versions)
id 'java-gradle-plugin'
id 'java-library'
id 'groovy'
id 'maven-publish'
}

repositories {
jcenter()
google()
}
subprojects {
repositories {
mavenCentral()
google()
}

apply from: 'gradle/dependencies.gradle'
tasks.withType(Jar).configureEach {
def dateFile = new File(buildDir, 'jar-manifest-date.txt')
if (!dateFile.exists()) {
def date = DateTimeFormatter.ofPattern('EEE MMM dd HH:mm:ss zzz yyyy').
format(ZonedDateTime.now())
dateFile.parentFile.mkdirs()
dateFile.text = date.trim()
}

group = GROUP
version = VERSION_NAME
description = POM_DESCRIPTION
manifest {
attributes(
'Created-By': POM_DEVELOPER_NAME,
'Implementation-Title': POM_NAME,
'Implementation-Version': VERSION_NAME,
'Implementation-Vendor': POM_DEVELOPER_NAME,
'Built-By': System.getProperty('user.name'),
'Built-Date': dateFile.text.trim(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion)
}
}

sourceCompatibility = versions.java
targetCompatibility = versions.java
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

jar {
manifest {
attributes(
'Implementation-Title': POM_NAME,
'Implementation-Version': archiveVersion,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion)
configure(options) {
compilerArgs << '-Xlint:all'
compilerArgs << '-Xlint:-options'
encoding = 'utf-8'
fork = true
}
}
}

dependencies {
implementation localGroovy()
tasks.withType(GroovyCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

testImplementation deps.android.tools.build.gradle
testImplementation deps.spock, { exclude module: 'groovy-all' } // Use localGroovy()
}
configure(options) {
compilerArgs << '-Xlint:all'
compilerArgs << '-Xlint:-options'
encoding = 'utf-8'
fork = true
}
}

tasks.withType(Test).configureEach {
useJUnitPlatform()

testLogging {
exceptionFormat 'full'
showCauses true
showExceptions true
showStackTraces true
events 'failed', 'skipped'
}

apply from: 'gradle/compile.gradle'
apply from: 'gradle/publish.gradle'
def maxWorkerCount = gradle.startParameter.maxWorkerCount
maxParallelForks = (maxWorkerCount < 2) ? 1 : maxWorkerCount / 2
}
}
28 changes: 28 additions & 0 deletions gradle-checker-framework-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
plugins {
alias(libs.plugins.maven.publish)
alias(libs.plugins.plugin.publish)
alias(libs.plugins.versions)
id 'java-gradle-plugin'
id 'java-library'
id 'groovy'
}

dependencies {
compileOnly gradleApi()

implementation localGroovy()

testImplementation localGroovy()
testImplementation gradleTestKit()
testImplementation libs.android.plugin
testImplementation libs.spock, { exclude module: 'groovy-all' } // Use localGroovy()
}

gradlePlugin {
plugins {
licensePlugin {
id = PLUGIN_NAME
implementationClass = PLUGIN_NAME_CLASS
}
}
}
3 changes: 3 additions & 0 deletions gradle-checker-framework-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_ARTIFACT_ID=gradle-checker-framework-plugin
POM_NAME=Gradle Checker Framework Plugin
POM_DESCRIPTION=Gradle plugin to use the Checker Framework for Java.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ final class CheckerExtensionSpec extends Specification {
}

repositories {
jcenter()
mavenCentral()
google()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ final class CheckerPluginSpec extends Specification {
'4.9',
'4.10',
'5.0',
'6.0'
'6.0',
'7.4.2',
]

def "setup"() {
Expand All @@ -33,7 +34,7 @@ final class CheckerPluginSpec extends Specification {
}

repositories {
jcenter()
mavenCentral()
google()
}
""".stripIndent().trim()
Expand Down Expand Up @@ -61,7 +62,7 @@ final class CheckerPluginSpec extends Specification {
}

repositories {
jcenter()
mavenCentral()
google()
}
""".stripIndent().trim()
Expand Down Expand Up @@ -90,7 +91,7 @@ final class CheckerPluginSpec extends Specification {
}

repositories {
jcenter()
mavenCentral()
google()
}
""".stripIndent().trim()
Expand Down
4 changes: 0 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
GROUP=com.jaredsburrows
VERSION_NAME=0.2.3-SNAPSHOT

POM_NAME=Gradle Checker Framework Plugin
POM_ARTIFACT_ID=gradle-checker-framework-plugin
POM_DESCRIPTION=Gradle plugin to use the Checker Framework for Java.
POM_PACKAGING=jar
POM_URL=https://github.com/jaredsburrows/gradle-checker-framework-plugin

Expand All @@ -22,6 +19,5 @@ POM_DEVELOPER_ID=jaredsburrows
POM_DEVELOPER_NAME=Jared Burrows
POM_DEVELOPER_EMAIL=jaredsburrows@gmail.com

BINTRAY_GITHUB_REPO=jaredsburrows/gradle-checker-framework-plugin
PLUGIN_NAME=com.jaredsburrows.checkerframework
PLUGIN_NAME_CLASS=com.jaredsburrows.checkerframework.CheckerPlugin
Loading