Skip to content

Commit

Permalink
Merge pull request #16 from Over-Run/refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 authored Aug 27, 2024
2 parents 05ab407 + c4bea05 commit 52174f4
Show file tree
Hide file tree
Showing 52 changed files with 2,671 additions and 2,463 deletions.
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Marshal allows you to conveniently create native library bindings with [FFM API]

~~See [wiki](https://github.com/Over-Run/marshal/wiki) for more information.~~

This library requires JDK 23 or newer.
This library requires JDK 23 ~~or newer~~.

## Overview

Expand Down Expand Up @@ -34,24 +34,17 @@ interface GLFW {
int GLFW_KEY_A = 65;

/**
* Sets the swap interval.
*
* @param interval the interval
* A normal function
*/
void glfwSwapInterval(int interval);

/**
* Gets the window position.
* A function with ref parameters.
* Marks the array parameter as a place to store the value returned by C
*
* @param window the window
* @param posX the position x
* @param posY the position y
*/
void glfwGetWindowPos(MemorySegment window, @Ref int[] posX, @Ref int[] posY);

/**
* Creates a window.
* Requires a segment allocator to allocate the string;
* if the first parameter is not segment allocator, then the memory stack is used
*
Expand Down Expand Up @@ -95,7 +88,7 @@ Import as a Gradle dependency:

```groovy
dependencies {
implementation("io.github.over-run:marshal:0.1.0-alpha.29-jdk23")
implementation("io.github.over-run:marshal:0.1.0-alpha.30-jdk23")
}
```

Expand Down
9 changes: 7 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ val projDevelopers = arrayOf(
Developer("squid233")
)

val junitVersion: String by rootProject
val memstackVersion: String by rootProject

data class Organization(
val name: String,
val url: String
Expand Down Expand Up @@ -82,13 +85,14 @@ allprojects {
//maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") }

//maven { url = uri("https://oss.oss.sonatype.org/content/repositories/releases") }
//maven { url = uri("https://s01.oss.sonatype.org/content/repositories/releases") }
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/releases") }
}

dependencies {
// add your dependencies
compileOnly("org.jetbrains:annotations:24.1.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.3")
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
api("io.github.over-run:memstack:$memstackVersion")
}

tasks.withType<Test> {
Expand Down Expand Up @@ -157,6 +161,7 @@ tasks.withType<Javadoc> {
encoding = "UTF-8"
locale = "en_US"
windowTitle = "$projName $projVersion Javadoc"
jFlags("-Duser.language=en-US")
if (this is StandardJavadocDocletOptions) {
charSet = "UTF-8"
isAuthor = true
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ projGroupId=io.github.over-run
projArtifactId=marshal
# The project name should only contain lowercase letters, numbers and hyphen.
projName=marshal
projVersion=0.1.0-alpha.29-jdk23
projVersion=0.1.0-alpha.30-jdk23
projDesc=Marshaler of native libraries
# Uncomment them if you want to publish to maven repository.
projUrl=https://github.com/Over-Run/marshal
Expand All @@ -33,3 +33,6 @@ jdkEnablePreview=true
# https://download.java.net/java/early_access/$jdkEarlyAccessDoc/docs/api/
# Uncomment it if you need to use EA build of JDK.
jdkEarlyAccessDoc=jdk23

junitVersion=5.11.0
memstackVersion=0.2.0
1 change: 1 addition & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@
opens overrun.marshal.internal.data;

requires static org.jetbrains.annotations;
requires io.github.overrun.memstack;
}
69 changes: 0 additions & 69 deletions src/main/java/overrun/marshal/CEnum.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/overrun/marshal/Checks.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ private Checks() {
* @param expected the expected size
* @param actual the actual size
*/
public static void checkArraySize(int expected, int actual) {
if (Configurations.CHECK_ARRAY_SIZE.get() && expected != actual) {
public static void checkArraySize(long expected, int actual) {
if (MarshalConfigs.CHECK_ARRAY_SIZE.get() && expected != actual) {
throw new IllegalArgumentException("Expected array of size " + expected + ", got " + actual);
}
}
Expand Down
Loading

0 comments on commit 52174f4

Please sign in to comment.