Skip to content

Commit

Permalink
Merge branch 'main' into copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Oct 16, 2024
2 parents d60c693 + 72ea41d commit 2e44668
Show file tree
Hide file tree
Showing 11 changed files with 268 additions and 161 deletions.
6 changes: 6 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
'github>junit-team/renovate-config',
],
}
35 changes: 26 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,38 @@ jobs:
gradle:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
distribution: temurin
java-version: 11
- uses: eskatos/gradle-command-action@v1
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
arguments: --stacktrace build
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4
- shell: bash
run: ./gradlew --stacktrace build

publish_artifacts:
name: Publish Snapshot Artifacts
needs: gradle
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository == 'apiguardian-team/apiguardian' && (startsWith(github.ref, 'refs/heads/releases/') || github.ref == 'refs/heads/main')
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
distribution: temurin
java-version: 11
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4
- name: 'Publish'
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
Expand All @@ -47,10 +58,16 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository == 'apiguardian-team/apiguardian' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
distribution: temurin
java-version: 11
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4
- name: 'Upload Documentation'
env:
GRGIT_USER: ${{ secrets.GH_TOKEN }}
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ Library that provides the `@API` annotation that is used to annotate public type

## How to use it

The @API Guardian library is deployed to Maven Central. You can simply add it as a dependency:
The @API Guardian library is deployed to Maven Central. To avoid compile-time warnings, you need to declare it as a _transitive_ compile-time dependency.

### Apache Maven

```xml
<dependency>
<groupId>org.apiguardian</groupId>
Expand All @@ -27,3 +28,11 @@ dependencies {
compileOnlyApi("org.apiguardian:apiguardian-api:1.1.2")
}
```

### Java Platform Module System

```java
module org.example {
requires static transitive org.apiguardian.api;
}
```
41 changes: 22 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ plugins {
id("idea")
id("maven-publish")
id("signing")
id("biz.aQute.bnd.builder") version "5.3.0"
id("net.nemerosa.versioning") version "2.14.0"
id("org.ajoberstar.git-publish") version "3.0.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("biz.aQute.bnd.builder") version "7.0.0"
id("net.nemerosa.versioning") version "3.1.0"
id("org.ajoberstar.git-publish") version "4.2.2"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}

val buildTimeAndDate = OffsetDateTime.now()
val buildDate = DateTimeFormatter.ISO_LOCAL_DATE.format(buildTimeAndDate)
val buildTime = DateTimeFormatter.ofPattern("HH:mm:ss.SSSZ").format(buildTimeAndDate)
val buildTimeAndDate: OffsetDateTime = OffsetDateTime.now()
val buildDate: String = DateTimeFormatter.ISO_LOCAL_DATE.format(buildTimeAndDate)
val buildTime: String = DateTimeFormatter.ofPattern("HH:mm:ss.SSSZ").format(buildTimeAndDate)
val builtByValue = project.findProperty("builtBy") ?: project.property("defaultBuiltBy")

val isSnapshot = project.version.toString().contains("SNAPSHOT")
val docsVersion = if (isSnapshot) "snapshot" else project.version
val docsDir = File(buildDir, "ghpages-docs")
val docsVersion = if (isSnapshot) "snapshot" else project.version.toString()
val docsDir = layout.buildDirectory.dir("ghpages-docs")
val replaceCurrentDocs = project.hasProperty("replaceCurrentDocs")

description = "@API Guardian"
Expand All @@ -39,12 +39,15 @@ val moduleSourceDir = file("src/module/java")

tasks {
compileJava {
options.release.set(6)
options.release = 6
javaCompiler = project.javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

val compileModule by registering(JavaCompile::class) {
source(moduleSourceDir)
destinationDir = file("$buildDir/classes/java/modules")
destinationDirectory = layout.buildDirectory.dir("classes/java/modules")
classpath = files(compileJava.map { it.classpath })
inputs.property("moduleName", moduleName)
inputs.property("moduleVersion", project.version)
Expand Down Expand Up @@ -87,7 +90,7 @@ tasks {
"Bundle-SymbolicName" to moduleName
)
}
from(files(compileModule.map { "${it.destinationDir}/${moduleName}" })) {
from(files(compileModule.flatMap { destinationDirectory.map { it.dir(moduleName) } })) {
include("module-info.class")
}
}
Expand Down Expand Up @@ -127,15 +130,15 @@ tasks {
dependsOn(javadoc)
outputs.dir(docsDir)

from("$buildDir/docs") {
from(layout.buildDirectory.dir("docs")) {
include("javadoc/**")
}
from("$buildDir/docs/javadoc") {
from(layout.buildDirectory.dir("docs/javadoc")) {
// For compatibility with pre JDK 10 versions of the Javadoc tool
include("element-list")
rename { "api/package-list" }
}
into("${docsDir}/${docsVersion}")
into(docsDir.map { it.dir(docsVersion) })
filesMatching("javadoc/**") {
path = path.replace("javadoc/", "api/")
}
Expand All @@ -147,11 +150,11 @@ tasks {
enabled = replaceCurrentDocs
outputs.dir("${docsDir}/current")

from("${docsDir}/${docsVersion}")
into("${docsDir}/current")
from(docsDir.map { it.dir(docsVersion) })
into(docsDir.map { it.dir("current") })
}

gitPublishCommit {
gitPublishCopy {
dependsOn(prepareDocsForUploadToGhPages, createCurrentDocsFolder)
}
}
Expand Down Expand Up @@ -185,7 +188,7 @@ publishing {
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
Expand Down
2 changes: 2 additions & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#This file is generated by updateDaemonJvm
toolchainVersion=21
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 4 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=2debee19271e1b82c6e41137d78e44e6e841035230a1a169ca47fd3fb09ed87b
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 2e44668

Please sign in to comment.