Skip to content
Draft
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
512 changes: 512 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions .github/workflows/maven.yml → .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
name: Java CI with Maven
name: Java CI with Gradle

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: write

jobs:
build:
name: Java ${{ matrix.java_version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java_version: ['8', '11', '17']

java_version: [ '17' ]
# java_version: ['8', '11', '17']
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Run a build
run: ./gradlew clean build --info
33 changes: 33 additions & 0 deletions .github/workflows/publish-to-github-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish package to GitHub Packages
on:
release:
types: [ created ]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3
- name: Publish package
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
.classpath
.settings
.project
.gradle
workspace.xml
bin
target
build/
src/main/java/org/natty/generated/*
src/main/java/*.tokens
src/main/antlr3/org/natty/generated/DebugDateParser.g
src/main/antlr3/org/natty/generated/DebugDateWalker.g
src/main/antlr/org/natty/generated/DebugDateParser.g
src/main/antlr/org/natty/generated/DebugDateWalker.g

# IntelliJ Idea
*.iml
Expand Down
42 changes: 30 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,70 @@
## What

Natty is a natural language date parser written in Java. Given a date
Natty is a natural language date parser written in Java. Given a date
expression, natty will apply standard language recognition and translation
techniques to produce a list of corresponding dates with optional parse and
syntax information.

## History

Originally written by Joel Stelmach at https://github.com/joestelmach/natty and developed between 2010 and 2017. Abandoned since then.
Originally written by Joel Stelmach at https://github.com/joestelmach/natty and developed between 2010 and 2017.
Abandoned since then.

## Usage

Maven:

```
<dependency>
<groupId>io.github.natty-parser</groupId>
<artifactId>natty</artifactId>
<version>1.0.1</version>
<version>1.0.3</version>
</dependency>
```

or [consult maven.org](https://search.maven.org/artifact/io.github.natty-parser/natty) for other build systems.

## Idea behind the fork

Started with [a thread in the original project](https://github.com/joestelmach/natty/issues/274). The aim is to try providing maintenance for the library.
Started with [a thread in the original project](https://github.com/joestelmach/natty/issues/274). The aim is to try
providing maintenance for the library.

Plan / Priorities (as of November 2022):

1. ~~Release version `1.0.0` with (possibly) the same code as the fork root, but under new name, consider renaming packages and artifacts to use `natty-parser` as the moniker, etc.~~
DONE
1. ~~Release version `1.0.0` with (possibly) the same code as the fork root, but under new name, consider renaming
packages and artifacts to use `natty-parser` as the moniker, etc.~~
DONE
2. ~~Fix the tests (some are failing?).~~ DONE
3. ~~Set up basic technicalities of the fork - Maven release process, CI (Continuous Integration), etc.~~ DONE
4. Start accepting contributions (PRs), encourage the community to solve [issues reported in the original repo](https://github.com/joestelmach/natty/issues)
4. Start accepting contributions (PRs), encourage the community to
solve [issues reported in the original repo](https://github.com/joestelmach/natty/issues)
5. Consider switching to Gradle (as this is a build tool which is modern and I am familiar with)
6. Decide on the overall vision of the project - at this point it's hard to tell, but I think a conscious decision on what is gonna be supported would be
great - i.e. focus on i18n, customization, stability, or what?
6. Decide on the overall vision of the project - at this point it's hard to tell, but I think a conscious decision on
what is gonna be supported would be
great - i.e. focus on i18n, customization, stability, or what?

## Known issues from the parent project

See [issues](issues.md)

## Commitment

I hope for open collaboration and contributions from others. To me it's totally a side-project, not the core activity. Yet, I can commit to being (fairly) responsive and inclusive.
I hope for open collaboration and contributions from others. To me it's totally a side-project, not the core activity.
Yet, I can commit to being (fairly) responsive and inclusive.

## Contibutions

Are more then welcome. Feel free to reach out (e.g. by creating an issue in this repo) to offer your support and ideas. I am happy to include more
Are more than welcome. Feel free to reach out (e.g. by creating an issue in this repo) to offer your support and ideas.
I am happy to include more
maintainers. Tag @mccartney if no response for 2-3 days (I might have missed that).

I see this project potentially being welcoming to many, incl. quite junior and inexperienced developers, who would like to learn and contribute.
I see this project potentially being welcoming to many, incl. quite junior and inexperienced developers, who would like
to learn and contribute.

## Build

Builds are done using the gradle wrapper. All that's need is a JDK (8 or upwards) to be installed on the machine.

```shell
./gradlew build
```
87 changes: 87 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'antlr'

alias(libs.plugins.nebula.release)
alias(libs.plugins.lombok)
}

repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}

dependencies {
api(
libs.antlr.runtime,
libs.ical4j,
libs.slf4j.api
)

antlr libs.antlr

testImplementation(
// libs.slf4j.log4j12, // required for Level
libs.junit,
libs.junit.jupiter.api,
libs.junit.jupiter.params,
libs.antlr.gunit,
libs.assertj.core
)
testRuntimeOnly(
// libs.slf4j.simple,
libs.log4j2,
libs.junit.jupiter.engine,
libs.junit.vintage.engine,
libs.junit.platform.engine,
//libs.logback.classic
)


}

description = 'Natty Date Parser'

generateGrammarSource {

arguments += ["-visitor",
"-listener",
"-long-messages",
"-lib", "src/main/antlr/org/natty/generated/imports"
]
outputDirectory = file("${project.buildDir}/generated-src/antlr/")
source "src/main/antlr"
include "org/natty/generated/DateLexer.g"
include "org/natty/generated/DateParser.g"

}

publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}

test {
useJUnitPlatform()
testLogging {
showStandardStreams = true
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}

tasks.withType(Javadoc).configureEach {
options.encoding = 'UTF-8'
}

tasks.compileJava {
dependsOn tasks.generateGrammarSource
}
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
group=io.github.natty-parser

# nebula release settings
release.scope=patch
release.stage=SNAPSHOT
44 changes: 44 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format

[versions]
logback-classic = "1.3.14"
log4j2 = "2.24.3"
junit = "4.13.2"
antlr = "3.5.3"
ical4j = "3.2.14"
slf4j = "2.0.17"
junit-jupiter = "5.13.0"
junit-platform = "1.13.0"
assertj = "3.27.3"

nebula-release = "19.0.10"
lombok = "8.13.1"

[libraries]
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback-classic" }
log4j2 = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version.ref = "log4j2" }

junit = { module = "junit:junit", version.ref = "junit" }
antlr-runtime = { module = "org.antlr:antlr-runtime", version.ref = "antlr" }
antlr = { module = "org.antlr:antlr", version.ref = "antlr" }
antlr-gunit = { module = "org.antlr:gunit", version.ref = "antlr" }
ical4j = { module = "org.mnode.ical4j:ical4j", version.ref = "ical4j" }
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
slf4j-log4j12 = { module = "org.slf4j:slf4j-log4j12", version.ref = "slf4j" }
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit-jupiter" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-jupiter" }

junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit-jupiter" }
junit-vintage-engine = { module = "org.junit.vintage:junit-vintage-engine", version.ref = "junit-jupiter" }
# ... existing libraries ...
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
junit-platform-engine = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }



[plugins]
nebula-release = { id = "nebula.release", version.ref = "nebula-release" }
lombok = { id = "io.freefair.lombok", version.ref = "lombok" }
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.14.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading