chore: add arguments like target architecture
This commit is contained in:
parent
eeaf8e9698
commit
8f7558bac4
24
README.md
24
README.md
@ -84,7 +84,7 @@ Available recipes:
|
||||
expand # [alias: e]
|
||||
fmt # [alias: f]
|
||||
install # [alias: i]
|
||||
make-app # [alias: mkapp]
|
||||
make-app # [alias: mk, mkapp]
|
||||
package # [alias: p, pkg]
|
||||
run # [alias: ru]
|
||||
runtest # [alias: rt]
|
||||
@ -120,15 +120,15 @@ BIN_APP_PATH := "/usr/local/bin"
|
||||
|
||||
| Recipe | alias | Descripción | parameters |
|
||||
|--------|-------|--------------|--------------------|
|
||||
| **build** | b | run cargo | |
|
||||
| **buildall** | ba, ball | on MacOS: <br><ul><li>build target releases for aarch64, x86_64</li><li>create universal (apple-darwin)i with <u>lipo</u></li></ul>on Linux: <ul><li>build target release</li></ul> | |
|
||||
| **run** | ru | run cargo b -r | |
|
||||
| **expand** | e | run cargo expand | |
|
||||
| **fmt** | f | run cargo +nightly fmt | |
|
||||
| **clean** | cl | run cargo clean | |
|
||||
| **doc** | d | run cargo doc --open --no-deps | |
|
||||
| **benchmark** | be | run cargo bench | |
|
||||
| **test*** | be | run cargo t | |
|
||||
| **build** | b | run cargo | cargo arguments |
|
||||
| **buildall** | ba, ball | on MacOS: <br><ul><li>build target releases for aarch64, x86_64</li><li>create universal (apple-darwin)i with <u>lipo</u></li></ul>on Linux: <ul><li>build target release</li></ul> | architecture (arm64 or x86_64 or universal) |
|
||||
| **run** | ru | run cargo b -r | cargo arguments |
|
||||
| **expand** | e | run cargo expand | cargo arguments |
|
||||
| **fmt** | f | run cargo +nightly fmt | cargo arguments |
|
||||
| **clean** | cl | run cargo clean | cargo arguments |
|
||||
| **doc** | d | run cargo doc --open --no-deps | cargo arguments |
|
||||
| **benchmark** | be | run cargo bench | cargo arguments |
|
||||
| **test*** | be | run cargo t | cargo arguments |
|
||||
| **runtest** | rt | run [run.sh](run.sh) script using [test](test) directories for **SOURCE** and **DEST** parametets | |
|
||||
|
||||
## To work on app
|
||||
@ -136,7 +136,7 @@ BIN_APP_PATH := "/usr/local/bin"
|
||||
| Recipe | alias | Descripción | parameters |
|
||||
|--------|-------|--------------|--------------------|
|
||||
| **install** | i | on MacOS: <ul><li>install [dir-odt-to-pdf.app](macos/dir-odt-to-pdf.app)</li><li> **make-run** and install commands</li></ul>on Linux: <ul><li>**just make-run**</li><li>install commands</li></ul>| |
|
||||
| **make-app** | mkapp | on MacOS: <ul><li>make app [dir-odt-to-pdf.app](macos/dir-odt-to-pdf.app) in [macos](macos) directory</li><li>Add icons and commands</li></ul>on Linux: <ul><li>**just buildall**</li></ul> | |
|
||||
| **make-app** | mk , mkapp | on MacOS: <ul><li>make app [dir-odt-to-pdf.app](macos/dir-odt-to-pdf.app) in [macos](macos) directory</li><li>Add icons and commands</li></ul>on Linux: <ul><li>**just buildall**</li></ul> | architecture (arm64 or x86_64 or universal) |
|
||||
| **make-run** | | on MacOS: <ul><li>install [dir-odt-to-pdf.app](macos/dir-odt-to-pdf.app)</li><li>**just delete-run**</li><li>install commands</li></ul>on Linux: <ul><li>**just delete-run**</li><li>install commands</li></ul>| |
|
||||
| **delete-run** | | Ask for replace **run-dir-odt-to-pdf.sh** created from [run.sh](run.sh) | |
|
||||
| **package** | | on MacOS: <ul><li>**just make-app**</li><li>create **DirOdtToPdf.dmg** DMG package in [packages](packages)<br>with [macos README](macos/README) and [macos install](macos/install.command)</li></ul>on Linux: <ul><li>**just make-app**</li><li>pack binary in compressed archive<br> with [linux](linux) files and commands</li></ul> | |
|
||||
| **package** | | on MacOS: <ul><li>**just make-app**</li><li>create **DirOdtToPdf.dmg** DMG package in [packages](packages)<br>with [macos README](macos/README) and [macos install](macos/install.command)</li></ul>on Linux: <ul><li>**just make-app**</li><li>pack binary in compressed archive<br> with [linux](linux) files and commands</li></ul> | architecture (arm64 or x86_64 or universal) |
|
||||
|
92
justfile
92
justfile
@ -10,6 +10,7 @@ alias rt := runtest
|
||||
alias ru := run
|
||||
alias cl := clean
|
||||
alias mkapp := make-app
|
||||
alias mk := make-app
|
||||
alias i := install
|
||||
alias p := package
|
||||
alias pkg := package
|
||||
@ -28,39 +29,47 @@ SRC_MACOS := file_name(justfile_directory()) + ".scpt"
|
||||
RUN_SRC := "run.sh"
|
||||
BIN_APP_PATH := "/usr/local/bin"
|
||||
|
||||
set positional-arguments
|
||||
|
||||
default:
|
||||
@just -l
|
||||
|
||||
build:
|
||||
cargo build
|
||||
[positional-arguments]
|
||||
build *ARGS:
|
||||
cargo build {{ARGS}}
|
||||
|
||||
[linux]
|
||||
buildall:
|
||||
buildall *ARGS:
|
||||
@echo "Build {{BOLD + MAGENTA}}{{APP_NAME}}{{NORMAL}} ... "
|
||||
cargo build --release
|
||||
cargo build --release {{ARGS}}
|
||||
|
||||
[macos]
|
||||
buildall:
|
||||
@echo "\nBuild {{BOLD + MAGENTA}}{{APP_NAME}}{{NORMAL}} universal for {{BOLD + GREEN}}{{os()}}{{NORMAL}} architectures ... "
|
||||
@echo "\n{{BOLD + MAGENTA + INVERT}}Apple Silicon (arm64){{NORMAL}}"
|
||||
cargo build --target aarch64-apple-darwin --release
|
||||
@echo "\n{{BOLD + MAGENTA + INVERT}}Intel (x86_64){{NORMAL}} "
|
||||
cargo build --target x86_64-apple-darwin --release
|
||||
@if ! test -r target/apple-darwin/release ; then \
|
||||
buildall *ARGS:
|
||||
@if test -z {{ARGS}} || test {{ARGS}} = "universal" || test {{ARGS}} = "aarch64" || test {{ARGS}} = "arm64"; then \
|
||||
echo "\nBuild {{BOLD + MAGENTA}}{{APP_NAME}}{{NORMAL}} universal for {{BOLD + GREEN}}{{os()}}{{NORMAL}} architectures ... " ; \
|
||||
echo "\n{{BOLD + MAGENTA + INVERT}}Apple Silicon (arm64){{NORMAL}}" ;\
|
||||
cargo build --target aarch64-apple-darwin --release ;\
|
||||
fi
|
||||
@if test -z {{ARGS}} || test {{ARGS}} = "universal" || test {{ARGS}} = "x86_64" || test {{ARGS}} = "x86"; then \
|
||||
echo "\n{{BOLD + MAGENTA + INVERT}}Intel (x86_64){{NORMAL}} " ;\
|
||||
cargo build --target x86_64-apple-darwin --release ;\
|
||||
fi
|
||||
@if test -z {{ARGS}} || test {{ARGS}} = "universal" && ! test -r target/apple-darwin/release ; then \
|
||||
mkdir -p target/apple-darwin/release; \
|
||||
fi
|
||||
@if type -p lipo > /dev/null; then \
|
||||
@if test -z {{ARGS}} || test {{ARGS}} = "universal" && type -p lipo > /dev/null; then \
|
||||
lipo -create \
|
||||
-output target/apple-darwin/release/{{APP_NAME}} \
|
||||
target/aarch64-apple-darwin/release/{{APP_NAME}} \
|
||||
target/x86_64-apple-darwin/release/{{APP_NAME}} ; \
|
||||
fi
|
||||
@if test -r target/apple-darwin/release/{{APP_NAME}} ; then \
|
||||
@if test -z {{ARGS}} || test {{ARGS}} = "universal" && test -r target/apple-darwin/release/{{APP_NAME}} ; then \
|
||||
echo "\n{{BOLD + GREEN + INVERT}}target/apple-darwin/release/{{APP_NAME}}{{NORMAL}} created";\
|
||||
fi
|
||||
|
||||
[macos]
|
||||
make-app: buildall
|
||||
make-app *ARGS:
|
||||
@just buildall {{ARGS}}
|
||||
@if test -r {{MACOS_ROOT_PATH + SRC_MACOS}} ; then \
|
||||
echo "\n{{BOLD + GREEN + INVERT}}{{MACOS_APP_PATH}}{{NORMAL}}";\
|
||||
echo "creating from {{BOLD + MAGENTA}}{{MACOS_ROOT_PATH + SRC_MACOS}}{{NORMAL}}";\
|
||||
@ -77,9 +86,19 @@ make-app: buildall
|
||||
cp {{MACOS_APP_ICNS_PATH}} {{MACOS_ROOT_PATH + MACOS_APP_PATH + "/Contents/Resources/applet.icns"}}; \
|
||||
echo "\nCopy {{BOLD + MAGENTA}}{{MACOS_APP_ICNS_PATH}}{{NORMAL}} to {{BOLD + GREEN}}{{MACOS_APP_PATH + "/Contents/Resources/applet.icns"}}{{NORMAL}}";\
|
||||
fi
|
||||
@cd {{justfile_directory()}} && if test -r target/apple-darwin/release/{{APP_NAME}} ; then \
|
||||
@cd {{justfile_directory()}} && \
|
||||
if [[ "{{ARGS}}" == "aarch64" || "{{ARGS}}" == "arm64" && -r target/aarch64-apple-darwin/release/{{APP_NAME}} ]] ; then \
|
||||
cp {{'target/aarch64-apple-darwin/release/' + APP_NAME}} {{MACOS_ROOT_PATH + MACOS_APP_PATH + "/Contents/MacOS/" + APP_NAME}}; \
|
||||
echo "\n{{BOLD + GREEN + INVERT}}target/aarch64-apple-darwin/release/{{APP_NAME}}{{NORMAL}} to Contets/MacOS/{{APP_NAME}}";\
|
||||
elif [[ "{{ARGS}}" == "x86_64" || "{{ARGS}}" == "x86" && -r target/x86_64-apple-darwin/release/{{APP_NAME}} ]] ; then \
|
||||
cp {{'target/x86_64-apple-darwin/release/' + APP_NAME}} {{MACOS_ROOT_PATH + MACOS_APP_PATH + "/Contents/MacOS/" + APP_NAME}}; \
|
||||
echo "\n{{BOLD + GREEN + INVERT}}target/x86_64-apple-darwin/release/{{APP_NAME}}{{NORMAL}} to Contets/MacOS/{{APP_NAME}}"; \
|
||||
elif [[ -z "{{ARGS}}" || "{{ARGS}}" == "universal" && -r target/apple-darwin/release/{{APP_NAME}} ]]; then \
|
||||
cp {{'target/apple-darwin/release/' + APP_NAME}} {{MACOS_ROOT_PATH + MACOS_APP_PATH + "/Contents/MacOS/" + APP_NAME}}; \
|
||||
echo "\n{{BOLD + GREEN + INVERT}}target/apple-darwin/release/{{APP_NAME}}{{NORMAL}} to Contets/MacOS/{{APP_NAME}}";\
|
||||
else \
|
||||
echo "Arquitectura no válida: {{ARGS}}"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cd {{justfile_directory()}} && if test -r {{RUN_SRC}} ; then \
|
||||
cat {{RUN_SRC}} | sed 's,:-\.,:-{{justfile_directory()}},g' |\
|
||||
@ -89,10 +108,12 @@ make-app: buildall
|
||||
fi
|
||||
|
||||
[linux]
|
||||
make-app: buildall
|
||||
make-app *ARGS:
|
||||
@just buildall {{ARGS}}
|
||||
|
||||
[macos]
|
||||
package: make-app
|
||||
package *ARGS:
|
||||
@just make-app {{ARGS}}
|
||||
@if test -r {{'/Volumes/' + APP_PACKAGE}} ; then \
|
||||
hdiutil detach {{'/Volumes/' + APP_PACKAGE}}; \
|
||||
fi
|
||||
@ -155,7 +176,8 @@ package: make-app
|
||||
fi
|
||||
|
||||
[linux]
|
||||
package:
|
||||
package *ARGS:
|
||||
@just make-app {{ARGS}}
|
||||
@if test -r {{APP_PACKAGES_PATH + APP_PACKAGE}} ; then \
|
||||
rm -rf {{APP_PACKAGES_PATH + APP_PACKAGE}}; \
|
||||
fi
|
||||
@ -198,7 +220,8 @@ make-run:
|
||||
fi
|
||||
|
||||
[linux]
|
||||
install: make-app
|
||||
install *ARGS:
|
||||
@just make-app {{ARGS}}
|
||||
@echo "\nInstall {{BOLD + GREEN + INVERT}}{{BIN_APP_PATH}}{{NORMAL}}";
|
||||
@cd {{justfile_directory()}} && if test -r target/{{APP_NAME}} ; then \
|
||||
cp -p target/{{APP_NAME}} {{BIN_APP_PATH}};\
|
||||
@ -206,7 +229,8 @@ install: make-app
|
||||
fi
|
||||
|
||||
[macos]
|
||||
install: make-app
|
||||
install *ARGS:
|
||||
@just make-app {{ARGS}}
|
||||
@echo "\nInstall {{BOLD + GREEN + INVERT}}{{MACOS_APP_PATH}}{{NORMAL}}" >/tmp/i;
|
||||
@cd {{justfile_directory()}} && if test -r target/{{APP_NAME}} ; then \
|
||||
cp -p target/{{APP_NAME}} {{BIN_APP_PATH}};\
|
||||
@ -222,14 +246,14 @@ install: make-app
|
||||
fi
|
||||
@just make-run
|
||||
|
||||
test:
|
||||
cargo t
|
||||
test *ARGS:
|
||||
cargo t {{ARGS}}
|
||||
|
||||
expand:
|
||||
cargo expand
|
||||
expand *ARGS:
|
||||
cargo expand {{ARGS}}
|
||||
|
||||
benchmark:
|
||||
cargo bench
|
||||
benchmark *ARGS:
|
||||
cargo bench {{ARGS}}
|
||||
|
||||
runtest:
|
||||
@cd {{justfile_directory()}} && if test -d "test/documents" ; then \
|
||||
@ -239,14 +263,14 @@ runtest:
|
||||
./{{RUN_SRC}}; \
|
||||
fi
|
||||
|
||||
run:
|
||||
cargo b -r
|
||||
run *ARGS:
|
||||
cargo b -r {{ARGS}}
|
||||
|
||||
fmt:
|
||||
cargo +nightly fmt
|
||||
fmt *ARGS:
|
||||
cargo +nightly fmt {{ARGS}}
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
clean *ARGS:
|
||||
cargo clean {{ARGS}}
|
||||
|
||||
doc:
|
||||
cargo doc --open --no-deps
|
||||
doc *ARGS:
|
||||
cargo doc --open --no-deps {{ARGS}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user