Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/antlr #106

Merged
merged 3 commits into from
Sep 20, 2023
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
58 changes: 57 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,58 @@
* text=auto
# .gitattributes snippet to force users to use same line endings for project.
#
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

#
# The above will handle all files NOT found below
# https://help.github.com/articles/dealing-with-line-endings/
# https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes



# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.css text
*.js text
*.scala text
*.java text
*.kt text
*.kts text
*.gradle text
*.sh text
*.xml text
*.md text
*.json text
*.htm text
*.html text
*.xml text
*.txt text
*.ini text
*.inc text
*.pl text
*.rb text
*.py text
*.scm text
*.sql text
.htaccess text
*.sh text

# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.pyc binary
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*.hprof
hs*.log

archived/

docsold/

#Maven exclusions
Expand Down Expand Up @@ -210,4 +212,5 @@ local.properties

.quarkus/
/subprojects/common/ddo-modeling/src/main/avro/
/subprojects/common/ddo-core/src/generated/java/io/truthencode/ddo/core/GeneratedVersion.java
/subprojects/common/ddo-core/src/generated/java/io/truthencode/ddo/core/GeneratedVersion.java
fixle.sh
4 changes: 4 additions & 0 deletions .trunk/configs/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Following source doesn't work in most setups
ignored:
- SC1090
- SC1091
8 changes: 5 additions & 3 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ plugins:
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- hadolint@2.12.0
- terrascan@1.18.3
- checkov@2.4.9
- osv-scanner@1.3.6
- osv-scanner@1.4.0
- trivy@0.45.0
- trufflehog@3.54.4
- trufflehog@3.56.0
- taplo@0.8.1
- actionlint@1.6.25
- dotenv-linter@3.3.0
Expand All @@ -22,7 +24,7 @@ lint:
- markdownlint@0.36.0
- oxipng@8.0.0
- prettier@3.0.3
- renovate@36.91.0
- renovate@36.93.7
- scalafmt@3.7.14
- shellcheck@0.9.0
- shfmt@3.6.0
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.1.0-alpha] - 2015-12-03

<!-- trunk-ignore(markdownlint/MD024) -->

### Added

[Unreleased]: https://github.com/truthencode/ddo-calc/0.1.0-alpha...HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This Kotlin source file was generated by the Gradle "init" task.
*/
package io.truthencode.poc.kantlr.app

import org.antlr.v4.runtime.CharStreams
import org.antlr.v4.runtime.CommonTokenStream
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

class ParserTest {
@Test
fun testGetMessage() {
val ar = "(init { (value 4) , (value 5) , (value 323) })"
val input = CharStreams.fromString("{4,5,323}", "lary")
val lexer = io.truthencode.poc.kantlr.app.ArrayInitLexer(input)
val tokens = CommonTokenStream(lexer)
val parser = io.truthencode.poc.kantlr.app.ArrayInitParser(tokens)

val tree = parser.init()

assertEquals(ar, tree.toStringTree(parser))
}

@Test
fun testRefEnchantmentParser() {
val p: io.truthencode.ddo.grammar.antlr.EnchantmentsParser
}
}
93 changes: 93 additions & 0 deletions archived/poc-reactive/src/main/docker/Dockerfile.legacy-jar
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the container image run:
#
# ./gradlew build -Dquarkus.package.type=legacy-jar
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/poc-reactive-legacy-jar .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/poc-reactive-legacy-jar
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005
# when running the container
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 quarkus/poc-reactive-legacy-jar
#
# This image uses the `run-java.sh` script to run the application.
# This scripts computes the command line to execute your Java application, and
# includes memory/GC tuning.
# You can configure the behavior using the following environment properties:
# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class")
# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options
# in JAVA_OPTS (example: "-Dsome.property=foo")
# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is
# used to calculate a default maximal heap memory based on a containers restriction.
# If used in a container without any memory constraints for the container then this
# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio
# of the container available memory as set here. The default is `50` which means 50%
# of the available memory is used as an upper boundary. You can skip this mechanism by
# setting this value to `0` in which case no `-Xmx` option is added.
# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This
# is used to calculate a default initial heap memory based on the maximum heap memory.
# If used in a container without any memory constraints for the container then this
# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio
# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx`
# is used as the initial heap size. You can skip this mechanism by setting this value
# to `0` in which case no `-Xms` option is added (example: "25")
# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS.
# This is used to calculate the maximum value of the initial heap memory. If used in
# a container without any memory constraints for the container then this option has
# no effect. If there is a memory constraint then `-Xms` is limited to the value set
# here. The default is 4096MB which means the calculated value of `-Xms` never will
# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096")
# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output
# when things are happening. This option, if set to true, will set
# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true").
# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example:
# true").
# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787").
# - CONTAINER_CORE_LIMIT: A calculated core limit as described in
# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2")
# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024").
# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion.
# (example: "20")
# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking.
# (example: "40")
# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection.
# (example: "4")
# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus
# previous GC times. (example: "90")
# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20")
# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100")
# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should
# contain the necessary JRE command-line options to specify the required GC, which
# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC).
# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080")
# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080")
# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-17:1.16

ENV LANGUAGE='en_US:en'


COPY build/lib/* /deployments/lib/
COPY build/*-runner.jar /deployments/quarkus-run.jar

EXPOSE 8080
USER 185
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"

ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]
4 changes: 1 addition & 3 deletions archived/toad-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

## Overview

```
DDO Calculations, Planner and Plotting
```
### DDO Calculations, Planner and Plotting

This is a macro service that I am creating to become more familiar with alternative JVM languages and multiple platforms.

Expand Down
5 changes: 4 additions & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ val defaultJavaToolChainVersion: String? by project
val kasechangeVersion: String by project

dependencies {
// enable gradle catalog for included convention plugins
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
// tool languages
// node
implementation("com.github.node-gradle:gradle-node-plugin:7.0.0")
Expand Down Expand Up @@ -70,7 +72,8 @@ dependencies {
// implementation("com.strumenta.antlr-kotlin:antlr-kotlin-gradle-plugin:70d79b7eb1")

// quarkus related
implementation("io.quarkus:gradle-application-plugin:$quarkusPlatformVersion")
// quarkus incompatible with avrohugger (old scala 12.1) used by ddo-modeling. Need to separate build.
// implementation("io.quarkus:gradle-application-plugin:$quarkusPlatformVersion")
implementation("org.kordamp.gradle:jandex-gradle-plugin:$jandexPluginVersion")

// Database
Expand Down
4 changes: 2 additions & 2 deletions build-logic/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ scalaVersions=2.12.18,2.11.12,2.13.12

# Quarkus
quarkusPluginId=io.quarkus
quarkusPluginVersion=3.2.0.Final
quarkusPluginVersion=3.3.3.Final
quarkusPlatformGroupId=io.quarkus.platform
quarkusPlatformArtifactId=qu
quarkusPlatformVersion=2.7.0.Final
quarkusPlatformVersion=3.3.3
jandexPluginVersion=0.11.0

testSetsPluginVersion=2.1.1
Expand Down
57 changes: 56 additions & 1 deletion build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// build-logic
pluginManagement {
repositories {
mavenCentral()
Expand All @@ -29,6 +29,7 @@ pluginManagement {

val foojayResolverPluginVersionversion: String by settings
val palantirPluginVersion: String by settings
val quarkusPlatformVersion: String by settings

plugins {
// id("org.kordamp.gradle.project") version kordampGradlePluginVersion
Expand All @@ -40,6 +41,7 @@ pluginManagement {
id("com.palantir.baseline-config") version palantirPluginVersion
id("org.inferred.processors") version "3.7.0"
id("org.scoverage") version "8.0.3"
id("io.quarkus") version quarkusPlatformVersion
// id("ru.vyarus.mkdocs") version "3.0.0"
}
}
Expand All @@ -49,6 +51,59 @@ plugins {
id("org.gradle.toolchains.foojay-resolver-convention")
}

/* Hackathon to use catalogs in convention plugin
Tracked in [github.com/gradle/gradle/issues/17863]
SO [stackoverflow.com/questions/69080927/gradle-7-2-gradle-kotlin-dsl-how-to-use-catalogs-in-convention-plugin]
Add custom code in included-builds build.gradle(.kts)
Add custom code in convention plugins settings.gradle(.kts)

``` kotlin
./build-src/build.gradle.kts
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

println("from build-src build script: ${libs.versions.bb.get()}")

dependencies {
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}

// ./build-src/settings.gradle.kts
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

// ./build-src/src/main/kotlin/foo.gradle.kts
import org.gradle.accessors.dm.LibrariesForLibs

val libs = the<LibrariesForLibs>()
println("from pre compiled script plugin: ${libs.versions.bb.get()}")

// ./build.gradle.kts
plugins {
id("foo")
}

println("from main build script: ${libs.versions.bb.get()}")

// ./gradle/libs.versions.toml
[versions]
bb = "3.2.1"

// ./settings.gradle.kts
rootProject.name = "showcase"
includeBuild("build-src")

*/
dependencyResolutionManagement {
versionCatalogs {
// declares an additional catalog, named 'testLibs', from the 'test-libs.versions.toml' file
Expand Down
Loading