Initial commit
This commit is contained in:
+97
@@ -0,0 +1,97 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/windows,linux,macos,visualstudiocode
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,macos,visualstudiocode
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### macOS Patch ###
|
||||
# iCloud generated files
|
||||
*.icloud
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
### VisualStudioCode Patch ###
|
||||
# Ignore all local history of files
|
||||
.history
|
||||
.ionide
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/windows,linux,macos,visualstudiocode
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Alexander Loren (omgitsalexl)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
name: "Collect Dependencies"
|
||||
description: "Copies an executable's required non-system DLLs to an artifact directory"
|
||||
|
||||
inputs:
|
||||
executable:
|
||||
description: "Path to the executable"
|
||||
required: true
|
||||
|
||||
output:
|
||||
description: "Artifact output directory"
|
||||
required: false
|
||||
default: "artifacts"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
||||
steps:
|
||||
- name: Collect dependencies
|
||||
shell: powershell
|
||||
run: |
|
||||
"${{ github.action_path }}\collect.ps1" -Executable "${{ inputs.executable }}" -Output "${{ inputs.output }}"
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Executable,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[string]$Output = "artifacts"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (-not (Test-Path $Executable)) {
|
||||
throw "Executable does not exist: $Executable"
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $Output | Out-Null
|
||||
|
||||
$windowsDirectories = @(
|
||||
$env:WINDIR,
|
||||
(Join-Path $env:WINDIR "System32"),
|
||||
(Join-Path $env:WINDIR "SysWOW64")
|
||||
)
|
||||
|
||||
$processed = @{}
|
||||
|
||||
function Test-IsWindowsSystemDll {
|
||||
param(
|
||||
[string]$Name
|
||||
)
|
||||
|
||||
foreach ($directory in $windowsDirectories) {
|
||||
$path = Join-Path $directory $Name
|
||||
|
||||
if (Test-Path $path) {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
return $false
|
||||
}
|
||||
|
||||
function Find-Dependency {
|
||||
param(
|
||||
[string]$Name,
|
||||
[string]$BinaryDirectory
|
||||
)
|
||||
|
||||
$localPath = Join-Path $BinaryDirectory $Name
|
||||
|
||||
if (Test-Path $localPath) {
|
||||
return $localPath
|
||||
}
|
||||
|
||||
$command = Get-Command $Name -ErrorAction SilentlyContinue
|
||||
|
||||
if ($command) {
|
||||
return $command.Source
|
||||
}
|
||||
|
||||
return $null
|
||||
}
|
||||
|
||||
function Copy-Dependencies {
|
||||
param(
|
||||
[string]$Binary
|
||||
)
|
||||
|
||||
$binaryDirectory = Split-Path -Parent $Binary
|
||||
|
||||
$dependencies = dumpbin /DEPENDENTS $Binary |
|
||||
Select-String '^\s+.*\.dll$' |
|
||||
ForEach-Object { $_.Line.Trim() } |
|
||||
Sort-Object -Unique
|
||||
|
||||
foreach ($dll in $dependencies) {
|
||||
|
||||
$key = $dll.ToLowerInvariant()
|
||||
|
||||
if ($processed.ContainsKey($key)) {
|
||||
continue
|
||||
}
|
||||
|
||||
$processed[$key] = $true
|
||||
|
||||
if (Test-IsWindowsSystemDll $dll) {
|
||||
Write-Host "Skipping Windows system dependency: $dll"
|
||||
continue
|
||||
}
|
||||
|
||||
$source = Find-Dependency `
|
||||
-Name $dll `
|
||||
-BinaryDirectory $binaryDirectory
|
||||
|
||||
if (-not $source) {
|
||||
Write-Warning "Could not locate dependency: $dll"
|
||||
continue
|
||||
}
|
||||
|
||||
$destination = Join-Path $Output (Split-Path -Leaf $source)
|
||||
|
||||
if (-not (Test-Path $destination)) {
|
||||
Write-Host "Copying dependency: $source"
|
||||
Copy-Item $source $destination -Force
|
||||
}
|
||||
|
||||
Copy-Dependencies -Binary $source
|
||||
}
|
||||
}
|
||||
|
||||
Copy-Dependencies -Binary $Executable
|
||||
Reference in New Issue
Block a user