diff --git a/.vscode/settings.json b/.vscode/settings.json index 3994e27..bbf66ee 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -27,5 +27,9 @@ "search.exclude": { "build/generated/jextract": false, }, - "java.compile.nullAnalysis.mode": "automatic" + "java.compile.nullAnalysis.mode": "automatic", + "sonarlint.connectedMode.project": { + "connectionId": "kaklakariada-github", + "projectKey": "luava" + } } diff --git a/README.md b/README.md index 20c46e6..d0a4f71 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# java-lua +# luava An experimental Java library for embedding a Lua VM. [![Build](https://github.com/kaklakariada/java-lua/actions/workflows/build.yml/badge.svg)](https://github.com/kaklakariada/java-lua/actions/workflows/build.yml) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jlua) -[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=bugs)](https://sonarcloud.io/summary/new_code?id=jlua) -[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=jlua) -[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=coverage)](https://sonarcloud.io/summary/new_code?id=jlua) -[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=jlua&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=jlua) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=luava) +[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=bugs)](https://sonarcloud.io/summary/new_code?id=luava) +[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=luava) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=coverage)](https://sonarcloud.io/summary/new_code?id=luava) +[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=luava&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=luava) ## Development diff --git a/build.gradle b/build.gradle index 38d458b..feffed2 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,9 @@ plugins { id "org.sonarqube" version "5.1.0.4882" } +version = '0.0.1' +group = 'org.itsallcode' + repositories { mavenCentral() } @@ -24,7 +27,7 @@ java { javadoc { enabled = true failOnError = true - excludes = ["org/itsallcode/jlua/ffi/**"] + excludes = ["org/itsallcode/luava/ffi/**"] options.addBooleanOption('html5', true) options.addStringOption('Xwerror', '-quiet') } @@ -138,7 +141,7 @@ task generateNativeInterface(type: Exec, dependsOn: [tasks.unpackJextract]) { commandLine jextractBinary, '--include-dir', includeDir, '--output', generatedSrc, - '--target-package', 'org.itsallcode.jlua.ffi', + '--target-package', 'org.itsallcode.luava.ffi', '--library', 'lua', '--header-class-name', 'Lua', "$includeDir/all_lua.h" diff --git a/settings.gradle b/settings.gradle index 790ab51..78f0cc3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,4 +3,4 @@ plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } -rootProject.name = 'jlua' +rootProject.name = 'luava' diff --git a/src/main/java/org/itsallcode/jlua/FunctionCallException.java b/src/main/java/org/itsallcode/jlua/FunctionCallException.java index a50c089..c1dd78c 100644 --- a/src/main/java/org/itsallcode/jlua/FunctionCallException.java +++ b/src/main/java/org/itsallcode/jlua/FunctionCallException.java @@ -1,4 +1,4 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; public class FunctionCallException extends LuaException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/itsallcode/jlua/LowLevelLua.java b/src/main/java/org/itsallcode/jlua/LowLevelLua.java index 6432023..7e79d67 100644 --- a/src/main/java/org/itsallcode/jlua/LowLevelLua.java +++ b/src/main/java/org/itsallcode/jlua/LowLevelLua.java @@ -1,11 +1,11 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; -import org.itsallcode.jlua.ffi.Lua; -import org.itsallcode.jlua.ffi.lua_KFunction; -import org.itsallcode.jlua.ffi.lua_KFunction.Function; +import org.itsallcode.luava.ffi.Lua; +import org.itsallcode.luava.ffi.lua_KFunction; +import org.itsallcode.luava.ffi.lua_KFunction.Function; class LowLevelLua implements AutoCloseable { private final Arena arena; @@ -36,7 +36,8 @@ void pcall(final int nargs, final int nresults, final int errfunc, final long ct pcall(nargs, nresults, errfunc, ctx, function); } - void pcall(final int nargs, final int nresults, final int errfunc, final long ctx, final Function upcallFunction) { + void pcall(final int nargs, final int nresults, final int errfunc, final long ctx, + final lua_KFunction.Function upcallFunction) { final MemorySegment k = lua_KFunction.allocate(upcallFunction, arena); final int error = Lua.lua_pcallk(state, nargs, nresults, errfunc, ctx, k); if (error != 0) { diff --git a/src/main/java/org/itsallcode/jlua/LuaException.java b/src/main/java/org/itsallcode/jlua/LuaException.java index 5ceb874..65c1d7e 100644 --- a/src/main/java/org/itsallcode/jlua/LuaException.java +++ b/src/main/java/org/itsallcode/jlua/LuaException.java @@ -1,4 +1,4 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; public class LuaException extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/itsallcode/jlua/LuaFunction.java b/src/main/java/org/itsallcode/jlua/LuaFunction.java index 83e2dc7..30df166 100644 --- a/src/main/java/org/itsallcode/jlua/LuaFunction.java +++ b/src/main/java/org/itsallcode/jlua/LuaFunction.java @@ -1,9 +1,9 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; -import org.itsallcode.jlua.ffi.Lua; +import org.itsallcode.luava.ffi.Lua; public class LuaFunction { diff --git a/src/main/java/org/itsallcode/jlua/LuaInterpreter.java b/src/main/java/org/itsallcode/jlua/LuaInterpreter.java index 0631d0b..2d2476c 100644 --- a/src/main/java/org/itsallcode/jlua/LuaInterpreter.java +++ b/src/main/java/org/itsallcode/jlua/LuaInterpreter.java @@ -1,4 +1,4 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; public class LuaInterpreter implements AutoCloseable { diff --git a/src/main/java/org/itsallcode/jlua/LuaStack.java b/src/main/java/org/itsallcode/jlua/LuaStack.java index 057a8e7..04c9764 100644 --- a/src/main/java/org/itsallcode/jlua/LuaStack.java +++ b/src/main/java/org/itsallcode/jlua/LuaStack.java @@ -1,10 +1,10 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; import java.nio.charset.StandardCharsets; -import org.itsallcode.jlua.ffi.Lua; +import org.itsallcode.luava.ffi.Lua; class LuaStack { private final MemorySegment state; diff --git a/src/main/java/org/itsallcode/jlua/LuaTable.java b/src/main/java/org/itsallcode/jlua/LuaTable.java index 3beadfb..36ac9d1 100644 --- a/src/main/java/org/itsallcode/jlua/LuaTable.java +++ b/src/main/java/org/itsallcode/jlua/LuaTable.java @@ -1,9 +1,9 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; -import org.itsallcode.jlua.ffi.Lua; +import org.itsallcode.luava.ffi.Lua; public class LuaTable { private final LuaStack stack; diff --git a/src/main/java/org/itsallcode/jlua/LuaType.java b/src/main/java/org/itsallcode/jlua/LuaType.java index 92cbaec..323007f 100644 --- a/src/main/java/org/itsallcode/jlua/LuaType.java +++ b/src/main/java/org/itsallcode/jlua/LuaType.java @@ -1,8 +1,8 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; import java.util.Arrays; -import org.itsallcode.jlua.ffi.Lua; +import org.itsallcode.luava.ffi.Lua; public enum LuaType { NONE(Lua.LUA_TNONE()), NIL(Lua.LUA_TNIL()), BOOLEAN(Lua.LUA_TBOOLEAN()), LIGHT_USERDATA(Lua.LUA_TLIGHTUSERDATA()), diff --git a/src/test/java/org/itsallcode/jlua/LowLevelLuaTest.java b/src/test/java/org/itsallcode/jlua/LowLevelLuaTest.java index feae151..e31a2f7 100644 --- a/src/test/java/org/itsallcode/jlua/LowLevelLuaTest.java +++ b/src/test/java/org/itsallcode/jlua/LowLevelLuaTest.java @@ -1,4 +1,4 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; diff --git a/src/test/java/org/itsallcode/jlua/LuaInterpreterTest.java b/src/test/java/org/itsallcode/jlua/LuaInterpreterTest.java index cc684c8..25ccfa9 100644 --- a/src/test/java/org/itsallcode/jlua/LuaInterpreterTest.java +++ b/src/test/java/org/itsallcode/jlua/LuaInterpreterTest.java @@ -1,13 +1,11 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.*; import org.junit.jupiter.api.function.Executable; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; diff --git a/src/test/java/org/itsallcode/jlua/LuaStackTest.java b/src/test/java/org/itsallcode/jlua/LuaStackTest.java index 93b78b9..01aece4 100644 --- a/src/test/java/org/itsallcode/jlua/LuaStackTest.java +++ b/src/test/java/org/itsallcode/jlua/LuaStackTest.java @@ -1,11 +1,9 @@ -package org.itsallcode.jlua; +package org.itsallcode.luava; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.*; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource;