Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ jobs:

strategy:
matrix:
java: [23]
java: [25]
os: ['ubuntu-latest', 'macos-latest']
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-os-${{ matrix.os }}-java-${{ matrix.java }}
cancel-in-progress: true
name: "Build on ${{ matrix.os }} with Java ${{ matrix.java }}"
env:
DEFAULT_JAVA: 23
DEFAULT_JAVA: 25
DEFAULT_OS: 'ubuntu-latest'
permissions:
contents: read

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{ matrix.java }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
uses: gradle/actions/setup-gradle@v6
- name: Build with Java ${{ matrix.java }}
run: ./gradlew build --info --warning-mode=all -PjavaVersion=${{ matrix.java }}
- name: Sonar analysis
Expand All @@ -44,7 +44,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Archive native lib
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: native-lib-${{ matrix.os }}
path: build/lua-libs/
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 23
java-version: 25
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v4
uses: gradle/actions/dependency-submission@v6
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ This project allows executing Lua scripts from a Java application. It uses [Fore

## Development

### Updating Lua

Lua source code is checked in `lua/src/`. The following files are patched compared to the original version:

* Added `lua/src/all_lua.h`
* Modified `lua/src/Makefile` to build Lua as a shared library.

### Enable Gradle Caching

To speedup repeated builds, add `org.gradle.caching=true` to `~/.gradle/gradle.properties`.

### Native Interface

Build scripts generate native interface classes in `build/generated/sources/jextract` using [Jextract](https://github.com/openjdk/jextract). Scripts download and cache Jextract automatically during the build.
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'java-library'
id 'jacoco'
id "com.github.ben-manes.versions" version "0.51.0"
id "org.sonarqube" version "5.1.0.4882"
id "com.github.ben-manes.versions" version "0.54.0"
id "org.sonarqube" version "7.3.0.8198"
}

version = '0.0.1'
Expand All @@ -17,7 +17,7 @@ dependencies {

java {
toolchain {
def javaVersion = project.hasProperty('javaVersion') ? project.getProperty('javaVersion') : 23
def javaVersion = project.hasProperty('javaVersion') ? project.getProperty('javaVersion') : 25
languageVersion = JavaLanguageVersion.of(javaVersion)
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ task downloadJextract(type: DownloadTask) {
throw new IllegalStateException("Unsupported architecture: ${arch}")
}
}
sourceUrl = "https://download.java.net/java/early_access/jextract/22/5/openjdk-22-jextract+5-33_${getOs()}-${getArch()}_bin.tar.gz"
sourceUrl = "https://download.java.net/java/early_access/jextract/25/2/openjdk-25-jextract+2-4_${getOs()}-${getArch()}_bin.tar.gz"
target = file("${project.buildDir}/jextract.tar.gz")
}

Expand All @@ -143,7 +143,7 @@ task unpackJextract(type: Copy, dependsOn: [tasks.downloadJextract]) {
}

task generateNativeInterface(type: JextractTask, dependsOn: [tasks.unpackJextract]) {
jextractBinary = new File(tasks.unpackJextract.outputs.files[0], "jextract-22/bin/jextract")
jextractBinary = new File(tasks.unpackJextract.outputs.files[0], "jextract-25/bin/jextract")
includeDir = new File(project.rootDir, "lua/src")
outputDir = new File(project.buildDir, "generated/sources/jextract/")
}
Expand Down
19 changes: 16 additions & 3 deletions buildSrc/src/main/groovy/JextractTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@ import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.file.ProjectLayout
import org.gradle.process.ExecOperations
import javax.inject.Inject

@CacheableTask
class JextractTask extends DefaultTask {
private final ExecOperations execOperations
private final File rootDir

@Inject
JextractTask(ExecOperations execOperations, ProjectLayout projectLayout) {
this.execOperations = execOperations
this.rootDir = projectLayout.projectDirectory.asFile
}

@InputFile @PathSensitive(PathSensitivity.RELATIVE) File jextractBinary

@InputDirectory @PathSensitive(PathSensitivity.RELATIVE) File includeDir
Expand All @@ -28,8 +40,9 @@ class JextractTask extends DefaultTask {
'--header-class-name', 'Lua',
"$includeDir/all_lua.h"
]
project.exec {
workingDir project.rootDir
def workingDirectory = rootDir
execOperations.exec {
workingDir workingDirectory
executable jextractBinary
args arguments
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
junit-jupiter = "5.11.2"
junit-jupiter = "6.0.3"
hamcrest = "3.0"
mockito = "5.14.1"
mockito = "5.23.0"

[libraries]
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
14 changes: 5 additions & 9 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 10 additions & 22 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 106 additions & 0 deletions lua/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Makefile for installing Lua
# See doc/readme.html for installation and customization instructions.

# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================

# Your platform. See PLATS for possible values.
PLAT= guess

# Where to install. The installation starts in the src and doc directories,
# so take care if INSTALL_TOP is not an absolute path. See the local target.
# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
INSTALL_TOP= /usr/local
INSTALL_BIN= $(INSTALL_TOP)/bin
INSTALL_INC= $(INSTALL_TOP)/include
INSTALL_LIB= $(INSTALL_TOP)/lib
INSTALL_MAN= $(INSTALL_TOP)/man/man1
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V

# How to install. If your install program does not support "-p", then
# you may have to run ranlib on the installed liblua.a.
INSTALL= install -p
INSTALL_EXEC= $(INSTALL) -m 0755
INSTALL_DATA= $(INSTALL) -m 0644
#
# If you don't have "install" you can use "cp" instead.
# INSTALL= cp -p
# INSTALL_EXEC= $(INSTALL)
# INSTALL_DATA= $(INSTALL)

# Other utilities.
MKDIR= mkdir -p
RM= rm -f

# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======

# Convenience platforms targets.
PLATS= guess aix bsd c89 freebsd generic ios linux macosx mingw posix solaris

# What to install.
TO_BIN= lua luac
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
TO_LIB= liblua.a
TO_MAN= lua.1 luac.1

# Lua version and release.
V= 5.5
R= $V.0

# Targets start here.
all: $(PLAT)

$(PLATS) help test clean:
@cd src && $(MAKE) $@

install: dummy
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)

uninstall:
cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB)
cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN)

local:
$(MAKE) install INSTALL_TOP=../install

# make may get confused with install/ if it does not support .PHONY.
dummy:

# Echo config parameters.
echo:
@cd src && $(MAKE) -s echo
@echo "PLAT= $(PLAT)"
@echo "V= $V"
@echo "R= $R"
@echo "TO_BIN= $(TO_BIN)"
@echo "TO_INC= $(TO_INC)"
@echo "TO_LIB= $(TO_LIB)"
@echo "TO_MAN= $(TO_MAN)"
@echo "INSTALL_TOP= $(INSTALL_TOP)"
@echo "INSTALL_BIN= $(INSTALL_BIN)"
@echo "INSTALL_INC= $(INSTALL_INC)"
@echo "INSTALL_LIB= $(INSTALL_LIB)"
@echo "INSTALL_MAN= $(INSTALL_MAN)"
@echo "INSTALL_LMOD= $(INSTALL_LMOD)"
@echo "INSTALL_CMOD= $(INSTALL_CMOD)"
@echo "INSTALL_EXEC= $(INSTALL_EXEC)"
@echo "INSTALL_DATA= $(INSTALL_DATA)"

# Echo pkg-config data.
pc:
@echo "version=$R"
@echo "prefix=$(INSTALL_TOP)"
@echo "libdir=$(INSTALL_LIB)"
@echo "includedir=$(INSTALL_INC)"

# Targets that do not create files (not all makes understand .PHONY).
.PHONY: all $(PLATS) help test clean install uninstall local dummy echo pc

# (end of Makefile)
Loading