Skip to content

Commit

Permalink
JSON spec interpretation
Browse files Browse the repository at this point in the history
  • Loading branch information
GlennFolker committed Feb 11, 2024
0 parents commit 0d1dd2d
Show file tree
Hide file tree
Showing 49 changed files with 1,341 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Java CI

on: [push, pull_request]

jobs:
buildJar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Build artifact
run: |
chmod +x gradlew
./gradlew jar
- name: Upload built artifact
uses: actions/upload-artifact@v4
with:
name: glTFrenzy.jar (zipped)
path: build/libs/glTFrenzy.jar
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Build settings
bin/
build/
.gradle/
.settings/
.project
.classpath

# IDE-specific
.idea/
.vscode/
.kateproject
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gltf.annotations.SpecProcessor,isolating
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gltf.annotations.SpecProcessor
9 changes: 9 additions & 0 deletions annotations/src/gltf/annotations/Alias.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package gltf.annotations;

import java.lang.annotation.*;

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.CLASS)
public @interface Alias{
String value();
}
7 changes: 7 additions & 0 deletions annotations/src/gltf/annotations/Named.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package gltf.annotations;

import java.lang.annotation.*;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface Named{}
25 changes: 25 additions & 0 deletions annotations/src/gltf/annotations/Spec.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package gltf.annotations;

import java.lang.annotation.*;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface Spec{
Prop[] value() default {};

@interface Prop{
String name();

Class<?> type();

boolean required() default false;

Def def() default @Def("");
}

@interface Def{
String value();

Class<?>[] args() default {};
}
}
375 changes: 375 additions & 0 deletions annotations/src/gltf/annotations/SpecProcessor.java

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
plugins{
id 'java-library'
id 'maven-publish'
}

configure(allprojects){
apply plugin: 'java-library'
ext{
compilerVersion = JavaVersion.current().ordinal() - JavaVersion.VERSION_17.ordinal() + 17
arc = {String module ->
"com.github.Anuken.Arc$module:$arcVersion"
}
}

dependencies{
annotationProcessor "com.github.GlennFolker.EntityAnno:downgrader:$entVersion"
}

repositories{
mavenCentral()
maven{url 'https://oss.sonatype.org/content/repositories/snapshots/'}
maven{url 'https://oss.sonatype.org/content/repositories/releases/'}
maven{url 'https://raw.githubusercontent.com/Zelaux/MindustryRepo/master/repository'}
maven{url 'https://jitpack.io'}
}
}

configure(rootProject){
sourceSets.main.java.srcDirs = [layout.projectDirectory.dir('src')]
version = projectVersion

java{
withSourcesJar()
withJavadocJar()
}

dependencies{
annotationProcessor project(':annotations')
compileOnly project(':annotations')

compileOnlyApi "${arc(':arc-core')}"
compileOnlyApi "${arc(':g3d')}"
}

tasks.withType(JavaCompile).configureEach{
sourceCompatibility = compilerVersion
options.release = 8
options.compilerArgs << '-Xlint:-options'

options.incremental = true
options.encoding = 'UTF-8'
}

tasks.withType(Jar).configureEach{
exclude 'gltfrenzy/spec/**'
}

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

configure(project(':annotations')){
sourceSets.main{
java.srcDirs = [layout.projectDirectory.dir('src')]
resources.srcDirs = [layout.projectDirectory.dir('assets')]
}

java{
toolchain{
languageVersion = JavaLanguageVersion.of(compilerVersion)
}
}

dependencies{
implementation "${arc(':arc-core')}"
implementation "${arc(':g3d')}"
implementation "com.squareup:javapoet:$javapoetVersion"
}

tasks.withType(JavaCompile).configureEach{
options.incremental = true
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:-options'

sourceCompatibility = compilerVersion
targetCompatibility = 8

doFirst{
sourceCompatibility = 8
}
}
}
19 changes: 19 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
projectVersion = v146.0.0
entVersion = v146.0.1
arcVersion = v146
javapoetVersion = 1.13.0

org.gradle.parallel = true
org.gradle.jvmargs = \
--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
--add-opens=java.base/sun.reflect.annotation=ALL-UNNAMED
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.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0d1dd2d

Please sign in to comment.