Skip to content

Commit

Permalink
Add release for supported platforms (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinayagarwal authored Sep 2, 2024
1 parent dae1bba commit b257aba
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 11 deletions.
179 changes: 175 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
name: vmone-android-linux-aarch64
path: lib/android/staticjdk/lib/
retention-days: 1

build-ios:
runs-on: macos-14
steps:
Expand All @@ -50,30 +51,200 @@ jobs:
name: vmone-ios-macos-aarch64
path: lib/ios/staticjdk/lib/
retention-days: 1

build-linux-x64:
runs-on: ubuntu-22.04
steps:
- name: 'Checkout the JDK source'
uses: actions/checkout@v4
- name: 'Download libjdk.a'
uses: robinraju/release-downloader@v1
with:
repository: 'gluonhq/mobile'
latest: true
fileName: 'linux-x64.zip'
- name: 'Build'
run: |
unzip linux-x64.zip -d /tmp/
mv /tmp/linux-x64/libjdk.a /tmp/
make clean all
- name: 'Upload static image artifact'
uses: actions/upload-artifact@v4
with:
name: vmone-linux-x64
path: lib/linux/staticjdk/lib/
retention-days: 1

build-macos-x64:
runs-on: macos-14
steps:
- name: 'Checkout the JDK source'
uses: actions/checkout@v4
- name: 'Download libjdk.a'
uses: robinraju/release-downloader@v1
with:
repository: 'gluonhq/mobile'
latest: true
fileName: 'macos-x64.zip'
- name: 'Build'
run: |
unzip macos-x64.zip -d /tmp/
mv /tmp/macos-x64/libjdk.a /tmp/
make clean all
- name: 'Upload static image artifact'
uses: actions/upload-artifact@v4
with:
name: vmone-macos-x64
path: lib/macosx/staticjdk/lib/
retention-days: 1

build-macos-aarch64:
runs-on: macos-14
steps:
- name: 'Checkout the JDK source'
uses: actions/checkout@v4
- name: 'Download libjdk.a'
uses: robinraju/release-downloader@v1
with:
repository: 'gluonhq/mobile'
latest: true
fileName: 'macos-aarch64.zip'
- name: 'Build'
run: |
unzip macos-aarch64.zip -d /tmp/
mv /tmp/macos-aarch64/libjdk.a /tmp/
make clean all
- name: 'Upload static image artifact'
uses: actions/upload-artifact@v4
with:
name: vmone-macos-aarch64
path: lib/macosx/staticjdk/lib/
retention-days: 1

build-windows-x64:
runs-on: windows-latest
steps:
- name: 'Checkout the JDK source'
uses: actions/checkout@v4
- name: 'Download libjdk.lib'
uses: robinraju/release-downloader@v1
with:
repository: 'gluonhq/mobile'
latest: true
fileName: 'windows-x64.zip'
- name: 'Build'
run: |
powershell -Command "Expand-Archive -Path windows-x64.zip -DestinationPath C:\temp\"
powershell -Command "Move-Item -Path C:\temp\windows-x64\libjdk.lib -Destination C:\temp\"
cd C:\temp
make clean all
- name: 'Upload static image artifact'
uses: actions/upload-artifact@v4
with:
name: vmone-windows-x64
path: C:\temp\lib\windows\x64\staticjdk\lib\
retention-days: 1

build-windows-aarch64:
runs-on: windows-latest
steps:
- name: 'Checkout the JDK source'
uses: actions/checkout@v4
- name: 'Download libjdk.lib'
uses: robinraju/release-downloader@v1
with:
repository: 'gluonhq/mobile'
latest: true
fileName: 'windows-aarch64.zip'
- name: 'Build'
run: |
powershell -Command "Expand-Archive -Path windows-aarch64.zip -DestinationPath C:\temp\"
powershell -Command "Move-Item -Path C:\temp\windows-aarch64\libjdk.lib -Destination C:\temp\"
cd C:\temp
make clean all
- name: 'Upload static image artifact'
uses: actions/upload-artifact@v4
with:
name: vmone-windows-aarch64
path: C:\temp\lib\windows\aarch64\staticjdk\lib\
retention-days: 1

release:
needs: [ build-android, build-ios ]
needs: [
build-android, build-ios,
build-linux-x64,
# build-macos-x64,
build-macos-aarch64,
# build-windows-x64, build-windows-aarch64
]
runs-on: ubuntu-22.04
steps:
- name: Download android artifacts
uses: actions/download-artifact@v4
with:
name: vmone-android-linux-aarch64
path: ./dist/android-linux-aarch64/lib/

- name: Download ios artifacts
uses: actions/download-artifact@v4
with:
name: vmone-ios-macos-aarch64
path: ./dist/ios-macos-aarch64/lib/
- name: Zip downloaded artifact

- name: Download linux x64 artifacts
uses: actions/download-artifact@v4
with:
name: vmone-linux-x64
path: ./dist/linux-x64/lib/

- name: Download macos x64 artifacts
uses: actions/download-artifact@v4
with:
name: vmone-macos-x64
path: ./dist/macos-x64/lib/
if: false

- name: Download macos aarch64 artifacts
uses: actions/download-artifact@v4
with:
name: vmone-macos-aarch64
path: ./dist/macos-aarch64/lib/

- name: Download windows x64 artifacts
uses: actions/download-artifact@v4
with:
name: vmone-windows-x64
path: ./dist/windows-x64/lib/
if: false

- name: Download windows aarch64 artifacts
uses: actions/download-artifact@v4
with:
name: vmone-windows-aarch64
path: ./dist/windows-aarch64/lib/
if: false

- name: Zip downloaded artifacts
run: |
cd $GITHUB_WORKSPACE/dist/android-linux-aarch64/
zip -r ../vmone-android-linux-aarch64.zip lib/
cd $GITHUB_WORKSPACE/dist/ios-macos-aarch64/
zip -r ../vmone-ios-macos-aarch64.zip lib/
- name: Check downloads
cd $GITHUB_WORKSPACE/dist/linux-x64/
zip -r ../vmone-linux-x64.zip lib/
# cd $GITHUB_WORKSPACE/dist/macos-x64/
# zip -r ../vmone-macos-x64.zip lib/
cd $GITHUB_WORKSPACE/dist/macos-aarch64/
zip -r ../vmone-macos-aarch64.zip lib/
# cd $GITHUB_WORKSPACE/dist/windows-x64/
# zip -r ../vmone-windows-x64.zip lib/
# cd $GITHUB_WORKSPACE/dist/windows-aarch64/
# zip -r ../vmone-windows-aarch64.zip lib/
- name: Check zip files
run: |
pwd
ls -R ./dist/
- name: Release
uses: softprops/action-gh-release@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ lib/
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# Mac
.DS_Store
38 changes: 31 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ else ifeq ($(shell uname), Darwin)
OS := macosx
CC = gcc
CFLAGS = -DDARWIN $(INCLUDE_FLAGS)
else
OS := Unknown
else ifeq ($(shell uname), MINGW32_NT)
OS := windows
CC = gcc
CFLAGS = -DWIN32 -I$(JAVA)/include -I$(JAVA)/include/win32
endif

ifeq ($(TARGET), ios)
Expand All @@ -37,7 +39,7 @@ else ifeq ($(TARGET), android)
CC = $(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
CFLAGS = -target aarch64-linux-android \
-DANDROID
else
else
endif


Expand Down Expand Up @@ -68,22 +70,44 @@ OBJS = $(OBJS_C) $(OBJS_M)
JDKLIB = /tmp/libjdk.a
TEMP_DIR = /tmp/extractdir

LIB = $(LIBDIR)/$(OS)/staticjdk/lib/libvmone.a
ifeq ($(OS), windows)
JDKLIB := C:/path/to/libjdk.lib
LIB = $(LIBDIR)/windows/staticjdk/lib/libvmone.lib
AR = lib
ARFLAGS = /OUT:
else
LIB = $(LIBDIR)/$(OS)/staticjdk/lib/libvmone.a
AR = ar
ARFLAGS = rcs
endif

all: $(LIB)

$(LIB): $(OBJS)
@mkdir -p $(LIBDIR)/$(OS)/staticjdk/lib
ifeq ($(OS), windows)
if [ -s $(JDKLIB) ]; then \
echo "Including $(JDKLIB) in lib"; \
TMPDIR=$(LIBDIR)/$(OS)/temp_objs; \
mkdir -p $$TMPDIR; \
(cd $$TMPDIR && $(AR) x $(JDKLIB)); \
$(AR) $(ARFLAGS) $@ $$TMPDIR/*.o $^; \
else \
echo "Existing library not found. Creating static library with object files only."; \
$(AR) $(ARFLAGS) $@ $^; \
fi
else
if [ -s $(JDKLIB) ]; then \
echo "Including $(JDKLIB) in lib"; \
TMPDIR=$(LIBDIR)/$(OS)/temp_objs; \
mkdir -p $$TMPDIR; \
(cd $$TMPDIR && ar x $(JDKLIB)); \
ar rcs $@ $$TMPDIR/*.o $^; \
ar $(ARFLAGS) $@ $$TMPDIR/*.o $^; \
else \
echo "Existing library not found. Creating static library with object files only."; \
ar rcs $@ $^; \
ar $(ARFLAGS) $@ $^; \
fi
endif

debug:
@echo "OS: $(OS)"
Expand All @@ -106,4 +130,4 @@ $(OBJDIR)/$(OS)/%.o: $(SRCDIR)/darwin/%.m
#$(CC) $(CFLAGS) -c $< -o $@

clean:
rm -rf $(OBJDIR) $(LIBDIR)
rm -rf $(OBJDIR) $(LIBDIR)

0 comments on commit b257aba

Please sign in to comment.