Skip to content

Commit

Permalink
Merge pull request #272 from asv-soft/develop
Browse files Browse the repository at this point in the history
Merge develop into main
  • Loading branch information
asv-soft-u01 authored Jan 26, 2024
2 parents b5a56dc + 20cd806 commit ab79e81
Show file tree
Hide file tree
Showing 54 changed files with 1,020 additions and 261 deletions.
29 changes: 0 additions & 29 deletions build.bat

This file was deleted.

81 changes: 81 additions & 0 deletions linux_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

export PublishDir="$(pwd)"
export Version=$(grep 'ProductVersion' $PublishDir/../src/Asv.Drones.Gui.Custom.props | sed -e 's/^.*ProductVersion>\([^<]*\)<.*$/\1/')

check_and_install_package() {
package_name=$1
if ! dpkg -l | grep -qw $package_name; then
echo "Package $package_name is not installed. Installing..."
sudo apt-get update
sudo apt-get install -y $package_name
else
echo "Package $package_name already installed."
fi
}

build_deb_package() {
platform=$1
architecture="all"

case "$platform" in
"linux-arm")
architecture="armhf"
;;
"linux-arm64")
architecture="arm64"
;;
"linux-musl-x64" | "linux-x64")
architecture="amd64"
;;
esac

mkdir -p asv-drones/DEBIAN asv-drones/usr/bin asv-drones/usr/share/applications asv-drones/usr/share/icons

cp $PublishDir/../src/Asv.Drones.Gui/Assets/icon.png asv-drones/usr/share/icons/asv-drones.png

cat > asv-drones/usr/share/applications/asv-drones.desktop << EOF
[Desktop Entry]
Name=Asv.Drones
Icon=/usr/share/icons/asv-drones.png
Exec=asv-drones-$platform %u
Type=Application
Terminal=false
Categories=Utility;
EOF
chmod 755 asv-drones/usr/share/applications/asv-drones.desktop

cat > asv-drones/DEBIAN/control << EOF
Package: asv-drones
Version: $Version
Section: utils
Priority: optional
Architecture: $architecture
Maintainer: Asv.Soft <me@asv.me>
Description: Open source implementation of ground control station application for ArduPilot and PX4 autopilot.
EOF
chmod 755 asv-drones/DEBIAN/control

cp $PublishDir/$platform/app/asv-drones-$platform asv-drones/usr/bin

chmod 777 asv-drones/usr/bin/asv-drones-$platform

dpkg-deb --build asv-drones
sudo -S alien -r asv-drones.deb

cp asv-drones.deb $PublishDir/$platform/asv-drones-$platform.deb
cp *.rpm $PublishDir/$platform

rm -r asv-drones
rm -f *.deb
rm -f *.rpm
}

check_and_install_package alien

cd ~

build_deb_package linux-arm
build_deb_package linux-arm64
build_deb_package linux-musl-x64
build_deb_package linux-x64
46 changes: 46 additions & 0 deletions osx_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

export PublishDir="$(pwd)"
export Version=$(grep 'ProductVersion' $PublishDir/../src/Asv.Drones.Gui.Custom.props | sed -e 's/^.*ProductVersion>\([^<]*\)<.*$/\1/')

build_app_package() {
platform=$1

mkdir -p asv-drones.app/Contents/MacOS asv-drones.app/Contents/Resources asv-drones.app/Contents/Frameworks

cp $PublishDir/../src/Asv.Drones.Gui/Assets/icon.icns asv-drones.app/Contents/Resources
cp -a $PublishDir/$platform/app/. asv-drones.app/Contents/MacOS

chmod 777 asv-drones.app/Contents/MacOS/asv-drones-$platform

cat > asv-drones.app/Contents/Info.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>asv-drones-$platform</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.asv.drones</string>
<key>CFBundleName</key>
<string>Asv.Drones</string>
<key>CFBundleVersion</key>
<string>$Version</string>
<key>CFBundleShortVersionString</key>
<string>$Version</string>
</dict>
</plist>
EOF

tar -czvf asv-drones-$platform.tar.gz asv-drones.app
cp asv-drones-$platform.tar.gz $PublishDir/$platform
rm -r asv-drones.app
rm -r asv-drones-$platform.tar.gz
}

cd ~

build_app_package osx-arm64
build_app_package osx-x64
140 changes: 140 additions & 0 deletions publish.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
cd publish

for /d %%i in (".\*") do (
rmdir /s /q "%%i"
)

cd ../src/Asv.Drones.Gui.Desktop

dotnet publish -c Release -r win-arm --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/win-arm/app
dotnet publish -c Release -r win-arm64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/win-arm64/app
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/win-x64/app
dotnet publish -c Release -r win-x86 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/win-x86/app

dotnet publish -c Release -r linux-arm --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/linux-arm/app
dotnet publish -c Release -r linux-arm64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/linux-arm64/app
dotnet publish -c Release -r linux-musl-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/linux-musl-x64/app
dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/linux-x64/app

dotnet publish -c Release -r osx-arm64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/osx-arm64/app
dotnet publish -c Release -r osx-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ~/../../../publish/osx-x64/app

cd ../../publish
del /S *.pdb

cd win-arm/app
move Asv.Drones.Gui.Desktop.exe asv-drones-win-arm.exe
cd ../../win-arm64/app
move Asv.Drones.Gui.Desktop.exe asv-drones-win-arm64.exe
cd ../../win-x64/app
move Asv.Drones.Gui.Desktop.exe asv-drones-win-x64.exe
cd ../../win-x86/app
move Asv.Drones.Gui.Desktop.exe asv-drones-win-x86.exe

cd ../../linux-arm/app
move Asv.Drones.Gui.Desktop asv-drones-linux-arm
cd ../../linux-arm64/app
move Asv.Drones.Gui.Desktop asv-drones-linux-arm64
cd ../../linux-musl-x64/app
move Asv.Drones.Gui.Desktop asv-drones-linux-musl-x64
cd ../../linux-x64/app
move Asv.Drones.Gui.Desktop asv-drones-linux-x64

cd ../../osx-arm64/app
move Asv.Drones.Gui.Desktop asv-drones-osx-arm64
cd ../../osx-x64/app
move Asv.Drones.Gui.Desktop asv-drones-osx-x64
cd ../../..

setlocal enabledelayedexpansion

set "xmlFile=src\Asv.Drones.Gui.Custom.props"

for /f "tokens=2 delims=<> " %%a in ('findstr /i "<ProductVersion>" "%xmlFile%"') do (
set "productVersion=%%a"
)

set "issFile=win-arm-install.iss"

set "tempFile=%temp%\temp.iss"

for /f "tokens=*" %%a in ('type "%issFile%"') do (
set "line=%%a"

echo !line! | findstr /C:"#define MyAppVersion" > nul

if !errorlevel! == 0 (
echo #define MyAppVersion "%productVersion%" >> "%tempFile%"
) else (
echo !line! >> "%tempFile%"
)
)

move /y "%tempFile%" "%issFile%" > nul

set "issFile=win-arm64-install.iss"

set "tempFile=%temp%\temp.iss"

for /f "tokens=*" %%a in ('type "%issFile%"') do (
set "line=%%a"

echo !line! | findstr /C:"#define MyAppVersion" > nul

if !errorlevel! == 0 (
echo #define MyAppVersion "%productVersion%" >> "%tempFile%"
) else (
echo !line! >> "%tempFile%"
)
)

move /y "%tempFile%" "%issFile%" > nul

set "issFile=win-x64-install.iss"

set "tempFile=%temp%\temp.iss"

for /f "tokens=*" %%a in ('type "%issFile%"') do (
set "line=%%a"

echo !line! | findstr /C:"#define MyAppVersion" > nul

if !errorlevel! == 0 (
echo #define MyAppVersion "%productVersion%" >> "%tempFile%"
) else (
echo !line! >> "%tempFile%"
)
)

move /y "%tempFile%" "%issFile%" > nul

set "issFile=win-x86-install.iss"

set "tempFile=%temp%\temp.iss"

for /f "tokens=*" %%a in ('type "%issFile%"') do (
set "line=%%a"

echo !line! | findstr /C:"#define MyAppVersion" > nul

if !errorlevel! == 0 (
echo #define MyAppVersion "%productVersion%" >> "%tempFile%"
) else (
echo !line! >> "%tempFile%"
)
)

move /y "%tempFile%" "%issFile%" > nul

endlocal

cd publish

iscc ../win-arm-install.iss
iscc ../win-arm64-install.iss
iscc ../win-x86-install.iss
iscc ../win-x64-install.iss

wsl ../linux_packages.sh

wsl ../osx_packages.sh
6 changes: 6 additions & 0 deletions src/.run/Linux-arm.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Linux-arm" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="linux-arm" self_contained="true" target_folder="$PROJECT_DIR$/../publish/linux-arm/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions src/.run/Linux-arm64.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Linux-arm64" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="linux-arm64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/linux-arm64/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions src/.run/Linux-musl-x64.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Linux-musl-x64" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="linux-musl-x64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/linux-musl-x64/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions src/.run/Linux-x64.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Linux-x64" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="linux-x64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/linux-x64/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions src/.run/Osx-arm64.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Osx-arm64" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="osx-arm64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/osx-arm64/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions src/.run/Osx-x64.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Osx-x64" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="osx-x64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/osx-x64/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
16 changes: 16 additions & 0 deletions src/.run/Win-arm.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Win-arm" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release"
delete_existing_files="true"
include_native_libs_for_self_extract="true"
platform="Any CPU"
produce_single_file="true"
runtime="win-arm"
self_contained="true"
target_folder="$PROJECT_DIR$/../publish/win-arm/app"
target_framework="net7.0"
uuid_high="-6069974389149972757"
uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions src/.run/Win-arm64.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Win-arm64" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="win-arm64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/win-arm64/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions src/.run/Win-x64.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Win-x64" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="win-x64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/win-x64/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions src/.run/Win-x86.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Win-x86" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="win-x86" self_contained="true" target_folder="$PROJECT_DIR$/../publish/win-x86/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
Loading

0 comments on commit ab79e81

Please sign in to comment.