This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo-access.git
The following commit(s) were added to refs/heads/main by this push: new 4f34b66 Added additional build plugins in preparation for release (#33) 4f34b66 is described below commit 4f34b6638484a3875bd5172273a0fb6c7c735944 Author: Dave Marion <dlmar...@apache.org> AuthorDate: Mon Jan 22 13:43:38 2024 -0500 Added additional build plugins in preparation for release (#33) --- .github/workflows/maven.yaml | 9 +- DEPENDENCIES | 25 ++ NOTICE | 5 + README.md | 8 + contrib/antlr4/README.md | 8 + .../antlr4/src/test/resources/specification.abnf | 19 ++ pom.xml | 289 ++++++++++++++++++++- .../apache/accumulo/access/AccessEvaluator.java | 2 +- .../accumulo/access/AccessExpressionBenchmark.java | 3 +- 9 files changed, 352 insertions(+), 16 deletions(-) diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index 6f01979..f0c9f1e 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -38,11 +38,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: distribution: adopt - java-version: 11 + java-version: 17 - name: Cache local maven repository uses: actions/cache@v3 with: @@ -70,9 +70,8 @@ jobs: strategy: matrix: profile: - - {name: 'unit-tests', distribution: adopt, javaver: 11, args: 'verify -PskipQA'} - - {name: 'qa-checks', distribution: adopt, javaver: 11, args: 'verify javadoc:jar -Psec-bugs,errorprone'} - - {name: 'jdk17', distribution: adopt, javaver: 17, args: 'verify'} + - {name: 'unit-tests', distribution: adopt, javaver: 17, args: 'verify -PskipQA'} + - {name: 'qa-checks', distribution: adopt, javaver: 17, args: 'verify javadoc:jar -Psec-bugs,errorprone'} - {name: 'jdk21', distribution: oracle, javaver: 21, args: 'verify'} fail-fast: false runs-on: ubuntu-latest diff --git a/DEPENDENCIES b/DEPENDENCIES new file mode 100644 index 0000000..d55492e --- /dev/null +++ b/DEPENDENCIES @@ -0,0 +1,25 @@ +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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 + + https://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. + +--> + +Apache Accumulo Access depends on artifacts which can be found in Maven Central. + +Each module has its own dependencies. Please refer to the individual +modules' pom.xml files for a comprehensive listing. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..5669a82 --- /dev/null +++ b/NOTICE @@ -0,0 +1,5 @@ +Apache Accumulo Access +Copyright 2023-2024 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (https://www.apache.org/). diff --git a/README.md b/README.md index a754d7f..e7bbe39 100644 --- a/README.md +++ b/README.md @@ -41,5 +41,13 @@ are package private and are not part of the public API. * [AccessExpression](src/main/java/org/apache/accumulo/access/AccessExpression.java). * [Authorizations](src/main/java/org/apache/accumulo/access/Authorizations.java). +## Running the Benchmark + +This project includes a JMH Benchmark. To run it: +``` +mvn clean package +mvn exec:exec -Dexec.executable="java" -Dexec.classpathScope=test -Dexec.args="-classpath %classpath org.apache.accumulo.access.AccessExpressionBenchmark" +``` + [1]:https://github.com/apache/accumulo/blob/rel/2.1.2/core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java [2]:https://github.com/apache/accumulo/blob/rel/2.1.2/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java diff --git a/contrib/antlr4/README.md b/contrib/antlr4/README.md index 1b90603..8dbf3f3 100644 --- a/contrib/antlr4/README.md +++ b/contrib/antlr4/README.md @@ -20,4 +20,12 @@ This contrib example contains an [ANTLRv4](https://www.antlr.org/) grammar file An example [parser](src/test/java/org/apache/accumulo/access/grammar/antlr/AccessExpressionAntlrParser.java) and [evaluator](src/test/java/org/apache/accumulo/access/grammar/antlr/AccessExpressionAntlrEvaluator.java) are used when building this project to confirm that the parsing and evaluation are consistent with the reference Java implementation. +## Running the Benchmark + ANTLR was evaluated as a replacement for the existing custom Java parser, but it doesn't parse as fast as the custom implementation. You can view the performance differences by running the JMH benchmark in this contrib project and the one in the main project. + +To run the benchmark in this project: +``` +mvn clean package +mvn exec:exec -Dexec.executable="java" -Dexec.classpathScope=test -Dexec.args="-classpath %classpath org.apache.accumulo.access.grammar.antlr.AccessExpressionAntlrBenchmark" +``` diff --git a/contrib/antlr4/src/test/resources/specification.abnf b/contrib/antlr4/src/test/resources/specification.abnf index ccd1c38..30f45b3 100644 --- a/contrib/antlr4/src/test/resources/specification.abnf +++ b/contrib/antlr4/src/test/resources/specification.abnf @@ -1,3 +1,22 @@ +; +; Licensed to the Apache Software Foundation (ASF) under one +; or more contributor license agreements. See the NOTICE file +; distributed with this work for additional information +; regarding copyright ownership. The ASF licenses this file +; to you 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 +; +; https://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. +; + access-expression = [expression] ; empty string is a valid access expression expression = (access-token / paren-expression) [and-expression / or-expression] diff --git a/pom.xml b/pom.xml index e971c8e..fc02e38 100644 --- a/pom.xml +++ b/pom.xml @@ -24,17 +24,72 @@ <parent> <groupId>org.apache</groupId> <artifactId>apache</artifactId> - <version>30</version> + <version>31</version> </parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-access</artifactId> <version>1.0.0-SNAPSHOT</version> - <name>Apache Accumulo Access</name> + <name>Apache Accumulo Access Project</name> + <url>https://accumulo.apache.org</url> + <organization> + <name>The Apache Software Foundation</name> + <url>https://www.apache.org</url> + </organization> + <licenses> + <license> + <name>Apache-2.0</name> + <url>https://www.apache.org/licenses/LICENSE-2.0</url> + </license> + </licenses> + <mailingLists> + <mailingList> + <name>User</name> + <subscribe>user-subscr...@accumulo.apache.org</subscribe> + <unsubscribe>user-unsubscr...@accumulo.apache.org</unsubscribe> + <post>u...@accumulo.apache.org</post> + <archive>https://lists.apache.org/list.html?u...@accumulo.apache.org</archive> + </mailingList> + <mailingList> + <name>Dev</name> + <subscribe>dev-subscr...@accumulo.apache.org</subscribe> + <unsubscribe>dev-unsubscr...@accumulo.apache.org</unsubscribe> + <post>d...@accumulo.apache.org</post> + <archive>https://lists.apache.org/list.html?d...@accumulo.apache.org</archive> + </mailingList> + <mailingList> + <name>Commits</name> + <subscribe>commits-subscr...@accumulo.apache.org</subscribe> + <unsubscribe>commits-unsubscr...@accumulo.apache.org</unsubscribe> + <archive>https://lists.apache.org/list.html?commits@accumulo.apache.org</archive> + </mailingList> + <mailingList> + <name>Notifications</name> + <subscribe>notifications-subscr...@accumulo.apache.org</subscribe> + <unsubscribe>notifications-unsubscr...@accumulo.apache.org</unsubscribe> + <archive>https://lists.apache.org/list.html?notificati...@accumulo.apache.org</archive> + </mailingList> + </mailingLists> + <scm> + <connection>scm:git:https://gitbox.apache.org/repos/asf/accumulo-access.git</connection> + <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/accumulo-access.git</developerConnection> + <tag>HEAD</tag> + <url>https://gitbox.apache.org/repos/asf?p=accumulo-access.git</url> + </scm> + <issueManagement> + <system>GitHub Issues</system> + <url>https://github.com/apache/accumulo-access/issues</url> + </issueManagement> + <ciManagement> + <system>GitHub Actions</system> + <url>https://github.com/apache/accumulo-access/actions</url> + </ciManagement> <properties> <maven.compiler.release>11</maven.compiler.release> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> + <maven.javadoc.failOnWarnings>true</maven.javadoc.failOnWarnings> <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile> + <minimalJavaBuildVersion>17</minimalJavaBuildVersion> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <version.errorprone>2.20.0</version.errorprone> <version.jmh>1.36</version.jmh> @@ -82,7 +137,6 @@ <licenseSet> <header>src/build/license-header.txt</header> <excludes combine.children="append"> - <exclude>contrib/antlr4/src/test/resources/specification.abnf</exclude> <exclude>contrib/antlr4/src/main/antlr4/Abnf.g4</exclude> <exclude>**/DEPENDENCIES</exclude> <exclude>**/LICENSE</exclude> @@ -93,14 +147,9 @@ </licenseSets> <mapping combine.children="append"> <!-- general mappings; module-specific mappings appear in their respective pom --> - <Makefile>SCRIPT_STYLE</Makefile> - <c>SLASHSTAR_STYLE</c> - <cc>SLASHSTAR_STYLE</cc> - <css>SLASHSTAR_STYLE</css> + <abnf>SEMICOLON_STYLE</abnf> <g4>SLASHSTAR_STYLE</g4> - <h>SLASHSTAR_STYLE</h> <java>SLASHSTAR_STYLE</java> - <thrift>SLASHSTAR_STYLE</thrift> </mapping> </configuration> </plugin> @@ -190,6 +239,14 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.gaul</groupId> + <artifactId>modernizer-maven-plugin</artifactId> + <version>2.7.0</version> + <configuration> + <javaVersion>${maven.compiler.target}</javaVersion> + </configuration> + </plugin> <plugin> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs-maven-plugin</artifactId> @@ -219,6 +276,216 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <configuration> + <checkstyleRules> + <module name="Checker"> + <property name="charset" value="UTF-8" /> + <property name="severity" value="warning" /> + <!-- Checks for whitespace --> + <!-- See https://checkstyle.sourceforge.io/config_whitespace.html --> + <module name="FileTabCharacter" /> + <module name="TreeWalker"> + <module name="OneTopLevelClass" /> + <module name="RegexpSinglelineJava"> + <property name="format" value="\s+$" /> + <property name="message" value="Line has trailing whitespace." /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="[@]Deprecated([^)]*forRemoval[^)]*)" /> + <property name="message" value="forRemoval should not be used." /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="[@]see\s+[{][@]link" /> + <property name="message" value="Javadoc @see does not need @link: pick one or the other." /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="jline[.]internal[.]Preconditions" /> + <property name="message" value="Please use Guava Preconditions not JLine" /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="org[.]apache[.]commons[.]math[.]" /> + <property name="message" value="Use commons-math3 (org.apache.commons.math3.*)" /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="import org[.]apache[.]accumulo[.]core[.]util[.]LazySingletons;" /> + <property name="message" value="Use static imports for LazySingletons for consistency" /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="org[.]junit[.]jupiter[.]api[.]Assertions;" /> + <property name="message" value="Use static imports for Assertions.* methods for consistency" /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="org[.]junit[.]jupiter[.]api[.]Assumptions;" /> + <property name="message" value="Use static imports for Assumptions.* methods for consistency" /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="import java[.]nio[.]charset[.]StandardCharsets;" /> + <property name="message" value="Use static imports for StandardCharsets.* constants for consistency" /> + </module> + <module name="RegexpSinglelineJava"> + <!-- double escape quotes because checkstyle passes these through another xml parser --> + <property name="format" value="&quot; [+] &quot;" /> + <property name="message" value="Unnecessary concatenation of string literals" /> + </module> + <module name="RegexpSinglelineJava"> + <property name="format" value="com[.]google[.]common[.]cache[.]" /> + <property name="message" value="Please use Caffeine Cache, not Guava" /> + </module> + <module name="OuterTypeFilename" /> + <module name="AvoidStarImport" /> + <module name="NoLineWrap" /> + <module name="LeftCurly" /> + <module name="RightCurly"> + <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT" /> + </module> + <module name="SeparatorWrap"> + <property name="tokens" value="DOT" /> + <property name="option" value="nl" /> + </module> + <module name="SeparatorWrap"> + <property name="tokens" value="COMMA" /> + <property name="option" value="EOL" /> + </module> + <module name="PackageName"> + <property name="format" value="^[a-z]+(\.[a-z][a-zA-Z0-9]*)*$" /> + </module> + <module name="MethodTypeParameterName"> + <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" /> + </module> + <module name="NonEmptyAtclauseDescription" /> + <module name="JavadocMethod"> + <property name="allowMissingParamTags" value="true" /> + <property name="allowMissingReturnTag" value="true" /> + <property name="allowedAnnotations" value="Override,Test,BeforeClass,AfterClass,Before,After,BeforeAll,AfterAll,BeforeEach,AfterEach" /> + </module> + <module name="MissingOverrideCheck" /> + <!--Require braces for all control statements --> + <module name="NeedBraces" /> + </module> + </module> + </checkstyleRules> + <violationSeverity>warning</violationSeverity> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <excludes>**/jmh_generated/</excludes> + </configuration> + <dependencies> + <dependency> + <groupId>com.puppycrawl.tools</groupId> + <artifactId>checkstyle</artifactId> + <version>10.12.6</version> + </dependency> + </dependencies> + <executions> + <execution> + <id>check-style</id> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> + <compilerArgs> + <arg>-Xlint:all</arg> + <arg>-Xlint:-processing</arg> + <!-- suppress try to ignore unused variable in try-with-resources --> + <arg>-Xlint:-try</arg> + <arg>-Xmaxwarns</arg> + <arg>5</arg> + </compilerArgs> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestEntries> + <Automatic-Module-Name>${accumulo.module.name}</Automatic-Module-Name> + <Implementation-Build>${mvngit.commit.id}</Implementation-Build> + <Sealed>true</Sealed> + </manifestEntries> + </archive> + <excludes> + <exclude>**/log4j2-test.properties</exclude> + </excludes> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <quiet>true</quiet> + <additionalJOption>-J-Xmx512m</additionalJOption> + <doclint>all,-missing</doclint> + <legacyMode>true</legacyMode> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-release-plugin</artifactId> + <configuration> + <arguments>-P !autoformat,verifyformat -DskipTests</arguments> + <autoVersionSubmodules>true</autoVersionSubmodules> + <goals>clean deploy</goals> + <preparationGoals>clean package</preparationGoals> + <tagNameFormat>rel/@{project.version}</tagNameFormat> + <releaseProfiles>apache-release,accumulo-release</releaseProfiles> + <useReleaseProfile>false</useReleaseProfile> + <pushChanges>false</pushChanges> + <localCheckout>true</localCheckout> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes combine.children="append"> + <exclude>contrib/antlr4/src/main/antlr4/Abnf.g4</exclude> + <exclude>src/test/resources/testdata.json</exclude> + <exclude>**/target/</exclude> + <exclude>**/.project</exclude> + <exclude>**/.classpath</exclude> + <exclude>**/.settings/</exclude> + </excludes> + </configuration> + <executions> + <execution> + <id>check-licenses</id> + <goals> + <goal>check</goal> + </goals> + <phase>prepare-package</phase> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>3.5.0</version> + <executions> + <execution> + <id>create-automatic-module-name</id> + <goals> + <goal>regex-property</goal> + </goals> + <configuration> + <name>accumulo.module.name</name> + <regex>-</regex> + <replacement>.</replacement> + <value>org-apache-${project.artifactId}</value> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> <profiles> @@ -398,6 +665,10 @@ compile time. Auto-generated code is not checked. See: https://errorprone.info/bugpatterns for list of available bug patterns.--> <id>errorprone</id> + <properties> + <!-- forking is required for -J options to take effect --> + <maven.compiler.fork>true</maven.compiler.fork> + </properties> <build> <plugins> <plugin> diff --git a/src/main/java/org/apache/accumulo/access/AccessEvaluator.java b/src/main/java/org/apache/accumulo/access/AccessEvaluator.java index c0123ed..cc8cf68 100644 --- a/src/main/java/org/apache/accumulo/access/AccessEvaluator.java +++ b/src/main/java/org/apache/accumulo/access/AccessEvaluator.java @@ -24,7 +24,7 @@ import java.util.Collection; * <p> * Used to decide if an entity with one more sets of authorizations can access zero or more access * expression. - * <p> + * </p> * <p> * Note: For performance improvements, especially in cases where expressions are expected to repeat, * it's recommended to wrap this evaluator with an external caching mechanism, such as Guava's diff --git a/src/test/java/org/apache/accumulo/access/AccessExpressionBenchmark.java b/src/test/java/org/apache/accumulo/access/AccessExpressionBenchmark.java index 330256f..b04b789 100644 --- a/src/test/java/org/apache/accumulo/access/AccessExpressionBenchmark.java +++ b/src/test/java/org/apache/accumulo/access/AccessExpressionBenchmark.java @@ -50,8 +50,9 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; * <pre> * mvn clean package * mvn exec:exec -Dexec.executable="java" -Dexec.classpathScope=test -Dexec.args="-classpath %classpath org.apache.accumulo.access.AccessExpressionBenchmark" - * </code></blockquote> * </pre> + * + * </blockquote> */ public class AccessExpressionBenchmark {