Skip to content

Commit

Permalink
Merge pull request #8 from footaku/compatible-with-jdk21
Browse files Browse the repository at this point in the history
Compatible with jdk21
  • Loading branch information
footaku authored Dec 1, 2023
2 parents 74cbc71 + 4ee30ab commit a83ccfa
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 8 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# erai(Extra Rules of Architecture Inspection)
erai is extra rules for Java inspecting architecture constraint, using ArchUnit.
- 0.0.x: Compatible with JDK 17
- 0.1.x: Compatible with JDK 21

## Implemented
- Inspect return values have nullability annotation
Expand All @@ -13,13 +15,19 @@ build.gradle
```groovy
plugins {
...
id "com.societegenerale.commons.arch-unit-gradle-plugin" version "3.0.0"
// For JDK 17
id "com.societegenerale.commons.arch-unit-gradle-plugin" version "3.1.0"
// For JDK 21
id "com.societegenerale.commons.arch-unit-gradle-plugin" version "4.0.0"
...
}
dependencies {
...
// For JDK 17
archUnitExtraLib('io.github.footaku:erai:0.0.7')
// For JDK 21
archUnitExtraLib('io.github.footaku:erai:0.1.0')
...
}
Expand Down
12 changes: 6 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ plugins {
}

group = "io.github.footaku"
version = "0.0.7"
version = "0.1.0"

repositories {
mavenLocal()
mavenCentral()
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

sourceSets {
Expand All @@ -30,8 +30,8 @@ sourceSets {
}

dependencies {
implementation("com.societegenerale.commons:arch-unit-build-plugin-core:3.1.0")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2")
implementation("com.societegenerale.commons:arch-unit-build-plugin-core:4.0.0")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.0")

testImplementation("jakarta.annotation:jakarta.annotation-api:2.1.1")
testImplementation("org.springframework:spring-core:6.0.9")
Expand Down Expand Up @@ -73,7 +73,7 @@ publishing {
create<MavenPublication>("mavenJava") {
groupId = "io.github.footaku"
artifactId = "erai"
version = "0.0.7"
version = "0.1.0"

pom {
name.set("erai")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

/**
* Nullability settings.
*
* @param returnValue return value settings
*/
public record Nullability(ReturnValue returnValue) {
private static final List<String> DEFAULT_AVAILABLE_ANNOTATIONS = List.of(
Expand Down Expand Up @@ -43,6 +45,11 @@ public List<String> excludeClasses() {

/**
* Return value settings.
*
* @param availableAnnotations available annotations for return values
* (default: {@link #DEFAULT_AVAILABLE_ANNOTATIONS})
* @param excludeClasses excluded classes from inspection
* (default: empty)
*/
public record ReturnValue(
List<String> availableAnnotations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

/**
* Setting for erai.
*
* @param nullability nullability setting
*/
public record Setting(Nullability nullability) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public class ShouldBeIndicateReturnValueNullability implements ArchRuleTest {
private final List<String> availableAnnotations = Erai.getSetting().nullability().availableAnnotations();
private final List<String> excludeClasses = Erai.getSetting().nullability().excludeClasses();

/**
* Default Constructor
*/
public ShouldBeIndicateReturnValueNullability() {}

@Override
public void execute(String packagePath, ScopePathProvider scopePathProvider, Collection<String> excludedPaths) {
var rule = ArchRuleDefinition.methods()
Expand Down

0 comments on commit a83ccfa

Please sign in to comment.