Skip to content

Commit

Permalink
Merge pull request #1 from kloverde/release-2.0
Browse files Browse the repository at this point in the history
Release 2.0
  • Loading branch information
kloverde authored Apr 10, 2024
2 parents 2980c29 + 7e77457 commit 91dce49
Show file tree
Hide file tree
Showing 17 changed files with 1,017 additions and 750 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.gradle
.settings
.project
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# 2.0.0 (April 10, 2024)

* Retargeted at Java 17 + Gradle 8
* No more reliance on the external BuildScripts repository to build this project
* Migrated to JUnit 5
* Added Spotbugs code coverage to the build
* Uses of `java.util.Random` have been replaced by `ThreadLocalRandom`

BREAKING CHANGES:

```java
PaymentCardGenerator.generateByPrefix(int howManyOfEachPrefix, List<Integer> lengths, Set<Long> prefixes)
```
now uses a `Set<Integer>` for `lengths` rather than `List<Integer>`


# 1.0.1 (May 8, 2021)

There are no code changes in this release. The project has been updated to be compatible with the latest [BuildScripts](https://github.com/kloverde/BuildScripts) and Gradle 7.0.
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It generates random payment card numbers so that you don't have to use an actual
Card numbers are generated based on the criteria defined here:

* https://en.wikipedia.org/wiki/Luhn_algorithm
* https://en.wikipedia.org/wiki/Payment_card_number (as of December, 2016)
* https://en.wikipedia.org/wiki/Payment_card_number (as of April 2024)


## Features
Expand All @@ -20,11 +20,21 @@ Card numbers are generated based on the criteria defined here:
* Future-proof: generate numbers based on your own criteria, even if the library doesn't have knowledge of the latest card number formats


## Building
## Build Tasks

This project is known to build on Gradle 7.0.
This project is known to build on Gradle 8.4.

1. Get [BuildScripts](https://github.com/kloverde/BuildScripts)
2. Provide a value for `builtBy` in gradle.properties
3. Run `gradle build`
4. Optionally, you can publish locally using `gradle publishtomavenlocal`
| task | purpose |
|---------------------|----------------------------------------------|
| build | Builds the project |
| check | Runs the tests and code quality checks |
| clean | Removes the `build` directory |
| jars | Builds the source, javadoc and binary jars |
| publishToMavenLocal | Published the jars to your local Maven cache |


## Donations

https://paypal.me/KurtisLoVerde/5

Thank you for your support!
82 changes: 80 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,84 @@
apply from: buildScriptsDir + "/build_java_lib.gradle"
buildscript {
repositories {
mavenCentral()
}
}

plugins {
id("java")
id("com.github.spotbugs") version "6.0.10"
id("maven-publish")
}

sourceCompatibility = javaSourceCompatibility
targetCompatibility = javaTargetCompatibility

repositories {
mavenCentral()
}

dependencies {
testImplementation "junit:junit:4.12"
implementation "com.github.spotbugs:spotbugs-annotations:4.8.4"

testImplementation platform("org.junit:junit-bom:5.10.2")
testImplementation "org.junit.jupiter:junit-jupiter"
testImplementation "org.mockito:mockito-junit-jupiter:5.11.0"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}

def includeManifest = {
manifest {
attributes "Specification-Title": rootProject.name,
"Implementation-Version": version,
"Built-Date": new Date(),
"Built-JDK": System.getProperty("java.version"),
"Target-JDK": targetCompatibility,
"Built-Gradle": gradle.gradleVersion
}
}

java {
withSourcesJar()
withJavadocJar()
}

tasks.spotbugsMain {
reports.create("html") {
required = true
outputLocation = file("${project.layout.buildDirectory.get()}/reports/spotbugs.html")
setStylesheet("fancy-hist.xsl")
}
}

jar {
configure includeManifest
}

sourcesJar {
configure includeManifest
}

javadocJar {
configure includeManifest
}

tasks.register("jars") {
dependsOn(
tasks.jar,
tasks.sourcesJar,
tasks.javadocJar
)
}

javadoc.options.addStringOption("Xdoclint:none", "-quiet")

publishing {
publications {
mavenJava(MavenPublication) {
from project.components.java
artifacts = [ jar, javadocJar, sourcesJar ]
}
}
}

compileJava.dependsOn clean
9 changes: 3 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
buildScriptsDir=../BuildScripts

javaSourceCompatibility=1.8
javaTargetCompatibility=1.8
javaSourceCompatibility=1.17
javaTargetCompatibility=1.17

group=org.loverde
version=1.0.1
builtBy=
version=2.0.0
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 91dce49

Please sign in to comment.