Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.0.0-b9 #114

Merged
merged 31 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d319ae8
update version
xpenatan Nov 4, 2023
665f574
Exclude class fix
xpenatan Nov 9, 2023
acf2add
update wrapper
xpenatan Nov 10, 2023
6e586e3
update imgui lib
xpenatan Nov 10, 2023
c45070a
update imgui lib
xpenatan Nov 10, 2023
aae3a3d
update teavm to 0.10.0-dev-2
xpenatan Nov 10, 2023
184bfac
update gdx tests
xpenatan Dec 5, 2023
bd24663
fix downloadFromUrl
xpenatan Dec 6, 2023
e3b8885
update teavm to 0.10.0-dev-4
xpenatan Dec 6, 2023
1f8f488
remove listener
xpenatan Dec 6, 2023
88cc210
Don't throw if properties failed to get
xpenatan Dec 6, 2023
82a8be3
fix imgui method
xpenatan Dec 6, 2023
56c6264
fix getting property url by decoding it
xpenatan Dec 6, 2023
824ba7c
small improvement
xpenatan Dec 6, 2023
a88efc9
downgrade teavm version
xpenatan Dec 22, 2023
e078896
update readme
xpenatan Jan 8, 2024
ac74b4e
update teavm to 0.9.2
xpenatan Jan 10, 2024
e5be4c1
test tag
xpenatan Jan 10, 2024
42f4ac8
update name
xpenatan Jan 10, 2024
f53ec5b
update script
xpenatan Jan 10, 2024
26b791b
get version from properties
xpenatan Jan 10, 2024
79ec587
checkout code first
xpenatan Jan 10, 2024
1295569
attempt to get version
xpenatan Jan 10, 2024
b2ae2b6
run tag in release push
xpenatan Jan 10, 2024
02b07c3
update imgui path
xpenatan Jan 10, 2024
a5ce4be
update Dependencies
xpenatan Jan 10, 2024
aa328e7
update Dependencies
xpenatan Jan 10, 2024
3c5e08d
fix import
xpenatan Jan 10, 2024
7a784e0
Remove tool from maven/snapshot
xpenatan Jan 11, 2024
5275589
update changes
xpenatan Jan 11, 2024
baf782d
update readme
xpenatan Jan 11, 2024
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
15 changes: 0 additions & 15 deletions .github/workflows/dispatch_build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
with:
isRelease: true
shouldUpload: true
secrets: inherit
secrets: inherit
38 changes: 38 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Create Tag

on:
push:
branches:
- 'release'

jobs:
add-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: madhead/read-java-properties@latest
id: version
with:
file: "./gradle.properties"
property: version
default: 0.0.1

- name: Create Git tag
uses: actions/github-script@v7
with:
script: |
const versionOutputs = ${{ toJSON(steps.version.outputs) }};

var version = versionOutputs.value;

console.log("Version: " + version);

var ref = "refs/tags/" + version
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: ref,
sha: context.sha
});
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[1.0.0-SNAPSHOT]

[1.0.0-b9]
- add TeaClassFilter printAllowedClasses() and printExcludedClasses()
- add TeaReflectionSupplier.printReflectionClasses()
- Change exclude class comparison to regex
- Downgrade teavm dev 0.10.X version to 0.9.2 release version
- Remove tool/generator from maven/snapshot.

[1.0.0-b8]
- Fix MMB code
- Fix catch key
- Support IntBuffer in GL20
Expand Down
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ repositories {
}
}
```
gdxTeaVMVersion = "1.0.0-SNAPSHOT"
// SNAPSHOT:
gdxTeaVMVersion = "-SNAPSHOT"
// RELEASE:
gdxTeaVMVersion = "[LAST_TAG_VERSION]"
```groovy
// In teaVM module
dependencies {
Expand All @@ -57,12 +60,5 @@ dependencies {
- [Bullet](https://github.com/xpenatan/gdx-bullet) (WIP)
- [PhysX](https://github.com/xpenatan/gdx-physx) (WIP)
- [ImGui](https://github.com/xpenatan/gdx-imgui) (WIP)
- [Lua](https://github.com/xpenatan/gdx-lua) (WIP)
- FreeType

## Generator:
A WIP standalone tool to convert your libgdx game in .jar or .class format to javascript. [Example](https://youtu.be/BIL_5eaxg9w)
<br>
<br>
Note: The compiled jar game should not be obfuscated.

Setup: TODO
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.badlogic.gdx.utils.BufferUtils;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.IntMap;
import com.github.xpenatan.gdx.backends.teavm.AssetLoaderListener;
import com.github.xpenatan.gdx.backends.teavm.TeaApplication;
import com.github.xpenatan.gdx.backends.teavm.TeaApplicationConfiguration;
Expand Down Expand Up @@ -101,7 +100,7 @@ public static int toGlType (FormatEmu format) {
private Gdx2DPixmapEmu nativePixmap;
private boolean disposed;

public static void downloadFromUrl(String url, final DownloadPixmapResponseListener responseListener) {
public static void downloadFromUrl(String url, final Pixmap.DownloadPixmapResponseListener responseListener) {
AssetLoaderListener<Blob> listener = new AssetLoaderListener<>() {
@Override
public void onFailure(String url) {
Expand All @@ -112,7 +111,7 @@ public void onFailure(String url) {
@Override
public boolean onSuccess(String url, Blob result) {
Object obj = new PixmapEmu(result.getImage());
responseListener.downloadComplete((PixmapEmu)obj);
responseListener.downloadComplete((Pixmap)obj);
return false;
}
};
Expand Down Expand Up @@ -739,9 +738,4 @@ public enum BlendingEmu {
public enum FilterEmu {
NearestNeighbour, BiLinear
}

public interface DownloadPixmapResponseListener {
void downloadComplete (PixmapEmu pixmap);
void downloadFailed (Throwable t);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public interface TeaProgressListener {
private static final String EXTENSION_FREETYPE = "gdx-freetype-teavm";
private static final String EXTENSION_BOX2D = "gdx-box2d-teavm";
private static final String EXTENSION_BOX2D_GWT = "gdx-box2d-gwt";
private static final String EXTENSION_IMGUI = "imgui-core-teavm";

public static TeaVMTool config(TeaBuildConfiguration configuration) {
TeaVMTool tool = new TeaVMTool();
Expand Down Expand Up @@ -215,7 +214,6 @@ private static void sortAcceptedClassPath(ArrayList<URL> acceptedURL) {
// Move extensions to be first so native classes are replaced by the emulated classes
makeClassPathFirst(acceptedURL, EXTENSION_FREETYPE);
makeClassPathFirst(acceptedURL, EXTENSION_BOX2D);
makeClassPathFirst(acceptedURL, EXTENSION_IMGUI);
// Move generic backend to be first
makeClassPathFirst(acceptedURL, "backend-teavm");
}
Expand Down Expand Up @@ -430,8 +428,6 @@ else if(path.contains("gdx-jnigen"))
isValid = ACCEPT_STATE.NOT_ACCEPT;
else if(path.contains("gdx-platform"))
isValid = ACCEPT_STATE.NOT_ACCEPT;
else if(path.contains("imgui-core"))
isValid = ACCEPT_STATE.NOT_ACCEPT;
else if(path.contains("generator/core/"))
isValid = ACCEPT_STATE.NOT_ACCEPT;
else if(path.contains("gdx-bullet-platform"))
Expand All @@ -455,8 +451,6 @@ else if(path.contains(EXTENSION_FREETYPE))
isValid = ACCEPT_STATE.ACCEPT;
else if(path.contains(EXTENSION_BOX2D))
isValid = ACCEPT_STATE.ACCEPT;
else if(path.contains(EXTENSION_IMGUI))
isValid = ACCEPT_STATE.ACCEPT;
else if(path.contains("jParser-loader"))
isValid = ACCEPT_STATE.ACCEPT;
else if(path.contains("jzlib"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
Expand Down Expand Up @@ -111,6 +113,7 @@ private static ArrayList<TeaVMResourceProperties> getAllProperties(ArrayList<URL
ArrayList<String> filteredUrl = new ArrayList<>();
for(URL url : acceptedURL) {
String path = url.getPath();
path = URLDecoder.decode(path, StandardCharsets.UTF_8);
boolean accept = !(
!(path.endsWith(".jar")) ||
path.contains("org.teavm"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.xpenatan.gdx.backends.teavm.config.plugins;

import com.github.xpenatan.gdx.backends.teavm.config.TeaBuilder;
import java.util.ArrayList;
import org.teavm.model.FieldReference;
import org.teavm.model.MethodReference;
Expand All @@ -10,6 +11,10 @@ public class TeaClassFilter implements ElementFilter {
private static final ArrayList<Pair> methodsToExclude = new ArrayList<>();
private static final ArrayList<Pair> fieldsToExclude = new ArrayList<>();

private static final ArrayList<String> ALLOWED_CLASSES = new ArrayList<>();
private static final ArrayList<String> EXCLUDED_CLASSES = new ArrayList<>();


/**
* my.package.ClassName or my.package
*/
Expand All @@ -31,10 +36,32 @@ public static void addFieldsToExclude(String className, String fieldName) {
fieldsToExclude.add(new Pair(className, fieldName));
}

/**
* Must be called after TeaBuilder.build
*/
public static void printAllowedClasses() {
TeaBuilder.logHeader("EXCLUDED CLASSES: " + ALLOWED_CLASSES.size());
for(String allowedClass : ALLOWED_CLASSES) {
TeaBuilder.log(allowedClass);
}
TeaBuilder.logEnd();
}

/**
* Must be called after TeaBuilder.build
*/
public static void printExcludedClasses() {
TeaBuilder.logHeader("ALLOWED CLASES: " + EXCLUDED_CLASSES.size());
for(String excludedClass : EXCLUDED_CLASSES) {
TeaBuilder.log(excludedClass);
}
TeaBuilder.logEnd();
}

private static boolean containsClass(ArrayList<String> list, String className) {
for(int i = 0; i < list.size(); i++) {
String excludedClass = list.get(i);
if(className.contains(excludedClass))
if(className.matches(excludedClass) || className.contains(excludedClass + "$") )
return true;
}
return false;
Expand All @@ -58,6 +85,12 @@ public boolean acceptClass(String fullClassName) {
if(containsClass(classesToExclude, fullClassName)) {
accceptClass = false;
}
if(accceptClass) {
ALLOWED_CLASSES.add(fullClassName);
}
else {
EXCLUDED_CLASSES.add(fullClassName);
}
return accceptClass;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.xpenatan.gdx.backends.teavm.config.plugins;

import com.github.xpenatan.gdx.backends.teavm.config.TeaBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -17,6 +18,8 @@ public class TeaReflectionSupplier implements ReflectionSupplier {

private static ArrayList<String> clazzList = new ArrayList();

private static HashSet<String> REFLECTION_CLASSES = new HashSet<>();

public static void addReflectionClass(Class<?> type) {
addReflectionClass(type.getName());
}
Expand All @@ -41,6 +44,17 @@ public static void addReflectionClass(String className) {
clazzList.add(className);
}

/**
* Must be called after TeaBuilder.build
*/
public static void printReflectionClasses() {
TeaBuilder.logHeader("REFLECTION CLASSES: " + REFLECTION_CLASSES.size());
for(String reflectionClass : REFLECTION_CLASSES) {
TeaBuilder.log(reflectionClass);
}
TeaBuilder.logEnd();
}

public TeaReflectionSupplier() {
}

Expand All @@ -54,6 +68,7 @@ public Collection<String> getAccessibleFields(ReflectionContext context, String

if(cls != null) {
if(canHaveReflection(className)) {
REFLECTION_CLASSES.add(className);
for(FieldReader field : cls.getFields()) {
String name = field.getName();
fields.add(name);
Expand All @@ -71,6 +86,7 @@ public Collection<MethodDescriptor> getAccessibleMethods(ReflectionContext conte
}
Set<MethodDescriptor> methods = new HashSet<>();
if(canHaveReflection(className)) {
REFLECTION_CLASSES.add(className);
Collection<? extends MethodReader> methods2 = cls.getMethods();
for(MethodReader method : methods2) {
MethodDescriptor descriptor = method.getDescriptor();
Expand Down
8 changes: 1 addition & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ subprojects {
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/releases/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/releases/") }
maven {
url = uri("http://teavm.org/maven/repository/")
isAllowInsecureProtocol = true
}
maven { url = uri("https://jitpack.io") }
}

Expand All @@ -33,9 +29,7 @@ subprojects {

var libProjects = mutableSetOf(
project(":backends:backend-teavm"),
project(":extensions:gdx-freetype-teavm"),
project(":tools:generator:core"),
project(":tools:generator:ui")
project(":extensions:gdx-freetype-teavm")
)

configure(libProjects) {
Expand Down
23 changes: 16 additions & 7 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
import java.io.File
import java.util.*

object LibExt {
const val groupId = "com.github.xpenatan.gdx-teavm"
val libVersion: String = getVersion("1.0.0", "b8")

val libVersion: String = getVersion()

const val gdxVersion = "1.12.1"
const val teaVMVersion = "0.10.0-dev-1"
const val teaVMVersion = "0.9.2"

const val gdxImGuiVersion = "1.0.0-SNAPSHOT"
const val gdxFrameViewportVersion = "1.0.0-SNAPSHOT"
const val gdxMultiViewVersion = "1.0.0-SNAPSHOT"

const val reflectionVersion = "0.10.2"
const val jettyVersion = "11.0.13"

const val aiVersion = "1.8.2"
}

private fun getVersion(releaseVersion: String, suffix: String = ""): String {
private fun getVersion(): String {
val file = File("gradle.properties")
val properties = Properties()
properties.load(file.inputStream())
val version = properties.getProperty("version")

val isRelease = System.getenv("RELEASE")
var libVersion = "${releaseVersion}-SNAPSHOT"
var libVersion = "-SNAPSHOT"
if(isRelease != null && isRelease.toBoolean()) {
libVersion = releaseVersion + if(suffix.isNotEmpty()) "-${suffix}" else ""
libVersion = version
}
System.out.println("Gdx-teaVM Version: " + libVersion)
println("gdx-teavm Version: $libVersion")
return libVersion
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void main(String[] args) throws IOException {

TeaVMTool tool = TeaBuilder.config(teaBuildConfiguration);
tool.setMainClass(TeaVMTestLauncher.class.getName());
tool.setObfuscated(false);
tool.setObfuscated(true);
TeaBuilder.build(tool);
}
}
4 changes: 2 additions & 2 deletions examples/gdx-tests/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ dependencies {
implementation("com.badlogicgames.gdx:gdx-backend-lwjgl3:${LibExt.gdxVersion}")

implementation("com.github.xpenatan.gdx-imgui:imgui-core:${LibExt.gdxImGuiVersion}")
implementation("com.github.xpenatan.gdx-imgui:gdx:${LibExt.gdxImGuiVersion}")
implementation("com.github.xpenatan.gdx-imgui:gdx-impl:${LibExt.gdxImGuiVersion}")

// Optional
implementation("com.github.xpenatan:gdx-frame-viewport:${LibExt.gdxFrameViewportVersion}")
implementation("com.github.xpenatan.gdx-multi-view:core:${LibExt.gdxMultiViewVersion}")

api("com.badlogicgames.gdx:gdx-tests")

Expand Down
Loading
Loading