From 29ac44558a438f2bd1dae0d762dd97e0b3f64b5b Mon Sep 17 00:00:00 2001 From: Mark Raynsford Date: Sat, 4 May 2024 11:53:02 +0000 Subject: [PATCH] Eliminate jstructural Affects: https://github.com/io7m-com/.github/issues/2 --- README.in | 50 +++++ README.md | 70 +++++- com.io7m.jobj.core/pom.xml | 11 + .../java/com/io7m/jobj/core/package-info.java | 4 + .../src/main/java/module-info.java | 3 + com.io7m.jobj.documentation/pom.xml | 204 ------------------ .../src/main/assembly/documentation.xml | 20 -- .../jobj/documentation/Documentation.java | 30 --- .../io7m/jobj/documentation/package-info.java | 22 -- .../src/main/java/module-info.java | 26 --- .../com/io7m/jobj/documentation/brand.xml | 9 - .../io7m/jobj/documentation/documentation.css | 73 ------- .../io7m/jobj/documentation/documentation.xml | 142 ------------ pom.xml | 16 +- .../site/resources}/obj.txt | 0 15 files changed, 144 insertions(+), 536 deletions(-) create mode 100644 README.in delete mode 100644 com.io7m.jobj.documentation/pom.xml delete mode 100644 com.io7m.jobj.documentation/src/main/assembly/documentation.xml delete mode 100644 com.io7m.jobj.documentation/src/main/java/com/io7m/jobj/documentation/Documentation.java delete mode 100644 com.io7m.jobj.documentation/src/main/java/com/io7m/jobj/documentation/package-info.java delete mode 100644 com.io7m.jobj.documentation/src/main/java/module-info.java delete mode 100644 com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/brand.xml delete mode 100644 com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/documentation.css delete mode 100644 com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/documentation.xml rename {com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation => src/site/resources}/obj.txt (100%) diff --git a/README.in b/README.in new file mode 100644 index 0000000..7e89363 --- /dev/null +++ b/README.in @@ -0,0 +1,50 @@ + +## jobj + +A parser for the useful subset of the Wavefront OBJ file format. + +## Features + +* Hand-written event-based recovering parser: Efficiently parse, accumulating + errors along the way, without being tied to any particular AST types. +* High coverage test suite. +* [OSGi-ready](https://www.osgi.org/) +* [JPMS-ready](https://en.wikipedia.org/wiki/Java_Platform_Module_System) +* ISC license. + +## Usage + +Provide an implementation of the `JOParserEventListenerType` interface +to a `JOParserType`: + +``` +Path file; +JOParserEventListenerType listener; +InputStream stream; + +final JOParserType p = + JOParser.newParserFromStream( + Optional.of(file), + stream, + listener + ); + +p.run(); +``` + +The `listener` will receive parse events encountered during parsing of the +file. + +## Coverage + +The only specification for the OBJ file format is an +[unofficial specification](src/site/resources/obj.txt) that appears to have +been handed around for decades. + +Most of the OBJ file format has no relevance to anything used in modern +computer graphics in 2024, but the format itself is often used as a +bare-minimum portable text format for distributing mesh data. This parser +attempts to capture the useful subset of data and makes no attempt to parse +the entirety of the OBJ format. It's practically guaranteed that the parser +will be missing the once piece of data you actually wanted to extract from the +`.obj` file you're parsing. Patches to increase format coverage are welcome. diff --git a/README.md b/README.md index 4772a80..172b453 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,66 @@ jobj === [![Maven Central](https://img.shields.io/maven-central/v/com.io7m.jobj/com.io7m.jobj.svg?style=flat-square)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.io7m.jobj%22) -[![Maven Central (snapshot)](https://img.shields.io/nexus/s/com.io7m.jobj/com.io7m.jobj?server=https%3A%2F%2Fs01.oss.sonatype.org&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/io7m/jobj/) -[![Codecov](https://img.shields.io/codecov/c/github/io7m-com/jobj.svg?style=flat-square)](https://codecov.io/gh/io7m-com/jobj) +[![Maven Central (snapshot)](https://img.shields.io/nexus/s/https/s01.oss.sonatype.org/com.io7m.jobj/com.io7m.jobj.svg?style=flat-square)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/io7m/jobj/) +[![Codecov](https://img.shields.io/codecov/c/github/io7m/jobj.svg?style=flat-square)](https://codecov.io/gh/io7m/jobj) -![com.io7m.jobj](./src/site/resources/jobj.jpg?raw=true) +![jobj](./src/site/resources/jobj.jpg?raw=true) + +| JVM | Platform | Status | +|---------------------------|----------|--------| +| OpenJDK (Temurin) Current | Linux | [![Build (OpenJDK (Temurin) Current, Linux)](https://img.shields.io/github/actions/workflow/status/io7m/jobj/main.linux.temurin.current?branch=develop)](https://github.com/io7m/jobj/actions?query=workflow%3Amain.linux.temurin.current) | +| OpenJDK (Temurin) Current | Windows | [![Build (OpenJDK (Temurin) Current, Windows)](https://img.shields.io/github/actions/workflow/status/io7m/jobj/main.windows.temurin.current?branch=develop)](https://github.com/io7m/jobj/actions?query=workflow%3Amain.windows.temurin.current) | +| OpenJDK (Temurin) LTS | Linux | [![Build (OpenJDK (Temurin) LTS, Linux)](https://img.shields.io/github/actions/workflow/status/io7m/jobj/main.linux.temurin.lts?branch=develop)](https://github.com/io7m/jobj/actions?query=workflow%3Amain.linux.temurin.lts) | +| OpenJDK (Temurin) LTS | Windows | [![Build (OpenJDK (Temurin) LTS, Windows)](https://img.shields.io/github/actions/workflow/status/io7m/jobj/main.windows.temurin.lts?branch=develop)](https://github.com/io7m/jobj/actions?query=workflow%3Amain.windows.temurin.lts) | + + +## jobj + +A parser for the useful subset of the Wavefront OBJ file format. + +## Features + +* Hand-written event-based recovering parser: Efficiently parse, accumulating + errors along the way, without being tied to any particular AST types. +* High coverage test suite. +* [OSGi-ready](https://www.osgi.org/) +* [JPMS-ready](https://en.wikipedia.org/wiki/Java_Platform_Module_System) +* ISC license. + +## Usage + +Provide an implementation of the `JOParserEventListenerType` interface +to a `JOParserType`: + +``` +Path file; +JOParserEventListenerType listener; +InputStream stream; + +final JOParserType p = + JOParser.newParserFromStream( + Optional.of(file), + stream, + listener + ); + +p.run(); +``` + +The `listener` will receive parse events encountered during parsing of the +file. + +## Coverage + +The only specification for the OBJ file format is an +[unofficial specification](src/site/resources/obj.txt) that appears to have +been handed around for decades. + +Most of the OBJ file format has no relevance to anything used in modern +computer graphics in 2024, but the format itself is often used as a +bare-minimum portable text format for distributing mesh data. This parser +attempts to capture the useful subset of data and makes no attempt to parse +the entirety of the OBJ format. It's practically guaranteed that the parser +will be missing the once piece of data you actually wanted to extract from the +`.obj` file you're parsing. Patches to increase format coverage are welcome. -| JVM | Platform | Status | -|-----|----------|--------| -| OpenJDK (Temurin) Current | Linux | [![Build (OpenJDK (Temurin) Current, Linux)](https://img.shields.io/github/actions/workflow/status/io7m-com/jobj/main.linux.temurin.current.yml)](https://www.github.com/io7m-com/jobj/actions?query=workflow%3Amain.linux.temurin.current)| -| OpenJDK (Temurin) LTS | Linux | [![Build (OpenJDK (Temurin) LTS, Linux)](https://img.shields.io/github/actions/workflow/status/io7m-com/jobj/main.linux.temurin.lts.yml)](https://www.github.com/io7m-com/jobj/actions?query=workflow%3Amain.linux.temurin.lts)| -| OpenJDK (Temurin) Current | Windows | [![Build (OpenJDK (Temurin) Current, Windows)](https://img.shields.io/github/actions/workflow/status/io7m-com/jobj/main.windows.temurin.current.yml)](https://www.github.com/io7m-com/jobj/actions?query=workflow%3Amain.windows.temurin.current)| -| OpenJDK (Temurin) LTS | Windows | [![Build (OpenJDK (Temurin) LTS, Windows)](https://img.shields.io/github/actions/workflow/status/io7m-com/jobj/main.windows.temurin.lts.yml)](https://www.github.com/io7m-com/jobj/actions?query=workflow%3Amain.windows.temurin.lts)| diff --git a/com.io7m.jobj.core/pom.xml b/com.io7m.jobj.core/pom.xml index d0a5f7d..94b4cfe 100644 --- a/com.io7m.jobj.core/pom.xml +++ b/com.io7m.jobj.core/pom.xml @@ -27,6 +27,17 @@ org.slf4j slf4j-api + + + org.osgi + org.osgi.annotation.versioning + provided + + + org.osgi + org.osgi.annotation.bundle + provided + diff --git a/com.io7m.jobj.core/src/main/java/com/io7m/jobj/core/package-info.java b/com.io7m.jobj.core/src/main/java/com/io7m/jobj/core/package-info.java index d437f01..78a5c4d 100644 --- a/com.io7m.jobj.core/src/main/java/com/io7m/jobj/core/package-info.java +++ b/com.io7m.jobj.core/src/main/java/com/io7m/jobj/core/package-info.java @@ -18,5 +18,9 @@ * Core types and functions. */ +@Export +@Version("1.0.0") package com.io7m.jobj.core; +import org.osgi.annotation.bundle.Export; +import org.osgi.annotation.versioning.Version; diff --git a/com.io7m.jobj.core/src/main/java/module-info.java b/com.io7m.jobj.core/src/main/java/module-info.java index 2c6c6dd..29722fe 100644 --- a/com.io7m.jobj.core/src/main/java/module-info.java +++ b/com.io7m.jobj.core/src/main/java/module-info.java @@ -20,6 +20,9 @@ module com.io7m.jobj.core { + requires org.osgi.annotation.bundle; + requires org.osgi.annotation.versioning; + requires org.slf4j; requires com.io7m.jlexing.core; diff --git a/com.io7m.jobj.documentation/pom.xml b/com.io7m.jobj.documentation/pom.xml deleted file mode 100644 index 085b99b..0000000 --- a/com.io7m.jobj.documentation/pom.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - 4.0.0 - - com.io7m.jobj - com.io7m.jobj - 0.4.0-SNAPSHOT - - com.io7m.jobj.documentation - - jar - com.io7m.jobj.documentation - Wavefront OBJ reader/writer (Documentation) - https://www.io7m.com/software/jobj - - - true - - - - - ${project.groupId} - com.io7m.jobj.core - ${project.version} - - - - com.io7m.primogenitor - com.io7m.primogenitor.support - - - - - - - - org.apache.maven.plugins - maven-resources-plugin - - - copy-documentation-resources - - copy-resources - - generate-resources - - ${project.build.directory}/documentation/ - - - src/main/resources/com/io7m/jobj/documentation/ - true - - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack-sources - package - - unpack-dependencies - - - module-info.java - ${project.groupId} - sources - false - ${project.build.directory}/javadoc-sources - - - - make-classpath - package - - build-classpath - - - ${project.build.directory}/javadoc-classpath - - - - - - - - com.io7m.jstructural - io7m-jstructural-maven-plugin - - - make-documentation-single - prepare-package - - transform - - - ${project.build.directory}/documentation/documentation.xml - ${project.build.directory}/documentation/ - ${project.build.directory}/documentation/brand.xml - XHTML_SINGLE - - - - make-documentation-multi - prepare-package - - transform - - - ${project.build.directory}/documentation/documentation.xml - ${project.build.directory}/documentation/ - ${project.build.directory}/documentation/brand.xml - XHTML_MULTI - - - - - - - - org.codehaus.mojo - exec-maven-plugin - - - javadoc - - java - - package - - com.io7m.primogenitor.support.TrivialJavadoc - - ${project.build.directory}/javadoc-sources - ${project.build.directory}/javadoc-classpath - ${project.build.directory}/documentation/apidocs - ${project.build.directory}/javadoc-log.txt - ${project.build.directory}/javadoc-options - - - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - src/main/assembly/documentation.xml - - - - - make-assembly - package - - single - - - false - - - - - - - - - org.codehaus.mojo - truezip-maven-plugin - false - - - copy-site-documentation - - copy - - site - - true - - ${project.build.directory}/${project.name}-${project.version}.zip/${project.name}-${project.version}/ - ${project.parent.build.directory}/minisite/documentation/ - - - - - - - - - diff --git a/com.io7m.jobj.documentation/src/main/assembly/documentation.xml b/com.io7m.jobj.documentation/src/main/assembly/documentation.xml deleted file mode 100644 index b888871..0000000 --- a/com.io7m.jobj.documentation/src/main/assembly/documentation.xml +++ /dev/null @@ -1,20 +0,0 @@ - - documentation - ${project.name}-${project.version} - - zip - - - - ${project.build.directory}/documentation - / - - - ${project.build.directory}/site/apidocs - /apidocs - - - diff --git a/com.io7m.jobj.documentation/src/main/java/com/io7m/jobj/documentation/Documentation.java b/com.io7m.jobj.documentation/src/main/java/com/io7m/jobj/documentation/Documentation.java deleted file mode 100644 index 6abdd54..0000000 --- a/com.io7m.jobj.documentation/src/main/java/com/io7m/jobj/documentation/Documentation.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright © 2015 Mark Raynsford https://www.io7m.com - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package com.io7m.jobj.documentation; - -/** - * Marker class for looking up files by resource. - */ - -public final class Documentation -{ - private Documentation() - { - throw new AssertionError("Unreachable code"); - } -} - diff --git a/com.io7m.jobj.documentation/src/main/java/com/io7m/jobj/documentation/package-info.java b/com.io7m.jobj.documentation/src/main/java/com/io7m/jobj/documentation/package-info.java deleted file mode 100644 index 8c7a1a0..0000000 --- a/com.io7m.jobj.documentation/src/main/java/com/io7m/jobj/documentation/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright © 2015 Mark Raynsford https://www.io7m.com - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/** - * Documentation. - */ - -package com.io7m.jobj.documentation; - diff --git a/com.io7m.jobj.documentation/src/main/java/module-info.java b/com.io7m.jobj.documentation/src/main/java/module-info.java deleted file mode 100644 index 801bdb4..0000000 --- a/com.io7m.jobj.documentation/src/main/java/module-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright © 2015 Mark Raynsford https://www.io7m.com - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/** - * Wavefront OBJ reader/writer (Documentation) - */ - -module com.io7m.jobj.documentation -{ - requires com.io7m.jobj.core; - - exports com.io7m.jobj.documentation; -} \ No newline at end of file diff --git a/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/brand.xml b/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/brand.xml deleted file mode 100644 index 7a7aa11..0000000 --- a/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/brand.xml +++ /dev/null @@ -1,9 +0,0 @@ - -
-
- io7m -
-
- ${project.parent.name} ${project.version} -
-
diff --git a/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/documentation.css b/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/documentation.css deleted file mode 100644 index f974701..0000000 --- a/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/documentation.css +++ /dev/null @@ -1,73 +0,0 @@ -.brand -{ - font-size: 75%; - font-family: monospace; -} - -.brand_left -{ - float: left; -} - -.brand_right -{ - text-align: right; -} - -.package -{ - font-family: monospace; - font-weight: bold; -} - -.emphasis, -.term -{ - font-style: italic; -} - -.attribute, -.class, -.command, -.constant, -.element, -.expression, -.file, -.function, -.keyword, -.parameter, -.variable, -.type -{ - font-family: monospace; -} - -.example, .license, .terminal -{ - font-family: monospace; - border: 1px solid #ccc; - padding-top: 1.0em; - padding-left: 1.0em; - padding-bottom: 1.0em; - margin-top: 1.2em; - overflow: auto; -} - -.dependencies table td -{ - padding-right: 3.0em; - font-family: monospace; - font-size: 9pt; -} - -.platforms table td -{ - padding-right: 2.0em; -} -.platforms table tbody, -.platforms table thead -{ - font-size: 8pt; - font-family: monospace; -} - diff --git a/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/documentation.xml b/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/documentation.xml deleted file mode 100644 index b82d88f..0000000 --- a/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/documentation.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - ${project.parent.name} ${project.version} Documentation - documentation.css - - - - Package Information - - - Orientation - - Overview - - The ${project.parent.name} package - implements a parser for a useful subset of the Wavefront OBJ file - format. - - - - - - Installation - - Source compilation - - The project can be compiled and installed with - Maven: - - - - - - - - Maven - - Regular releases are made to the - Central Repository, - so it's possible to use the ${project.parent.name} - package in your projects with the following Maven dependency: - - - - ${project.groupId} - ${project.parent.artifactId}-core - ${project.version} -]]> - - - All io7m.com - packages use Semantic Versioning - - http://semver.org - , which implies that it is always safe to use version ranges - with an exclusive upper bound equal to the next major version - the API of - the package will not change in a backwards-incompatible manner before the - next major version. - - - - - - Platform Specific Issues - - There are currently no known platform-specific issues. - - - - - License - - All files distributed with the ${project.parent.name} - package are placed under the following license: - https://www.io7m.com - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.]]> - - - - - - - Format Specification - - - Format Specification - - The following (unofficial?) - specification - has been circulated online for many years. It is the only known - documentation for the format: - - - Specification - - - - - - - API Reference - - - Javadoc - - API documentation for the package is provided via the - included Javadoc. - - - - - diff --git a/pom.xml b/pom.xml index 18b5903..cd7f01b 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,6 @@ com.io7m.jobj.core - com.io7m.jobj.documentation com.io7m.jobj.tests com.io7m.jobj.tools @@ -70,6 +69,10 @@ sonatype-nexus-staging https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + sonatype-nexus-snapshots + https://s01.oss.sonatype.org/content/repositories/snapshots/ + @@ -99,6 +102,17 @@ com.io7m.primogenitor.support 8.2.0 + + org.osgi + org.osgi.annotation.versioning + 1.1.2 + + + org.osgi + org.osgi.annotation.bundle + 2.0.0 + + args4j args4j diff --git a/com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/obj.txt b/src/site/resources/obj.txt similarity index 100% rename from com.io7m.jobj.documentation/src/main/resources/com/io7m/jobj/documentation/obj.txt rename to src/site/resources/obj.txt