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

fixes and updates #4

Merged
merged 15 commits into from
Oct 8, 2023
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
25 changes: 21 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
sudo DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
ca-certificates \
rpm \
openjdk-17-jdk \
openjdk-17-jdk-headless

Expand All @@ -70,20 +71,30 @@ jobs:
run: id;pwd;ls -al;./gradlew -Dorg.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64 packageUberJarForCurrentOS

- name: check jar
run: id;pwd;ls -hal ./build/compose/jars/trifa_material-linux-x64-1.0.0.jar
run: id;pwd;ls -hal ./build/compose/jars/trifa_material-linux-x64-*.jar

- name: check deb
run: id;pwd;ls -hal ./build/compose/binaries/main/deb/trifa-material_1.0.0-1_amd64.deb
run: id;pwd;ls -hal ./build/compose/binaries/main/deb/trifa-material_*-1_amd64.deb

- name: check rpm
run: id;pwd;ls -hal ./build/compose/binaries/main/rpm/trifa_material-*.x86_64.rpm


- name: Rename artifact for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
cp -v ./build/compose/binaries/main/deb/trifa-material_*_amd64.deb trifa-material_nightly.deb
cp -v ./build/compose/binaries/main/rpm/trifa_material-*.x86_64.rpm trifa-material_nightly.rpm
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: trifa-material_nightly.deb
path: trifa-material_nightly.deb
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: trifa-material_nightly.rpm
path: trifa-material_nightly.rpm
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
Expand All @@ -95,7 +106,7 @@ jobs:
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "trifa-material_nightly.deb"
artifacts: "trifa-material_nightly.deb,trifa-material_nightly.rpm"


build-macos-nightly-artifact:
Expand Down Expand Up @@ -195,11 +206,17 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
cp -v ./build/compose/binaries/main/msi/trifa*material*.msi trifa-material_nightly.msi
cp -v ./build/compose/binaries/main/exe/trifa_material-*.exe trifa-material_nightly.exe
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: trifa-material_nightly.msi
path: trifa-material_nightly.msi
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: trifa-material_nightly.exe
path: trifa-material_nightly.exe
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
Expand All @@ -211,6 +228,6 @@ jobs:
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "trifa-material_nightly.msi"
artifacts: "trifa-material_nightly.msi,trifa-material_nightly.exe"


2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.idea/
.run/
build/
.gradle/
savedata.tox
bin/
deps/
1 change: 1 addition & 0 deletions .localrun/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ubuntu_16.04_linux
ubuntu_18.04_linux
ll.sh
c-toxcore
ubuntu_20.04_linux/
26 changes: 26 additions & 0 deletions .localrun/Dockerfile_ub20
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get -y --force-yes install \
ca-certificates \
libconfig-dev \
wget \
unzip \
zip \
automake \
autotools-dev \
build-essential \
check \
checkinstall \
libtool \
pkg-config \
rsync \
git \
gdb \
nano \
yasm \
openjdk-17-jdk-headless

4 changes: 2 additions & 2 deletions .localrun/docker_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo "$_HOME_"
cd "$_HOME_" || exit


build_for='ubuntu:18.04
build_for='ubuntu:20.04
'


Expand Down Expand Up @@ -77,7 +77,7 @@ pkgs_Ubuntu_18_04="
gdb
nano
yasm
openjdk-11-jdk-headless
openjdk-17-jdk-headless
"

pkgs_Ubuntu_20_04="$pkgs_Ubuntu_18_04"
Expand Down
105 changes: 105 additions & 0 deletions .localrun/docker_linux_fast.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#! /bin/bash

_HOME2_=$(dirname "$0")
export _HOME2_
_HOME_=$(cd "$_HOME2_" || exit;pwd)
export _HOME_

echo "$_HOME_"
cd "$_HOME_" || exit

if [ "$1""x" == "buildx" ]; then
docker build -f Dockerfile_ub20 -t trifa_materia_002_ub20 .
exit 0
fi


build_for='ubuntu:20.04
'


for system_to_build_for in $build_for ; do

system_to_build_for_orig="$system_to_build_for"
system_to_build_for=$(echo "$system_to_build_for_orig" 2>/dev/null|tr ':' '_' 2>/dev/null)"_linux"

cd "$_HOME_"/ || exit
mkdir -p "$_HOME_"/"$system_to_build_for"/

# rm -Rf $_HOME_/"$system_to_build_for"/script 2>/dev/null
# rm -Rf $_HOME_/"$system_to_build_for"/workspace 2>/dev/null

mkdir -p "$_HOME_"/"$system_to_build_for"/artefacts
mkdir -p "$_HOME_"/"$system_to_build_for"/script
mkdir -p "$_HOME_"/"$system_to_build_for"/workspace

ls -al "$_HOME_"/"$system_to_build_for"/

rsync -a ../ --exclude=.localrun "$_HOME_"/"$system_to_build_for"/workspace/data
chmod a+rwx -R "$_HOME_"/"$system_to_build_for"/workspace/data

echo '#! /bin/bash


#------------------------

pwd
ls -al
id -a

mkdir -p /workspace/data/jni-c-toxcore/
cd /workspace/data/jni-c-toxcore/ || exit 1

ls -al

set -x

if [ "$1""x" == "localx" ]; then
../circle_scripts/deps_linux.sh local || exit 1
../circle_scripts/java_jni_lib_linux.sh local || exit 1
else
../circle_scripts/deps_linux.sh || exit 1
../circle_scripts/java_jni_lib_linux.sh || exit 1
fi


#------------------------


' > "$_HOME_"/"$system_to_build_for"/script/run.sh

if [ "$1""x" == "localx" ]; then
echo " ******* LOCAL *******"
echo " ******* LOCAL *******"
echo " ******* LOCAL *******"
docker run -ti --rm \
-v "$_HOME_"/"$system_to_build_for"/artefacts:/artefacts \
-v "$_HOME_"/"$system_to_build_for"/script:/script \
-v "$_HOME_"/"$system_to_build_for"/workspace:/workspace \
-v "$_HOME_"/"$system_to_build_for"/c-toxcore:/c-toxcore \
--net=host \
"trifa_materia_002_ub20" \
/bin/sh -c "apk add bash >/dev/null 2>/dev/null; /bin/bash /script/run.sh local"
if [ $? -ne 0 ]; then
echo "** ERROR **:$system_to_build_for_orig"
exit 1
else
echo "--SUCCESS--:$system_to_build_for_orig"
fi
else
docker run -ti --rm \
-v "$_HOME_"/"$system_to_build_for"/artefacts:/artefacts \
-v "$_HOME_"/"$system_to_build_for"/script:/script \
-v "$_HOME_"/"$system_to_build_for"/workspace:/workspace \
--net=host \
"trifa_materia_002_ub20" \
/bin/sh -c "apk add bash >/dev/null 2>/dev/null; /bin/bash /script/run.sh"
if [ $? -ne 0 ]; then
echo "** ERROR **:$system_to_build_for_orig"
exit 1
else
echo "--SUCCESS--:$system_to_build_for_orig"
fi
fi
done

24 changes: 24 additions & 0 deletions .run/desktopApp.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="desktopApp" type="GradleRunConfiguration" factoryName="Gradle" activateToolWindowBeforeRun="false">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="run" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
83 changes: 75 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import org.gradle.internal.impldep.org.codehaus.plexus.util.Os
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.de.undercouch.gradle.tasks.download.Download

plugins {
kotlin("jvm") version "1.9.10"
// kotlin("multiplatform") version "1.9.10"
id("org.jetbrains.compose") version "1.5.1"
kotlin("jvm")
// kotlin("multiplatform")
id("org.jetbrains.compose")
}

group = "com.zoffcc.applications.trifa_material"
version = "1.0.0-SNAPSHOT"
version = "1.0.0"
val appName = "trifa_material"

repositories {
mavenCentral()
Expand All @@ -21,6 +24,18 @@ dependencies {
// (in a separate module for demo project and in testMain).
// With compose.desktop.common you will also lose @Preview functionality
implementation(compose.desktop.currentOs)
implementation(compose.desktop.common)
implementation(compose.ui)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.material3)
@Suppress("OPT_IN_IS_NOT_ENABLED")
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
//
implementation("com.russhwolf:multiplatform-settings-no-arg:1.0.0")
implementation(compose.materialIconsExtended)
}

compose.desktop {
Expand All @@ -35,35 +50,87 @@ compose.desktop {
}

application {
mainClass = "com.zoffcc.applications.trifa.MainKt"
mainClass = "MainKt"
// jvmArgs += listOf("-Xmx2G")
// args += listOf("-customArgument")

nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "trifa_material"
packageVersion = "1.0.0"
packageName = appName
packageVersion = "${project.version}"
println("packageVersion=$packageVersion")
description = "TRIfA Material App"
copyright = "© 2023 Zoff. All rights reserved."
vendor = "Zoxcore"
licenseFile.set(project.file("LICENSE"))
println("licenseFile=" + project.file("LICENSE"))
appResourcesRootDir.set(project.layout.projectDirectory.dir("resources"))

targetFormats(
TargetFormat.Msi, TargetFormat.Exe,
TargetFormat.Dmg,
TargetFormat.Deb, TargetFormat.Rpm
) // , TargetFormat.AppImage)

val iconsRoot = project.file("resources")
println("iconsRoot=$iconsRoot")
macOS {
println("iconFile=" + iconsRoot.resolve("icon-mac.icns"))
iconFile.set(iconsRoot.resolve("icon-mac.icns"))
}
windows {
iconFile.set(iconsRoot.resolve("icon-windows.ico"))
println("iconFile=" + iconsRoot.resolve("icon-windows.ico"))
menuGroup = "TRIfA Material"
// see https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html
// and https://www.guidgen.com/
upgradeUuid = "7774da26-11dd-4ea4-bd08-f4950d252504"
}
linux {
iconFile.set(iconsRoot.resolve("icon-linux.png"))
println("iconFile=" + iconsRoot.resolve("icon-linux.png"))
}
}
}
}

val appImageTool = project.file("deps/appimagetool.AppImage")
val linuxAppDir = project.file("build/compose/binaries/main/app")
val desktopFile = project.file("resources/trifa_material.desktop")
val linuxIconFile = project.file("resources/icon-linux.png")

tasks {
val downloadAppImageBuilder by registering(Download::class) {
src("https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage")
dest(appImageTool)
overwrite(false)
doFirst {
exec {
commandLine("mkdir", "-p", "deps/")
}
}
doLast {
exec {
commandLine("chmod", "+x", "deps/appimagetool.AppImage")
}
}
}

val copyAppimageDesktopfile by registering(Exec::class) {
environment("ARCH", "x86_64")
commandLine("cp", "-v", desktopFile, linuxAppDir)
}

val copyAppimageIconfile by registering(Exec::class) {
environment("ARCH", "x86_64")
commandLine("cp", "-v", linuxIconFile, "${linuxAppDir}/${appName}")
}

val executeAppImageBuilder by registering(Exec::class) {
dependsOn(downloadAppImageBuilder)
// dependsOn(copyBuildToPackaging)
dependsOn(copyAppimageDesktopfile)
dependsOn(copyAppimageIconfile)
environment("ARCH", "x86_64")
commandLine(appImageTool, linuxAppDir, "$appName-${project.version}.AppImage")
}
}
Loading
Loading