-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcom.artemis_rgb.Artemis.yml
218 lines (183 loc) · 8.5 KB
/
com.artemis_rgb.Artemis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
id: com.artemis_rgb.Artemis
runtime: org.freedesktop.Platform
runtime-version: &runtime-version '23.08'
sdk: org.freedesktop.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.dotnet8
build-options:
prepend-path: /usr/lib/sdk/dotnet8/bin
append-ld-library-path: /usr/lib/sdk/dotnet8/lib
prepend-pkg-config-path: /usr/lib/sdk/dotnet8/lib/pkgconfig
command: run.sh
finish-args:
# TODO: Replace this with wayland and fallback-x11 once Wayland support
# becomes available:
# https://github.com/AvaloniaUI/Avalonia/pull/8003
- --socket=x11
- --device=dri
- --share=ipc
- --share=network
- --env=DOTNET_ROOT=/app/lib/dotnet
# Pass in full session bus access due to Avalonia being wacky about creating tray icons.
- --socket=session-bus
# Allow access to appindicator icons
- --talk-name=org.kde.StatusNotifierWatcher
- --talk-name=com.canonical.AppMenu.Registrar
modules:
- shared-modules/libusb/libusb.json
- name: libhidapi
buildsystem: cmake-ninja
sources:
- type: git
url: https://github.com/libusb/hidapi.git
tag: hidapi-0.14.0
commit: d3013f0af3f4029d82872c1a9487ea461a56dee4
x-checker-data:
type: json
url: https://api.github.com/repos/libusb/hidapi/releases/latest
tag-query: .tag_name
timestamp-query: .published_at
- name: wooting-analog-sdk
buildsystem: simple
only-arches:
- x86_64
build-commands:
- install -Dm755 wrapper/sdk/libwooting_analog_sdk.so "${FLATPAK_DEST}/lib/libwooting_analog_sdk.so"
sources:
- type: archive
url:
https://github.com/WootingKb/wooting-analog-sdk/releases/download/v0.8.0/wooting-analog-sdk-v0.8.0-x86_64-unknown-linux-gnu.tar.gz
sha512:
bb93460de0ad4096ba160469945f2ba0a35a081b604627059905a48f5d73ac68488fa568b9d7980be46778aa5be79ae3cb164f000c0c5f67cce29f4b45128663
strip-components: 0
x-checker-data:
type: json
url: https://api.github.com/repos/WootingKb/wooting-analog-sdk/releases/latest
version-query: .tag_name
url-query: .assets[] | select(.name|endswith("x86_64-unknown-linux-gnu.tar.gz"))
| .browser_download_url
- name: dotnet
buildsystem: simple
build-commands:
- /usr/lib/sdk/dotnet8/bin/install.sh
- name: artemis
buildsystem: simple
build-commands:
- |
# Set variables for output and build directories to be used later
PluginBuildDir="build/build-plugins"
StagingDir="build/build-artemis"
PluginStagingDir="$StagingDir/Plugins"
# Create build output and staging directories.
mkdir -p "$PluginBuildDir" "$StagingDir" "$PluginStagingDir"
function GetVersion {
# Attempt to recreate 'version' job step from gh-actions branch workflow:
# https://github.com/Artemis-RGB/Artemis/blob/feature/gh-actions/.github/workflows/nuget.yml
# Find the Artemis.Core.csproj file (adjust path if necessary)
CoreProjFile=$(find "Artemis/src" -type f -name "Artemis.Core.csproj")
# Change into the 'Artemis' directory where the git repository is located
pushd "Artemis" > /dev/null
# Get the branch name and replace '/' and '.' with '-'
BranchName=$(git rev-parse --abbrev-ref HEAD | sed 's/[\/.]/-/g')
# Get the date of the most recent commit in ISO 8601 format
LatestCommitDate=$(git log -1 --format=%cd --date=iso-strict)
# Extract just the date part (YYYY-MM-DD)
LatestCommitDateOnly=$(echo "$LatestCommitDate" | cut -d'T' -f1)
# Set MidnightUtc to midnight of the latest commit date
MidnightUtc="${LatestCommitDateOnly}T00:00:00Z"
# Set EndOfDayUtc to the end of the latest commit date
EndOfDayUtc="${LatestCommitDateOnly}T23:59:59Z"
# Calculate the number of commits on that date
NumberOfCommitsToday=$(git rev-list --count --since="$MidnightUtc" --until="$EndOfDayUtc" HEAD)
# Return to the previous directory
popd > /dev/null
# Format the date part as yyyy.MMdd based on the latest commit date
DatePart=$(date -u -d "$LatestCommitDateOnly" +"%Y.%m%d")
# Extract ApiVersion from the csproj file
ApiVersion=$(grep -oP '(?<=<PluginApiVersion>).*?(?=</PluginApiVersion>)' "$CoreProjFile")
# Construct the VersionNumber
VersionNumber="$ApiVersion.$DatePart.$NumberOfCommitsToday"
# If the branch name is not 'master' or 'HEAD', append it to the VersionNumber
if [ "$BranchName" != "master" ] && [ "$BranchName" != "HEAD" ]; then
VersionNumber="$VersionNumber-$BranchName"
fi
# Export the VersionNumber for use in build commands
export VersionNumber
}
# Build Artemis UI component
GetVersion
UIProjFile=$(find "Artemis/src" -type f -name "Artemis.UI.Linux.csproj")
dotnet publish --configuration Release -p:Version="$VersionNumber" --source ./nuget-sources --output "$StagingDir" --no-self-contained "$UIProjFile"
# Search for all plugin projects
PluginProjects=$(find "Artemis.Plugins/src" -type f -name "*.csproj")
# Function to build a single plugin
build_plugin() {
PluginProjFile="$1"
Name=$(basename -s .csproj "$PluginProjFile")
echo "Building Plugin $Name"
Output="$PluginBuildDir/$Name"
mkdir -p "$Output"
# Build the plugin
dotnet publish --configuration Release -p:Version="$VersionNumber" --source ./nuget-sources --output "$Output" --no-self-contained "$PluginProjFile"
# Zip the output
pushd "$Output" > /dev/null
zip -r "$Name.zip" .
popd > /dev/null
# Copy the zip to the staging directory
cp "$Output/$Name.zip" "$PluginStagingDir"
echo "Finished Building Plugin $Name"
}
# Export the function and variables if needed
export -f build_plugin
export PluginBuildDir StagingDir PluginStagingDir VersionNumber
# Initialize a counter for background jobs
MAX_JOBS="$(nproc --all)" # Adjust this number based on your CPU cores
current_jobs=0
for PluginProjFile in $PluginProjects; do
build_plugin "$PluginProjFile" &
((current_jobs+=1))
# If the number of background jobs reaches MAX_JOBS, wait for any to finish
if [[ "$current_jobs" -ge "$MAX_JOBS" ]]; then
wait -n
((current_jobs-=1))
fi
done
# Wait for all remaining background jobs to finish
wait
# Continue with the rest of your script
# Install Metainfo and desktop files
install -Dm644 com.artemis_rgb.Artemis.metainfo.xml "${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml"
install -Dm644 com.artemis_rgb.Artemis.desktop "${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop"
# Extract and install icons of various sizes
pushd "$StagingDir/Icons" > /dev/null
for size in 16x16 32x32 48x48 64x64 128x128 256x256; do
install -Dm644 "$size/apps/artemis.png" "${FLATPAK_DEST}/share/icons/hicolor/$size/apps/${FLATPAK_ID}.png"
done
popd > /dev/null
# Set executable bit on Artemis binary
chmod +x "$StagingDir/Artemis.UI.Linux"
# Install files to Flatpak staging folder.
cp -r --remove-destination "$StagingDir/." "${FLATPAK_DEST}/bin"
# Install Flatpak specific wrapper
install -Dm755 run.sh "${FLATPAK_DEST}/bin/run.sh"
sources:
- type: script
dest-filename: run.sh
commands:
- /app/bin/Artemis.UI.Linux --channel=none "$@"
- type: file
path: com.artemis_rgb.Artemis.desktop
- type: file
path: com.artemis_rgb.Artemis.metainfo.xml
- type: git
url: https://github.com/Artemis-RGB/Artemis.git
commit: 4c6ca9b511d45f8aea5533c31b091b98af118c14
dest: Artemis
disable-shallow-clone: true
- type: git
url: https://github.com/Artemis-RGB/Artemis.Plugins.git
commit: c574f62f255999a1460fc39d4d6885fd512b7db0
dest: Artemis.Plugins
disable-shallow-clone: true
- artemis-sources.json
- artemis-plugins-sources.json