Skip to content

Commit

Permalink
Merge pull request #106 from Bernardo-MG/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Bernardo-MG authored Dec 20, 2021
2 parents cf03a92 + b0a9bf4 commit 583a708
Show file tree
Hide file tree
Showing 126 changed files with 424 additions and 546 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jobs:
DEPLOY_DOCS_DEVELOP_PASSWORD: ${{ secrets.DEPLOY_DOCS_DEVELOP_PASSWORD }}
DEPLOY_DOCS_SITE: ${{ secrets.DEPLOY_DOCS_SITE }}
DEPLOY_DOCS_DEVELOP_SITE: ${{ secrets.DEPLOY_DOCS_DEVELOP_SITE }}
- name: Dependency cache
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Deploy development docs
if: steps.extract_branch.outputs.branch == 'develop'
run: mvn verify site site:deploy -B -P deployment,deployment-development --settings settings.xml
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deploy_github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
java-version: 11
distribution: 'adopt'
server-id: github
- name: Dependency cache
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Deploy
run: mvn deploy -B -P deployment,deployment-release,deployment-github
env:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deploy_ossrh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Dependency cache
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Deploy
run: mvn deploy -B -P deployment,deployment-release,deployment-ossrh
env:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
jdk: [ 11, 15 ]
jdk: [ 11, 16 ]

steps:
- name: Check-out
Expand All @@ -18,5 +18,10 @@ jobs:
with:
java-version: ${{ matrix.jdk }}
distribution: 'adopt'
- name: Dependency cache
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Run all tests
run: mvn clean verify
24 changes: 14 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.bernardomg.maven</groupId>
<artifactId>base-pom</artifactId>
<version>1.4.2</version>
<version>1.4.4</version>
</parent>

<!-- ********************************************** -->
Expand All @@ -20,7 +20,7 @@

<groupId>com.bernardomg.tabletop</groupId>
<artifactId>dice</artifactId>
<version>2.1.2</version>
<version>2.2.0</version>
<packaging>jar</packaging>

<name>Dice Notation Tools for Java</name>
Expand Down Expand Up @@ -258,10 +258,10 @@
<!-- =========== DEPENDENCIES VERSIONS ============ -->
<!-- ============================================== -->
<antlr.version>4.9.2</antlr.version>
<guava.version>30.1.1-jre</guava.version>
<junit.jupiter.version>5.7.2</junit.jupiter.version>
<mockito.version>3.11.0</mockito.version>
<log4j.version>2.14.1</log4j.version>
<lombok.version>1.18.22</lombok.version>
<mockito.version>4.2.0</mockito.version>
<log4j.version>2.17.0</log4j.version>
<slf4j.version>1.7.30</slf4j.version>
<!-- ============================================== -->
<!-- ============== PLUGINS VERSIONS ============== -->
Expand All @@ -272,7 +272,7 @@
<!-- ============================================== -->
<!-- ================= MAVEN SITE ================= -->
<!-- ============================================== -->
<site.skin.version>2.2.0</site.skin.version>
<site.skin.version>2.2.5</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 @@ -301,11 +301,15 @@
<artifactId>antlr4</artifactId>
<version>${antlr.version}</version>
</dependency>
<!-- ============================================== -->
<!-- ================== LOMBOK ==================== -->
<!-- ============================================== -->
<dependency>
<!-- Guava -->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<!-- Lombok -->
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- ============================================== -->
<!-- ================== LOGGERS =================== -->
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ JDK 8 or higher is required. All other dependencies are handled through Maven, a

### Installing

The recommended way to install the project is by setting it up as a dependency. To get the configuration information for this check the [Maven Central Repository][maven-repo].
The recommended way to install the project is by setting it up as a dependency. To get the configuration information for this check the [Maven Central Repository][maven-repo].

It is always possible installing it by using the usual Maven command:

Expand Down
11 changes: 11 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,16 @@
Updated CI deployment configuration.
</action>
</release>
<release version="2.2.0" date="2021-12-20" description="Updated dependencies used">
<action dev="bmg" type="remove">
Removed Guava.
</action>
<action dev="bmg" type="add">
Applied Lombok for data objects.
</action>
<action dev="bmg" type="update">
Updated dependencies.
</action>
</release>
</body>
</document>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2020 the original author or authors
* Copyright 2014-2021 the original author or authors
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2020 the original author or authors
* Copyright 2014-2021 the original author or authors
*
* Licensed 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
Expand Down
93 changes: 8 additions & 85 deletions src/main/java/com/bernardomg/tabletop/dice/DefaultDice.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2020 the original author or authors
* Copyright 2014-2021 the original author or authors
* <p>
* Licensed 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
Expand All @@ -16,10 +16,8 @@

package com.bernardomg.tabletop.dice;

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import lombok.Data;
import lombok.NonNull;

/**
* Immutable group of dice.
Expand All @@ -30,98 +28,23 @@
*
* @author Bernardo Mart&iacute;nez Garrido
*/
@Data
public final class DefaultDice implements Dice {

/**
* Number of dice.
* <p>
* This is greater or equal to zero.
*/
private final Integer diceQuantity;
@NonNull
private final Integer quantity;

/**
* Number of sides in each die.
* <p>
* This is greater than zero.
*/
private final Integer diceSides;

/**
* Constructs a dice group with the specified quantity and number sides.
* <p>
* The quantity can't be a negative value, and the number of sides should be
* greater than zero. Otherwise an exception will be thrown.
*
* @param quantity
* the number of dice
* @param sides
* the number sides each die has
*/
public DefaultDice(final Integer quantity, final Integer sides) {
super();

diceQuantity = checkNotNull(quantity,
"Received a null pointer as quantity");
diceSides = checkNotNull(sides, "Received a null pointer as sides");
}

@Override
public final boolean equals(final Object obj) {
if (this == obj) {
return true;
}

if (obj == null) {
return false;
}

if (getClass() != obj.getClass()) {
return false;
}

final DefaultDice other;

other = (DefaultDice) obj;

return Objects.equal(diceQuantity, other.diceQuantity)
&& Objects.equal(diceSides, other.diceSides);
}

/**
* Returns the number of dice which compose this group.
* <p>
* This is a positive value or zero.
*
* @return the number of dice being rolled
*/
@Override
public final Integer getQuantity() {
return diceQuantity;
}

/**
* Returns the number of sides of the dice in the group.
* <p>
* All the dice will have this same number of sides.
* <p>
* This is a positive value greater than zero.
*
* @return the dice's number of sides
*/
@Override
public final Integer getSides() {
return diceSides;
}

@Override
public final int hashCode() {
return Objects.hashCode(diceQuantity, diceSides);
}

@Override
public final String toString() {
return MoreObjects.toStringHelper(this).add("quantity", diceQuantity)
.add("sides", diceSides).toString();
}
@NonNull
private final Integer sides;

}
2 changes: 1 addition & 1 deletion src/main/java/com/bernardomg/tabletop/dice/Dice.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2020 the original author or authors
* Copyright 2014-2021 the original author or authors
* <p>
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014-2020 the original author or authors
* Copyright 2014-2021 the original author or authors
* <p>
* Licensed 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
Expand All @@ -16,7 +16,10 @@

package com.bernardomg.tabletop.dice.history;

import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;

import lombok.Data;
import lombok.NonNull;

/**
* Immutable roll history.
Expand All @@ -28,23 +31,27 @@
* @author Bernardo Mart&iacute;nez Garrido
*
*/
@Data
public final class DefaultRollHistory implements RollHistory {

/**
* The text representation of the roll history.
* <p>
* Used as the string representation of the history.
*/
@NonNull
private final String historyText;

/**
* The results of each expression.
*/
@NonNull
private final Iterable<RollResult> rollResults;

/**
* Sum of all the generated values.
*/
@NonNull
private final Integer totalRoll;

/**
Expand All @@ -59,28 +66,18 @@ public final class DefaultRollHistory implements RollHistory {
* @param total
* sum of all the values
*/
public DefaultRollHistory(final Iterable<RollResult> results,
final String text, final Integer total) {
public DefaultRollHistory(@NonNull final Iterable<RollResult> results,
@NonNull final String text, @NonNull final Integer total) {
super();

rollResults = checkNotNull(results,
rollResults = Objects.requireNonNull(results,
"Received a null pointer as roll results");
historyText = checkNotNull(text,
historyText = Objects.requireNonNull(text,
"Received a null pointer as history text");
totalRoll = checkNotNull(total,
totalRoll = Objects.requireNonNull(total,
"Received a null pointer as total roll");
}

@Override
public final Iterable<RollResult> getRollResults() {
return rollResults;
}

@Override
public final Integer getTotalRoll() {
return totalRoll;
}

@Override
public final String toString() {
return historyText;
Expand Down
Loading

0 comments on commit 583a708

Please sign in to comment.