diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..23c4cb3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +--- +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml new file mode 100644 index 0000000..58aa0a1 --- /dev/null +++ b/.github/workflows/make.yml @@ -0,0 +1,39 @@ +--- +name: Make + +on: + push: + branches: + - "**" + pull_request: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ${{ matrix.os }} + timeout-minutes: 120 + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Build on Linux + if: runner.os == 'Linux' + shell: bash + run: bash -x make.sh build + + - name: Build on Windows + if: runner.os == 'Windows' + shell: powershell + run: pwsh -File make.ps1 build diff --git a/README.md b/README.md index c3342aa..203688e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,5 @@ CopyCommander is a tool for windows/linux to use queued file-copy/moves from one A manual can be found [here](src/how_to_use.txt) -If you do not have Lazarus you can directly download a precompiled binary from: - -https://www.corpsman.de/klickcounter.php?url=download/copycommander.zip +If you do not have Lazarus you can directly download a precompiled binary [from](https://www.corpsman.de/klickcounter.php?url=download/copycommander.zip). diff --git a/make.ps1 b/make.ps1 new file mode 100644 index 0000000..f43c4f0 --- /dev/null +++ b/make.ps1 @@ -0,0 +1,90 @@ +#!/usr/bin/env pwsh +############################################################################################################## + +Function Show-Usage { + Return " +Usage: pwsh -File $($PSCommandPath) [OPTIONS] +Options: + build Build program +" +} + +Function Request-File { + ForEach ($REPLY in $args) { + $params = @{ + Uri = $REPLY + OutFile = (Split-Path -Path $REPLY -Leaf).Split('?')[0] + } + Invoke-WebRequest @params | Out-Null + Return $params.OutFile + } +} + +Function Install-Program { + While ($Input.MoveNext()) { + Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) { + 'msi' { + & msiexec /passive /package $Input.Current | Out-Host + } + 'exe' { + & ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Host + } + } + Remove-Item $Input.Current + } +} + +Function Build-Project { + $VAR = @{ + Cmd = 'lazbuild' + Url = 'https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Windows%2064%20bits/Lazarus%203.6/lazarus-3.6-fpc-3.2.2-win64.exe?viasf=1' + Path = "C:\Lazarus" + } + Try { + Get-Command $VAR.Cmd + } Catch { + Request-File $VAR.Url | Install-Program + $env:PATH+=";$($VAR.Path)" + Get-Command $VAR.Cmd + } + If ( Test-Path -Path 'use\components.txt' ) { + & git submodule update --recursive --init | Out-Host + & git submodule update --recursive --remote | Out-Host + Get-Content -Path 'use\components.txt' | ForEach-Object { + If ((-not (& lazbuild --verbose-pkgsearch $_ | Out-Null)) -and + (-not (& lazbuild --add-package $_ | Out-Null)) -and + (-not (Test-Path -Path 'use\components.txt'))) { + $OutFile = Request-File "https://packages.lazarus-ide.org/$($_).zip" + Expand-Archive -Path $OutFile -DestinationPath "use\$($_)" -Force + Remove-Item $OutFile + } + } + Get-ChildItem -Filter '*.lpk' -Recurse -File –Path 'use' | ForEach-Object { + & lazbuild --add-package-link $_ | Out-Host + } + } + Get-ChildItem -Filter '*.lpi' -Recurse -File –Path 'src' | ForEach-Object { + & lazbuild --no-write-project --recursive --build-mode=release $_ | Out-Host + } +} + +Function Switch-Action { + $ErrorActionPreference = 'stop' + Set-PSDebug -Strict -Trace 1 + Invoke-ScriptAnalyzer -EnableExit -Path $PSCommandPath + If ($args.count -gt 0) { + Switch ($args[0]) { + 'build' { + Build-Project + } + Default { + Show-Usage + } + } + } Else { + Show-Usage + } +} + +############################################################################################################## +Switch-Action @args | Out-Null diff --git a/make.sh b/make.sh new file mode 100644 index 0000000..d762e5d --- /dev/null +++ b/make.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +function priv_clippit +( + cat </dev/null + unzip -o "${VAR[out]}" -d "use/${REPLY}" + rm --verbose "${VAR[out]}" + fi + done < 'use/components.txt' + find 'use' -type 'f' -name '*.lpk' -exec lazbuild --add-package-link {} + + fi + find 'src' -type 'f' -name '*.lpi' \ + -exec lazbuild --no-write-project --recursive --no-write-project --build-mode=release {} + 1>&2 +) + +function priv_main +( + set -euo pipefail + if ((${#})); then + case ${1} in + build) priv_lazbuild ;; + *) priv_clippit ;; + esac + else + priv_clippit + fi +) + +priv_main "${@}" >/dev/null diff --git a/src/CopyCommander2.lpi b/src/CopyCommander2.lpi index bf49eaa..21c4fac 100644 --- a/src/CopyCommander2.lpi +++ b/src/CopyCommander2.lpi @@ -16,8 +16,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/CopyCommander2.lpr b/src/CopyCommander2.lpr index 89decc2..439c28d 100644 --- a/src/CopyCommander2.lpr +++ b/src/CopyCommander2.lpr @@ -31,7 +31,7 @@ Begin RequireDerivedFormResource := True; - Application.Scaled := True; + Application.Scaled:=True; Application.Initialize; Application.CreateForm(TForm1, Form1); Application.CreateForm(TForm2, Form2);