Skip to content

Commit

Permalink
Builder: fixed support for overriding output location
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed May 15, 2024
1 parent 611b882 commit b20d5f6
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/siskin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ jobs:
- name: Test build multiple at once
run: ./siskin-windows-x86_64.exe test 1 2 "test-8 spaced"

- name: Test build with output override
run: |
./siskin-windows-x86_64.exe test --output new.exe test-1
./new.exe
- name: Test Rebol Preprocessor
run: |
./siskin-windows-x86_64.exe test test.r3
Expand All @@ -82,6 +87,11 @@ jobs:
- name: Test build 8 (MSVC)
run: ./siskin-windows-x86_64.exe test --msvc 8

- name: Test build 8 with output override (MSVC)
run: |
./siskin-windows-x86_64.exe test --msvc -o new.exe 8
./new.exe
- name: Test only single command
run: ./siskin-windows-x86_64.exe test list-dir

Expand Down Expand Up @@ -145,6 +155,11 @@ jobs:
- name: Test build multiple at once
run: ./siskin-linux-x86_64 test 1 2 "test-8 spaced"

- name: Test build with output override
run: |
./siskin-linux-x86_64 test --output new test-1
./new
- name: Test Rebol Preprocessor
run: |
./siskin-linux-x86_64 test test.r3
Expand Down Expand Up @@ -245,6 +260,11 @@ jobs:
- name: Test build multiple at once
run: ./siskin-macos-x86_64 test 1 2 "test-8 spaced"

- name: Test build with output override
run: |
./siskin-macos-x86_64 test --output new test-1
./new
- name: Test Rebol Preprocessor
run: |
./siskin-macos-x86_64 test test.r3
Expand Down
36 changes: 34 additions & 2 deletions tree/rebol/Siskin/siskin.reb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ nest-context: object [
timestamp: none
result: none
out-file: none
out-file-override: none
app-file: none ;; bundle output

defaults: context [
Expand Down Expand Up @@ -966,7 +967,12 @@ do-nest: closure/with/extern [
| 'update (update?: on)
| 'git-ssh (git-ssh?: on)
| 'no-upx (no-upx?: on)
| 'output set out-file: skip
| 'output set out-file-override: skip (
out-file-override: to-rebol-file out-file-override
unless abs-path? out-file-override [
insert out-file-override root-dir
]
)
]
;? args
parse args [
Expand All @@ -980,13 +986,23 @@ do-nest: closure/with/extern [
update?: false
git-ssh?: false
force-compiler: none
out-file-override: none
result-code: 0
)

any options
copy ids: some [integer! | file! | string!]
(
if all [
out-file-override
1 < length? ids
not dir? to-rebol-file out-file-override
][
print-error "Using output override for multiple targets!"
break
]
forall ids [
out-file: none
unless build-target ids/1 [break]
if all [
run-result?
Expand Down Expand Up @@ -1158,7 +1174,7 @@ build: function/with [
spec/:k: v
]
]
out-file: any [out-file spec/exe-file spec/name spec/target]
out-file: any [spec/exe-file spec/name spec/target]
if out-file [
out-file: to-rebol-file out-file
if abs-path? out-file [
Expand Down Expand Up @@ -1832,6 +1848,9 @@ finalize-build: closure/with [spec [map!] file [file! none!] /no-fail][
eval-cmd/v ["otool -L" out-file]
]
]
if out-file-override [
out-file: move-file out-file out-file-override
]
print-ready
return true
]
Expand Down Expand Up @@ -2627,3 +2646,16 @@ prepare-macos-bundle: function/with [
write contents-dir/Info.plist probe Info.plist

] :nest-context

move-file: function/with [src [file!] dst [file!]][
if all [dir?/check dst not dir?/check src][
;; moving a file to another directory keeping its name
dst: join dirize dst second split-path src
]
unless no-eval? [
delete dst
print-info ["Moving" as-green src 'to as-green dst]
rename src dst
]
dst
] :nest-context

0 comments on commit b20d5f6

Please sign in to comment.