Skip to content

Commit

Permalink
patch to jnigen renaming, deploy to experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Ski committed Apr 16, 2024
1 parent 942b821 commit 424de2b
Show file tree
Hide file tree
Showing 20 changed files with 357 additions and 18 deletions.
330 changes: 330 additions & 0 deletions .github/workflows/build-publish-experimental.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
name: Build and Publish

on:
push:
branches: [ experimental ]

jobs:

natives-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build macOS natives
run: |
# See https://github.com/actions/virtual-environments/issues/2557
sudo mv /Library/Developer/CommandLineTools/SDKs/* /tmp
sudo mv /Applications/Xcode.app /Applications/Xcode.app.bak
sudo mv /Applications/Xcode_13.2.app /Applications/Xcode.app
sudo xcode-select -switch /Applications/Xcode.app
/usr/bin/xcodebuild -version
./gradlew jniGen jnigenBuildIOS
./backends/gdx-backend-robovm/build-objectal.sh
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" -o -name "*.xcframework" | grep "libs" > native-files-list
zip -r natives-ios -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-ios.zip
path: natives-ios.zip

natives-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build macOS natives
run: |
# See https://github.com/actions/virtual-environments/issues/2557
sudo mv /Library/Developer/CommandLineTools/SDKs/* /tmp
sudo mv /Applications/Xcode.app /Applications/Xcode.app.bak
sudo mv /Applications/Xcode_13.2.app /Applications/Xcode.app
sudo xcode-select -switch /Applications/Xcode.app
/usr/bin/xcodebuild -version
./gradlew jniGen jnigenBuildMacOsX64 jnigenBuildMacOsXARM64
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-macos -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-macos.zip
path: natives-macos.zip

natives-linux:
runs-on: ubuntu-20.04
container:
image: ubuntu:18.04
steps:
- name: Install dependencies into minimal dockerfile
run: |
# ubuntu dockerfile is very minimal (only 122 packages are installed)
# need to install updated git (from official git ppa)
apt update
apt install -y software-properties-common
add-apt-repository ppa:git-core/ppa -y
# install dependencies expected by other steps
apt update
apt install -y git \
curl \
ca-certificates \
wget \
bzip2 \
zip \
unzip \
xz-utils \
maven \
ant sudo locales
# set Locale to en_US.UTF-8 (avoids hang during compilation)
locale-gen en_US.UTF-8
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "LANGUAGE=en_US.UTF-8" >> $GITHUB_ENV
echo "LC_ALL=en_US.UTF-8" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Install cross-compilation toolchains
run: |
sudo apt update
sudo apt install -y --force-yes gcc g++
sudo apt install -y --force-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross
sudo apt install -y --force-yes gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross
- name: Build Linux natives
run: |
./gradlew jniGen jnigenBuildLinux64 jnigenBuildLinuxARM jnigenBuildLinuxARM64
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-linux -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-linux.zip
path: natives-linux.zip

natives-windows:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Install cross-compilation toolchains
run: |
sudo apt update
sudo apt install -y --force-yes mingw-w64 lib32z1
- name: Build Windows natives
run: |
./gradlew jniGen jnigenBuildWindows64 jnigenBuildWindows
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-windows -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-windows.zip
path: natives-windows.zip

natives-android:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build Android natives
run: |
export NDK_HOME=$ANDROID_NDK_HOME
./gradlew jniGen jnigenBuildAndroid
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-android -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-android.zip
path: natives-android.zip

pack-natives:
runs-on: ubuntu-20.04
needs: [natives-macos, natives-linux, natives-windows, natives-ios, natives-android]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Download natives-ios artifact
uses: actions/download-artifact@v2
with:
name: natives-ios.zip

- name: Download natives-macos artifact
uses: actions/download-artifact@v2
with:
name: natives-macos.zip

- name: Download natives-linux artifact
uses: actions/download-artifact@v2
with:
name: natives-linux.zip

- name: Download natives-windows artifact
uses: actions/download-artifact@v2
with:
name: natives-windows.zip

- name: Download natives-android artifact
uses: actions/download-artifact@v2
with:
name: natives-android.zip

- name: Unpack natives
run: |
unzip -o natives-ios.zip
unzip -o natives-macos.zip
unzip -o natives-linux.zip
unzip -o natives-windows.zip
unzip -o natives-android.zip
- name: Pack desktop natives
run: |
./gradlew jniGen
ant -f gdx/jni/build.xml pack-natives
ant -f extensions/gdx-box2d/gdx-box2d/jni/build.xml pack-natives
ant -f extensions/gdx-freetype/jni/build.xml pack-natives
ant -f extensions/gdx-bullet/jni/build.xml pack-natives
- name: Pack natives
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" -o -name "*-natives.jar" -o -name "*.xcframework" | grep "libs" > native-files-list
zip -r natives -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives.zip
path: natives.zip

publish:
runs-on: ubuntu-20.04
needs: pack-natives
env:
ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Download natives artifact
uses: actions/download-artifact@v2
with:
name: natives.zip

- name: Unpack natives
run: |
unzip -o natives.zip
- name: Fetch external natives
run: |
./gradlew fetchExternalNatives
- name: Snapshot build deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/experimental' && github.repository_owner == 'libgdx'
run: |
./gradlew build publish
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Clipboard;
import com.badlogic.gdx.utils.Null;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import com.badlogic.gdx.jnigen.SharedLibraryLoader;

import java.awt.Canvas;
import java.awt.Container;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.badlogic.gdx.graphics.Cursor;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import com.badlogic.gdx.jnigen.SharedLibraryLoader;

public class LwjglCursor implements Cursor {
org.lwjgl.input.Cursor lwjglCursor = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import com.badlogic.gdx.jnigen.SharedLibraryLoader;

/** An implementation of the {@link Graphics} interface based on Lwjgl.
* @author mzechner */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package com.badlogic.gdx.backends.lwjgl;

import static com.badlogic.gdx.utils.SharedLibraryLoader.*;
import static com.badlogic.gdx.jnigen.SharedLibraryLoader.*;

import com.badlogic.gdx.utils.GdxNativesLoader;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import com.badlogic.gdx.jnigen.SharedLibraryLoader;

import java.io.File;
import java.lang.reflect.Method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import com.badlogic.gdx.utils.Clipboard;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import com.badlogic.gdx.jnigen.SharedLibraryLoader;
import org.lwjgl.system.Configuration;

public class Lwjgl3Application implements Lwjgl3ApplicationBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.badlogic.gdx.net.ServerSocketHints;
import com.badlogic.gdx.net.Socket;
import com.badlogic.gdx.net.SocketHints;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import com.badlogic.gdx.jnigen.SharedLibraryLoader;

/** LWJGL implementation of the {@link Net} API, it could be reused in other Desktop backends since it doesn't depend on LWJGL.
* @author acoppes */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import com.badlogic.gdx.jnigen.SharedLibraryLoader;

public class Lwjgl3Window implements Disposable {
private long windowHandle;
Expand Down

0 comments on commit 424de2b

Please sign in to comment.