Skip to content

Commit

Permalink
Merge branch 'main' into stb
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 committed Jan 6, 2024
2 parents 343b205 + 5322b3e commit 16ae37e
Show file tree
Hide file tree
Showing 547 changed files with 44,302 additions and 11,998 deletions.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ body:
description: Add any other context or screenshots about the feature request here.
placeholder: Other context
value: "I want ..."
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Over-Run/overrungl/blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Summary

_A brief introduction to your changes..._

# Description

_Full description of your changes..._

# Additional Context

_Other context, such as version, dependencies, ..._

---

- [ ] I agree to follow this project's [Code of Conduct](https://github.com/Over-Run/overrungl/blob/main/CODE_OF_CONDUCT.md)
11 changes: 5 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

name: Java CI with Gradle

on: [ push, pull_request ]
on: [ push, pull_request, workflow_dispatch ]

jobs:
build:
strategy:
matrix:
java: [
21-ea
22-ea
]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
Expand All @@ -25,7 +25,7 @@ jobs:
with:
java-version: |
${{ matrix.java }}
20
21
distribution: 'temurin'
- name: Grant execute permission for gradlew
if: ${{ runner.os != 'Windows' }}
Expand All @@ -40,12 +40,11 @@ jobs:
with:
name: build-reports
path: |
modules/overrungl/**/build/reports/
modules/**/build/reports/
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '21-ea' }}
if: ${{ runner.os == 'Linux' && matrix.java == '22-ea' }}
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: |
modules/overrungl/**/build/libs/
modules/**/build/libs/
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,34 @@
![Maven Central](https://img.shields.io/maven-central/v/io.github.over-run/overrungl)
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/io.github.over-run/overrungl?server=https%3A%2F%2Fs01.oss.sonatype.org%2F)

![GitHub repo size](https://img.shields.io/github/repo-size/Over-Run/overrungl)
[![Java CI with Gradle](https://github.com/Over-Run/overrungl/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/Over-Run/overrungl/actions/workflows/gradle.yml)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8279/badge)](https://www.bestpractices.dev/projects/8279)

## Introduction

Overrun Game Library is a high-performance library that implemented with Java 21,
enables cross-platform access to a set of C/C++ library bindings, and provides some useful utilities.
Overrun Game Library is a high-performance library implemented with Java 22,
which enables cross-platform access to a set of C/C++ library bindings, and provides some useful utilities.

### OverrunGL vs. LWJGL

[LWJGL 3](https://github.com/LWJGL/lwjgl3) is also a Java library that enables native access.

LWJGL 3 uses JNI to access native functions,
but OverrunGL uses [FFM API](https://openjdk.org/jeps/434), which has better performance.
but OverrunGL uses [FFM API](https://openjdk.org/jeps/454), which has better performance.

## Getting Started

You can check our [wiki](https://github.com/Over-Run/overrungl/wiki) or
the [samples](modules/samples/src/test/java/overrungl/demo).

### Enable native access

You must enable the access of OverrunGL by adding a VM argument or a manifest attribute.

```
--enable-preview-access=overrungl.core,...
```

## Using as a Dependency

~~The libraries are available on Maven Central.~~ Currently, we are developing with the first version, and it is very
Expand Down Expand Up @@ -95,6 +103,10 @@ Javadoc can be found [here](https://over-run.github.io/overrungl-doc/).

The documentation of OpenGL can be found [here](https://docs.gl/).

### Credits

[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo (Main) logo." width="128" height="128">](https://jb.gg/OpenSourceSupport)

### Publishing (for internal member)

To publish this library, you need a GPG key and the write permission of Maven Central.
Expand All @@ -121,7 +133,7 @@ natives
│ └─ windows
│ └─ x64
│ └─ glfw3.dll
├─ nfd https://github.com/Over-Run/nativefiledialog-extended-ci
├─ nfd https://github.com/Over-Run/nfd-ci
│ ├─ linux
│ │ ├─ arm32
│ │ │ └─ libnfd.so
Expand Down
19 changes: 19 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Security Policy

## Supported Versions

We are currently working on 0.x versions,
and only the latest version will be supported.

| Version | Supported |
|---------|--------------------|
| 0.1.x | :white_check_mark: |

## Reporting a Vulnerability

You can report a vulnerability through [creating an issue](https://github.com/Over-Run/overrungl/security/advisories/new).

By reporting the vulnerability, you acknowledge that you have read and agree our [Code of Conduct](CODE_OF_CONDUCT.md).

We don't accept any vulnerability in unsupported versions.
Please keep using the latest version.
60 changes: 30 additions & 30 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.nio.file.Files
import kotlin.io.path.Path

Expand All @@ -17,14 +17,17 @@ val projName: String by project
val projVersion: String by project
val projVcs: String by project
val projBranch: String by project
val projLicenseYear: String by project
val orgName: String by project
val orgUrl: String by project
val developers: String by project

val jdkEABuildDoc: String? = "jdk21"
val targetJavaVersion = 21
val enablePreview = true
rootProject.ext["enablePreview"] = enablePreview
val jdkVersion: String by rootProject
val jdkEnablePreview: String by rootProject
val jdkEarlyAccessDoc: String? by rootProject
val kotlinTargetJdkVersion: String by rootProject

val targetJavaVersion = jdkVersion.toInt()

group = projGroupId
version = projVersion
Expand Down Expand Up @@ -116,7 +119,7 @@ enum class Artifact(

fun nativeFileName(platform: NativePlatform): String? {
return if (nativeBinding == null) null
else "$nativeBinding/${platform.osFamilyName}/${platform.osArch}/${platform.nativeLibPrefix}${nativeBinding.basename}${platform.nativeLibSuffix}"
else "${nativeBinding.bindingName}/${platform.osFamilyName}/${platform.osArch}/${platform.nativeLibPrefix}${nativeBinding.basename}${platform.nativeLibSuffix}"
}
}

Expand All @@ -125,6 +128,7 @@ subprojects {
apply(plugin = "java-library")
apply(plugin = "idea")
apply(plugin = "me.champeau.jmh")
apply(plugin = "org.jetbrains.kotlin.jvm")

group = projGroupId
version = projVersion
Expand All @@ -141,20 +145,24 @@ subprojects {
val compileOnly by configurations
val implementation by configurations
dependencies {
compileOnly("org.jetbrains:annotations:24.0.1")
compileOnly("org.jetbrains:annotations:24.1.0")
if (project.name != "core") {
implementation(project(":core"))
}
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
if (enablePreview) options.compilerArgs.add("--enable-preview")
if (jdkEnablePreview.toBoolean()) options.compilerArgs.add("--enable-preview")
options.release.set(targetJavaVersion)
}

tasks.withType<KotlinCompile> {
kotlinOptions { jvmTarget = kotlinTargetJdkVersion }
}

tasks.withType<Test> {
if (enablePreview) jvmArgs("--enable-preview")
if (jdkEnablePreview.toBoolean()) jvmArgs("--enable-preview")
}

extensions.configure<JavaPluginExtension>("java") {
Expand Down Expand Up @@ -202,8 +210,6 @@ subprojects {
}

the<IdeaModel>().module.inheritOutputDirs = true

the<KotlinJvmProjectExtension>().jvmToolchain(20)
}

tasks.register("assembleJavadocArgs") {
Expand All @@ -214,10 +220,12 @@ tasks.register("assembleJavadocArgs") {
doLast {
Files.deleteIfExists(mspFile)

Files.writeString(mspFile, """
Files.writeString(
mspFile, """
--module-source-path
${rootProject.projectDir.path}/modules/*/src/main/java
""".trimIndent())
""".trimIndent()
)
}
}

Expand All @@ -241,16 +249,18 @@ allprojects {
tasks.withType<Javadoc> {
options {
if (this is CoreJavadocOptions) {
addBooleanOption("-enable-preview", true)
if (jdkEnablePreview.toBoolean()) {
addBooleanOption("-enable-preview", true)
}
addStringOption("source", targetJavaVersion.toString())
if (this is StandardJavadocDocletOptions) {
charSet = "UTF-8"
docEncoding = "UTF-8"
isAuthor = true
if (jdkEABuildDoc == null) {
if (jdkEarlyAccessDoc == null) {
links("https://docs.oracle.com/en/java/javase/$targetJavaVersion/docs/api/")
} else {
links("https://download.java.net/java/early_access/$jdkEABuildDoc/docs/api/")
links("https://download.java.net/java/early_access/$jdkEarlyAccessDoc/docs/api/")
}

tags(
Expand All @@ -264,9 +274,10 @@ allprojects {
"glfw.note:m:Note:"
)

bottom = "<a href=\"https://github.com/Over-Run/overrungl/issues\">Report a bug or suggest an enhancement</a><br>" +
"Copyright © 2022-2023 Overrun Organization<br>" +
"<b>$projVersion</b>"
bottom =
"<a href=\"https://github.com/Over-Run/overrungl/issues\">Report a bug or suggest an enhancement</a><br>" +
"Copyright © 2022-$projLicenseYear Overrun Organization<br>" +
"<b>$projVersion</b>"
}
}
encoding = "UTF-8"
Expand Down Expand Up @@ -294,17 +305,6 @@ publishing.publications {
name.set(orgName)
url.set(orgUrl)
}
developers {
developers.split(',')
.map { it.split(':', limit = 3) }
.forEach { (id1, name1, email1) ->
developer {
id.set(id1)
name.set(name1)
email.set(email1)
}
}
}
scm {
connection.set("scm:git:https://github.com/${projVcs}.git")
developerConnection.set("scm:git:https://github.com/${projVcs}.git")
Expand Down
3 changes: 2 additions & 1 deletion doc/notes/0.x/0.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ _Not Released Yet_

This version includes the following features:

- GLFW 3.3.8
- GLFW 3.3.9
- OpenGL 1.0 ~ 4.6 functions and constants
- OpenGL extension functions
- OpenGL Loader
- STB Image, perlin noise, easy font
- C memory function
Expand Down
10 changes: 7 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ projArtifactId=overrungl
projName=overrungl
projVersion=0.1.0-SNAPSHOT
projVcs=Over-Run/overrungl
projBranch=0.x
projBranch=main
projLicenseYear=2024

# Organization
orgName=Overrun Organization
orgUrl=https://over-run.github.io/

# Developers
developers=squid233:squid233:[email protected]
jdkVersion=22
jdkEnablePreview=true
jdkEarlyAccessDoc=jdk22
kotlinTargetJdkVersion=21

projModules=core, glfw, nfd, joml, opengl, stb
overrunPlatformVersion=1.0.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 9 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
5 changes: 5 additions & 0 deletions modules/overrungl.core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
val overrunPlatformVersion: String by rootProject

dependencies {
api("io.github.over-run:platform:$overrunPlatformVersion")
}
Loading

0 comments on commit 16ae37e

Please sign in to comment.