Skip to content

Commit f3acd21

Browse files
committed
🏷️ Release 1.4.0
1 parent 3b265b5 commit f3acd21

37 files changed

+405
-340
lines changed

.idea/gradle.xml

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.run/Build Project.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<component name="ProjectRunConfigurationManager">
2-
<configuration default="false" name="Build Project" type="GradleRunConfiguration" factoryName="Gradle">
2+
<configuration default="false" name="Build Project" dataType="GradleRunConfiguration" factoryName="Gradle">
33
<ExternalSystemSettings>
44
<option name="executionName" />
55
<option name="externalProjectPath" value="$PROJECT_DIR$" />

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ Assuming you use gradle.
2626
2727
public class DataTest {
2828
public static void main(String[] args) {
29-
MapType type = new MapType();
30-
type.putString("greetings", "Hello World");
29+
MapType dataType = new MapType();
30+
dataType.putString("greetings", "Hello World");
3131
32-
DataIo.write(type, new File("data.ubo"));
32+
DataIo.write(dataType, new File("data.ubo"));
3333
}
3434
}
3535
```

build.gradle.kts

Lines changed: 84 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ plugins {
55

66
}
77

8-
apply(plugin="java")
9-
apply(plugin="java-library")
10-
apply(plugin="maven-publish")
11-
apply(plugin="signing")
8+
apply(plugin = "java")
9+
apply(plugin = "java-library")
10+
apply(plugin = "maven-publish")
11+
apply(plugin = "signing")
1212

1313
group = project.property("group")!!
1414
version = "${project.property("version")}"
@@ -28,10 +28,10 @@ dependencies {
2828
compileOnly("org.jetbrains:annotations:23.0.0")
2929
}
3030

31-
//tasks.compileJava {
32-
// sourceCompatibility = JavaVersion("1.8")
33-
// targetCompatibility = JavaVersion("1.8")
34-
//}
31+
tasks.compileJava {
32+
sourceCompatibility = "1.8"
33+
targetCompatibility = "1.8"
34+
}
3535

3636
java {
3737
withSourcesJar()
@@ -46,6 +46,64 @@ publishing {
4646
publications {
4747
register("mavenJava", MavenPublication::class) {
4848
from(components["java"])
49+
50+
groupId = project.group.toString()
51+
artifactId = project.name
52+
version = project.version.toString()
53+
54+
pom {
55+
name.set("UBO")
56+
description.set("Extensible NBT-like data API.")
57+
58+
url.set("https://github.com/Ultreon/ubo")
59+
inceptionYear.set("2022")
60+
61+
developers {
62+
developer {
63+
name.set("XyperCode")
64+
email.set("qboiwastaken@gmail.com")
65+
66+
organization.set("Ultreon")
67+
organizationUrl.set("https://github.com/Ultreon")
68+
}
69+
}
70+
71+
organization {
72+
name.set("Ultreon")
73+
url.set("https://github.com/Ultreon")
74+
}
75+
76+
issueManagement {
77+
system.set("GitHub")
78+
url.set("https://github.com/Ultreon/ubo/issues")
79+
}
80+
81+
licenses {
82+
license {
83+
name.set("Apache License")
84+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
85+
}
86+
}
87+
88+
scm {
89+
connection.set("scm:git:git://github.com/Ultreon/ubo.git")
90+
developerConnection.set("scm:git:ssh://github.com/Ultreon/ubo.git")
91+
92+
url.set("https://github.com/Ultreon/ubo/tree/main")
93+
}
94+
95+
contributors {
96+
contributor {
97+
name.set("XyperCode")
98+
url.set("https://github.com/XyperCode")
99+
}
100+
101+
contributor {
102+
name.set("AndEditor7")
103+
url.set("https://github.com/AndEditor7")
104+
}
105+
}
106+
}
49107
}
50108
}
51109
repositories {
@@ -56,26 +114,29 @@ publishing {
56114
val ossrhUsername = findProperty("ossrh.username") ?: System.getenv("OSSRH_USERNAME")
57115
val ossrhPassword = findProperty("ossrh.password") ?: System.getenv("OSSRH_PASSWORD")
58116

59-
maven {
60-
name = "OssSonatype"
61-
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
62-
credentials {
63-
if (ossrhUsername != null && ossrhPassword != null) {
117+
if (ossrhUsername != null && ossrhPassword != null) {
118+
maven {
119+
name = "OssSonatype"
120+
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
121+
122+
credentials {
64123
username = ossrhUsername.toString()
65124
password = ossrhPassword.toString()
66125
}
126+
67127
}
68-
}
69128

70-
maven {
71-
name = "OssSnapshots"
72-
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
73-
credentials {
74-
if (ossrhUsername != null && ossrhPassword != null) {
129+
maven {
130+
name = "OssSnapshots"
131+
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
132+
133+
credentials {
75134
username = ossrhUsername.toString()
76135
password = ossrhPassword.toString()
77136
}
78137
}
138+
} else {
139+
logger.warn("No OSSRH credentials found, skipping upload to OSSRH.")
79140
}
80141
}
81142
}
@@ -90,9 +151,10 @@ tasks.withType<GenerateModuleMetadata> {
90151
enabled = false
91152
}
92153

93-
//tasks.signing {
94-
// sign(configurations["archives"])
95-
//}
154+
extensions.configure<SigningExtension>("signing") {
155+
useGpgCmd()
156+
sign(publishing.publications["mavenJava"])
157+
}
96158

97159
afterEvaluate {
98160
tasks.javadoc {
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.ultreon.ubo;
22

3+
import dev.ultreon.ubo.types.DataType;
34
import dev.ultreon.ubo.util.DataTypeVisitor;
4-
import dev.ultreon.ubo.types.IType;
55

66
import java.io.*;
77
import java.net.URL;
@@ -15,14 +15,14 @@ public class DataIo {
1515
private static final int BUFFER_SIZE = 4096;
1616

1717
@SafeVarargs
18-
public static <T extends IType<?>> T read(File file, T... type) throws IOException {
18+
public static <T extends DataType<?>> T read(File file, T... type) throws IOException {
1919
try (InputStream stream = new BufferedInputStream(Files.newInputStream(file.toPath()), BUFFER_SIZE)) {
2020
return read(stream, type);
2121
}
2222
}
2323

2424
@SafeVarargs
25-
public static <T extends IType<?>> T read(URL url, T... type) throws IOException {
25+
public static <T extends DataType<?>> T read(URL url, T... type) throws IOException {
2626
try (InputStream stream = new BufferedInputStream(url.openStream(), BUFFER_SIZE)) {
2727
return read(stream, type);
2828
}
@@ -33,7 +33,7 @@ public static <T extends IType<?>> T read(URL url, T... type) throws IOException
3333
* @throws DataTypeException when the read data type is invalid.
3434
*/
3535
@SafeVarargs
36-
public static <T extends IType<?>> T read(InputStream stream, T... type) throws IOException {
36+
public static <T extends DataType<?>> T read(InputStream stream, T... type) throws IOException {
3737
if (stream instanceof DataInput) {
3838
return read((DataInput) stream, type);
3939
}
@@ -46,7 +46,7 @@ public static <T extends IType<?>> T read(InputStream stream, T... type) throws
4646
*/
4747
@SafeVarargs
4848
@SuppressWarnings("unchecked")
49-
public static <T extends IType<?>> T read(DataInput input, T... type) throws IOException {
49+
public static <T extends DataType<?>> T read(DataInput input, T... type) throws IOException {
5050
int magic = input.readInt();
5151
if (magic != HEADER) {
5252
throw new StreamCorruptedException(String.format("Invalid header got 0x%08X (expected 0xFF804269)", magic));
@@ -58,99 +58,99 @@ public static <T extends IType<?>> T read(DataInput input, T... type) throws IOE
5858
}
5959

6060
Class<T> componentType = (Class<T>) type.getClass().getComponentType();
61-
int componentId = TypeRegistry.getId(componentType);
61+
int componentId = DataTypeRegistry.getId(componentType);
6262
int id = input.readUnsignedByte();
6363

6464
if (componentId != id) {
6565
throw new DataTypeException("The read data id " + id + " is different from the expected id: " + componentId);
6666
}
6767

68-
return (T) TypeRegistry.read(id, input);
68+
return (T) DataTypeRegistry.read(id, input);
6969
}
7070

7171
@SafeVarargs
72-
public static <T extends IType<?>> T readCompressed(File file, T... type) throws IOException {
72+
public static <T extends DataType<?>> T readCompressed(File file, T... type) throws IOException {
7373
try (InputStream stream = new BufferedInputStream(Files.newInputStream(file.toPath()), BUFFER_SIZE)) {
7474
return readCompressed(stream, type);
7575
}
7676
}
7777

7878
@SafeVarargs
79-
public static <T extends IType<?>> T readCompressed(URL url, T... type) throws IOException {
79+
public static <T extends DataType<?>> T readCompressed(URL url, T... type) throws IOException {
8080
try (InputStream stream = new BufferedInputStream(url.openStream())) {
8181
return readCompressed(stream, type);
8282
}
8383
}
8484

8585
@SafeVarargs
86-
public static <T extends IType<?>> T readCompressed(InputStream stream, T... type) throws IOException {
86+
public static <T extends DataType<?>> T readCompressed(InputStream stream, T... type) throws IOException {
8787
GZIPInputStream gzipStream = new GZIPInputStream(stream);
8888
return read(gzipStream, type);
8989
}
9090

91-
public static void write(IType<?> type, File file) throws IOException {
91+
public static void write(DataType<?> dataType, File file) throws IOException {
9292
try (OutputStream stream = new BufferedOutputStream(Files.newOutputStream(file.toPath()), BUFFER_SIZE)) {
93-
write(type, stream);
93+
write(dataType, stream);
9494
}
9595
}
9696

97-
public static void write(IType<?> type, URL file) throws IOException {
97+
public static void write(DataType<?> dataType, URL file) throws IOException {
9898
try (OutputStream stream = new BufferedOutputStream(file.openConnection().getOutputStream(), BUFFER_SIZE)) {
99-
write(type, stream);
99+
write(dataType, stream);
100100
}
101101
}
102102

103-
public static void write(IType<?> type, OutputStream stream) throws IOException {
103+
public static void write(DataType<?> dataType, OutputStream stream) throws IOException {
104104
if (stream instanceof DataOutput) {
105-
write(type, (DataOutput) stream);
105+
write(dataType, (DataOutput) stream);
106106
}
107-
write(type, (DataOutput) new DataOutputStream(stream));
107+
write(dataType, (DataOutput) new DataOutputStream(stream));
108108
}
109109

110-
public static void write(IType<?> type, DataOutput output) throws IOException {
110+
public static void write(DataType<?> dataType, DataOutput output) throws IOException {
111111
output.writeInt(HEADER);
112112
output.writeShort(VERSION); // Version
113-
output.writeByte(type.id()); // Type
114-
type.write(output);
113+
output.writeByte(dataType.id()); // Type
114+
dataType.write(output);
115115
}
116116

117-
public static void writeCompressed(IType<?> type, URL file) throws IOException {
117+
public static void writeCompressed(DataType<?> dataType, URL file) throws IOException {
118118
try (OutputStream stream = new BufferedOutputStream(file.openConnection().getOutputStream(), BUFFER_SIZE)) {
119-
writeCompressed(type, stream);
119+
writeCompressed(dataType, stream);
120120
}
121121
}
122122

123-
public static void writeCompressed(IType<?> type, File file) throws IOException {
123+
public static void writeCompressed(DataType<?> dataType, File file) throws IOException {
124124
try (OutputStream stream = new BufferedOutputStream(Files.newOutputStream(file.toPath()), BUFFER_SIZE)) {
125-
writeCompressed(type, stream);
125+
writeCompressed(dataType, stream);
126126
}
127127
}
128128

129-
public static void writeCompressed(IType<?> type, OutputStream stream) throws IOException {
129+
public static void writeCompressed(DataType<?> dataType, OutputStream stream) throws IOException {
130130
GZIPOutputStream gzipStream = new GZIPOutputStream(stream);
131-
write(type, gzipStream);
131+
write(dataType, gzipStream);
132132
gzipStream.finish();
133133
gzipStream.flush();
134134
}
135135

136-
public static String toUso(IType<?> type) {
137-
return type.writeUso();
136+
public static String toUso(DataType<?> dataType) {
137+
return dataType.writeUso();
138138
}
139139

140-
public static <T> T visit(DataTypeVisitor<T> visitor, IType<?> type) {
141-
return type.accept(visitor);
140+
public static <T> T visit(DataTypeVisitor<T> visitor, DataType<?> dataType) {
141+
return dataType.accept(visitor);
142142
}
143143

144144
@SuppressWarnings("unchecked")
145145
@SafeVarargs
146-
public static <T extends IType<?>> T fromUso(String value, T... type) throws IOException {
146+
public static <T extends DataType<?>> T fromUso(String value, T... type) throws IOException {
147147
try (BufferedReader reader = new BufferedReader(new StringReader(value))) {
148-
IType<?> iType = readUso(reader.readLine());
149-
return (T) iType;
148+
DataType<?> iDataType = readUso(reader.readLine());
149+
return (T) iDataType;
150150
}
151151
}
152152

153-
private static IType<?> readUso(String value) throws IOException {
153+
private static DataType<?> readUso(String value) throws IOException {
154154
return new UsoParser(value).parse();
155155
}
156156
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package dev.ultreon.ubo;
22

3-
import dev.ultreon.ubo.types.IType;
3+
import dev.ultreon.ubo.types.DataType;
44

55
import java.io.DataInput;
66
import java.io.IOException;
77

88
@FunctionalInterface
9-
public interface IReader<T extends IType<?>> {
9+
public interface DataReader<T extends DataType<?>> {
1010
T read(DataInput input) throws IOException;
1111
}

0 commit comments

Comments
 (0)