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

Verify code via forbidden-apis (jdk-internal and jdk-non-portable signatures) #2012

Merged
merged 1 commit into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Changed

### Added
- Verify code via forbidden-apis (jdk-internal and jdk-non-portable signatures) [PR #2012](https://github.com/pgjdbc/pgjdbc/pull/2012)

### Fixed

Expand Down
19 changes: 19 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.github.vlsi.gradle.properties.dsl.props
import com.github.vlsi.gradle.properties.dsl.stringProperty
import com.github.vlsi.gradle.publishing.dsl.simplifyXml
import com.github.vlsi.gradle.publishing.dsl.versionFromResolution
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApisExtension
import org.postgresql.buildtools.JavaCommentPreprocessorTask

plugins {
Expand All @@ -24,6 +25,7 @@ plugins {
id("org.owasp.dependencycheck")
id("org.checkerframework") apply false
id("com.github.johnrengelman.shadow") apply false
id("de.thetaphi.forbiddenapis") apply false
id("org.nosphere.gradle.github.actions")
// IDE configuration
id("org.jetbrains.gradle.plugin.idea-ext")
Expand All @@ -45,6 +47,7 @@ val enableCheckerframework by props()
val skipCheckstyle by props()
val skipAutostyle by props()
val skipJavadoc by props()
val skipForbiddenApis by props()
val enableMavenLocal by props()
val enableGradleMetadata by props()
// For instance -PincludeTestTags=!org.postgresql.test.SlowTests
Expand Down Expand Up @@ -374,6 +377,22 @@ allprojects {
}
}

if (!skipForbiddenApis && !props.bool("skipCheckstyle")) {
apply(plugin = "de.thetaphi.forbiddenapis")
configure<CheckForbiddenApisExtension> {
failOnUnsupportedJava = false
bundledSignatures.addAll(
listOf(
// "jdk-deprecated",
"jdk-internal",
"jdk-non-portable"
// "jdk-system-out"
// "jdk-unsafe"
)
)
}
}

if (!skipAutostyle) {
autostyle {
java {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ com.github.johnrengelman.shadow.version=5.1.0
com.github.lburgazzoli.karaf.version=0.5.1
com.github.spotbugs.version=2.0.0
com.github.vlsi.vlsi-release-plugins.version=1.70
de.thetaphi.forbiddenapis.version=3.1
kotlin.version=1.3.70
me.champeau.gradle.jmh.version=0.5.0
org.checkerframework.version=0.5.5
Expand Down
1 change: 1 addition & 0 deletions pgjdbc-jre6/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# There's no point in verifying preprocessed sources
skipCheckstyle=true
jdbc.specification.version=4.0
skipForbiddenApis=true
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pluginManagement {
idv("com.github.vlsi.ide", "com.github.vlsi.vlsi-release-plugins")
idv("com.github.vlsi.license-gather", "com.github.vlsi.vlsi-release-plugins")
idv("com.github.vlsi.stage-vote-release", "com.github.vlsi.vlsi-release-plugins")
idv("de.thetaphi.forbiddenapis")
idv("me.champeau.gradle.jmh")
idv("org.checkerframework")
idv("org.jetbrains.gradle.plugin.idea-ext")
Expand Down