Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
concurrency:
group: deploy-github-${{ github.ref }}
cancel-in-progress: true
permissions:
permissions:
contents: read
packages: write

Expand All @@ -20,20 +20,22 @@ jobs:
uses: bernardo-mg/maven-github-deployment-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
jdk: 17

ossrh:
name: OSSRH deployment
central:
name: Central deployment
runs-on: ubuntu-latest
environment: deployment_ossrh
environment: deployment_central
concurrency:
group: deploy-ossrh-${{ github.ref }}
group: deploy-central-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Deploy
uses: bernardo-mg/maven-signed-deployment-action@v1
with:
username: ${{ secrets.OSSRH_USERNAME }}
password: ${{ secrets.OSSRH_TOKEN }}
username: ${{ secrets.CENTRAL_USERNAME }}
password: ${{ secrets.CENTRAL_TOKEN }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
jdk: 17
44 changes: 0 additions & 44 deletions .github/workflows/doc_deployment.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
jdk: [11, 17, 20]
jdk: [17, 21, 24]

steps:
- name: Check-out
Expand Down
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ local.properties
/src/main/resources/rebel.xml
.springBeans

# IntelliJ Idea files #
.idea
*.iml

# Visual Studio #
.vscode/
.factorypath

# Docker
.env

# Windows files #
Thumbs.db
Desktop.ini
Expand All @@ -54,4 +65,3 @@ Desktop.ini
._*
.Spotlight-V100
.Trashes
/target/
79 changes: 22 additions & 57 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>com.bernardomg.maven</groupId>
<artifactId>base-pom</artifactId>
<version>1.5.6</version>
<version>1.5.11</version>
</parent>

<!-- ********************************************** -->
Expand Down Expand Up @@ -67,23 +67,6 @@
<!-- ============================================== -->
<!-- ============ DEPLOYMENT PROFILES ============= -->
<!-- ============================================== -->
<profile>
<!-- Site deployment profile -->
<!-- Sets the site repository to point to the releases repo -->
<id>deployment-site</id>
<activation>
<!-- Active by default so the repository appears in the reports -->
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<site>
<id>site</id>
<name>Project Documentation Site</name>
<!-- The URL should be set externally -->
<url>${site.url}</url>
</site>
</distributionManagement>
</profile>
<profile>
<!-- Github deployment profile. -->
<id>deployment-github</id>
Expand All @@ -92,31 +75,17 @@
<!-- Github repository -->
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/Bernardo-MG/dice-notation-java</url>
<url>https://maven.pkg.github.com/bernardo-mg/java-validation</url>
</repository>
</distributionManagement>
</profile>
<profile>
<!-- OSSRH deployment profile. -->
<id>deployment-ossrh</id>
<distributionManagement>
<repository>
<!-- OSSRH repository -->
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<!-- OSSRH snapshots repository -->
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<!-- Central deployment profile. -->
<id>deployment-central</id>
<build>
<plugins>
<plugin>
<!-- GPG -->
<!-- Signs the artifacts -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
Expand All @@ -136,6 +105,17 @@
</gpgArguments>
</configuration>
</plugin>
<plugin>
<!-- Maven Central publishing -->
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -176,23 +156,18 @@
<!-- ============================================== -->
<maven.version>3.8</maven.version>
<!-- ============================================== -->
<!-- ================ JAVA VERSION ================ -->
<!-- ============================================== -->
<java.version>11</java.version>
<!-- ============================================== -->
<!-- =============== MANIFEST DATA ================ -->
<!-- ============================================== -->
<manifest.name>com/bernardomg/tabletop/dice</manifest.name>
<!-- ============================================== -->
<!-- =========== DEPENDENCIES VERSIONS ============ -->
<!-- ============================================== -->
<antlr.version>4.13.1</antlr.version>
<assertj.version>3.25.1</assertj.version>
<junit.jupiter.version>5.10.1</junit.jupiter.version>
<lombok.version>1.18.30</lombok.version>
<mockito.version>5.8.0</mockito.version>
<log4j.version>2.20.0</log4j.version>
<slf4j.version>2.0.9</slf4j.version>
<antlr.version>4.13.2</antlr.version>
<assertj.version>3.27.3</assertj.version>
<junit.jupiter.version>5.13.3</junit.jupiter.version>
<mockito.version>5.18.0</mockito.version>
<log4j.version>2.25.0</log4j.version>
<slf4j.version>2.0.17</slf4j.version>
<!-- ============================================== -->
<!-- ============== PLUGINS VERSIONS ============== -->
<!-- ============================================== -->
Expand All @@ -210,7 +185,7 @@
<!-- ============================================== -->
<!-- ================= MAVEN SITE ================= -->
<!-- ============================================== -->
<site.skin.version>2.3.2</site.skin.version>
<site.skin.version>2.4.1</site.skin.version>
<mavenURL>http://mvnrepository.com/artifact/com.bernardomg.tabletop/dice</mavenURL>
<githubArtifactURL><![CDATA[https://github.com/Bernardo-MG?tab=packages&amp;repo_name=dice-notation-java]]></githubArtifactURL>
</properties>
Expand Down Expand Up @@ -240,16 +215,6 @@
<version>${antlr.version}</version>
</dependency>
<!-- ============================================== -->
<!-- ================== LOMBOK ==================== -->
<!-- ============================================== -->
<dependency>
<!-- Lombok -->
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- ============================================== -->
<!-- ================== LOGGERS =================== -->
<!-- ============================================== -->
<dependency>
Expand Down
22 changes: 1 addition & 21 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ Its usefulness is very clear, it allows working with specific random values dist

[![Maven Central](https://img.shields.io/maven-central/v/com.bernardomg.tabletop/dice.svg)][maven-repo]

[![Release docs](https://img.shields.io/badge/docs-release-blue.svg)][site-release]
[![Development docs](https://img.shields.io/badge/docs-develop-blue.svg)][site-develop]

[![Release javadocs](https://img.shields.io/badge/javadocs-release-blue.svg)][javadoc-release]
[![Development javadocs](https://img.shields.io/badge/javadocs-develop-blue.svg)][javadoc-develop]

## Features

- ANTLR4 grammar
Expand All @@ -39,16 +33,6 @@ The grammar is included among the [ANTLR4 sample grammars][antrl-grammars].

## Documentation

Documentation is always generated for the latest release, kept in the 'master' branch:

- The [latest release documentation page][site-release].
- The [the latest release Javadoc site][javadoc-release].

Documentation is also generated from the latest snapshot, taken from the 'develop' branch:

- The [the latest snapshot documentation page][site-develop].
- The [the latest snapshot Javadoc site][javadoc-develop].

The documentation site sources come along the source code (as it is a Maven site), so it is always possible to generate them using the following Maven command:

```
Expand Down Expand Up @@ -95,7 +79,7 @@ rolls = parser.parse("1d6+12", roller);
System.out.println(rolls.getTotalRoll());
```

For more examples and details check the [docs][site-release].
For more examples and details check the documentation.

## Collaborate

Expand All @@ -119,11 +103,7 @@ The project has been released under version 2.0 of the [Apache License][license]
[antrl-grammars]: https://github.com/antlr/grammars-v4
[maven-repo]: http://mvnrepository.com/artifact/com.bernardomg.tabletop/dice
[issues]: https://github.com/Bernardo-MG/dice-notation-java/issues
[javadoc-develop]: https://docs.bernardomg.com/development/maven/dice-notation-java/apidocs
[javadoc-release]: https://docs.bernardomg.com/maven/dice-notation-java/apidocs
[license]: http://www.apache.org/licenses/LICENSE-2.0
[scm]: http://github.com/Bernardo-MG/dice-notation-java
[site-develop]: https://docs.bernardomg.com/development/maven/dice-notation-java
[site-release]: https://docs.bernardomg.com/maven/dice-notation-java

[dice-notation-java-cli]: https://github.com/Bernardo-MG/dice-notation-java-cli
19 changes: 5 additions & 14 deletions src/config/pmd/pmd-rules.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<ruleset name="Default" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
<ruleset name="Default"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">

Expand All @@ -8,20 +9,10 @@
</description>

<rule ref="category/java/bestpractices.xml" />
<rule ref="category/java/codestyle.xml">
<exclude name="AvoidFinalLocalVariable" />
<exclude name="UnnecessaryConstructor" />
<exclude name="UnnecessaryModifier" />
<exclude name="UselessParentheses" />
</rule>
<rule ref="category/java/design.xml">
<exclude name="DataClass" />
<exclude name="LawOfDemeter" />
</rule>
<rule ref="category/java/codestyle.xml" />
<rule ref="category/java/design.xml" />
<rule ref="category/java/errorprone.xml" />
<rule ref="category/java/multithreading.xml">
<exclude name="UseConcurrentHashMap" />
</rule>
<rule ref="category/java/multithreading.xml" />
<rule ref="category/java/performance.xml" />

</ruleset>
33 changes: 15 additions & 18 deletions src/main/java/com/bernardomg/tabletop/dice/DefaultDice.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package com.bernardomg.tabletop.dice;

import lombok.Data;
import lombok.NonNull;
import java.util.Objects;

/**
* Immutable group of dice.
Expand All @@ -27,23 +26,21 @@
*
* @author Bernardo Mart&iacute;nez Garrido
*/
@Data
public final class DefaultDice implements Dice {
public final record DefaultDice(Integer quantity, Integer sides) implements Dice {

/**
* Number of dice.
* <p>
* This is greater or equal to zero.
*/
@NonNull
private final Integer quantity;
public DefaultDice(final Integer quantity, final Integer sides) {
this.quantity = Objects.requireNonNull(quantity, "Received a null pointer as quantity");
this.sides = Objects.requireNonNull(sides, "Received a null pointer as sides");
}

/**
* Number of sides in each die.
* <p>
* This is greater than zero.
*/
@NonNull
private final Integer sides;
@Override
public final Integer getQuantity() {
return quantity;
}

@Override
public final Integer getSides() {
return sides;
}

}
Loading