diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..64284b90 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +--- +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/make.ps1 b/.github/workflows/make.ps1 new file mode 100644 index 00000000..0f8c2d91 --- /dev/null +++ b/.github/workflows/make.ps1 @@ -0,0 +1,130 @@ +#!/usr/bin/env pwsh +############################################################################################################## + +Function Show-Usage { + " +Usage: pwsh -File $($PSCommandPath) [OPTIONS] +Options: + build Build program +" | Out-Host +} + +Function Build-Project { + New-Variable -Name VAR -Option Constant -Value @{ + Src = 'lazpaint' + Use = '.' + Pkg = 'use\components.txt' + } + If (! (Test-Path -Path $Var.Src)) { + 'Source do not find!' | Out-Host + Exit 1 + } + If (Test-Path -Path '.gitmodules') { + & git submodule update --init --recursive --force --remote | Out-Host + ".... [[$($LastExitCode)]] git submodule update" | Out-Host + } + @( + @{ + Cmd = 'lazbuild' + Url = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' + Path = "C:\Lazarus" + } + ) | Where-Object { ! (Test-Path -Path $_.Path) } | + ForEach-Object { + $_.Url | Request-File | Install-Program + $Env:PATH+=";$($_.Path)" + (Get-Command $_.Cmd).Source | Out-Host + } + If (Test-Path -Path $VAR.Use) { + If (Test-Path -Path $VAR.Pkg) { + Get-Content -Path $VAR.Pkg | + Where-Object { + ! (Test-Path -Path "$($VAR.Use)\$($_)") && + ! (& lazbuild --verbose-pkgsearch $_ ) && + ! (& lazbuild --add-package $_) + } | ForEach-Object { + Return @{ + Uri = "https://packages.lazarus-ide.org/$($_).zip" + Path = "$($VAR.Use)\$($_)" + OutFile = (New-TemporaryFile).FullName + } + } | ForEach-Object -Parallel { + Invoke-WebRequest -OutFile $_.OutFile -Uri $_.Uri + Expand-Archive -Path $_.OutFile -DestinationPath $_.Path + Remove-Item $_.OutFile + Return ".... download $($_.Uri)" + } | Out-Host + } + (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $VAR.Use).FullName | + ForEach-Object { + & lazbuild --add-package-link $_ | Out-Null + Return ".... [$($LastExitCode)] add package link $($_)" + } | Out-Host + } + Exit ( + (Get-ChildItem -Filter '*.lpi' -Recurse -File –Path $Var.Src).FullName | + Sort-Object | + ForEach-Object { + $Output = (& lazbuild --build-all --recursive --no-write-project --build-mode='release' $_) + $Result = @(".... [$($LastExitCode)] build project $($_)") + $exitCode = Switch ($LastExitCode) { + 0 { + $Result += $Output | Select-String -Pattern 'Linking' + 0 + } + Default { + $Result += $Output | Select-String -Pattern 'Error:', 'Fatal:' + 1 + } + } + $Result | Out-Host + Return $exitCode + } | Measure-Object -Sum + ).Sum +} + +Function Request-File { + While ($Input.MoveNext()) { + New-Variable -Name VAR -Option Constant -Value @{ + Uri = $Input.Current + OutFile = (Split-Path -Path $Input.Current -Leaf).Split('?')[0] + } + Invoke-WebRequest @VAR + Return $VAR.OutFile + } +} + +Function Install-Program { + While ($Input.MoveNext()) { + Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) { + 'msi' { + & msiexec /passive /package $Input.Current | Out-Null + } + Default { + & ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null + } + } + Remove-Item $Input.Current + } +} + +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 diff --git a/.github/workflows/make.sh b/.github/workflows/make.sh new file mode 100644 index 00000000..c38ce4e5 --- /dev/null +++ b/.github/workflows/make.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +function priv_clippit +( + cat <&2 + fi + declare -i errors=0 + while read -r; do + declare -A TMP=( + [out]=$(mktemp) + ) + if (lazbuild --build-all --recursive --no-write-project --build-mode='release' --widgetset='qt5' "${REPLY}" > "${TMP[out]}"); then + printf '\x1b[32m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" + grep --color='always' 'Linking' "${TMP[out]}" + else + printf '\x1b[31m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" + grep --color='always' --extended-regexp '(Error|Fatal):' "${TMP[out]}" + ((errors+=1)) + fi 1>&2 + rm "${TMP[out]}" + done < <(find "${VAR[src]}" -type 'f' -name '*.lpi' | sort) + find 'resources' -type 'f' -name '*.py' -printf '\033[32m\tlint files.py\t%p\033[0m\n' -exec \ + python3 -m pylint {} + 1>&2 + find "${VAR[src]}" -type 'f' -name '*.c' -printf '\033[32m\tlint files.c\t%p\033[0m\n' -exec \ + cppcheck --language=c --enable=warning,style --template=gcc {} + 1>&2 + find "${PWD}" -type 'f' -name '*.sh' -printf '\033[32m\tlint files.sh\t%p\033[0m\n' -exec \ + shellcheck --external-sources {} + 1>&2 + exit "${errors}" +) + +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/.github/workflows/make.yml b/.github/workflows/make.yml new file mode 100644 index 00000000..006d55cd --- /dev/null +++ b/.github/workflows/make.yml @@ -0,0 +1,49 @@ +--- +name: Make + +on: + schedule: + - cron: '0 0 1 * *' + push: + branches: + - "**" + pull_request: + branches: + - master + - main + +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 .github/workflows/make.sh build + + - name: Build on Windows + if: runner.os == 'Windows' + shell: powershell + run: pwsh -File .github/workflows/make.ps1 build + + - name: Archive + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + retention-days: 1 + path: src\bin\*.exe diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..fe8b2cba --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "use/bgracontrols"] + path = use/bgracontrols + url = git@github.com:bgrabitmap/bgracontrols.git +[submodule "use/bgrabitmap"] + path = use/bgrabitmap + url = git@github.com:bgrabitmap/bgrabitmap.git diff --git a/lazpaint/test_embedded/project1.lpi b/lazpaint/test_embedded/project1.lpi index 11e06e50..d06c50d8 100644 --- a/lazpaint/test_embedded/project1.lpi +++ b/lazpaint/test_embedded/project1.lpi @@ -1,10 +1,12 @@ - + - + + + @@ -12,18 +14,88 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + @@ -40,7 +112,7 @@ - + @@ -52,7 +124,7 @@ - + diff --git a/lazpaintcontrols/lcvectorialfillinterface.pas b/lazpaintcontrols/lcvectorialfillinterface.pas index 0237f5b2..fcb6e8f1 100644 --- a/lazpaintcontrols/lcvectorialfillinterface.pas +++ b/lazpaintcontrols/lcvectorialfillinterface.pas @@ -1407,6 +1407,6 @@ procedure TVectorialFillInterface.UpdateShapeFill(AShape: TVectorShape; end; begin - {$i fillimages.lrs} + {$i ../resources/fillimages.lrs} end. diff --git a/use/bgrabitmap b/use/bgrabitmap new file mode 160000 index 00000000..311fa8d5 --- /dev/null +++ b/use/bgrabitmap @@ -0,0 +1 @@ +Subproject commit 311fa8d5f9b2baabdb3490ded5f721e68ea67ae2 diff --git a/use/bgracontrols b/use/bgracontrols new file mode 160000 index 00000000..555c0df8 --- /dev/null +++ b/use/bgracontrols @@ -0,0 +1 @@ +Subproject commit 555c0df8e2c52c60a9099d1bfd7b14c19852d5a4