Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins committed May 31, 2023
2 parents 113acd8 + e2e55af commit 7ba6aea
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-Daether.checksums.algorithms=SHA-512,SHA-256,SHA-1,MD5
-Daether.connector.smartChecksums=false
4 changes: 2 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.2-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ issue before implementing any new feature and sending a pull request. I'm happy
discuss your idea and give advice on how to best implement it.

If your idea is accepted, simply send the PR against the *development* branch.
Contributions should adhere to the coding standards used. All changes and additions
should be covered by unit tests. We do use spaces here :)
Note that code formatting is enforced by `spotless`. You can apply the configured
formatting rules to your changes by running `./mvnw spotless:apply`
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- This file is auto generated during release from readme/README.md -->

[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=2.2.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.2.0/jar)
[![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=2.2.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.2.0)
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=2.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.0/jar)
[![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=2.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.0)
[![Coverage Status](https://coveralls.io/repos/github/skuzzle/restrict-imports-enforcer-rule/badge.svg?branch=master)](https://coveralls.io/github/skuzzle/restrict-imports-enforcer-rule?branch=master)
[![Twitter Follow](https://img.shields.io/twitter/follow/skuzzleOSS.svg?style=social)](https://twitter.com/skuzzleOSS)

Expand All @@ -21,12 +21,12 @@ information.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<version>3.3.0</version>
<dependencies>
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
</dependency>
</dependencies>
<executions>
Expand Down
12 changes: 8 additions & 4 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=2.2.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.2.0/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=2.2.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.2.0)
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=2.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.0/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=2.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.0)

### Features
* [#60](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/60) Fall back to _line-by-line_ parsing if _full-compilation-unit_ parsing failed.
### Bug fixes
* [#73](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/73) Classloader issues while locating LanguageSupport instances
* [#76](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/76) `**` wildcard must match at least a single package part

### Misc
* Updated various dependencies



Expand All @@ -11,6 +15,6 @@ Maven Central coordinates for this release:
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
</dependency>
```
79 changes: 55 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,50 @@
<parent>
<groupId>de.skuzzle</groupId>
<artifactId>skuzzle-parent</artifactId>
<version>3.0.1</version>
<version>3.0.4</version>
<relativePath />
</parent>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<packaging>jar</packaging>
<name>Restrict Imports Enforcer Rule</name>
<description>Bans imports of specified classes/packages</description>
<url>https://github.com/skuzzle/${github.name}</url>
<scm>
<developerConnection>scm:git:https://github.com/skuzzle/${github.name}.git</developerConnection>
<tag>HEAD</tag>
</scm>

<properties>
<coveralls.skip>false</coveralls.skip>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<jacoco-plugin.version>0.8.9</jacoco-plugin.version>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.release>8</maven.compiler.release>
<version.enforcer-api>3.0.0</version.enforcer-api>
<version.maven>2.2.1</version.maven>
<version.junit>5.8.1</version.junit>
<version.assertj>3.13.2</version.assertj>
<version.equals-verifier>3.7.2</version.equals-verifier>
<version.slf4j>1.7.25</version.slf4j>
<version.mockito>4.0.0</version.mockito>
<maven.surefire.version>3.0.0</maven.surefire.version>
<maven.failsafe.version>3.0.0</maven.failsafe.version>
<version.enforcer-api>3.3.0</version.enforcer-api>
<version.maven>3.9.2</version.maven>
<version.junit>5.9.2</version.junit>
<version.assertj>3.24.2</version.assertj>
<version.byte-buddy>1.14.4</version.byte-buddy>
<version.equals-verifier>3.14.1</version.equals-verifier>
<version.slf4j>1.7.36</version.slf4j>
<version.mockito>5.3.1</version.mockito>
<version.jimfs>1.2</version.jimfs>
<version.java-parser>3.24.10</version.java-parser>
<version.resources-plugin>3.2.0</version.resources-plugin>
<version.java-parser>3.25.2</version.java-parser>
<version.resources-plugin>3.3.1</version.resources-plugin>
<version.invoker-plugin>3.5.1</version.invoker-plugin>

<!-- DO NOT UPDATE spotless UNTIL #64 IS RESOLVED -->
<!-- https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/64 -->
<version.spotless-plugin>2.34.0</version.spotless-plugin>

<site.name>restrict-imports-enforcer-rule</site.name>
<github.name>restrict-imports-enforcer-rule</github.name>
<!-- dont break on dependency failure -->
<failOnWarning>false</failOnWarning>
</properties>
<scm>
<developerConnection>scm:git:https://github.com/skuzzle/${github.name}.git</developerConnection>
<tag>HEAD</tag>
</scm>

<dependencyManagement>
<dependencies>
<dependency>
Expand All @@ -50,7 +60,7 @@
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<artifactId>maven-core</artifactId>
<version>${version.maven}</version>
</dependency>
<dependency>
Expand Down Expand Up @@ -93,8 +103,19 @@
<artifactId>mockito-core</artifactId>
<version>${version.mockito}</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${version.byte-buddy}</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>${version.byte-buddy}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -111,7 +132,7 @@
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -124,6 +145,16 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down Expand Up @@ -214,7 +245,7 @@
</goals>
<phase>validate</phase>
<configuration>
<outputDirectory>${basedir}</outputDirectory>
<outputDirectory>${project.basedir}</outputDirectory>
<resources>
<resource>
<directory>readme/</directory>
Expand Down Expand Up @@ -260,7 +291,7 @@
<configuration>
<showErrors>true</showErrors>
<streamLogs>false</streamLogs>
<settingsFile>src/it/settings.xml</settingsFile>
<settingsFile>${project.basedir}/src/it/settings.xml</settingsFile>
<!--uncomment next line to debug invoker tests -->
<!--<mavenOpts>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000</mavenOpts> -->
</configuration>
Expand Down Expand Up @@ -291,7 +322,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>2.0.0</version>
<version>2.1.0</version>
</dependency>
</dependencies>
<executions>
Expand Down
8 changes: 6 additions & 2 deletions readme/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=${project.version}&color=blue)](https://search.maven.org/artifact/${project.groupId}/${project.artifactId}/${project.version}/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=${project.version}&color=orange)](http://www.javadoc.io/doc/${project.groupId}/${project.artifactId}/${project.version})

### Features
* [#60](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/60) Fall back to _line-by-line_ parsing if _full-compilation-unit_ parsing failed.
### Bug fixes
* [#73](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/73) Classloader issues while locating LanguageSupport instances
* [#76](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/76) `**` wildcard must match at least a single package part

### Misc
* Updated various dependencies



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ private static boolean matchesInternal(boolean matchIsStatic, String[] matchPart

if ("**".equals(patternPart)) {
if (patternIndex + 1 < patternParts.length) {

// See #76
// https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/76
// ** is supposed to match at least one package. So we eagerly skip
// one package
matchIndex++;

final String nextPatternPart = patternParts[patternIndex + 1];
while (matchIndex < matchParts.length
&& !matchParts(nextPatternPart, matchParts[matchIndex])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ static boolean isLanguageSupported(String extension) {
* @return The implementations, mapped by their supported extensions.
*/
private static Map<String, LanguageSupport> lookupImplementations() {
final ServiceLoader<LanguageSupport> serviceProvider = ServiceLoader.load(LanguageSupport.class);
final ClassLoader classLoader = SupportedLanguageHolder.class.getClassLoader();
final ServiceLoader<LanguageSupport> serviceProvider = ServiceLoader.load(LanguageSupport.class, classLoader);
final Map<String, LanguageSupport> implementations = new HashMap<>();
serviceProvider.forEach(parser -> parser.getSupportedFileExtensions().stream()
.map(SupportedLanguageHolder::determineNormalizedExtension)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@

public class PackagePatternTest {

@Test
void testMatchWildcardPrefix() {
// See #76
// https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/76
assertThat(PackagePattern.parse("**.com.google.common.annotations.VisibleForTesting")
.matches("com.couchbase.client.core.deps.com.google.common.annotations.VisibleForTesting")).isTrue();
}

@Test
void testMatchLiteralAsterisk() {
final PackagePattern pattern = PackagePattern.parse("java.util.'*'");
Expand Down

0 comments on commit 7ba6aea

Please sign in to comment.