From a2de068bcd45c06fde7d4f579e6fdacad7abc16c Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 26 Aug 2024 12:09:17 +0300 Subject: [PATCH 1/6] refactor(build): Bulk-copy build system overhaul from CaSILE --- .cargo/config.toml | 7 + .gitignore | 16 +- Cargo.toml | 2 +- Dockerfile | 79 ++++- LICENSE => LICENSE.md | 430 ++++++++++++------------ Makefile.am | 229 +++++-------- bootstrap.sh | 10 + build-aux/ax_add_am_macro.m4 | 29 ++ build-aux/ax_am_macros.m4 | 44 +++ build-aux/ax_append_to_file.m4 | 27 ++ build-aux/ax_print_to_file.m4 | 27 ++ build-aux/ax_python_module.m4 | 56 +++ build.rs => build-aux/build.rs | 2 +- build-aux/docker-glibc-workaround.sh | 42 --- build-aux/que_developer_mode.m4 | 19 ++ build-aux/que_dist_checksums.am | 21 ++ build-aux/que_dist_checksums.m4 | 20 ++ build-aux/que_docker_boilerplate.am | 28 ++ build-aux/que_docker_boilerplate.m4 | 18 + build-aux/que_git_version.am | 36 ++ build-aux/que_git_version.m4 | 26 ++ build-aux/que_progvar.m4 | 5 + build-aux/que_rust_boilerplate.am | 93 +++++ build-aux/que_rust_boilerplate.m4 | 42 +++ build-aux/que_shell_completion_dirs.am | 21 ++ build-aux/que_shell_completion_dirs.m4 | 54 +++ build-aux/que_transform_package_name.m4 | 18 + configure.ac | 169 ++++------ lib/fontship-entry.zsh.in | 12 + lib/make-shell.zsh.in | 97 ++++++ make-shell.zsh.in | 68 ---- rules/fontship.mk.in | 28 +- rules/functions.mk | 16 +- rules/rules.mk | 2 +- rules/ufo.mk | 6 +- src/lib.rs | 19 +- src/main.rs | 2 +- src/make/mod.rs | 2 + 38 files changed, 1202 insertions(+), 620 deletions(-) create mode 100644 .cargo/config.toml rename LICENSE => LICENSE.md (62%) create mode 100644 build-aux/ax_add_am_macro.m4 create mode 100644 build-aux/ax_am_macros.m4 create mode 100644 build-aux/ax_append_to_file.m4 create mode 100644 build-aux/ax_print_to_file.m4 create mode 100644 build-aux/ax_python_module.m4 rename build.rs => build-aux/build.rs (98%) delete mode 100755 build-aux/docker-glibc-workaround.sh create mode 100644 build-aux/que_developer_mode.m4 create mode 100644 build-aux/que_dist_checksums.am create mode 100644 build-aux/que_dist_checksums.m4 create mode 100644 build-aux/que_docker_boilerplate.am create mode 100644 build-aux/que_docker_boilerplate.m4 create mode 100644 build-aux/que_git_version.am create mode 100644 build-aux/que_git_version.m4 create mode 100644 build-aux/que_progvar.m4 create mode 100644 build-aux/que_rust_boilerplate.am create mode 100644 build-aux/que_rust_boilerplate.m4 create mode 100644 build-aux/que_shell_completion_dirs.am create mode 100644 build-aux/que_shell_completion_dirs.m4 create mode 100644 build-aux/que_transform_package_name.m4 create mode 100755 lib/fontship-entry.zsh.in create mode 100755 lib/make-shell.zsh.in delete mode 100755 make-shell.zsh.in diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..a563824 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,7 @@ +# Since autotools sets these and we are *not* forcing them here, this will not +# affect release builds. It will affect `cargo run`, `cargo clippy` and others +# making it easier to test locally since the Lua loader path and other +# resources will be relative to the current sources. +[env] +CONFIGURE_DATADIR = { value = "", relative = true } + diff --git a/.gitignore b/.gitignore index f1e9602..93eb3e9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,11 +3,15 @@ /fontship fontship-* fontship.1 +completions/* .version .version-prev -make-shell.zsh +.tarball-version rules/fontship.mk completions/* +!lib/*.in +lib/* +*.asc ### Editor cruft ### @@ -32,12 +36,22 @@ Makefile.in # http://www.gnu.org/software/autoconf autom4te.cache +/autoscan.log +/autoscan-*.log /aclocal.m4 +/compile +/config.guess +/config.h.in /config.log /config.status +/config.sub /configure +/aminclude.am +/configure.scan +/depcomp build-aux/install-sh build-aux/missing +/stamp-h1 ### Python ### # Byte-compiled / optimized / DLL files diff --git a/Cargo.toml b/Cargo.toml index 04409df..0025db9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ description = "A font development toolkit and collaborative work flow" homepage = "https://github.com/theleagueof/fontship" repository = "https://github.com/theleagueof/fontship" license = "AGPL-3" -build = "build.rs" +build = "build-aux/build.rs" [dependencies] colored = "2.0.0" diff --git a/Dockerfile b/Dockerfile index 16bfe39..27024e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,32 +4,52 @@ ARG ARCHTAG FROM docker.io/library/archlinux:$ARCHTAG AS base -# Monkey patch glibc to avoid issues with old kernels on hosts -RUN --mount=type=bind,target=/mp,source=build-aux/docker-glibc-workaround.sh /mp - # Setup Caleb’s hosted Arch repository with prebuilt dependencies RUN pacman-key --init && pacman-key --populate RUN sed -i /etc/pacman.conf -e \ - '/^.community/{n;n;s!^!\n\[alerque\]\nServer = https://arch.alerque.com/$arch\n!}' + '/^.extra/{n;n;s!^!\n\[alerque\]\nServer = https://arch.alerque.com/$arch\n!}' RUN pacman-key --recv-keys 63CC496475267693 && pacman-key --lsign-key 63CC496475267693 +# This hack can convince Docker its cache is obsolete; e.g. when the contents +# of downloaded resources have changed since being fetched. It's helpful to have +# this as a separate layer because it saves time for local builds. Incrementing +# this when pushing dependency updates to Caleb's Arch user repository or just +# when the remote Docker Hub builds die should be enough. +ARG DOCKER_HUB_CACHE=1 + ARG RUNTIME_DEPS -ARG BUILD_DEPS + +# Enable system locales for everything we have localizations for so tools like +# `date` will output matching localized strings. By default Arch Docker images +# have almost all locale data stripped out. This also makes it easier to +# rebuild custom Docker images with extra languages supported. +RUN sed -i -e '/^NoExtract.*locale/d' /etc/pacman.conf # Freshen all base system packages RUN pacman --needed --noconfirm -Syuq && yes | pacman -Sccq -# Install run-time dependecies +# Rebuild locale database after having enabled localization, added our +# supported locales, and making sure glibc *at least* has been updated without +# blocking locale files. +RUN pacman --noconfirm -Sq glibc && yes | pacman -Sccq +RUN grep -E '^(en)_' /usr/share/i18n/SUPPORTED > /etc/locale.gen +RUN locale-gen + +# Install run-time dependencies RUN pacman --needed --noconfirm -Sq $RUNTIME_DEPS && yes | pacman -Sccq +RUN chsh -s /usr/bin/zsh && echo 'autoload -U zmv' >> /etc/zsh/zprofile + # Setup separate image for build so we don’t bloat the final image FROM base AS builder -# Install build time dependecies +ARG BUILD_DEPS + +# Install build time dependencies RUN pacman --needed --noconfirm -Sq $BUILD_DEPS && yes | pacman -Sccq # Set at build time, forces Docker’s layer caching to reset at this point -ARG VCS_REF=0 +ARG REVISION COPY ./ /src WORKDIR /src @@ -39,21 +59,52 @@ WORKDIR /src RUN build-aux/bootstrap-docker.sh RUN ./bootstrap.sh -RUN ./configure +RUN ./configure --mandir='${prefix}/man' RUN make -RUN make check +RUN make check-version RUN make install DESTDIR=/pkgdir # Work around BuiltKit / buildx bug, they can’t copy to symlinks only dirs RUN mv /pkgdir/usr/local/{share/,}/man -FROM base AS final +# Same args as above, repeated because they went out of scope with FROM +ARG REVISION +ARG VERSION + +# Allow `su` with no root password so non-priv users can install dependencies +RUN sed -i -e '/.so$/s/$/ nullok/' /etc/pam.d/su + +# Set system locale to something other than 'C' that resolves to a real language +ENV LANG=en_US.UTF-8 + +# Make sure the current project volume can be manipulated inside Docker in +# spite of new default Git safety restrictions. We default the workdir to /data +# and suggest that to users but they are free to rearrange. More notably GH +# Actions injects a workdir of its choice externally at runtime and is subject +# to change, so we have to cover our bases. Everything inside the container has +# root permissions anyway so we're not really adding insecure surface area here. +RUN git config --system --add safe.directory '*' + +# Set user info for when Fontship commits directly, can of course be overridden +RUN git config --system user.name "Fontship" && \ + git config --system user.email "fontship@theleagueofmoveabletype.com" + +# Makeup for our Pandoc fork being sideloaded by giving it access to system Lua stuff +RUN ln -s /usr/{,/local}/lib/lua && ln -s /usr/{,local/}share/lua + +LABEL org.opencontainers.image.title="Fontship" +LABEL org.opencontainers.image.description="A containerized version of Fontship, a font development toolkit and collaborative work flow" +LABEL org.opencontainers.image.authors="Caleb Maclennan " +LABEL org.opencontainers.image.licenses="AGPL-3.0" +LABEL org.opencontainers.image.url="https://github.com/theleagueof/fontship/pkgs/container/fontship" +LABEL org.opencontainers.image.source="https://github.com/theleagueof/fontship" +LABEL org.opencontainers.image.version="v$VERSION" +LABEL org.opencontainers.image.revision="$REVISION" -LABEL maintainer="Caleb Maclennan " -LABEL version="$VCS_REF" COPY --from=builder /pkgdir / +COPY --from=builder /src/lib/fontship-entry.zsh /usr/local/bin RUN fontship --version WORKDIR /data -ENTRYPOINT ["fontship"] +ENTRYPOINT ["fontship-entry.zsh"] diff --git a/LICENSE b/LICENSE.md similarity index 62% rename from LICENSE rename to LICENSE.md index 0ad25db..4ef32f0 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,35 +1,37 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 +GNU Affero General Public License +================================= - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +_Version 3, 19 November 2007_ +_Copyright © 2007 Free Software Foundation, Inc. <>_ - Preamble +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. - The GNU Affero General Public License is a free, copyleft license for +## Preamble + +The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. - The licenses for most software and other practical works are designed +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. - When we speak of free software, we are referring to freedom, not +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer +Developers that use our General Public Licenses protect your rights +with two steps: **(1)** assert copyright on the software, and **(2)** offer you this License which gives you legal permission to copy, distribute and/or modify the software. - A secondary benefit of defending all users' freedom is that +A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and @@ -39,7 +41,7 @@ The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. - The GNU Affero General Public License is designed specifically to +The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the @@ -47,79 +49,79 @@ users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. - An older license, called the Affero General Public License and +An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. - The precise terms and conditions for copying, distribution and +The precise terms and conditions for copying, distribution and modification follow. - TERMS AND CONDITIONS +## TERMS AND CONDITIONS - 0. Definitions. +### 0. Definitions - "This License" refers to version 3 of the GNU Affero General Public License. +“This License” refers to version 3 of the GNU Affero General Public License. - "Copyright" also means copyright-like laws that apply to other kinds of +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. +“The Program” refers to any copyrightable work licensed under this +License. Each licensee is addressed as “you”. “Licensees” and +“recipients” may be individuals or organizations. - To "modify" a work means to copy from or adapt all or part of the work +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. +exact copy. The resulting work is called a “modified version” of the +earlier work or a work “based on” the earlier work. - A "covered work" means either the unmodified Program or a work based +A “covered work” means either the unmodified Program or a work based on the Program. - To "propagate" a work means to do anything with it that, without +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - To "convey" a work means any kind of propagation that enables other +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - An interactive user interface displays "Appropriate Legal Notices" +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) +feature that **(1)** displays an appropriate copyright notice, and **(2)** tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. - 1. Source Code. +### 1. Source Code - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source +The “source code” for a work means the preferred form of the work +for making modifications to it. “Object code” means any non-source form of a work. - A "Standard Interface" means an interface that either is an official +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of +The “System Libraries” of an executable work include anything, other +than the work as a whole, that **(a)** is included in the normal form of packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that +Component, and **(b)** serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component +“Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - The "Corresponding Source" for a work in object code form means all +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's @@ -132,16 +134,16 @@ linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - The Corresponding Source need not include anything that users +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - The Corresponding Source for a work in source code form is that +The Corresponding Source for a work in source code form is that same work. - 2. Basic Permissions. +### 2. Basic Permissions - All rights granted under this License are granted for the term of +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a @@ -149,7 +151,7 @@ covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. - You may make, run and propagate covered works that you do not +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you @@ -160,19 +162,19 @@ for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - Conveying under any other circumstances is permitted solely under +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. +### 3. Protecting Users' Legal Rights From Anti-Circumvention Law - No covered work shall be deemed part of an effective technological +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. - When you convey a covered work, you waive any legal power to forbid +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or @@ -180,9 +182,9 @@ modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. - 4. Conveying Verbatim Copies. +### 4. Conveying Verbatim Copies - You may convey verbatim copies of the Program's source code as you +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any @@ -190,104 +192,97 @@ non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. - You may charge any price or no price for each copy that you convey, +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. - 5. Conveying Modified Source Versions. +### 5. Conveying Modified Source Versions - You may convey a work based on the Program, or the modifications to +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent +* **a)** The work must carry prominent notices stating that you modified +it, and giving a relevant date. +* **b)** The work must carry prominent notices stating that it is +released under this License and any conditions added under section 7. +This requirement modifies the requirement in section 4 to +“keep intact all notices”. +* **c)** You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. +* **d)** If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not +“aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. - 6. Conveying Non-Source Forms. +### 6. Conveying Non-Source Forms - You may convey a covered work in object code form under the terms +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded +* **a)** Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. +* **b)** Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either **(1)** a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or **(2)** access to copy the +Corresponding Source from a network server at no charge. +* **c)** Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. +* **d)** Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. +* **e)** Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - A "User Product" is either (1) a "consumer product", which means any +A “User Product” is either **(1)** a “consumer product”, which means any tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation +or household purposes, or **(2)** anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a +product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product @@ -295,7 +290,7 @@ is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - "Installation Information" for a User Product means any methods, +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must @@ -303,7 +298,7 @@ suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - If you convey an object code work under this section in, or with, or +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a @@ -314,7 +309,7 @@ if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - The requirement to provide Installation Information does not include a +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a @@ -322,15 +317,15 @@ network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - Corresponding Source conveyed, and Installation Information provided, +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. - 7. Additional Terms. +### 7. Additional Terms - "Additional permissions" are terms that supplement the terms of this +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent @@ -339,42 +334,37 @@ apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - When you convey a copy of a covered work, you may at your option +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - Notwithstanding any other provision of this License, for material you +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you +* **a)** Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or +* **b)** Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or +* **c)** Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or +* **d)** Limiting the use for publicity purposes of names of licensors or +authors of the material; or +* **e)** Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or +* **f)** Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered “further +restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains @@ -383,46 +373,46 @@ License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - If you add terms to a covered work in accord with this section, you +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - Additional terms, permissive or non-permissive, may be stated in the +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. - 8. Termination. +### 8. Termination - You may not propagate or modify a covered work except as expressly +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated **(a)** provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright +finally terminates your license, and **(b)** permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - Moreover, your license from a particular copyright holder is +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - Termination of your rights under this section does not terminate the +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. - 9. Acceptance Not Required for Having Copies. +### 9. Acceptance Not Required for Having Copies - You are not required to accept this License in order to receive or +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, @@ -431,14 +421,14 @@ modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. - 10. Automatic Licensing of Downstream Recipients. +### 10. Automatic Licensing of Downstream Recipients - Each time you convey a covered work, the recipient automatically +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - An "entity transaction" is a transaction transferring control of an +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that @@ -448,7 +438,7 @@ give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - You may not impose any further restrictions on the exercise of the +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation @@ -456,49 +446,49 @@ rights granted under this License, and you may not initiate litigation any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. - 11. Patents. +### 11. Patents - A "contributor" is a copyright holder who authorizes use under this +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". +work thus licensed is called the contributor's “contributor version”. - A contributor's "essential patent claims" are all patent claims +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant +purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - Each contributor grants you a non-exclusive, worldwide, royalty-free +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - In the following three paragraphs, a "patent license" is any express +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a +sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - If you convey a covered work, knowingly relying on a patent license, +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner +then you must either **(1)** cause the Corresponding Source to be so +available, or **(2)** arrange to deprive yourself of the benefit of the +patent license for this particular work, or **(3)** arrange, in a manner consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have +license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - If, pursuant to or in connection with a single transaction or +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify @@ -506,7 +496,7 @@ or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - A patent license is "discriminatory" if it does not include within +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered @@ -515,19 +505,19 @@ in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily +patent license **(a)** in connection with copies of the covered work +conveyed by you (or copies made from those copies), or **(b)** primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - Nothing in this License shall be construed as excluding or limiting +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. - 12. No Surrender of Others' Freedom. +### 12. No Surrender of Others' Freedom - If conditions are imposed on you (whether by court order, agreement or +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this @@ -537,9 +527,9 @@ to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - 13. Remote Network Interaction; Use with the GNU General Public License. +### 13. Remote Network Interaction; Use with the GNU General Public License - Notwithstanding any other provision of this License, if you modify the +Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding @@ -550,7 +540,7 @@ shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. - Notwithstanding any other provision of this License, you have +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this @@ -558,46 +548,46 @@ License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. - 14. Revised Versions of this License. +### 14. Revised Versions of this License - The Free Software Foundation may publish revised and/or new versions of +The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - Each version is given a distinguishing version number. If the +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the +Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. - If the Program specifies that a proxy can decide which future +If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - Later license versions may give you additional or different +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. - 15. Disclaimer of Warranty. +### 15. Disclaimer of Warranty - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - 16. Limitation of Liability. +### 16. Limitation of Liability - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE @@ -607,34 +597,34 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - 17. Interpretation of Sections 15 and 16. +### 17. Interpretation of Sections 15 and 16 - If the disclaimer of warranty and limitation of liability provided +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - END OF TERMS AND CONDITIONS +_END OF TERMS AND CONDITIONS_ - How to Apply These Terms to Your New Programs +## How to Apply These Terms to Your New Programs - If you develop a new program, and you want it to be of the greatest +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - To do so, attach the following notices to the program. It is safest +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. +the “copyright” line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -643,19 +633,19 @@ the "copyright" line and a pointer to where the full notice is found. GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. - If your software can interact with users remotely through a computer +If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive +interface could display a “Source” link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. +You should also get your employer (if you work as a programmer) or school, +if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see -. +<>. diff --git a/Makefile.am b/Makefile.am index 2cbc826..c9fa163 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,108 +1,47 @@ -$(and $(word 2,$(MAKEFILE_LIST)),$(error This is not the makefile you should include in your project to run Fontship, please use 'rules/fontship.mk' instead.)) - ACLOCAL_AMFLAGS = -I build-aux +AM_DISTCHECK_CONFIGURE_FLAGS = --enable-developer-mode .ONESHELL: .SECONDARY: .SECONDEXPANSION: .DELETE_ON_ERROR: -licensedir = $(datarootdir)/licenses/$(TRANSFORMED_PACKAGE_NAME) docdir = $(datarootdir)/doc/$(TRANSFORMED_PACKAGE_NAME) +licensedir = $(datarootdir)/licenses/$(TRANSFORMED_PACKAGE_NAME) datadir = $(datarootdir)/$(TRANSFORMED_PACKAGE_NAME) pkgdatadir = $(datadir) -pkgdata_SCRIPTS = make-shell.zsh dist_doc_DATA = README.md CHANGELOG.md -dist_license_DATA = LICENSE +dist_license_DATA = LICENSE.md dist_man_MANS = fontship.1 nobase_data_DATA = rules/fontship.mk nobase_dist_data_DATA = rules/rules.mk rules/functions.mk rules/glyphs.mk rules/sfd.mk rules/ufo.mk -bin_PROGRAMS = fontship _fontship_libs = src/lib.rs src/cli.rs src/config.rs src/i18n.rs _fontship_modules = src/make/mod.rs src/setup/mod.rs src/status/mod.rs _fontship_assets = assets/en-US/cli.ftl -fontship_SOURCES = Cargo.toml build.rs src/main.rs $(_fontship_libs) $(_fontship_modules) $(_fontship_assets) +bin_PROGRAMS = fontship +fontship_SOURCES = src/main.rs $(_fontship_libs) $(_fontship_modules) $(_fontship_assets) EXTRA_fontship_SOURCES = Cargo.lock EXTRA_DIST = requirements.txt EXTRA_DIST += build-aux/action-updater.js build-aux/cargo-updater.js build-aux/git-version-gen -EXTRA_DIST += Dockerfile build-aux/bootstrap-docker.sh build-aux/docker-glibc-workaround.sh hooks/build - -BUILT_SOURCES = .version -CLEANFILES = $(BUILT_SOURCES) .version-prev $(bin_PROGRAMS) - -if DEBUG_RELEASE -CARGO_RELEASE_ARGS=--all-features -else -CARGO_RELEASE_ARGS=--release --locked --all-features -endif - -CARGO_ENV = CARGO_TARGET_DIR=@abs_top_builddir@/target -RUST_BIN = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/$(PACKAGE_NAME) -_RUST_OUT = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/.cargo_out_dir -COMPLETIONS_OUT_DIR = completions - -if ENABLE_BASH_COMPLETION -bashcompletiondir = $(BASH_COMPLETION_DIR) -nodist_bashcompletion_DATA = $(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME) -CLEANFILES += $(nodist_bashcompletion_DATA) -endif - -if ENABLE_FISH_COMPLETION -fishcompletiondir = $(FISH_COMPLETION_DIR) -nodist_fishcompletion_DATA = $(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME).fish -CLEANFILES += $(nodist_fishcompletion_DATA) -endif - -if ENABLE_ZSH_COMPLETION -zshcompletiondir = $(ZSH_COMPLETION_DIR) -nodist_zshcompletion_DATA = $(COMPLETIONS_OUT_DIR)/_$(TRANSFORMED_PACKAGE_NAME) -CLEANFILES += $(nodist_zshcompletion_DATA) -endif - -export FONTSHIP_VERSION = v$(VERSION) - -# Leave some tips for cargo to use so CLI knows where it is -export CONFIGURE_PREFIX = $(prefix)/ -export CONFIGURE_DATADIR = $(datadir)/ -export CONFIGURE_BINDIR = $(bindir)/ - -CARGO_VERBOSE = $(cargo_verbose_$(V)) -cargo_verbose_ = $(cargo_verbose_$(AM_DEFAULT_VERBOSITY)) -cargo_verbose_0 = -cargo_verbose_1 = --verbose - -$(COMPLETIONS_OUT_DIR): - mkdir -p $@ - -$(PACKAGE_NAME)$(EXEEXT): $(RUST_BIN) - install $< $@ - -$(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME): $(RUST_BIN) | $(COMPLETIONS_OUT_DIR) - install $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/$(PACKAGE_NAME).bash $@ - -$(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME).elv: $(RUST_BIN) | $(COMPLETIONS_OUT_DIR) - install $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/$(PACKAGE_NAME).elv $@ +EXTRA_DIST += Dockerfile build-aux/bootstrap-docker.sh hooks/build -$(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME).fish: $(RUST_BIN) | $(COMPLETIONS_OUT_DIR) - install $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/$(PACKAGE_NAME).fish $@ +BUILT_SOURCES = -$(COMPLETIONS_OUT_DIR)/_$(TRANSFORMED_PACKAGE_NAME).ps1: $(RUST_BIN) | $(COMPLETIONS_OUT_DIR) - install $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/_$(PACKAGE_NAME).ps1 $@ +CLEANFILES = -$(COMPLETIONS_OUT_DIR)/_$(TRANSFORMED_PACKAGE_NAME): $(RUST_BIN) | $(COMPLETIONS_OUT_DIR) - install $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/_$(PACKAGE_NAME) $@ +DISTCLEANFILES = @AMINCLUDE@ -$(_RUST_OUT) $(RUST_BIN): $(fontship_SOURCES) $(EXTRA_fontship_SOURCES) clean-embedded-assets - cd $(top_srcdir) - $(CARGO_ENV) $(CARGO) build $(CARGO_VERBOSE) $(CARGO_RELEASE_ARGS) - $(CARGO_ENV) $(CARGO) build --quiet --message-format=json $(CARGO_RELEASE_ARGS) | - $(JQ) -sr 'map(select(.reason == "build-script-executed")) | last | .out_dir' > $(_RUST_OUT) +# A classical use of the autoconf-archive include macro would expand +# INC_AMINCLUDE here, but the perl script that inlines include statements +# runs before the automake that organizes logic and performs substitution. +# Consequentially with a substitution here it becomes impossible to use +# automake conditionals and substitutions in the included Makefile fragments. +# By entering the expanded value directly we are ready in time for the inlining +# functionality and hence can use conditionals in included makefile fragments. +include $(top_srcdir)/aminclude.am -.version: $(shell $(AWK) '{print ".git/" $$2}' .git/HEAD 2>/dev/null ||:) - [ -e "$@" ] && mv "$@" "$@-prev" || $(if $<,touch,cp "$(srcdir)/.tarball-version") "$@-prev" - $(if $<,./build-aux/git-version-gen "$(srcdir)/.tarball-version",printf "$(VERSION)") > "$@" - $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force +CLEANFILES += $(bin_PROGRAMS) .PHONY: clean-embedded-assets clean-embedded-assets: @@ -110,58 +49,6 @@ clean-embedded-assets: dist: fontship-$(VERSION).md -dist-hook: - printf "$(VERSION)" > "$(distdir)/.tarball-version" - -clean-local: - cd $(top_srcdir) - $(CARGO_ENV) $(CARGO) clean - -check-local: cargo-test check-version - -cargo-test: $(PACKAGE_NAME)$(EXEEXT) - cd $(srcdir) - $(CARGO_ENV) $(CARGO) test --locked - -check-version: $(PACKAGE_NAME)$(EXEEXT) | .version - ./$< --version | $(GREP) -Ff $| - -installcheck-local: - ./$(TRANSFORMED_PACKAGE_NAME) --version - -.PHONY: lint -lint: rustfmt clippy - -.PHONY: rustfmt -rustfmt: - $(GIT) ls-files '*.rs' | $(XARGS) rustfmt --check - -.PHONY: clippy -clippy: - cd $(srcdir) - $(CARGO_ENV) $(CARGO) clippy -- -D warnings - -RELTYPE ?= - -.PHONY: tagrelease -tagrelease: - test -z $$($(GIT) tag --points-at HEAD) || \ - $(GIT) diff-index --quiet --cached HEAD && \ - $(GIT) diff-files --quiet && \ - npm run release -- $(and $(RELTYPE),--release-as $(RELTYPE)) - -.PHONY: release-preview -release-preview: - npm run release -- --dry-run $(and $(RELTYPE),--release-as $(RELTYPE)) - -.PHONY: release -release: tagrelease - -CLEANFILES += $(PACKAGE_NAME)-$(VERSION).md -$(PACKAGE_NAME)-%.md: CHANGELOG.md - $(SED) -e '/\.\.\.v$*/,/\.\.\.v/!d' $< | \ - $(SED) -e '1,3d;N;$$!P;$$!D;$$d' > $@ - _svg_cleanup = select-all;object-to-path;vacuum-defs _scour_args = --quiet --set-precision=4 --remove-metadata --enable-id-stripping --strip-xml-prolog --strip-xml-space --no-line-breaks --no-renderer-workaround @@ -198,24 +85,76 @@ media_badge: media/badge.svg @svgo --datauri base64 --multipass --quiet -i $< -o - @echo ================= +dist: fontship-$(VERSION).md + +fontship-%.md: CHANGELOG.md + $(SED) -e '/\.\.\.v$*/,/\.\.\.v/!d' $< | \ + $(SED) -e '1,3d;N;$$!P;$$!D;$$d' > $@ + +PHONY_DEVELOPER_TARGETS = lint checkmake ruff +PHONY_DEVELOPER_TARGETS += tagrelease release-preview release +PHONY_DEVELOPER_TARGETS += docker docker-dep-check docker-ghcr-to-hub docker-build-push +.PHONY: $(PHONY_DEVELOPER_TARGETS) + +if DEVELOPER_MODE + +lint: checkmake ruff ruff-format + +checkmake: + $(GIT) ls-files 'rules/*.mk' 'rules/*.mk.in' | $(XARGS) -n1 checkmake + +ruff: + $(GIT) ls-files '*.py' '*.py.in' | $(XARGS) $(RUFF) check + +ruff-format: + $(GIT) ls-files '*.py' '*.py.in' | $(XARGS) $(RUFF) format --check + +RELTYPE ?= + +tagrelease: + test -z $$($(GIT) tag --points-at HEAD) || \ + $(GIT) diff-index --quiet --cached HEAD && \ + $(GIT) diff-files --quiet && \ + $(NPM) run release --preMajor $(and $(RELTYPE),--release-as $(RELTYPE)) + +release-preview: + $(NPM) run release --preMajor --dry-run $(and $(RELTYPE),--release-as $(RELTYPE)) + +release: tagrelease + +export GHCR_REGISTRY ?= ghcr.io +export GHCR_REPO ?= sile-typesetter/$(TRANSFORMED_PACKAGE_NAME) + export DOCKER_REGISTRY ?= docker.io export DOCKER_REPO ?= theleagueof/$(TRANSFORMED_PACKAGE_NAME) export DOCKER_TAG ?= HEAD -.PHONY: docker docker: Dockerfile hooks/build .version ./hooks/build $(VERSION) -.PHONY: docker-build-push -docker-build-push: docker - docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG) - test -z "$(DOCKER_PAT)" || \ - docker login https://$(DOCKER_REGISTRY) -u $(DOCKER_USERNAME) -p $(DOCKER_PAT) - docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG) - if [[ "$(DOCKER_TAG)" == v*.*.* ]]; then \ - tag=$(DOCKER_TAG) ;\ - docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):latest ;\ - docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):$${tag//.*} ;\ - docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):latest ;\ - docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):$${tag//.*} ;\ - fi +docker-dep-check: .docker_deps .aur_deps + $(DIFF) -u $^ + +CLEANFILES += .docker_deps +.docker_deps: hooks/build + $(SHELL) -c 'source <($(SED) -nE "/^(RUN|'"'"')/{s/.*=/echo /;p}" $<)' | \ + $(TR) ' ' '\n' | \ + $(SORT) > $@ + +CLEANFILES += .aur_deps +.aur_deps: + $(CURL) -Ls 'https://aur.archlinux.org/cgit/aur.git/plain/.SRCINFO?h=fontship-git' | \ + $(SED) -nE '/\bdepends =/{s/.*= //;p}' | \ + $(GREP) -v 'so.$$' | \ + $(SORT) > $@ + +docker-ghcr-to-hub: + $(DOCKER) pull $(GHCR_REGISTRY)/$(GHCR_REPO):$(DOCKER_TAG) + $(DOCKER) tag $(GHCR_REGISTRY)/$(GHCR_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG) + +else !DEVELOPER_MODE + +$(PHONY_DEVELOPER_TARGETS): + @: $(error "Please reconfigure using --enable-developer-mode to use developer tooling") + +endif !DEVELOPER_MODE diff --git a/bootstrap.sh b/bootstrap.sh index 0d8d284..4d621dd 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -21,4 +21,14 @@ else ./build-aux/git-version-gen .tarball-version > .version fi +# Autoreconf uses a perl script to inline includes from Makefile.am into +# Makefile.in before ./configure is ever run even once ... which typically +# means AX_AUTOMAKE_MACROS forfeit access to substitutions or conditional logic +# because they enter the picture after those steps. We're intentionally using +# the expanded value of @INC_AMINCLUDE@ directly so the include will be +# inlined. To bootstrap, we must pre-seed an empty file to avoid a 'file not +# found' error on first run. Subsequently running ./configure will generate the +# content based on configure flags and also get re-inlined into Makefile.in. +touch aminclude.am + autoreconf --install diff --git a/build-aux/ax_add_am_macro.m4 b/build-aux/ax_add_am_macro.m4 new file mode 100644 index 0000000..3962002 --- /dev/null +++ b/build-aux/ax_add_am_macro.m4 @@ -0,0 +1,29 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_add_am_macro.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_ADD_AM_MACRO([RULE]) +# +# DESCRIPTION +# +# Adds the specified rule to $AMINCLUDE. This macro will only work +# properly with implementations of Make which allow include statements. +# See also AX_ADD_AM_MACRO_STATIC. +# +# LICENSE +# +# Copyright (c) 2009 Tom Howard +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 10 + +AC_DEFUN([AX_ADD_AM_MACRO],[ + AC_REQUIRE([AX_AM_MACROS]) + AX_APPEND_TO_FILE([$AMINCLUDE],[$1]) +]) diff --git a/build-aux/ax_am_macros.m4 b/build-aux/ax_am_macros.m4 new file mode 100644 index 0000000..36c3ab6 --- /dev/null +++ b/build-aux/ax_am_macros.m4 @@ -0,0 +1,44 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_am_macros.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_AM_MACROS +# +# DESCRIPTION +# +# Adds support for macros that create Make rules. You must manually add +# the following line +# +# @INC_AMINCLUDE@ +# +# to your Makefile.in (or Makefile.am if you use Automake) files. +# +# LICENSE +# +# Copyright (c) 2009 Tom Howard +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 11 + +AC_DEFUN([AX_AM_MACROS], +[ +AC_MSG_NOTICE([adding automake macro support]) +AMINCLUDE="aminclude.am" +AC_SUBST(AMINCLUDE) +AC_MSG_NOTICE([creating $AMINCLUDE]) +AMINCLUDE_TIME=`LC_ALL=C date` +AX_PRINT_TO_FILE([$AMINCLUDE],[[ +# generated automatically by configure from AX_AUTOMAKE_MACROS +# on $AMINCLUDE_TIME + +]]) + +INC_AMINCLUDE="include \$(top_builddir)/$AMINCLUDE" +AC_SUBST(INC_AMINCLUDE) +]) diff --git a/build-aux/ax_append_to_file.m4 b/build-aux/ax_append_to_file.m4 new file mode 100644 index 0000000..fca5708 --- /dev/null +++ b/build-aux/ax_append_to_file.m4 @@ -0,0 +1,27 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_append_to_file.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_TO_FILE([FILE],[DATA]) +# +# DESCRIPTION +# +# Appends the specified data to the specified file. +# +# LICENSE +# +# Copyright (c) 2008 Tom Howard +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 9 + +AC_DEFUN([AX_APPEND_TO_FILE],[ +AC_REQUIRE([AX_FILE_ESCAPES]) +printf "%s" "$2" >> "$1" +]) diff --git a/build-aux/ax_print_to_file.m4 b/build-aux/ax_print_to_file.m4 new file mode 100644 index 0000000..8aa7112 --- /dev/null +++ b/build-aux/ax_print_to_file.m4 @@ -0,0 +1,27 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_print_to_file.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PRINT_TO_FILE([FILE],[DATA]) +# +# DESCRIPTION +# +# Writes the specified data to the specified file. +# +# LICENSE +# +# Copyright (c) 2008 Tom Howard +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AC_DEFUN([AX_PRINT_TO_FILE],[ +AC_REQUIRE([AX_FILE_ESCAPES]) +printf "$2" > "$1" +]) diff --git a/build-aux/ax_python_module.m4 b/build-aux/ax_python_module.m4 new file mode 100644 index 0000000..f0f873d --- /dev/null +++ b/build-aux/ax_python_module.m4 @@ -0,0 +1,56 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_python_module.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PYTHON_MODULE(modname[, fatal, python]) +# +# DESCRIPTION +# +# Checks for Python module. +# +# If fatal is non-empty then absence of a module will trigger an error. +# The third parameter can either be "python" for Python 2 or "python3" for +# Python 3; defaults to Python 3. +# +# LICENSE +# +# Copyright (c) 2008 Andrew Collier +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 9 + +AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE]) +AC_DEFUN([AX_PYTHON_MODULE],[ + if test -z $PYTHON; + then + if test -z "$3"; + then + PYTHON="python3" + else + PYTHON="$3" + fi + fi + PYTHON_NAME=`basename $PYTHON` + AC_MSG_CHECKING($PYTHON_NAME module: $1) + $PYTHON -c "import $1" 2>/dev/null + if test $? -eq 0; + then + AC_MSG_RESULT(yes) + eval AS_TR_CPP(HAVE_PYMOD_$1)=yes + else + AC_MSG_RESULT(no) + eval AS_TR_CPP(HAVE_PYMOD_$1)=no + # + if test -n "$2" + then + AC_MSG_ERROR(failed to find required module $1) + exit 1 + fi + fi +]) diff --git a/build.rs b/build-aux/build.rs similarity index 98% rename from build.rs rename to build-aux/build.rs index 6788a43..618b32f 100644 --- a/build.rs +++ b/build-aux/build.rs @@ -4,7 +4,7 @@ use clap_complete::shells::{Bash, Elvish, Fish, PowerShell, Zsh}; use std::{collections, env, fs}; use vergen::{vergen, Config}; -include!("src/cli.rs"); +include!("../src/cli.rs"); fn main() { let mut flags = Config::default(); diff --git a/build-aux/docker-glibc-workaround.sh b/build-aux/docker-glibc-workaround.sh deleted file mode 100755 index b44a9e0..0000000 --- a/build-aux/docker-glibc-workaround.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env sh -set -e - -# Temporary workaround for glibc 2.33 having new syscalls that are not -# whitelisted yet in some older Docker host environments including the engines -# on GitHub Actions and Docker Hub. -# -# Arch Linux bug report: -# https://gitlab.archlinux.org/archlinux/archlinux-docker/-/issues/56 -# -# Upstream GitHub issue (also affects Docker Hub): -# https://github.com/actions/virtual-environments/issues/2658 -# -# Dockerfile workaround thanks to: -# https://github.com/lxqt/lxqt-panel/pull/1562 -# -# Patched glibc sources here: -# https://github.com/archlinuxcn/repo/tree/master/archlinuxcn/glibc-linux4 - -cd /tmp - -pkgfile='glibc-linux4-2.33-4-x86_64.pkg.tar.zst' -sha256sum='a89f4d23ae7cde78b4258deec4fcda975ab53c8cda8b5e0a0735255c0cdc05cc' - -check_checksum () { - echo "$sha256sum $pkgfile" | sha256sum -c -} - -check_checksum || - curl -LO "https://repo.archlinuxcn.org/x86_64/$pkgfile" && - check_checksum - -bsdtar -C / -xvf "$pkgfile" 2>/dev/null - -sed -e '/^HoldPkg/s/^/#/' -i /etc/pacman.conf - -pacman --noconfirm --dbonly -Rdd glibc -pacman --noconfirm --overwrite '*' -Udd "$pkgfile" - -sed -e '/^#\?IgnorePkg/{s/^#//;s/$/ glibc/}' -i /etc/pacman.conf - -rm "$pkgfile" diff --git a/build-aux/que_developer_mode.m4 b/build-aux/que_developer_mode.m4 new file mode 100644 index 0000000..18bd29f --- /dev/null +++ b/build-aux/que_developer_mode.m4 @@ -0,0 +1,19 @@ +# Like AM_MAINTAINER_MODE, but doesn't touch automake internals and so +# can be used freely to control access to project specific developer +# tooling without breaking autotools if disabled. +AC_DEFUN([QUE_DEVELOPER_MODE], [ + m4_case(m4_default([$1], [disable]), + [enable], [m4_define([_que_developer_def], [disable])], + [disable], [m4_define([_que_developer_def], [enable])], + [m4_define([_que_developer_def], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_DEVELOPER_MODE: $1])]) + AC_MSG_CHECKING([whether to enable developer-specific portions of Makefiles]) + AC_ARG_ENABLE([developer-mode], + [AS_HELP_STRING([--]_que_developer_def[-developer-mode], + _que_developer_def[ dependencies and make targets only useful for developers])], + [USE_DEVELOPER_MODE=$enableval], + [USE_DEVELOPER_MODE=]m4_if(_que_developer_def, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_DEVELOPER_MODE]) + AM_CONDITIONAL([DEVELOPER_MODE], [test $USE_DEVELOPER_MODE = yes]) + +]) diff --git a/build-aux/que_dist_checksums.am b/build-aux/que_dist_checksums.am new file mode 100644 index 0000000..7474ad7 --- /dev/null +++ b/build-aux/que_dist_checksums.am @@ -0,0 +1,21 @@ +# Output both a file that can be attached to releases and also write STDOUT +# for the sake of CI build logs so they can be audited as matching what is +# eventually posted. The list of files checksummed is a glob (even though we +# know an exact pattern) to avoid errors for formats not generated. +checksum_dist = \ + shopt -s nullglob ; \ + $(SHA256SUM) $(distdir)*.{tar.{gz,bz2,lz,xz,zst},zip} |\ + $(TEE) $(distdir).sha256.txt + +# Since the checksums file isn't an artifact produced by the default source dist +# creation process, we have to clean it up ourselves so distcheck can see that +# everything round-tripped cleanly. +distclean-local: distclean-local-checksums + +distclean-local-checksums: + rm -f $(distdir).sha256.txt + +# Append checksum operation to function that runs after compressing dist archives +am__post_remove_distdir = $(am__remove_distdir); $(checksum_dist) + +# vim: ft=automake diff --git a/build-aux/que_dist_checksums.m4 b/build-aux/que_dist_checksums.m4 new file mode 100644 index 0000000..7ace93a --- /dev/null +++ b/build-aux/que_dist_checksums.m4 @@ -0,0 +1,20 @@ +AC_DEFUN_ONCE([QUE_DIST_CHECKSUMS], [ + + QUE_TRANSFORM_PACKAGE_NAME + + AC_REQUIRE([AX_AM_MACROS]) + AX_ADD_AM_MACRO([dnl +EXTRA_DIST += build-aux/que_dist_checksums.am +])dnl + + AM_COND_IF([DEVELOPER_MODE], [ + + QUE_PROGVAR([sha256sum]) + QUE_PROGVAR([tee]) + + AX_ADD_AM_MACRO([dnl +$(cat build-aux/que_dist_checksums.am) +])dnl + + ]) +]) diff --git a/build-aux/que_docker_boilerplate.am b/build-aux/que_docker_boilerplate.am new file mode 100644 index 0000000..b584d44 --- /dev/null +++ b/build-aux/que_docker_boilerplate.am @@ -0,0 +1,28 @@ +export VERSION_FROM_AUTOTOOLS = v$(VERSION) + +DOCKER_DEVELOPER_TARGETS = docker +.PHONY: $(DOCKER_DEVELOPER_TARGETS) + +export DOCKER_REGISTRY ?= ghcr.io +export DOCKER_REPO ?= sile-typesetter/$(TRANSFORMED_PACKAGE_NAME) +export DOCKER_TAG ?= HEAD + +docker: Dockerfile hooks/build .version + ./hooks/build $(VERSION) + +docker-build-push: docker + docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG) + $(docker_push) + +define docker_push = + test -z "$(DOCKER_PAT)" || \ + docker login https://$(DOCKER_REGISTRY) -u $(DOCKER_USERNAME) -p $(DOCKER_PAT) + docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG) + if [[ "$(DOCKER_TAG)" == v*.*.* ]]; then \ + tag=$(DOCKER_TAG) ; \ + docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):latest ; \ + docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):$${tag//.*} ; \ + docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):latest ; \ + docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):$${tag//.*} ; \ + fi +endef diff --git a/build-aux/que_docker_boilerplate.m4 b/build-aux/que_docker_boilerplate.m4 new file mode 100644 index 0000000..066bf3e --- /dev/null +++ b/build-aux/que_docker_boilerplate.m4 @@ -0,0 +1,18 @@ +AC_DEFUN_ONCE([QUE_DOCKER_BOILERPLATE], [ + + QUE_TRANSFORM_PACKAGE_NAME + + AC_MSG_NOTICE([checking for tools used by automake to build Docker projects]) + AC_PROG_INSTALL + AM_COND_IF([DEVELOPER_MODE], [ + QUE_PROGVAR([docker]) + ]) + + AC_REQUIRE([AX_AM_MACROS]) + AX_ADD_AM_MACRO([dnl +EXTRA_DIST += build-aux/que_docker_boilerplate.am + +$($SED -E "s/@PACKAGE_VAR@/$PACKAGE_VAR/g" build-aux/que_docker_boilerplate.am) +])dnl + +]) diff --git a/build-aux/que_git_version.am b/build-aux/que_git_version.am new file mode 100644 index 0000000..6b9e809 --- /dev/null +++ b/build-aux/que_git_version.am @@ -0,0 +1,36 @@ +.SECONDEXPANSION: + +EXTRA_DIST += build-aux/git-version-gen +BUILT_SOURCES += .version +CLEANFILES += .version .version-prev + +_BRANCH_REF != $(AWK) '{print ".git/" $$2}' .git/HEAD 2>/dev/null ||: +.version: $(_BRANCH_REF) + @if [ -e "$(srcdir)/.tarball-version" ]; then \ + printf "$(VERSION)" > $@; \ + else \ + touch "$@-prev"; \ + if [ -e "$@" ]; then \ + cp "$@" "$@-prev"; \ + fi; \ + ./build-aux/git-version-gen "$(srcdir)/.tarball-version" > $@; \ + $(CMP) -s "$@" "$@-prev" || autoreconf configure.ac --force; \ + fi + +check-version: check-git-version + +.PHONY: check-git-version +check-git-version: $(PACKAGE_NAME)$(EXEEXT) | .version + $(GREP) -Fx '$(VERSION)' $| + ./$< --version | $(GREP) -Ff $| + +installcheck-local-version: + ./$(TRANSFORMED_PACKAGE_NAME)$(EXEEXT) --version + +dist-hook: dist-tarball-version + +.PHONY: dist-tarball-version +dist-tarball-version: + printf "$(VERSION)" > "$(distdir)/.tarball-version" + +# vim: ft=automake diff --git a/build-aux/que_git_version.m4 b/build-aux/que_git_version.m4 new file mode 100644 index 0000000..f91ca11 --- /dev/null +++ b/build-aux/que_git_version.m4 @@ -0,0 +1,26 @@ +AC_DEFUN_ONCE([QUE_GIT_VERSION], [ + + AM_CONDITIONAL([SOURCE_IS_GIT], + [test -d .git]) + + AM_CONDITIONAL([SOURCE_IS_DIST], + [test -f .tarball-version]) + + AM_CONDITIONAL([SOURCE_IS_ARCHIVE], + [test ! -d .git -a ! -f .tarball-version]) + + AC_PROG_AWK + AC_PROG_GREP + + QUE_TRANSFORM_PACKAGE_NAME + + AM_COND_IF([SOURCE_IS_DIST], [], [QUE_PROGVAR([cmp])]) + + AC_REQUIRE([AX_AM_MACROS]) + AX_ADD_AM_MACRO([dnl +EXTRA_DIST += build-aux/que_git_version.am + +$(cat build-aux/que_git_version.am) +])dnl + +]) diff --git a/build-aux/que_progvar.m4 b/build-aux/que_progvar.m4 new file mode 100644 index 0000000..20d1288 --- /dev/null +++ b/build-aux/que_progvar.m4 @@ -0,0 +1,5 @@ +AC_DEFUN([QUE_PROGVAR], [ + test -n "$m4_toupper($1)" || { AC_PATH_PROG(m4_toupper($1), m4_default($2,$1)) } + test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required]) +]) + diff --git a/build-aux/que_rust_boilerplate.am b/build-aux/que_rust_boilerplate.am new file mode 100644 index 0000000..2f7b2dd --- /dev/null +++ b/build-aux/que_rust_boilerplate.am @@ -0,0 +1,93 @@ +export VERSION_FROM_AUTOTOOLS = v$(VERSION) + +@PACKAGE_VAR@_SOURCES += Cargo.toml build-aux/build.rs +EXTRA_@PACKAGE_VAR@_SOURCES += Cargo.lock .version +dist_man_MANS += @PACKAGE_NAME@.1 + +CLEANFILES += $(bin_PROGRAMS) $(BUILT_SOURCES) $(dist_man_MANS) + +CARGO_RELEASE_ARGS = +if !DEBUG_RELEASE +CARGO_RELEASE_ARGS += --release --locked +endif + +CARGO_ENV = CARGO_TARGET_DIR=@builddir@/target +CARGO_BIN = @builddir@/target/@RUST_TARGET_SUBDIR@/$(PACKAGE_NAME) +_RUST_OUT = @builddir@/target/@RUST_TARGET_SUBDIR@/.cargo_out_dir + +distclean-local: distclean-local-rust + +distclean-local-rust: + -rm -rf @builddir@/target + +@PACKAGE_NAME@$(EXEEXT): $(CARGO_BIN) + $(INSTALL) $< $@ + +# Leave some tips for cargo to use so CLI knows where it is +export CONFIGURE_PREFIX = $(prefix)/ +export CONFIGURE_DATADIR = $(datadir)/ +export CONFIGURE_BINDIR = $(bindir)/ + +CARGO_VERBOSE = $(cargo_verbose_$(V)) +cargo_verbose_ = $(cargo_verbose_$(AM_DEFAULT_VERBOSITY)) +cargo_verbose_0 = +cargo_verbose_1 = --verbose + +$(COMPLETIONS_OUT_DIR): + $(MKDIR_P) $@ + +$(PACKAGE_NAME).1: $(CARGO_BIN) + $(INSTALL) -m644 $$(cat $(_RUST_OUT))/$@ $@ + +$(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME): $(CARGO_BIN) | $(COMPLETIONS_OUT_DIR) + $(INSTALL) -m755 $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/$(PACKAGE_NAME).bash $@ + +$(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME).elv: $(CARGO_BIN) | $(COMPLETIONS_OUT_DIR) + $(INSTALL) -m755 $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/$(PACKAGE_NAME).elv $@ + +$(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME).fish: $(CARGO_BIN) | $(COMPLETIONS_OUT_DIR) + $(INSTALL) -m755 $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/$(PACKAGE_NAME).fish $@ + +$(COMPLETIONS_OUT_DIR)/_$(TRANSFORMED_PACKAGE_NAME).ps1: $(CARGO_BIN) | $(COMPLETIONS_OUT_DIR) + $(INSTALL) -m755 $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/_$(PACKAGE_NAME).ps1 $@ + +$(COMPLETIONS_OUT_DIR)/_$(TRANSFORMED_PACKAGE_NAME): $(CARGO_BIN) | $(COMPLETIONS_OUT_DIR) + $(INSTALL) -m755 $$(cat $(_RUST_OUT))/$(COMPLETIONS_OUT_DIR)/_$(PACKAGE_NAME) $@ + +$(_RUST_OUT) $(CARGO_BIN): $(@PACKAGE_VAR@_SOURCES) $(EXTRA_@PACKAGE_VAR@_SOURCES) + set -e + export AUTOTOOLS_DEPENDENCIES="$^" + $(CARGO_ENV) $(CARGO) build $(CARGO_VERBOSE) $(CARGO_FEATURE_ARGS) $(CARGO_RELEASE_ARGS) + $(CARGO_ENV) $(CARGO) build --quiet --message-format=json $(CARGO_FEATURE_ARGS) $(CARGO_RELEASE_ARGS) | \ + $(JQ) -sr 'map(select(.reason == "build-script-executed")) | last | .out_dir' > $(_RUST_OUT) + +RUST_DEVELOPER_TARGETS = cargo-test clippy rustfmt +.PHONY: $(RUST_DEVELOPER_TARGETS) + +if DEVELOPER_MODE + +test: cargo-test +lint: rustfmt clippy +clean-local: clean-cargo +check-local: cargo-test + +rustfmt: + $(GIT) ls-files '*.rs' '*.rs.in' | $(XARGS) $(RUSTFMT) --check --config skip_children=true + +clippy: + $(CARGO_ENV) $(CARGO) $(CARGO_VERBOSE) clippy $(CARGO_FEATURE_ARGS) -- -D warnings + +clean-cargo: + $(CARGO_ENV) $(CARGO) $(CARGO_VERBOSE) clean + +cargo-test: $(PACKAGE_NAME)$(EXEEXT) + $(CARGO_ENV) $(CARGO) $(CARGO_VERBOSE) test $(CARGO_FEATURE_ARGS) --locked + +else !DEVELOPER_MODE + +$(RUST_DEVELOPER_TARGETS): + @: $(error "Please reconfigure using --enable-developer-mode to use developer tooling") + +endif !DEVELOPER_MODE + +# vim: ft=automake diff --git a/build-aux/que_rust_boilerplate.m4 b/build-aux/que_rust_boilerplate.m4 new file mode 100644 index 0000000..36fa092 --- /dev/null +++ b/build-aux/que_rust_boilerplate.m4 @@ -0,0 +1,42 @@ +AC_DEFUN_ONCE([QUE_RUST_BOILERPLATE], [ + + QUE_TRANSFORM_PACKAGE_NAME + QUE_DEVELOPER_MODE + QUE_SHELL_COMPLETION_DIRS + + AC_ARG_ENABLE(debug, + AS_HELP_STRING([--enable-debug], + [Build Rust code with debugging information])) + AM_CONDITIONAL([DEBUG_RELEASE], [test "x$debug_release" = "xyes"]) + + AC_MSG_NOTICE([checking for tools used by automake to build Rust projects]) + AC_PROG_INSTALL + AC_PROG_SED + QUE_PROGVAR([cargo]) + QUE_PROGVAR([jq]) + QUE_PROGVAR([rustc]) + QUE_PROGVAR([cmp]) + QUE_PROGVAR([xargs]) + AM_COND_IF([DEVELOPER_MODE], [ + QUE_PROGVAR([git]) + QUE_PROGVAR([rustfmt]) + ]) + + AC_MSG_CHECKING([whether to build Rust code with debugging information]) + AM_COND_IF([DEBUG_RELEASE], [ + AC_MSG_RESULT(yes) + RUST_TARGET_SUBDIR=debug + ], [ + AC_MSG_RESULT(no) + RUST_TARGET_SUBDIR=release + ]) + AC_SUBST([RUST_TARGET_SUBDIR]) + + AC_REQUIRE([AX_AM_MACROS]) + AX_ADD_AM_MACRO([dnl +EXTRA_DIST += build-aux/que_rust_boilerplate.am + +$($SED -E "s/@PACKAGE_VAR@/$PACKAGE_VAR/g;s/@PACKAGE_NAME@/$PACKAGE_NAME/g" build-aux/que_rust_boilerplate.am) +])dnl + +]) diff --git a/build-aux/que_shell_completion_dirs.am b/build-aux/que_shell_completion_dirs.am new file mode 100644 index 0000000..5e29abb --- /dev/null +++ b/build-aux/que_shell_completion_dirs.am @@ -0,0 +1,21 @@ +COMPLETIONS_OUT_DIR = completions + +if ENABLE_BASH_COMPLETION +bashcompletiondir = $(BASH_COMPLETION_DIR) +nodist_bashcompletion_DATA = $(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME) +CLEANFILES += $(nodist_bashcompletion_DATA) +endif + +if ENABLE_FISH_COMPLETION +fishcompletiondir = $(FISH_COMPLETION_DIR) +nodist_fishcompletion_DATA = $(COMPLETIONS_OUT_DIR)/$(TRANSFORMED_PACKAGE_NAME).fish +CLEANFILES += $(nodist_fishcompletion_DATA) +endif + +if ENABLE_ZSH_COMPLETION +zshcompletiondir = $(ZSH_COMPLETION_DIR) +nodist_zshcompletion_DATA = $(COMPLETIONS_OUT_DIR)/_$(TRANSFORMED_PACKAGE_NAME) +CLEANFILES += $(nodist_zshcompletion_DATA) +endif + +# vim: ft=automake diff --git a/build-aux/que_shell_completion_dirs.m4 b/build-aux/que_shell_completion_dirs.m4 new file mode 100644 index 0000000..380ff53 --- /dev/null +++ b/build-aux/que_shell_completion_dirs.m4 @@ -0,0 +1,54 @@ +AC_DEFUN_ONCE([QUE_SHELL_COMPLETION_DIRS], [ + + QUE_TRANSFORM_PACKAGE_NAME + + AC_ARG_WITH([bash-completion-dir], + AS_HELP_STRING([--with-bash-completion-dir[=PATH]], + [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]), + [], + [with_bash_completion_dir=yes]) + AM_CONDITIONAL([ENABLE_BASH_COMPLETION], + [test "x$with_bash_completion_dir" != "xno"]) + + AM_COND_IF([ENABLE_BASH_COMPLETION], + [PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], + [BASH_COMPLETION_DIR="$(pkg-config --define-variable=datadir=$datadir --variable=completionsdir bash-completion)"], + [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"])], + [BASH_COMPLETION_DIR="$with_bash_completion_dir"]) + AC_SUBST([BASH_COMPLETION_DIR]) + + AC_ARG_WITH([fish-completion-dir], + AS_HELP_STRING([--with-fish-completion-dir[=PATH]], + [Install the fish auto-completion script in this directory. @<:@default=yes@:>@]), + [], + [with_fish_completion_dir=yes]) + AM_CONDITIONAL([ENABLE_FISH_COMPLETION],[test "x$with_fish_completion_dir" != "xno"]) + + AM_COND_IF([ENABLE_FISH_COMPLETION], + [PKG_CHECK_MODULES([FISH_COMPLETION], [fish >= 3.0], + [FISH_COMPLETION_DIR="$(pkg-config --define-variable=datadir=$datadir --variable=completionsdir fish)"], + [FISH_COMPLETION_DIR="$datadir/fish/vendor_completions.d"])], + [FISH_COMPLETION_DIR="$with_fish_completion_dir"]) + AC_SUBST([FISH_COMPLETION_DIR]) + + AC_ARG_WITH([zsh-completion-dir], + AS_HELP_STRING([--with-zsh-completion-dir[=PATH]], + [Install the zsh auto-completion script in this directory. @<:@default=yes@:>@]), + [], + [with_zsh_completion_dir=yes]) + AM_CONDITIONAL([ENABLE_ZSH_COMPLETION], + [test "x$with_zsh_completion_dir" != "xno"]) + + AM_COND_IF([ENABLE_ZSH_COMPLETION], + [ZSH_COMPLETION_DIR="$datadir/zsh/site-functions"], + [ZSH_COMPLETION_DIR="$with_zsh_completion_dir"]) + AC_SUBST([ZSH_COMPLETION_DIR]) + + AC_REQUIRE([AX_AM_MACROS]) + AX_ADD_AM_MACRO([dnl +EXTRA_DIST += build-aux/que_shell_completion_dirs.am + +$(cat build-aux/que_shell_completion_dirs.am) +])dnl + +]) diff --git a/build-aux/que_transform_package_name.m4 b/build-aux/que_transform_package_name.m4 new file mode 100644 index 0000000..ee1e897 --- /dev/null +++ b/build-aux/que_transform_package_name.m4 @@ -0,0 +1,18 @@ +# The autotools supplied AC_ARG_PROGRAM enables renaming operations, but it +# supplies them as a sed operation that can be applied to multiple binaries. +# This isn't convenient to use if we're just renaming the top level package, so +# we go ahead and *do* the transformation and save for use as a substitution. + +AC_DEFUN_ONCE([QUE_TRANSFORM_PACKAGE_NAME], [ + + AC_PROG_SED + + TRANSFORMED_PACKAGE_NAME="$(printf "$PACKAGE_NAME" | $SED -e "$(printf "$program_transform_name" | $SED -e 's/\$\$/\$/')")" + AC_SUBST([TRANSFORMED_PACKAGE_NAME]) + + PACKAGE_VAR="$(printf "$PACKAGE_NAME" | $SED -e "s/-/_/g")" + AC_SUBST([PACKAGE_VAR]) + + AC_ARG_PROGRAM + +]) diff --git a/configure.ac b/configure.ac index e296c4a..c202c91 100644 --- a/configure.ac +++ b/configure.ac @@ -1,116 +1,74 @@ AC_PREREQ([2.69]) -AC_INIT([fontship],[m4_esyscmd(build-aux/git-version-gen .tarball-version)],[caleb@alerque.com]) +AC_INIT([fontship], [m4_esyscmd(build-aux/git-version-gen .tarball-version)],[caleb@alerque.com]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([build-aux]) -AM_INIT_AUTOMAKE([foreign tar-pax dist-xz dist-zip no-dist-gzip color-tests subdir-objects]) +AM_INIT_AUTOMAKE([foreign tar-pax dist-zstd dist-zip no-dist-gzip color-tests subdir-objects]) AM_SILENT_RULES([yes]) -AC_DEFUN([AX_PROGVAR], - [ - test -n "$m4_toupper($1)" || { AC_PATH_PROG(m4_toupper($1), m4_default($2,$1)) } - test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required]) - ]) +QUE_GIT_VERSION +QUE_TRANSFORM_PACKAGE_NAME +QUE_DEVELOPER_MODE +QUE_DIST_CHECKSUMS +# Build time deps AC_PROG_AWK AC_PROG_SED AC_PROG_GREP -AX_PROGVAR([cmp]) -AX_PROGVAR([xargs]) +QUE_PROGVAR([cmp]) +QUE_PROGVAR([xargs]) -AC_ARG_ENABLE([dependency-checks], - AS_HELP_STRING([--disable-dependency-checks], [Disable dependency checks])) - -AC_ARG_WITH([bash-completion-dir], - AS_HELP_STRING([--with-bash-completion-dir[=PATH]], - [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]), - [], - [with_bash_completion_dir=yes]) -if test "x$with_bash_completion_dir" = "xyes"; then - PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], - [BASH_COMPLETION_DIR="`pkg-config --define-variable=datadir=$datadir --variable=completionsdir bash-completion`"], - [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]) -else - BASH_COMPLETION_DIR="$with_bash_completion_dir" -fi -AC_SUBST([BASH_COMPLETION_DIR]) -AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"]) - -AC_ARG_WITH([fish-completion-dir], - AS_HELP_STRING([--with-fish-completion-dir[=PATH]], - [Install the fish auto-completion script in this directory. @<:@default=yes@:>@]), - [], - [with_fish_completion_dir=yes]) -if test "x$with_fish_completion_dir" = "xyes"; then - PKG_CHECK_MODULES([FISH_COMPLETION], [fish >= 3.0], - [FISH_COMPLETION_DIR="`pkg-config --define-variable=datadir=$datadir --variable=completionsdir fish`"], - [FISH_COMPLETION_DIR="$datadir/fish/vendor_completions.d"]) -else - FISH_COMPLETION_DIR="$with_fish_completion_dir" -fi -AC_SUBST([FISH_COMPLETION_DIR]) -AM_CONDITIONAL([ENABLE_FISH_COMPLETION],[test "x$with_fish_completion_dir" != "xno"]) - -AC_ARG_WITH([zsh-completion-dir], - AS_HELP_STRING([--with-zsh-completion-dir[=PATH]], - [Install the zsh auto-completion script in this directory. @<:@default=yes@:>@]), - [], - [with_zsh_completion_dir=yes]) -if test "x$with_zsh_completion_dir" = "xyes"; then - ZSH_COMPLETION_DIR="$datadir/zsh/site-functions" -else - ZSH_COMPLETION_DIR="$with_zsh_completion_dir" -fi -AC_SUBST([ZSH_COMPLETION_DIR]) -AM_CONDITIONAL([ENABLE_ZSH_COMPLETION],[test "x$with_zsh_completion_dir" != "xno"]) - -# Add --enable-debug flag to change Rust build mode -AC_ARG_ENABLE(debug, - AS_HELP_STRING([--enable-debug],[Build Rust code with debugging information [default=no]]), - [debug_release=$enableval], - [debug_release=no]) - -AC_MSG_CHECKING(whether to build Rust code with debugging information) -if test "x$debug_release" = "xyes" ; then - AC_MSG_RESULT(yes) - RUST_TARGET_SUBDIR=debug -else - AC_MSG_RESULT(no) - RUST_TARGET_SUBDIR=release -fi -AM_CONDITIONAL([DEBUG_RELEASE], [test "x$debug_release" = "xyes"]) +QUE_RUST_BOILERPLATE +QUE_DOCKER_BOILERPLATE -AC_SUBST([RUST_TARGET_SUBDIR]) - -AS_IF([test "x$enable_dependency_checks" != "xno"], [ - AX_PROGVAR([cargo]) - AX_PROGVAR([rustc]) - AX_PROGVAR([jq]) - AX_PROGVAR([babelfont]) - AX_PROGVAR([find]) - AX_PROGVAR([fontmake]) - AX_PROGVAR([fontv], [font-v]) - AX_PROGVAR([gftools]) - AX_PROGVAR([git]) - AX_PROGVAR([psautohint]) - AX_PROGVAR([sfdnormalize]) - AX_PROGVAR([sfd2ufo]) - AX_PROGVAR([sfnt2woffzopfli], [sfnt2woff-zopfli]) - AX_PROGVAR([ttfautohint]) - AX_PROGVAR([ttx]) - AX_PROGVAR([ufonormalizer]) - AX_PROGVAR([woff2_compress]) - AX_PROGVAR([zsh]) - - AM_PATH_PYTHON([3.6]) - AX_PYTHON_MODULE(cffsubr, true) - AX_PYTHON_MODULE(defcon, true) - AX_PYTHON_MODULE(pcpp, true) - AX_PYTHON_MODULE(sfdLib, true) - AX_PYTHON_MODULE(pathops, true) - AX_PYTHON_MODULE(ufo2ft, true) - AX_PYTHON_MODULE(ufoLib2, true) - AX_PYTHON_MODULE(vttLib, true) - ]) +AC_ARG_ENABLE([dependency-checks], + AS_HELP_STRING([--disable-dependency-checks], │ │ + [Disable build tooling dependency checks])) │ │ +AM_CONDITIONAL([DEPENDENCY_CHECKS], [test "x$enable_dependency_checks" != "xno"]) + + +AM_COND_IF([DEPENDENCY_CHECKS], [ + + # Run time deps + QUE_PROGVAR([babelfont]) + QUE_PROGVAR([find]) + QUE_PROGVAR([fontmake]) + QUE_PROGVAR([fontv], [font-v]) + QUE_PROGVAR([gftools]) + QUE_PROGVAR([git]) + QUE_PROGVAR([psautohint]) + QUE_PROGVAR([sfdnormalize]) + QUE_PROGVAR([sfd2ufo]) + QUE_PROGVAR([sfnt2woffzopfli], [sfnt2woff-zopfli]) + QUE_PROGVAR([ttfautohint]) + QUE_PROGVAR([ttx]) + QUE_PROGVAR([ufonormalizer]) + QUE_PROGVAR([woff2_compress]) + QUE_PROGVAR([zsh]) + + AM_PATH_PYTHON([3.6]) + AX_PYTHON_MODULE(cffsubr, true) + AX_PYTHON_MODULE(defcon, true) + AX_PYTHON_MODULE(pcpp, true) + AX_PYTHON_MODULE(sfdLib, true) + AX_PYTHON_MODULE(pathops, true) + AX_PYTHON_MODULE(ufo2ft, true) + AX_PYTHON_MODULE(ufoLib2, true) + AX_PYTHON_MODULE(vttLib, true) + + # Developer tooling deps + AM_COND_IF([DEVELOPER_MODE], [ + QUE_PROGVAR([checkmake]) + QUE_PROGVAR([docker]) + QUE_PROGVAR([ruff]) + QUE_PROGVAR([tr]) + ]) +]) + +# Avoid the need for configuring with the `--datarootdir=$(cd ..; pwd)` hack to +# run from the source directory when developer mode is enabled. +AM_COND_IF([DEVELOPER_MODE], [ + datarootdir="$(cd ..; pwd)" +]) if [[ -d .git ]]; then MAN_DATE=$(git log -1 --format="%cd" --date=format:"%d %B %Y" -- fontship.1.in) @@ -119,14 +77,11 @@ else fi AC_SUBST([MAN_DATE]) -TRANSFORMED_PACKAGE_NAME="$(printf "$PACKAGE_NAME" | $SED -e "${program_transform_name//\$\$/\$}")" -AC_SUBST([TRANSFORMED_PACKAGE_NAME]) - AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([fontship.1]) AC_CONFIG_FILES([rules/fontship.mk]) -AC_CONFIG_FILES([make-shell.zsh], [chmod +x make-shell.zsh]) -AC_ARG_PROGRAM +AC_CONFIG_FILES([lib/make-shell.zsh], [chmod +x lib/make-shell.zsh]) +AC_CONFIG_FILES([lib/fontship-entry.zsh], [chmod +x lib/fontship-entry.zsh]) AC_OUTPUT diff --git a/lib/fontship-entry.zsh.in b/lib/fontship-entry.zsh.in new file mode 100755 index 0000000..14867e9 --- /dev/null +++ b/lib/fontship-entry.zsh.in @@ -0,0 +1,12 @@ +#!@ZSH@ + +# This entire entry point script is only necessary because GitHub +# actions insists on checking out the project as a non-privileged user, +# running Docker as root, and not allowing us to pass a user argument +# to Docker. It might prove handy for users so they don't have to +# manually pass their user ID at runtime. +if [[ $(id -u) -ne $(@STAT@ -c '%u' .) ]]; then + exec setpriv --clear-groups $(@STAT@ -c '--euid %u --egid %g' .) $0 $@ +fi + +exec fontship $@ diff --git a/lib/make-shell.zsh.in b/lib/make-shell.zsh.in new file mode 100755 index 0000000..5c17799 --- /dev/null +++ b/lib/make-shell.zsh.in @@ -0,0 +1,97 @@ +#!@ZSH@ + +set -o nomatch +set -o pipefail + +local status() { + echo -e "$@" +} + +local pre_hook() { + status "FONTSHIPPRE$target" +} + +local post_hook() { + status "FONTSHIPPOST$target$2" +} + +local report_stdout() { + while read line; do + echo -e "FONTSHIPSTDOUT$target$line" + done +} + +local report_stderr() { + while read line; do + echo -e "FONTSHIPSTDERR$target$line" >&2 + done +} + +local process_recipe() { + pre_hook $target + { + ( + set -e + set -o nobadpattern + [[ ! -v _debug ]] || set -x + exec > >(report_stdout) 2> >(report_stderr) + eval "$@" + set +x + ) + } always { + post_hook $target $? + } +} + +local process_shell() { + ( + set -e + set -o nobadpattern + [[ ! -v _debug ]] || set -x + eval "$@" + set +x + ) +} + +# GNU Make 4.4 started passing shell args as a single argument no matter how +# they are quoted. Since we want to process them ourselves, explode them here. +# for the purposes of our parsing off wrapper arguments, then use the final +# argument as the only one to be eval()'ed. +final=$argv[$#] +shift -p +argv=(${(z)argv} ${(z)final}) + +while true; do + case $1 in + '/bin/sh'|'-c') + shift + ;; + '-x') + _debug=true + shift + ;; + 'target='*) +eval $1 +shift + ;; + # Bogus filler flag to force make to have at least one flag even if debug + # isn't set hence forcing it to quote the actual shell code argument. + '-w') + shift + ;; + '_WRAPTARGET='*) + final=${final##$1 } + eval $1 + shift + ;; + *) + break + ;; + esac +done + +if ${_WRAPTARGET:-false} && [[ -v target ]]; then + exec process_recipe $final +else + exec process_shell $final +fi diff --git a/make-shell.zsh.in b/make-shell.zsh.in deleted file mode 100755 index 1d355b3..0000000 --- a/make-shell.zsh.in +++ /dev/null @@ -1,68 +0,0 @@ -#!@ZSH@ - -set -o nomatch -set -o pipefail - -local status() { - echo -e "$@" -} - -local pre_hook() { - status "FONTSHIPPRE$target" -} - -local post_hook() { - status "FONTSHIPPOST$2$target" -} - -local report_stdout() { - cat - | - while read line; do - echo -e "FONTSHIPSTDOUT$target$line" - done -} - -local report_stderr() { - cat - | - while read line; do - echo -e "FONTSHIPSTDERR$target$line" >&2 - done -} - -local process_recipe() { - pre_hook $target - { - ( - set -e - set -o nobadpattern - [[ ! -v _debug ]] || set -x - exec > >(report_stdout) 2> >(report_stderr) - eval "$@" - ) - } always { - post_hook $target $? - } -} - -local process_shell() { - ( - set -e - set -o nobadpattern - [[ ! -v _debug ]] || set -x - eval "$@" - ) -} - -eval $1 -shift - -if [[ $1 = "-x" ]]; then - _debug=true - shift -fi - -if [[ -n $target && -v MAKELEVEL ]]; then - process_recipe $@ -else - process_shell $@ -fi diff --git a/rules/fontship.mk.in b/rules/fontship.mk.in index 2e9f1cb..8e7e14f 100644 --- a/rules/fontship.mk.in +++ b/rules/fontship.mk.in @@ -4,9 +4,12 @@ MAKEFLAGS += --output-sync=none MAKEFLAGS += --silent # Disable as many built in file type builds as possible MAKEFLAGS += --no-builtin-rules +# Avoid silent errors to ease debugging +MAKEFLAGS += --warn-undefined-variables + .SUFFIXES: -# Don't drop intermediate artifacts (saves rebulid time and aids debugging) +# Don't drop intermediate artifacts (saves rebuild time and aids debugging) .SECONDARY: .PRECIOUS: % .DELETE_ON_ERROR: @@ -17,8 +20,25 @@ $(error Use of fontship rule file inclusion outside of the CLI is deprecated!) endif # Run complete recipes in wrapper script that facilitates clean CLI output -SHELL := $(FONTSHIPDIR)/make-shell.zsh -.SHELLFLAGS = target=$@ +SHELL := $(FONTSHIPDIR)/lib/make-shell.zsh + +.SHELLFLAGS = -w + +DEBUG ?= false # also later set in rules.mk just to be visible with other settings +ifeq ($(DEBUG),true) +.SHELLFLAGS += -x +endif + +# We *must* pass at least one argument to our custom shell before make adds the +# shell code it wants to execute. We use this one because its easy to falsify +# in our $(shell) wrapper environment... +.SHELLFLAGS += _WRAPTARGET=true + +# Differentiate shells used to run recipes vs. shell wrapper function +# See https://stackoverflow.com/q/65553367/313192 +_ENV := _WRAPTARGET=false + +.SHELLFLAGS += $(eval @?=)$(and $@,target=$@) .ONESHELL: .SECONDEXPANSION: @@ -43,8 +63,6 @@ UFONORMALIZER ?= @UFONORMALIZER@ WOFF2COMPRESS ?= @WOFF2_COMPRESS@ ZSH ?= @ZSH@ -BUILDDIR ?= .fontship - .PHONY: default default: all diff --git a/rules/functions.mk b/rules/functions.mk index 0fbd8bf..60ebf00 100644 --- a/rules/functions.mk +++ b/rules/functions.mk @@ -5,16 +5,16 @@ $(space) := $() $() lparen := ( rparen := ) -glyphsFamilyNames ?= $(shell $(PYTHON) -c 'from glyphsLib import GSFont; print(GSFont("$1").familyName.title().replace(" ", ""))') -glyphsInstances ?= $(shell $(PYTHON) -c 'from glyphsLib import GSFont; list(map(lambda x: print(x.name.replace(" ", "")), GSFont("$1").instances))') +glyphsFamilyNames ?= $(shell $(_ENV) $(PYTHON) -c 'from glyphsLib import GSFont; print(GSFont("$1").familyName.title().replace(" ", ""))') +glyphsInstances ?= $(shell $(_ENV) $(PYTHON) -c 'from glyphsLib import GSFont; list(map(lambda x: print(x.name.replace(" ", "")), GSFont("$1").instances))') glyphsMasters ?= $(notdir $(basename $1)) -ufoFamilyNames ?= $(shell $(PYTHON) -c 'import babelfont; print(babelfont.Babelfont.open("$1").info.familyName.title().replace(" ", ""))') -ufoInstances ?= $(shell $(PYTHON) -c 'import babelfont; print(babelfont.Babelfont.open("$1").info.styleName.replace(" ", ""))') -designspaceFamilyNames ?= $(shell $(PYTHON) -c 'from fontTools.designspaceLib import DesignSpaceDocument; d = DesignSpaceDocument(); d.read("$1"); for i in d.instances: print(i.familyName.replace(" ", ""))') -designspaceInstances ?= $(shell $(PYTHON) -c 'from fontTools.designspaceLib import DesignSpaceDocument; d = DesignSpaceDocument(); d.read("$1"); for i in d.instances: print(i.styleName.replace(" ", ""))') +ufoFamilyNames ?= $(shell $(_ENV) $(PYTHON) -c 'import babelfont; print(babelfont.Babelfont.open("$1").info.familyName.title().replace(" ", ""))') +ufoInstances ?= $(shell $(_ENV) $(PYTHON) -c 'import babelfont; print(babelfont.Babelfont.open("$1").info.styleName.replace(" ", ""))') +designspaceFamilyNames ?= $(shell $(_ENV) $(PYTHON) -c 'from fontTools.designspaceLib import DesignSpaceDocument; d = DesignSpaceDocument(); d.read("$1"); for i in d.instances: print(i.familyName.replace(" ", ""))') +designspaceInstances ?= $(shell $(_ENV) $(PYTHON) -c 'from fontTools.designspaceLib import DesignSpaceDocument; d = DesignSpaceDocument(); d.read("$1"); for i in d.instances: print(i.styleName.replace(" ", ""))') designspaceMasters ?= $(notdir $(basename $1)) -sfdFamilyNames = $(shell $(SED) -n '/^FamilyName/{s/.*: //;s/ //g;p}' "$1") -sfdInstances ?= $(shell $(SED) -n '/^FontName:/{s/^.*-//g;p}' "$1") +sfdFamilyNames = $(shell $(_ENV) $(SED) -n '/^FamilyName/{s/.*: //;s/ //g;p}' "$1") +sfdInstances ?= $(shell $(_ENV) $(SED) -n '/^FontName:/{s/^.*-//g;p}' "$1") define normalizeVersion ?= $(FONTV) $(FONTVFLAGS) write --ver=$(FontVersion) $(if $(isTagged),--rel,--dev --sha1) $@ diff --git a/rules/rules.mk b/rules/rules.mk index 5a9dfa3..78792de 100644 --- a/rules/rules.mk +++ b/rules/rules.mk @@ -350,7 +350,7 @@ endif # Utility stuff -forceiftagchange = $(shell $(CMP) -s $@ - <<< "$(GitVersion)" || echo force) +forceiftagchange = $(shell $(_ENV) $(CMP) -s $@ - <<< "$(GitVersion)" || echo force) $(BUILDDIR)/last-commit: $$(forceiftagchange) | $(BUILDDIR) $(GIT) update-index --refresh --ignore-submodules ||: $(GIT) diff-index --quiet --cached HEAD -- $(SOURCES) diff --git a/rules/ufo.mk b/rules/ufo.mk index 4e06ced..e50e1ec 100644 --- a/rules/ufo.mk +++ b/rules/ufo.mk @@ -1,5 +1,5 @@ ufoNormalize ?= $(UFONORMALIZER) $(UFONORMALIZERFLAGS) "$1" -o "$2" -expandUFOParts = $(shell $(FIND) "$1" -type f 2> /dev/null) +expandUFOParts = $(shell $(_ENV) $(FIND) "$1" -type f 2> /dev/null) ufoParts = $(call expandUFOParts,$(patsubst %-normalized.ufo,%.ufo,$(patsubst $(BUILDDIR)/%,$(SOURCEDIR)/%,$@))) instanceToDS = $(_DSF_$(subst -,,$*)) @@ -11,9 +11,9 @@ for instance in designspace.instances: print("_DSI_{1}{0} = {1} {2}\n_DSF_{1}{0} endef ifneq ($(SOURCES_DESIGNSPACE),) -_TMP := $(shell local tmp=$$(mktemp vars-XXXXXX.mk); echo $${tmp}; {$(foreach SOURCE,$(SOURCES_DESIGNSPACE),$(PYTHON) -c '$(makeVars)';)} >> $${tmp}) +_TMP := $(shell $(_ENV) local tmp=$$(mktemp vars-XXXXXX.mk); echo $${tmp}; {$(foreach SOURCE,$(SOURCES_DESIGNSPACE),$(PYTHON) -c '$(makeVars)';)} >> $${tmp}) $(eval $(file < $(_TMP))) -$(shell rm -f $(_TMP)) +$(shell $(_ENV) rm -f $(_TMP)) endif $(BUILDDIR)/%-VF-variable.otf: $(SOURCEDIR)/%.designspace | $(BUILDDIR) diff --git a/src/lib.rs b/src/lib.rs index 65f30da..d097532 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,8 +31,11 @@ pub static CONFIGURE_DATADIR: &str = env!["CONFIGURE_DATADIR"]; /// If all else fails, use this BCP-47 locale pub static DEFAULT_LOCALE: &str = "en-US"; -/// Fontship version number as detected by `git describe --tags` at build time -pub static VERSION: &str = env!("VERGEN_GIT_SEMVER"); +lazy_static! { + /// Fontship version number as detected by `git describe --tags` at build time + pub static ref VERSION: &'static str = + option_env!("VERGEN_GIT_DESCRIBE").unwrap_or_else(|| env!("CARGO_PKG_VERSION")); +} pub type Result = result::Result>; @@ -92,6 +95,16 @@ pub fn commit(repo: Repository, oid: Oid, msg: &str) -> result::Result String { + let re = Regex::new(r"[-_\.].*$").unwrap(); + let locale_frag = lang.as_str().to_lowercase(); + let lang = re.replace(&locale_frag, ""); + match &lang[..] { + "c" => String::from("en"), + _ => String::from(lang), + } +} + pub fn format_font_version(version: String) -> String { let re = Regex::new(r"-r.*$").unwrap(); String::from(re.replace(version.as_str(), "")) @@ -99,7 +112,7 @@ pub fn format_font_version(version: String) -> String { /// Output welcome header at start of run before moving on to actual commands pub fn show_welcome() { - let welcome = LocalText::new("welcome").arg("version", VERSION); + let welcome = LocalText::new("welcome").arg("version", VERSION.to_string()); eprintln!("{} {}", "┏━".cyan(), welcome.fmt().cyan()); } diff --git a/src/main.rs b/src/main.rs index c3845b3..0541e11 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,7 @@ fn main() -> Result<()> { let target = vec![String::from("_gha"), String::from("dist")]; make::run(target) } else { - let app = Cli::command().infer_subcommands(true).version(VERSION); + let app = Cli::command().infer_subcommands(true).version(*VERSION); let matches = app.get_matches(); let args = Cli::from_arg_matches(&matches)?; CONF.from_args(&args)?; diff --git a/src/make/mod.rs b/src/make/mod.rs index 16812ba..6ddfd4d 100644 --- a/src/make/mod.rs +++ b/src/make/mod.rs @@ -50,9 +50,11 @@ pub fn run(target: Vec) -> Result<()> { let git_version = status::get_git_version(); let font_version = format_font_version(git_version.clone()); process = process + .env("BUILDDIR", CONF.get_string("builddir")?) .env("FONTSHIP_CLI", "true") .env("FONTSHIPDIR", CONFIGURE_DATADIR) .env("CONTAINERIZED", status::is_container().to_string()) + .env("LANGUAGE", locale_to_language(CONF.get_string("language")?)) .env("GITNAME", &gitname) .env("PROJECT", pname(&gitname)) .env("PROJECTDIR", CONF.get_string("path")?) From e2f15bb4949d49b2c426626200da9dcb10f665db Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 26 Aug 2024 12:59:34 +0300 Subject: [PATCH 2/6] refactor(cli): Update clap and config, generate man page --- Cargo.lock | 1424 ++++++++++++++++++++++++++++++++++++++++---- Cargo.toml | 27 +- Makefile.am | 2 +- build-aux/build.rs | 63 +- configure.ac | 8 - fontship.1.in | 38 -- src/cli.rs | 18 +- src/config.rs | 43 +- src/lib.rs | 4 +- src/main.rs | 37 +- src/make/mod.rs | 2 +- src/setup/mod.rs | 4 +- 12 files changed, 1415 insertions(+), 255 deletions(-) delete mode 100644 fontship.1.in diff --git a/Cargo.lock b/Cargo.lock index 889d0a1..4417111 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,17 +8,99 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" -version = "1.0.56" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] -name = "arrayvec" -version = "0.5.2" +name = "arc-swap" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "atty" @@ -43,6 +125,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + [[package]] name = "block-buffer" version = "0.9.0" @@ -52,6 +140,49 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.0.73" @@ -76,50 +207,82 @@ dependencies = [ "libc", "num-integer", "num-traits", - "time", + "time 0.1.44", "winapi", ] [[package]] name = "clap" -version = "3.1.6" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ - "atty", - "bitflags", + "clap_builder", "clap_derive", - "indexmap", - "lazy_static", - "os_str_bytes", +] + +[[package]] +name = "clap_builder" +version = "4.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", "strsim", - "termcolor", "terminal_size", - "textwrap", ] [[package]] name = "clap_complete" -version = "3.1.1" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25" +checksum = "531d7959c5bbb6e266cecdd0f20213639c3a5c3e4d615f97db87661745f781ff" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "3.1.4" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.76", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "clap_mangen" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17415fd4dfbea46e3274fcd8d368284519b358654772afb700dc2e8d2b24eeb" +dependencies = [ + "clap", + "roff", ] +[[package]] +name = "clru" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbd0f76e066e64fdc5631e3bb46381254deab9ef1158292f27c8c57e3bf3fe59" + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + [[package]] name = "colored" version = "2.0.0" @@ -133,12 +296,13 @@ dependencies = [ [[package]] name = "config" -version = "0.11.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1b9d958c2b1368a663f05538fc1b5975adce1e19f435acceae987aceeeb369" +checksum = "7328b20597b53c2454f0b1919720c25c7339051c02b72b7e05409e00b14132be" dependencies = [ "lazy_static", "nom", + "pathdiff", "serde", "yaml-rust", ] @@ -152,6 +316,15 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-channel" version = "0.5.2" @@ -196,6 +369,15 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "digest" version = "0.9.0" @@ -205,6 +387,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "either" version = "1.6.1" @@ -237,9 +425,31 @@ checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.86", +] + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", ] +[[package]] +name = "faster-hex" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a2b11eda1d40935b26cf18f6833c526845ae8c41e58d09af6adeb6f0269183" + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + [[package]] name = "filetime" version = "0.2.15" @@ -248,10 +458,20 @@ checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.11", "winapi", ] +[[package]] +name = "flate2" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fluent" version = "0.12.0" @@ -302,6 +522,12 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac0f7e83d14cccbf26e165d8881dcac5891af0d85a88543c09dd72ebd31d91ba" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "fontship" version = "0.8.2" @@ -309,6 +535,7 @@ dependencies = [ "Inflector", "clap", "clap_complete", + "clap_mangen", "colored", "config", "fluent", @@ -324,16 +551,15 @@ dependencies = [ "rust-embed", "subprocess", "unic-langid", - "vergen", + "vergen 8.3.2", ] [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "matches", "percent-encoding", ] @@ -356,7 +582,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.86", ] [[package]] @@ -367,7 +593,7 @@ checksum = "29e6ee3be1779ae457baf5c0697e8fef1af71058b04488c8b28151bd6fa6015e" dependencies = [ "filetime", "git2", - "vergen", + "vergen 6.0.2", ] [[package]] @@ -376,24 +602,535 @@ version = "0.13.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "libgit2-sys", "log", "url", ] +[[package]] +name = "gix" +version = "0.63.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "984c5018adfa7a4536ade67990b3ebc6e11ab57b3d6cd9968de0947ca99b4b06" +dependencies = [ + "gix-actor", + "gix-commitgraph", + "gix-config", + "gix-date", + "gix-diff", + "gix-discover", + "gix-features", + "gix-fs", + "gix-glob", + "gix-hash", + "gix-hashtable", + "gix-index", + "gix-lock", + "gix-macros", + "gix-object", + "gix-odb", + "gix-pack", + "gix-path", + "gix-ref", + "gix-refspec", + "gix-revision", + "gix-revwalk", + "gix-sec", + "gix-tempfile", + "gix-trace", + "gix-traverse", + "gix-url", + "gix-utils", + "gix-validate", + "once_cell", + "parking_lot", + "signal-hook", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-actor" +version = "0.31.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0e454357e34b833cc3a00b6efbbd3dd4d18b24b9fb0c023876ec2645e8aa3f2" +dependencies = [ + "bstr", + "gix-date", + "gix-utils", + "itoa", + "thiserror", + "winnow", +] + +[[package]] +name = "gix-bitmap" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a371db66cbd4e13f0ed9dc4c0fea712d7276805fccc877f77e96374d317e87ae" +dependencies = [ + "thiserror", +] + +[[package]] +name = "gix-chunk" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45c8751169961ba7640b513c3b24af61aa962c967aaf04116734975cd5af0c52" +dependencies = [ + "thiserror", +] + +[[package]] +name = "gix-commitgraph" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133b06f67f565836ec0c473e2116a60fb74f80b6435e21d88013ac0e3c60fc78" +dependencies = [ + "bstr", + "gix-chunk", + "gix-features", + "gix-hash", + "memmap2", + "thiserror", +] + +[[package]] +name = "gix-config" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fafe42957e11d98e354a66b6bd70aeea00faf2f62dd11164188224a507c840" +dependencies = [ + "bstr", + "gix-config-value", + "gix-features", + "gix-glob", + "gix-path", + "gix-ref", + "gix-sec", + "memchr", + "once_cell", + "smallvec", + "thiserror", + "unicode-bom", + "winnow", +] + +[[package]] +name = "gix-config-value" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03f76169faa0dec598eac60f83d7fcdd739ec16596eca8fb144c88973dbe6f8c" +dependencies = [ + "bitflags 2.6.0", + "bstr", + "gix-path", + "libc", + "thiserror", +] + +[[package]] +name = "gix-date" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eed6931f21491ee0aeb922751bd7ec97b4b2fe8fbfedcb678e2a2dce5f3b8c0" +dependencies = [ + "bstr", + "itoa", + "thiserror", + "time 0.3.36", +] + +[[package]] +name = "gix-diff" +version = "0.44.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1996d5c8a305b59709467d80617c9fde48d9d75fd1f4179ea970912630886c9d" +dependencies = [ + "bstr", + "gix-hash", + "gix-object", + "thiserror", +] + +[[package]] +name = "gix-discover" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc27c699b63da66b50d50c00668bc0b7e90c3a382ef302865e891559935f3dbf" +dependencies = [ + "bstr", + "dunce", + "gix-fs", + "gix-hash", + "gix-path", + "gix-ref", + "gix-sec", + "thiserror", +] + +[[package]] +name = "gix-features" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac7045ac9fe5f9c727f38799d002a7ed3583cd777e3322a7c4b43e3cf437dc69" +dependencies = [ + "crc32fast", + "flate2", + "gix-hash", + "gix-trace", + "gix-utils", + "libc", + "once_cell", + "prodash", + "sha1_smol", + "thiserror", + "walkdir", +] + +[[package]] +name = "gix-fs" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2bfe6249cfea6d0c0e0990d5226a4cb36f030444ba9e35e0639275db8f98575" +dependencies = [ + "fastrand", + "gix-features", + "gix-utils", +] + +[[package]] +name = "gix-glob" +version = "0.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74908b4bbc0a0a40852737e5d7889f676f081e340d5451a16e5b4c50d592f111" +dependencies = [ + "bitflags 2.6.0", + "bstr", + "gix-features", + "gix-path", +] + +[[package]] +name = "gix-hash" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93d7df7366121b5018f947a04d37f034717e113dcf9ccd85c34b58e57a74d5e" +dependencies = [ + "faster-hex", + "thiserror", +] + +[[package]] +name = "gix-hashtable" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ddf80e16f3c19ac06ce415a38b8591993d3f73aede049cb561becb5b3a8e242" +dependencies = [ + "gix-hash", + "hashbrown", + "parking_lot", +] + +[[package]] +name = "gix-index" +version = "0.33.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a9a44eb55bd84bb48f8a44980e951968ced21e171b22d115d1cdcef82a7d73f" +dependencies = [ + "bitflags 2.6.0", + "bstr", + "filetime", + "fnv", + "gix-bitmap", + "gix-features", + "gix-fs", + "gix-hash", + "gix-lock", + "gix-object", + "gix-traverse", + "gix-utils", + "gix-validate", + "hashbrown", + "itoa", + "libc", + "memmap2", + "rustix", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-lock" +version = "14.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bc7fe297f1f4614774989c00ec8b1add59571dc9b024b4c00acb7dedd4e19d" +dependencies = [ + "gix-tempfile", + "gix-utils", + "thiserror", +] + +[[package]] +name = "gix-macros" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "999ce923619f88194171a67fb3e6d613653b8d4d6078b529b15a765da0edcc17" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.76", +] + +[[package]] +name = "gix-object" +version = "0.42.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25da2f46b4e7c2fa7b413ce4dffb87f69eaf89c2057e386491f4c55cadbfe386" +dependencies = [ + "bstr", + "gix-actor", + "gix-date", + "gix-features", + "gix-hash", + "gix-utils", + "gix-validate", + "itoa", + "smallvec", + "thiserror", + "winnow", +] + +[[package]] +name = "gix-odb" +version = "0.61.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20d384fe541d93d8a3bb7d5d5ef210780d6df4f50c4e684ccba32665a5e3bc9b" +dependencies = [ + "arc-swap", + "gix-date", + "gix-features", + "gix-fs", + "gix-hash", + "gix-object", + "gix-pack", + "gix-path", + "gix-quote", + "parking_lot", + "tempfile", + "thiserror", +] + +[[package]] +name = "gix-pack" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0594491fffe55df94ba1c111a6566b7f56b3f8d2e1efc750e77d572f5f5229" +dependencies = [ + "clru", + "gix-chunk", + "gix-features", + "gix-hash", + "gix-hashtable", + "gix-object", + "gix-path", + "memmap2", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-path" +version = "0.10.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d5b8722112fa2fa87135298780bc833b0e9f6c56cc82795d209804b3a03484" +dependencies = [ + "bstr", + "gix-trace", + "home", + "once_cell", + "thiserror", +] + +[[package]] +name = "gix-quote" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbff4f9b9ea3fa7a25a70ee62f545143abef624ac6aa5884344e70c8b0a1d9ff" +dependencies = [ + "bstr", + "gix-utils", + "thiserror", +] + +[[package]] +name = "gix-ref" +version = "0.44.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3394a2997e5bc6b22ebc1e1a87b41eeefbcfcff3dbfa7c4bd73cb0ac8f1f3e2e" +dependencies = [ + "gix-actor", + "gix-date", + "gix-features", + "gix-fs", + "gix-hash", + "gix-lock", + "gix-object", + "gix-path", + "gix-tempfile", + "gix-utils", + "gix-validate", + "memmap2", + "thiserror", + "winnow", +] + +[[package]] +name = "gix-refspec" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6868f8cd2e62555d1f7c78b784bece43ace40dd2a462daf3b588d5416e603f37" +dependencies = [ + "bstr", + "gix-hash", + "gix-revision", + "gix-validate", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-revision" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01b13e43c2118c4b0537ddac7d0821ae0dfa90b7b8dbf20c711e153fb749adce" +dependencies = [ + "bstr", + "gix-date", + "gix-hash", + "gix-hashtable", + "gix-object", + "gix-revwalk", + "gix-trace", + "thiserror", +] + +[[package]] +name = "gix-revwalk" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b030ccaab71af141f537e0225f19b9e74f25fefdba0372246b844491cab43e0" +dependencies = [ + "gix-commitgraph", + "gix-date", + "gix-hash", + "gix-hashtable", + "gix-object", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-sec" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fe4d52f30a737bbece5276fab5d3a8b276dc2650df963e293d0673be34e7a5f" +dependencies = [ + "bitflags 2.6.0", + "gix-path", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "gix-tempfile" +version = "14.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046b4927969fa816a150a0cda2e62c80016fe11fb3c3184e4dddf4e542f108aa" +dependencies = [ + "gix-fs", + "libc", + "once_cell", + "parking_lot", + "signal-hook", + "signal-hook-registry", + "tempfile", +] + +[[package]] +name = "gix-trace" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f924267408915fddcd558e3f37295cc7d6a3e50f8bd8b606cee0808c3915157e" + +[[package]] +name = "gix-traverse" +version = "0.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e499a18c511e71cf4a20413b743b9f5bcf64b3d9e81e9c3c6cd399eae55a8840" +dependencies = [ + "bitflags 2.6.0", + "gix-commitgraph", + "gix-date", + "gix-hash", + "gix-hashtable", + "gix-object", + "gix-revwalk", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-url" +version = "0.27.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd280c5e84fb22e128ed2a053a0daeacb6379469be6a85e3d518a0636e160c89" +dependencies = [ + "bstr", + "gix-features", + "gix-path", + "home", + "thiserror", + "url", +] + +[[package]] +name = "gix-utils" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35192df7fd0fa112263bad8021e2df7167df4cc2a6e6d15892e1e55621d3d4dc" +dependencies = [ + "fastrand", + "unicode-normalization", +] + +[[package]] +name = "gix-validate" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c27dd34a49b1addf193c92070bcbf3beaf6e10f16a78544de6372e146a0acf" +dependencies = [ + "bstr", + "thiserror", +] + [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] [[package]] name = "heck" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -405,24 +1142,22 @@ dependencies = [ ] [[package]] -name = "idna" -version = "0.2.3" +name = "home" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "windows-sys 0.52.0", ] [[package]] -name = "indexmap" -version = "1.8.0" +name = "idna" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "autocfg", - "hashbrown", + "unicode-bidi", + "unicode-normalization", ] [[package]] @@ -445,6 +1180,12 @@ dependencies = [ "unic-langid", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.10.3" @@ -454,6 +1195,12 @@ dependencies = [ "either", ] +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + [[package]] name = "jobserver" version = "0.1.24" @@ -469,24 +1216,11 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec", - "bitflags", - "cfg-if", - "ryu", - "static_assertions", -] - [[package]] name = "libc" -version = "0.2.119" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" @@ -518,6 +1252,22 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.14" @@ -528,16 +1278,19 @@ dependencies = [ ] [[package]] -name = "matches" -version = "0.1.9" +name = "memchr" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "memchr" -version = "2.4.1" +name = "memmap2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" +dependencies = [ + "libc", +] [[package]] name = "memoffset" @@ -548,17 +1301,37 @@ dependencies = [ "autocfg", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "nom" -version = "5.1.2" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "lexical-core", "memchr", - "version_check", + "minimal-lexical", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.44" @@ -588,6 +1361,21 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + [[package]] name = "opaque-debug" version = "0.3.0" @@ -595,19 +1383,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] -name = "os_str_bytes" -version = "6.0.0" +name = "parking_lot" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ - "memchr", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.3", + "smallvec", + "windows-targets 0.52.6", ] +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pkg-config" @@ -615,6 +1423,12 @@ version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -624,7 +1438,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.86", "version_check", ] @@ -641,18 +1455,24 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ - "unicode-xid", + "unicode-ident", ] +[[package]] +name = "prodash" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744a264d26b88a6a7e37cbad97953fa233b94d585236310bcbc88474b4092d79" + [[package]] name = "quote" -version = "1.0.15" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -688,23 +1508,46 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" dependencies = [ - "bitflags", + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +dependencies = [ + "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.5.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reiterate" @@ -734,9 +1577,15 @@ checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.86", ] +[[package]] +name = "roff" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" + [[package]] name = "rust-embed" version = "6.3.0" @@ -757,7 +1606,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn", + "syn 1.0.86", "walkdir", ] @@ -777,11 +1626,24 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "rustversion" -version = "1.0.6" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" @@ -804,11 +1666,52 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] + [[package]] name = "serde" -version = "1.0.136" +version = "1.0.209" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.209" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.76", +] + +[[package]] +name = "serde_json" +version = "1.0.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha1_smol" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" [[package]] name = "sha2" @@ -823,11 +1726,30 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "signal-hook" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + [[package]] name = "smallvec" -version = "1.8.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "stable_deref_trait" @@ -835,17 +1757,11 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subprocess" @@ -869,51 +1785,57 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.1.3" +name = "syn" +version = "2.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" dependencies = [ - "winapi-util", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "terminal_size" -version = "0.1.17" +name = "tempfile" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ - "libc", - "winapi", + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", ] [[package]] -name = "textwrap" -version = "0.15.0" +name = "terminal_size" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "terminal_size", + "rustix", + "windows-sys 0.48.0", ] [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.76", ] [[package]] @@ -927,6 +1849,39 @@ dependencies = [ "winapi", ] +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.3.4" @@ -983,15 +1938,27 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-bom" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217" + +[[package]] +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -1004,16 +1971,21 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "url" -version = "2.2.2" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", - "matches", "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "vcpkg" version = "0.2.15" @@ -1036,6 +2008,21 @@ dependencies = [ "thiserror", ] +[[package]] +name = "vergen" +version = "8.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566" +dependencies = [ + "anyhow", + "cargo_metadata", + "cfg-if", + "gix", + "regex", + "rustversion", + "time 0.3.36", +] + [[package]] name = "version_check" version = "0.9.4" @@ -1090,6 +2077,163 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +dependencies = [ + "memchr", +] + [[package]] name = "yaml-rust" version = "0.4.5" @@ -1098,3 +2242,23 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.76", +] diff --git a/Cargo.toml b/Cargo.toml index 0025db9..2d8809a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "fontship" version = "0.8.2" authors = [ "Caleb Maclennan " ] -edition = "2018" +edition = "2021" description = "A font development toolkit and collaborative work flow" homepage = "https://github.com/theleagueof/fontship" repository = "https://github.com/theleagueof/fontship" @@ -23,13 +23,13 @@ subprocess = "0.2.8" unic-langid = "0.9.0" [dependencies.config] - version = "0.11.0" + version = "0.14" default-features = false features = [ "yaml" ] [dependencies.clap] - version = "3.1.6" - features = [ "derive", "env", "wrap_help" ] + version = "4.5" + features = [ "derive", "wrap_help" ] [dependencies.git2] version = "0.13.25" @@ -48,14 +48,19 @@ unic-langid = "0.9.0" default-features = false features = [ "std" ] -[build-dependencies] -clap = "3.1.6" -clap_complete = "3.1.1" +[build-dependencies.clap_mangen] +version = "0.2" - [build-dependencies.vergen] - version = "6.0.0" - default-features = false - features = [ "build", "git" ] +[build-dependencies.clap] +version = "4.5" +features = [ "derive" ] +[build-dependencies.clap_complete] +version = "4.5" + +[build-dependencies.vergen] +version = "8.3" +default-features = false +features = [ "build", "cargo", "git", "gitoxide" ] [profile.release] lto = true diff --git a/Makefile.am b/Makefile.am index c9fa163..022b701 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ pkgdatadir = $(datadir) dist_doc_DATA = README.md CHANGELOG.md dist_license_DATA = LICENSE.md -dist_man_MANS = fontship.1 +dist_man_MANS = nobase_data_DATA = rules/fontship.mk nobase_dist_data_DATA = rules/rules.mk rules/functions.mk rules/glyphs.mk rules/sfd.mk rules/ufo.mk _fontship_libs = src/lib.rs src/cli.rs src/config.rs src/i18n.rs diff --git a/build-aux/build.rs b/build-aux/build.rs index 618b32f..afee4de 100644 --- a/build-aux/build.rs +++ b/build-aux/build.rs @@ -1,23 +1,50 @@ -use clap::IntoApp; +use clap::Command; use clap_complete::generator::generate_to; use clap_complete::shells::{Bash, Elvish, Fish, PowerShell, Zsh}; +use clap_mangen::Man; use std::{collections, env, fs}; -use vergen::{vergen, Config}; +use vergen::EmitBuilder; include!("../src/cli.rs"); fn main() { - let mut flags = Config::default(); - // If passed a version, use that instead of vergen's formatting - if let Ok(val) = env::var("FONTSHIP_VERSION") { - *flags.git_mut().enabled_mut() = false; - println!("cargo:rustc-env=VERGEN_GIT_SEMVER={}", val) + if let Ok(val) = env::var("AUTOTOOLS_DEPENDENCIES") { + for dependency in val.split(' ') { + println!("cargo:rerun-if-changed={dependency}"); + } + } + let mut builder = EmitBuilder::builder(); + // If passed a version from automake, use that instead of vergen's formatting + if let Ok(val) = env::var("VERSION_FROM_AUTOTOOLS") { + println!("cargo:rustc-env=VERGEN_GIT_DESCRIBE={val}") + } else { + builder = *builder.git_describe(true, true, None); }; - vergen(flags).expect("Unable to generate the cargo keys!"); + builder.emit().expect("Unable to generate the cargo keys!"); pass_on_configure_details(); + generate_manpage(); generate_shell_completions(); } +/// Generate man page +fn generate_manpage() { + let out_dir = match env::var_os("OUT_DIR") { + None => return, + Some(out_dir) => out_dir, + }; + let manpage_dir = path::Path::new(&out_dir); + fs::create_dir_all(manpage_dir).expect("Unable to create directory for generated manpages"); + let bin_name: &str = "fontship"; + let cli = Command::new("fontship"); + let cli = Cli::augment_args(cli); + let man = Man::new(cli); + let mut buffer: Vec = Default::default(); + man.render(&mut buffer) + .expect("Unable to render man page to UTF-8 string"); + fs::write(manpage_dir.join(format!("{bin_name}.1")), buffer) + .expect("Unable to write manepage to file"); +} + /// Generate shell completion files from CLI interface fn generate_shell_completions() { let out_dir = match env::var_os("OUT_DIR") { @@ -27,20 +54,18 @@ fn generate_shell_completions() { let completions_dir = path::Path::new(&out_dir).join("completions"); fs::create_dir_all(&completions_dir) .expect("Could not create directory in which to place completions"); - let app = Cli::command(); - let bin_name: &str = app - .get_bin_name() - .expect("Could not retrieve bin-name from generated Clap app"); - let mut app = Cli::command(); - generate_to(Bash, &mut app, bin_name, &completions_dir) + let bin_name: &str = "fontship"; + let cli = Command::new("fontship"); + let mut cli = Cli::augment_args(cli); + generate_to(Bash, &mut cli, bin_name, &completions_dir) .expect("Unable to generate bash completions"); - generate_to(Elvish, &mut app, bin_name, &completions_dir) + generate_to(Elvish, &mut cli, bin_name, &completions_dir) .expect("Unable to generate elvish completions"); - generate_to(Fish, &mut app, bin_name, &completions_dir) + generate_to(Fish, &mut cli, bin_name, &completions_dir) .expect("Unable to generate fish completions"); - generate_to(PowerShell, &mut app, bin_name, &completions_dir) + generate_to(PowerShell, &mut cli, bin_name, &completions_dir) .expect("Unable to generate powershell completions"); - generate_to(Zsh, &mut app, bin_name, &completions_dir) + generate_to(Zsh, &mut cli, bin_name, &completions_dir) .expect("Unable to generate zsh completions"); } @@ -53,6 +78,6 @@ fn pass_on_configure_details() { autoconf_vars.insert("CONFIGURE_DATADIR", String::from("./")); for (var, default) in autoconf_vars { let val = env::var(var).unwrap_or(default); - println!("cargo:rustc-env={}={}", var, val); + println!("cargo:rustc-env={var}={val}"); } } diff --git a/configure.ac b/configure.ac index c202c91..8896866 100644 --- a/configure.ac +++ b/configure.ac @@ -70,15 +70,7 @@ AM_COND_IF([DEVELOPER_MODE], [ datarootdir="$(cd ..; pwd)" ]) -if [[ -d .git ]]; then - MAN_DATE=$(git log -1 --format="%cd" --date=format:"%d %B %Y" -- fontship.1.in) -else - MAN_DATE=$(date "+%d %B %Y") -fi -AC_SUBST([MAN_DATE]) - AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([fontship.1]) AC_CONFIG_FILES([rules/fontship.mk]) AC_CONFIG_FILES([lib/make-shell.zsh], [chmod +x lib/make-shell.zsh]) diff --git a/fontship.1.in b/fontship.1.in deleted file mode 100644 index 26dfa13..0000000 --- a/fontship.1.in +++ /dev/null @@ -1,38 +0,0 @@ -.TH @TRANSFORMED_PACKAGE_NAME@ 1 "@MAN_DATE@" "version v@VERSION@" -.SH NAME -@TRANSFORMED_PACKAGE_NAME@ \- A font development toolkit and collaborative work flow. -.SH SYNOPSIS -.B @TRANSFORMED_PACKAGE_NAME@ [ -.I options -.B ] -.I COMMAND -.B [ -.I ARGS -.B ] -.SH DESCRIPTION -Fontship transforms a Git repository with font sources into generated fonts ready to distribute. -.SH OPTIONS -.B @TRANSFORMED_PACKAGE_NAME@ -accepts the following subcommands: -.TP -.BR \-h ", " \-\-help -Show a usage information and exit. -.TP -.BR \-v ", " \-\-version -Show the version and exit. -.TP -.BR \-d ", " \-\-debug -Enable debug mode flags. -.TP -.BR \-v ", " \-\-verbose -Enable extra verbose output from tooling. -.SH COMMANDS -.TP -.BR make -Build specified target(s). -.TP -.BR setup -Setup Fontship for use on a new Font project. -.TP -.BR status -Show information about setup and build status. diff --git a/src/cli.rs b/src/cli.rs index d1e791c..acddec9 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,11 +1,11 @@ -use clap::{Parser, Subcommand}; +use clap::{Args, Subcommand}; use std::path; // FTL: help-description /// The command line interface to Fontship, /// a font development toolkit and collaborative work flow. -#[derive(Parser, Debug)] -#[clap(bin_name = "fontship")] +#[derive(Args, Debug)] +#[clap(author)] pub struct Cli { // FTL: help-flags-debug /// Enable extra debug output from tooling @@ -14,13 +14,18 @@ pub struct Cli { // FTL: help-flags-language /// Set language - #[clap(short, long, env = "LANG")] + #[clap(short, long)] pub language: Option, + // FTL: help-flag-passthrough + /// Eschew all UI output and just pass the subprocess output through + #[clap(short, long)] + pub passthrough: bool, + // FTL: help-flags-path /// Set project root path - #[clap(short, long, default_value = "./")] - pub path: path::PathBuf, + #[clap(short = 'P', long, default_value = "./", value_hint = clap::ValueHint::DirPath)] + pub project: path::PathBuf, // FTL: help-flags-quiet /// Discard all non-error output messages @@ -43,6 +48,7 @@ pub enum Commands { Make { // FTL: help-subcommand-make-target /// Target as defined in Fontship or project rules + #[clap(value_hint = clap::ValueHint::AnyPath)] target: Vec, }, diff --git a/src/config.rs b/src/config.rs index a1900d8..b5a8462 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,7 +2,7 @@ use crate::cli::Cli; use crate::Result; use config::{Config, Environment}; -use std::sync; +use std::{env, sync}; static ERROR_CONFIG_WRITE: &str = "Unable to gain write lock on global app config"; static ERROR_CONFIG_READ: &str = "Unable to gain read lock on global app config"; @@ -12,25 +12,37 @@ lazy_static! { } impl CONF { + #[allow(deprecated)] pub fn defaults(&self) -> Result<()> { - self.write() - .expect(ERROR_CONFIG_WRITE) + let mut config = self.write().expect(ERROR_CONFIG_WRITE); + config .set_default("debug", false)? .set_default("quiet", false)? .set_default("verbose", false)? - .set_default("path", "./")? - .set_default("sourcedir", "sources")?; + .set_default("language", crate::DEFAULT_LOCALE)? + .set_default("passthrough", false)? + .set_default("project", "./")? + .set_default("sourcedir", "sources")? + .set_default("builddir", ".fontship")?; Ok(()) } - pub fn from_env(&self) -> Result<()> { - self.write() - .expect(ERROR_CONFIG_WRITE) - .merge(Environment::with_prefix("fontship"))?; + #[allow(deprecated)] + pub fn merge_env(&self) -> Result<()> { + let mut config = self.write().expect(ERROR_CONFIG_WRITE); + if let Some(lang) = env::var_os("LANG") { + if lang.len() > 0 && env::var_os("FONTSHIP_LANGUAGE").is_none() { + env::set_var("FONTSHIP_LANGUAGE", lang) + } + } + if env::var("RUNNER_DEBUG").is_ok() { + env::set_var("FONTSHIP_DEBUG", env::var("RUNNER_DEBUG")?) + } + config.merge(Environment::with_prefix("fontship"))?; Ok(()) } - pub fn from_args(&self, args: &Cli) -> Result<()> { + pub fn merge_args(&self, args: &Cli) -> Result<()> { if args.debug { self.set_bool("debug", true)?; self.set_bool("verbose", true)?; @@ -39,8 +51,11 @@ impl CONF { } else if args.quiet { self.set_bool("quiet", true)?; } - if let Some(path) = &args.path.to_str() { - self.set_str("path", path)?; + if args.passthrough { + self.set_bool("passthrough", true)?; + } + if let Some(project) = &args.project.to_str() { + self.set_str("project", project)?; } if let Some(language) = &args.language { self.set_str("language", language)?; @@ -48,6 +63,7 @@ impl CONF { Ok(()) } + #[allow(deprecated)] pub fn set_bool(&self, key: &str, val: bool) -> Result<()> { self.write().expect(ERROR_CONFIG_WRITE).set(key, val)?; Ok(()) @@ -57,12 +73,13 @@ impl CONF { Ok(self.read().expect(ERROR_CONFIG_READ).get_bool(key)?) } + #[allow(deprecated)] pub fn set_str(&self, key: &str, val: &str) -> Result<()> { self.write().expect(ERROR_CONFIG_WRITE).set(key, val)?; Ok(()) } pub fn get_string(&self, key: &str) -> Result { - Ok(self.read().expect(ERROR_CONFIG_READ).get_str(key)?) + Ok(self.read().expect(ERROR_CONFIG_READ).get_string(key)?) } } diff --git a/src/lib.rs b/src/lib.rs index d097532..1971484 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,8 +74,8 @@ pub fn pname(input: &str) -> String { /// Get repository object pub fn get_repo() -> Result { - let path = CONF.get_string("path")?; - Ok(Repository::discover(path)?) + let project = CONF.get_string("project")?; + Ok(Repository::discover(project)?) } pub fn commit(repo: Repository, oid: Oid, msg: &str) -> result::Result { diff --git a/src/main.rs b/src/main.rs index 0541e11..9d603d7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,35 +1,24 @@ -use clap::{FromArgMatches, IntoApp}; +use clap::{Args, Command, FromArgMatches as _}; use fontship::cli::{Cli, Commands}; use fontship::config::CONF; use fontship::{make, setup, status}; use fontship::{Result, VERSION}; -use std::env; - fn main() -> Result<()> { CONF.defaults()?; - CONF.from_env()?; - // Workaround for Github Actions usage to make the prebuilt Docker image - // invocation interchangeable with the default run-time built invocation we - // need to set some default arguments. These are not used by the regular CLI. - // See the action.yml file for matching arguments for run-time invocations. - let ret = if status::is_gha()? && env::args().count() == 1 { - CONF.set_str("language", "en-US")?; - fontship::show_welcome(); - let target = vec![String::from("_gha"), String::from("dist")]; - make::run(target) - } else { - let app = Cli::command().infer_subcommands(true).version(*VERSION); - let matches = app.get_matches(); - let args = Cli::from_arg_matches(&matches)?; - CONF.from_args(&args)?; - fontship::show_welcome(); - match args.subcommand { - Commands::Make { target } => make::run(target), - Commands::Setup {} => setup::run(), - Commands::Status {} => status::run(), - } + CONF.merge_env()?; + let cli = Command::new("fontship").version(*VERSION); + let cli = Cli::augment_args(cli); + let matches = cli.get_matches(); + let args = Cli::from_arg_matches(&matches).expect("Unable to parse arguments"); + CONF.merge_args(&args)?; + fontship::show_welcome(); + let subcommand = Commands::from_arg_matches(&matches)?; + let ret = match subcommand { + Commands::Make { target } => make::run(target), + Commands::Setup {} => setup::run(), + Commands::Status {} => status::run(), }; fontship::show_outro(); ret diff --git a/src/make/mod.rs b/src/make/mod.rs index 6ddfd4d..8ef1bb9 100644 --- a/src/make/mod.rs +++ b/src/make/mod.rs @@ -57,7 +57,7 @@ pub fn run(target: Vec) -> Result<()> { .env("LANGUAGE", locale_to_language(CONF.get_string("language")?)) .env("GITNAME", &gitname) .env("PROJECT", pname(&gitname)) - .env("PROJECTDIR", CONF.get_string("path")?) + .env("PROJECTDIR", CONF.get_string("project")?) .env("GitVersion", git_version) .env("FontVersion", font_version) .env("SOURCEDIR", CONF.get_string("sourcedir")?) diff --git a/src/setup/mod.rs b/src/setup/mod.rs index 4afb609..a69ccbd 100644 --- a/src/setup/mod.rs +++ b/src/setup/mod.rs @@ -13,8 +13,8 @@ use subprocess::{Exec, NullFile, Redirection}; /// Setup a font project for use with Fontship pub fn run() -> Result<()> { show_header("setup-header"); - let path = &CONF.get_string("path")?; - let metadata = fs::metadata(&path)?; + let project = &CONF.get_string("project")?; + let metadata = fs::metadata(project)?; match metadata.is_dir() { true => match is_repo()? { true => { From 2216711ac10da68d2b1fc6245b4e59208dd4004d Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 26 Aug 2024 15:12:04 +0300 Subject: [PATCH 3/6] chore(deps): Bump libgit2 and git-warp-time dependencies --- Cargo.lock | 252 ++++++++++++++++++++++++++++++----------------- Cargo.toml | 5 +- src/setup/mod.rs | 20 +++- 3 files changed, 179 insertions(+), 98 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4417111..e87f9cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -198,19 +198,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "time 0.1.44", - "winapi", -] - [[package]] name = "clap" version = "4.5.16" @@ -249,7 +236,7 @@ version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.76", @@ -369,6 +356,41 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.76", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.76", +] + [[package]] name = "deranged" version = "0.3.11" @@ -378,6 +400,37 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derive_builder" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.76", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" +dependencies = [ + "derive_builder_core", + "syn 2.0.76", +] + [[package]] name = "digest" version = "0.9.0" @@ -408,26 +461,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "enum-iterator" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.86", -] - [[package]] name = "errno" version = "0.3.9" @@ -587,22 +620,25 @@ dependencies = [ [[package]] name = "git-warp-time" -version = "0.4.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29e6ee3be1779ae457baf5c0697e8fef1af71058b04488c8b28151bd6fa6015e" +checksum = "e53e0f7ef245b95dd7f26e1ba87657aed5a5d036035b52e3c078d3b76a990a9e" dependencies = [ + "anyhow", + "camino", "filetime", "git2", - "vergen 6.0.2", + "snafu", + "vergen-gix", ] [[package]] name = "git2" -version = "0.13.25" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6" +checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "libc", "libgit2-sys", "log", @@ -740,7 +776,7 @@ dependencies = [ "bstr", "itoa", "thiserror", - "time 0.3.36", + "time", ] [[package]] @@ -1126,6 +1162,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "heck" version = "0.5.0" @@ -1150,6 +1192,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.5.0" @@ -1224,9 +1272,9 @@ checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" -version = "0.12.26+1.3.0" +version = "0.17.0+1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494" +checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" dependencies = [ "cc", "libc", @@ -1332,25 +1380,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-integer" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - [[package]] name = "num_cpus" version = "1.13.1" @@ -1626,6 +1655,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.34" @@ -1751,6 +1789,27 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "snafu" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b835cb902660db3415a672d862905e791e54d306c6e8189168c7f3d9ae1c79d" +dependencies = [ + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d1e02fca405f6280643174a50c942219f0bbf4dbf7d480f1dd864d6f211ae5" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.76", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -1838,17 +1897,6 @@ dependencies = [ "syn 2.0.76", ] -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi", - "winapi", -] - [[package]] name = "time" version = "0.3.36" @@ -1994,33 +2042,61 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vergen" -version = "6.0.2" +version = "8.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3893329bee75c101278e0234b646fa72221547d63f97fb66ac112a0569acd110" +checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566" dependencies = [ "anyhow", + "cargo_metadata", "cfg-if", - "chrono", - "enum-iterator", - "getset", - "git2", + "gix", + "regex", "rustversion", - "thiserror", + "time", ] [[package]] name = "vergen" -version = "8.3.2" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566" +checksum = "c32e7318e93a9ac53693b6caccfb05ff22e04a44c7cf8a279051f24c09da286f" dependencies = [ "anyhow", "cargo_metadata", - "cfg-if", - "gix", + "derive_builder", + "getset", "regex", + "rustc_version", + "rustversion", + "time", + "vergen-lib", +] + +[[package]] +name = "vergen-gix" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf11588e10333838eeb5b0d341e3364dfc1bfaf7c1b3beccf8f8706c49d5d34" +dependencies = [ + "anyhow", + "derive_builder", + "gix", + "rustversion", + "time", + "vergen 9.0.0", + "vergen-lib", +] + +[[package]] +name = "vergen-lib" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06bee42361e43b60f363bad49d63798d0f42fb1768091812270eca00c784720" +dependencies = [ + "anyhow", + "derive_builder", + "getset", "rustversion", - "time 0.3.36", ] [[package]] @@ -2040,12 +2116,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 2d8809a..e09b429 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,11 +32,11 @@ unic-langid = "0.9.0" features = [ "derive", "wrap_help" ] [dependencies.git2] - version = "0.13.25" + version = "0.19" default-features = false [dependencies.git-warp-time] - version = "0.4.4" + version = "0.8" default-features = false [dependencies.Inflector] @@ -54,6 +54,7 @@ version = "0.2" [build-dependencies.clap] version = "4.5" features = [ "derive" ] + [build-dependencies.clap_complete] version = "4.5" diff --git a/src/setup/mod.rs b/src/setup/mod.rs index a69ccbd..07eba76 100644 --- a/src/setup/mod.rs +++ b/src/setup/mod.rs @@ -3,7 +3,7 @@ use crate::*; use colored::Colorize; use git2::{Repository, Status}; -use git_warp_time::reset_mtime; +use git_warp_time::reset_mtimes; use std::io::prelude::*; use std::sync::{Arc, RwLock}; use std::{fs, io, path}; @@ -20,7 +20,9 @@ pub fn run() -> Result<()> { true => { regen_gitignore(get_repo()?)?; configure_short_shas(get_repo()?)?; - warp_time(get_repo()?)?; + if is_deep()? { + warp_time(get_repo()?)?; + } Ok(()) } false => Err(Box::new(io::Error::new( @@ -86,7 +88,14 @@ pub fn is_repo() -> Result { Ok(ret) } -/// Are we not in the CaSILE source repo? +/// Is this repo a deep clone? +pub fn is_deep() -> Result { + let ret = !get_repo()?.is_shallow(); + display_check("setup-is-deep", ret); + Ok(ret) +} + +/// Are we not in the Fontship source repo? pub fn is_not_fontship_source() -> Result { let repo = get_repo()?; let workdir = repo.workdir().unwrap(); @@ -165,12 +174,13 @@ fn warp_time(repo: Repository) -> Result<()> { let opts = git_warp_time::Options::new(); let text = LocalText::new("setup-warp-time").fmt(); eprintln!("{} {}", "┠┄".cyan(), text); - let files = reset_mtime(repo, opts)?; + let files = reset_mtimes(repo, opts)?; match CONF.get_bool("verbose")? { true => { for file in files.iter() { + let path = file.clone().into_os_string().into_string().unwrap(); let text = LocalText::new("setup-warp-time-file") - .arg("path", file.white().bold()) + .arg("path", path.white().bold()) .fmt(); eprintln!("{} {}", "┠┄".cyan(), text); } From a326331648e35b55f6c8ec75040c6eebf2d99699 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 26 Aug 2024 17:28:49 +0300 Subject: [PATCH 4/6] refactor(cli): Rip-off interactive UI changes from CaSILE --- Cargo.lock | 406 +++++++++++++++++++++++++++++-------------- Cargo.toml | 33 ++-- assets/en-US/cli.ftl | 74 ++++++-- rules/functions.mk | 5 +- src/i18n.rs | 181 ++++++++++++------- src/lib.rs | 73 +++----- src/main.rs | 5 +- src/make/mod.rs | 241 ++++++++++++------------- src/setup/mod.rs | 72 ++++---- src/status/mod.rs | 41 +++-- src/ui.rs | 206 ++++++++++++++++++++++ src/ui_ascii.rs | 204 ++++++++++++++++++++++ src/ui_indicatif.rs | 334 +++++++++++++++++++++++++++++++++++ 13 files changed, 1429 insertions(+), 446 deletions(-) create mode 100644 src/ui.rs create mode 100644 src/ui_ascii.rs create mode 100644 src/ui_indicatif.rs diff --git a/Cargo.lock b/Cargo.lock index e87f9cc..8633769 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,14 +103,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] -name = "atty" -version = "0.2.14" +name = "async-trait" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ - "hermit-abi", - "libc", - "winapi", + "proc-macro2", + "quote", + "syn 2.0.76", ] [[package]] @@ -133,9 +133,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" -version = "0.9.0" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] @@ -198,6 +198,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chunky-vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb7bdea464ae038f09197b82430b921c53619fc8d2bcaf7b151013b3ca008017" + [[package]] name = "clap" version = "4.5.16" @@ -236,7 +242,7 @@ version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.76", @@ -270,17 +276,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" -[[package]] -name = "colored" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] - [[package]] name = "config" version = "0.14.0" @@ -294,6 +289,19 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", +] + [[package]] name = "cpufeatures" version = "0.2.1" @@ -312,16 +320,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.1" @@ -356,6 +354,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "darling" version = "0.20.10" @@ -433,11 +441,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.9.0" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "generic-array", + "block-buffer", + "crypto-common", ] [[package]] @@ -453,13 +462,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] -name = "elsa" -version = "1.7.0" +name = "encode_unicode" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b4b5d23ed6b6948d68240aafa4ac98e568c9a020efd9d4201a6288bc3006e09" -dependencies = [ - "stable_deref_trait", -] +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "errno" @@ -507,9 +513,9 @@ dependencies = [ [[package]] name = "fluent" -version = "0.12.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3b6132d1377d8776409a337c6851d342aee4e85277c96ecd2755c4e0efde1d" +checksum = "bb74634707bebd0ce645a981148e8fb8c7bccd4c33c652aeffd28bf2f96d555a" dependencies = [ "fluent-bundle", "unic-langid", @@ -517,27 +523,34 @@ dependencies = [ [[package]] name = "fluent-bundle" -version = "0.12.0" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a094d494ab2ed06077e9a95f4e47f446c376de95f6c93045dd88c499bfcd70" +checksum = "7fe0a21ee80050c678013f82edf4b705fe2f26f1f9877593d13198612503f493" dependencies = [ "fluent-langneg", "fluent-syntax", "intl-memoizer", "intl_pluralrules", - "rental", + "rustc-hash", + "self_cell 0.10.3", "smallvec", "unic-langid", ] [[package]] name = "fluent-fallback" -version = "0.0.4" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f87d8e08eff168fbfd9a897f5c39d840e12a9a1091e274df19010c53855cfa41" +checksum = "1010c29cde3a7eeb231c59d95411dcea1c1d91ad00dd733b076dbd885815024a" dependencies = [ + "async-trait", + "chunky-vec", "fluent-bundle", - "reiterate", + "futures", + "once_cell", + "pin-cell", + "rustc-hash", + "unic-langid", ] [[package]] @@ -551,9 +564,12 @@ dependencies = [ [[package]] name = "fluent-syntax" -version = "0.9.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac0f7e83d14cccbf26e165d8881dcac5891af0d85a88543c09dd72ebd31d91ba" +checksum = "2a530c4694a6a8d528794ee9bbd8ba0122e779629ac908d15ad5a7ae7763a33d" +dependencies = [ + "thiserror", +] [[package]] name = "fnv" @@ -569,21 +585,25 @@ dependencies = [ "clap", "clap_complete", "clap_mangen", - "colored", "config", + "console", "fluent", "fluent-fallback", "fluent-langneg", + "futures", "git-warp-time", "git2", + "indicatif", "itertools", "lazy_static", "num_cpus", "rayon", "regex", "rust-embed", + "rustc-hash", "subprocess", "unic-langid", + "unic-langid-impl", "vergen 8.3.2", ] @@ -596,6 +616,95 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.76", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "generic-array" version = "0.14.5" @@ -1162,12 +1271,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1176,12 +1279,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "home" @@ -1208,11 +1308,35 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indicatif" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +dependencies = [ + "console", + "instant", + "number_prefix", + "portable-atomic", + "rayon", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + [[package]] name = "intl-memoizer" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c310433e4a310918d6ed9243542a6b83ec1183df95dff8f23f87bb88a264a66f" +checksum = "fe22e020fce238ae18a6d5d8c502ee76a52a6e880d99477657e6acc30ec57bda" dependencies = [ "type-map", "unic-langid", @@ -1236,9 +1360,9 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" -version = "0.10.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -1382,9 +1506,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ "hermit-abi", "libc", @@ -1400,16 +1524,16 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.19.0" +name = "number_prefix" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] -name = "opaque-debug" -version = "0.3.0" +name = "once_cell" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "parking_lot" @@ -1446,12 +1570,36 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pin-cell" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1f4c4ebd3c5f82080164b7d9cc8e505cd9536fda8c750b779daceb4b7180a7b" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +[[package]] +name = "portable-atomic" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" + [[package]] name = "powerfmt" version = "0.2.0" @@ -1508,27 +1656,22 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", - "num_cpus", ] [[package]] @@ -1578,37 +1721,6 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" -[[package]] -name = "reiterate" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702df0082a41c77a8c59a7ed42beea321a32c2d148f755661124910c5f3f8262" -dependencies = [ - "elsa", - "stable_deref_trait", -] - -[[package]] -name = "rental" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc89fe2acac36d212474d138aaf939c04a82df5b61d07011571ebce5aef81f2e" -dependencies = [ - "rental-impl", - "stable_deref_trait", -] - -[[package]] -name = "rental-impl" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.86", -] - [[package]] name = "roff" version = "0.2.2" @@ -1617,9 +1729,9 @@ checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" [[package]] name = "rust-embed" -version = "6.3.0" +version = "8.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40377bff8cceee81e28ddb73ac97f5c2856ce5522f0b260b763f434cdfae602" +checksum = "fa66af4a4fdd5e7ebc276f115e895611a34739a9c1c01028383d612d550953c0" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -1628,22 +1740,22 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "6.2.0" +version = "8.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e763e24ba2bf0c72bc6be883f967f794a019fafd1b86ba1daff9c91a7edd30" +checksum = "6125dbc8867951125eec87294137f4e9c2c96566e61bf72c45095a7c77761478" dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 1.0.86", + "syn 2.0.76", "walkdir", ] [[package]] name = "rust-embed-utils" -version = "7.1.0" +version = "8.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad22c7226e4829104deab21df575e995bfbc4adfad13a595e387477f238c1aec" +checksum = "2e5347777e9aacb56039b0e1f28785929a8a3b709e87482e7442c72e7c12529d" dependencies = [ "sha2", "walkdir", @@ -1704,6 +1816,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "self_cell" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14e4d63b804dc0c7ec4a1e52bcb63f02c7ac94476755aa579edac21e01f915d" +dependencies = [ + "self_cell 1.0.4", +] + +[[package]] +name = "self_cell" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" + [[package]] name = "semver" version = "1.0.23" @@ -1753,15 +1880,13 @@ checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" [[package]] name = "sha2" -version = "0.9.9" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "block-buffer", "cfg-if", "cpufeatures", "digest", - "opaque-debug", ] [[package]] @@ -1783,6 +1908,15 @@ dependencies = [ "libc", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -1804,18 +1938,12 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d1e02fca405f6280643174a50c942219f0bbf4dbf7d480f1dd864d6f211ae5" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "syn 2.0.76", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "strsim" version = "0.11.1" @@ -1953,9 +2081,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "type-map" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d3364c5e96cb2ad1603037ab253ddd34d7fb72a58bdddf4b7350760fc69a46" +checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f" dependencies = [ "rustc-hash", ] @@ -2011,6 +2139,18 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + [[package]] name = "unicode-xid" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index e09b429..51fd4d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,17 +10,20 @@ license = "AGPL-3" build = "build-aux/build.rs" [dependencies] -colored = "2.0.0" -fluent = "0.12.0" -fluent-fallback = "0.0.4" -fluent-langneg = "0.13.0" -itertools = "0.10.3" -lazy_static = "1.4.0" -num_cpus = "1.13.1" -rayon = "1.5.1" -rust-embed = "6.3.0" -subprocess = "0.2.8" -unic-langid = "0.9.0" +console = "0.15" +fluent = "0.16" +fluent-fallback = "0.7" +fluent-langneg = "0.13" +futures = "0.3" +itertools = "0.13" +lazy_static = "1.4" +num_cpus = "1.16" +rayon = "1.10" +rust-embed = "8.3" +rustc-hash = "1.1" +subprocess = "0.2" +unic-langid = "0.9" +unic-langid-impl = "0.9" [dependencies.config] version = "0.14" @@ -39,12 +42,16 @@ unic-langid = "0.9.0" version = "0.8" default-features = false + [dependencies.indicatif] + version = "0.17" + features = [ "improved_unicode", "rayon" ] + [dependencies.Inflector] - version = "0.11.4" + version = "0.11" default-features = false [dependencies.regex] - version = "1.5.4" + version = "1.10" default-features = false features = [ "std" ] diff --git a/assets/en-US/cli.ftl b/assets/en-US/cli.ftl index 30f3ef1..6725d01 100644 --- a/assets/en-US/cli.ftl +++ b/assets/en-US/cli.ftl @@ -4,19 +4,22 @@ help-description = a font development toolkit and collaborative work flow. # Currently hard coded, see clap issue #1880 -help-flags-debug = +help-flag-debug = Enable extra debug output from tooling # Currently hard coded, see clap issue #1880 -help-flags-language = +help-flag-language = Set language # Currently hard coded, see clap issue #1880 -help-flags-quiet = +help-flag-quiet = Discard all non-error output messages +help-flag-passthrough = + Eschew all UI output and just pass the subprocess output through + # Currently hard coded, see clap issue #1880 -help-flags-verbose = +help-flag-verbose = Enable extra verbose output from tooling # Currently hard coded, see clap issue #1880 @@ -55,26 +58,32 @@ error-no-path = welcome = Welcome to Fontship { $version } -outro = - Fontship run complete +farewell = + Fontship run completed in { $duration }. make-header = Building target(s) using ‘make’ +make-good = + All target(s) successfully made. + +make-bad = + Unable to finish making some or all target(s). + make-report-start = - Starting make job for target: { $target } + Started to make: { $target } -make-report-end = - Finished make job for target: { $target } +make-report-pass = + Finished making: { $target } make-report-fail = - Failed make job for target: { $target } + Make recipe for target { $target } failed with exit code { $code }. make-backlog-start = - Dumping captured output of ‘make’ + Dumping captured output of ‘make’ for target { $target }: make-backlog-end = - End dump + End of dump. make-error-unknown-code = Make returned an action code Fontship doesn't have a handler for. The most @@ -85,6 +94,9 @@ make-error-unknown-code = make-error = Failed to execute a subprocess for ‘make’. +make-error-oom = + Make reported process aborted because system ran out of memory (OOM). + make-error-unfinished = Make reported outdated targets were not built. @@ -94,27 +106,33 @@ make-error-build = make-error-target = Make failed to execute a recipe. +make-error-unidentified-target = + Make asked to print output related to a target we didn't know was running: { $target } + make-error-unknown = Make returned unknown error. setup-header = Configuring repository for use with Fontship -setup-true = - Yes - -setup-false = - No - setup-good = Everything seems to be ship shape, anchors up! setup-bad = Something isn’t seaworthy, run ‘fontship setup’ +setup-true = + Yes + +setup-false = + No + setup-is-repo = Is the path a Git repository? +setup-is-deep = + Is the Git a deep clone? + setup-is-not-fontship = Are we not in the Fontship source repository? @@ -137,13 +155,31 @@ setup-short-shas = Setting default length of short SHA hashes in repository setup-warp-time = - Reseting version tracked file timestamps to last affecting commit + Resetting version tracked file timestamps to last affecting commit setup-warp-time-file = Rewound clock on { $path } +is-setup-header = + { setup-header } + +is-setup-good = + { status-good } + +is-setup-bad = + { status-bad } + status-header = Scanning project status +status-good = + Everything seems to be ship shape, warm up the presses! + +status-bad = + Hold the presses, something isn’t right, run ‘fontship setup’ + status-is-gha = Are we running as a GitHub Action? + +status-is-glc = + Are we running as a GitLab CI job? diff --git a/rules/functions.mk b/rules/functions.mk index 60ebf00..bf70a0b 100644 --- a/rules/functions.mk +++ b/rules/functions.mk @@ -1,7 +1,8 @@ # Utility variables for later, http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html , := , -space := $() $() -$(space) := $() $() +empty := +space := $(empty) $(empty) +$(space) := $(empty) $(empty) lparen := ( rparen := ) diff --git a/src/i18n.rs b/src/i18n.rs index 922553d..54f850b 100644 --- a/src/i18n.rs +++ b/src/i18n.rs @@ -1,12 +1,24 @@ use crate::config::CONF; -use crate::DEFAULT_LOCALE; use fluent::{FluentArgs, FluentBundle, FluentResource, FluentValue}; -use fluent_fallback::Localization; +use fluent_fallback::{ + env::LocalesProvider, + generator::{BundleGenerator, FluentBundleResult}, + types::{ResourceId, ResourceType}, + Localization, +}; +use fluent_langneg::{accepted_languages, negotiate_languages, NegotiationStrategy}; +use futures::stream::Stream; use regex::Regex; use rust_embed::RustEmbed; -use std::{iter, ops, path, str, sync, vec}; -use unic_langid::LanguageIdentifier; +use rustc_hash::FxHashSet; +use std::borrow::Cow; +use std::ops::Deref; +use std::path::{Component, Path, PathBuf}; +use std::str; +use std::sync::RwLock; +use std::vec::IntoIter; +use unic_langid_impl::LanguageIdentifier; // List of Fluent resource filenames to scan for keys from each locale directory. static FTL_RESOURCES: &[&str] = &["cli.ftl"]; @@ -18,17 +30,16 @@ pub struct Asset; lazy_static! { /// List of Locales in order of closeness to the runtime config - pub static ref LOCALES: sync::RwLock = - sync::RwLock::new(Locales::new(CONF.get_string("language").expect("Unable to retrieve language from config"))); + pub static ref LOCALES: RwLock = + RwLock::new(Locales::new(CONF.get_string("language").expect("Unable to retrieve language from config"))); } /// A prioritized locale fallback stack #[derive(Debug)] pub struct Locales(Vec); -impl ops::Deref for Locales { +impl Deref for Locales { type Target = Vec; - fn deref(&self) -> &Vec { &self.0 } @@ -39,16 +50,16 @@ impl Locales { pub fn new(language: String) -> Locales { let language = normalize_lang(&language); let available = self::list_available_locales(); - let requested = fluent_langneg::accepted_languages::parse(&language); - let default: LanguageIdentifier = DEFAULT_LOCALE + let requested = accepted_languages::parse(&language); + let default: LanguageIdentifier = crate::DEFAULT_LOCALE .parse() .expect("Unable to parse default locale"); Locales( - fluent_langneg::negotiate_languages( + negotiate_languages( &requested, &available, Some(&default), - fluent_langneg::NegotiationStrategy::Filtering, + NegotiationStrategy::Filtering, ) .iter() .copied() @@ -58,6 +69,13 @@ impl Locales { } } +impl LocalesProvider for Locales { + type Iter = as IntoIterator>::IntoIter; + fn locales(&self) -> Self::Iter { + self.0.clone().into_iter() + } +} + /// A Fluent key plus any variables that will be needed to format it. #[derive(Debug)] pub struct LocalText<'a> { @@ -79,12 +97,12 @@ impl<'a> LocalText<'a> { let value = FluentValue::from(val.to_string()); let args: Option> = match self.args { Some(mut args) => { - args.insert(var, value); + args.set(var, value); Some(args) } None => { let mut args: FluentArgs<'a> = FluentArgs::new(); - args.insert(var, value); + args.set(var, value); Some(args) } }; @@ -94,49 +112,96 @@ impl<'a> LocalText<'a> { } } - /// Format and return a string for the given key and args using the prefered locale fallback + /// Format and return a string for the given key and args using the preferred locale fallback /// stack as negotiated at runtime. pub fn fmt(&self) -> String { let locales = LOCALES .read() - .expect("Unable to read negotiated locale list"); - let mut res_path_scheme = path::PathBuf::new(); + .expect("Unable to read negotiated locale list") + .clone(); + let bundled_resources = EmbeddedBundleManager {}; + let scan_resources: Vec = FTL_RESOURCES + .iter() + .map(|s| ResourceId::new(s.to_string(), ResourceType::Required)) + .collect(); + let loc = Localization::with_env(scan_resources, true, locales, bundled_resources); + let bundles = loc.bundles(); + let mut errors = vec![]; + let value = bundles + .format_value_sync(&self.key, self.args.as_ref(), &mut errors) + .expect("Failed to format a value"); + value.unwrap_or(Cow::from("")).to_string() + } +} + +pub struct BundleIter { + locales: as IntoIterator>::IntoIter, + res_ids: FxHashSet, +} + +impl Iterator for BundleIter { + type Item = FluentBundleResult; + + fn next(&mut self) -> Option { + let locale = self.locales.next()?; + let mut bundle = FluentBundle::new(vec![locale.clone()]); + let mut res_path_scheme = PathBuf::new(); res_path_scheme.push("{locale}"); res_path_scheme.push("{res_id}"); - let generate_messages = |res_ids: &[String]| { - let mut resolved_locales = locales.iter(); + for res_id in self.res_ids.iter() { let res_path_scheme = res_path_scheme .to_str() .expect("Locale resource path not valid"); - let res_ids = res_ids.to_vec(); - iter::from_fn(move || { - resolved_locales.next().map(|locale| { - let x = vec![locale.clone()]; - let mut bundle = FluentBundle::new(&x); - let res_path = res_path_scheme.replace("{locale}", &locale.to_string()); - for res_id in &res_ids { - let path = res_path.replace("{res_id}", res_id); - if let Some(source) = Asset::get(&path) { - let data = str::from_utf8(source.data.as_ref()) - .expect("Fluent data source not valid UTF-8"); - let res = FluentResource::try_new(data.to_string()) - .expect("Fluent data source not valid resource"); - bundle - .add_resource(res) - .expect("Unable to add Fluent resource to bundle"); - } - } - bundle - }) - }) - }; - let loc = Localization::new( - FTL_RESOURCES.iter().map(|s| s.to_string()).collect(), - generate_messages, - ); - // let value: String = loc.format_value(&self.key, &self.args).to_string(); - let value: String = loc.format_value(&self.key, self.args.as_ref()).to_string(); - value + let res_path = res_path_scheme.replace("{locale}", &locale.to_string()); + let res_id = res_id.to_string(); + let path = res_path.replace("{res_id}", res_id.as_str()); + if let Some(source) = Asset::get(&path) { + let data = str::from_utf8(source.data.as_ref()) + .expect("Fluent data source not valid UTF-8"); + let res = FluentResource::try_new(data.to_string()) + .expect("Fluent data source not valid resource"); + bundle + .add_resource(res) + .expect("Unable to add Fluent resource to bundle"); + } + } + Some(Ok(bundle)) + } +} + +impl Stream for BundleIter { + type Item = FluentBundleResult; + + fn poll_next( + self: std::pin::Pin<&mut Self>, + _cx: &mut std::task::Context<'_>, + ) -> std::task::Poll> { + unimplemented!() + } +} + +struct EmbeddedBundleManager {} + +impl BundleGenerator for EmbeddedBundleManager { + type Resource = FluentResource; + type LocalesIter = IntoIter; + type Iter = BundleIter; + type Stream = BundleIter; + + fn bundles_iter( + &self, + locales: Self::LocalesIter, + res_ids: FxHashSet, + ) -> Self::Iter { + BundleIter { locales, res_ids } + } + + fn bundles_stream( + &self, + _locales: Self::LocalesIter, + _res_ids: FxHashSet, + ) -> Self::Stream { + unimplemented!(); } } @@ -146,33 +211,33 @@ pub fn normalize_lang(input: &str) -> String { re.replace(input, "").to_string() } -/// Scan our embedded assets for what recognisable locale data we have on hand +/// Scan our embedded assets for what recognizable locale data we have on hand // https://github.com/projectfluent/fluent-rs/blob/c9e45651/fluent-resmgr/examples/simple-resmgr.rs#L35 pub fn list_available_locales() -> Locales { - let mut embeded = vec![]; + let mut embedded = vec![]; for asset in Asset::iter() { let asset_name = asset.to_string(); - let path = path::Path::new(&asset_name); - let mut components = path.components(); - if let Some(path::Component::Normal(part)) = components.next() { + let mut components = Path::new(&asset_name).components(); + if let Some(Component::Normal(part)) = components.next() { let bytes = part .to_str() .expect("Cannot handle directory name in assets") .as_bytes(); + // if let Ok(langid) = LanguageIdentifier::try_from_bytes(bytes) { if let Ok(langid) = LanguageIdentifier::from_bytes(bytes) { - if let Some(path::Component::Normal(part)) = components.next() { + if let Some(Component::Normal(part)) = components.next() { if self::FTL_RESOURCES .iter() .any(|v| v == &part.to_str().unwrap()) { - embeded.push(langid); + embedded.push(langid); } } } } } - embeded.dedup(); - Locales(embeded) + embedded.dedup(); + Locales(embedded) } #[cfg(test)] @@ -187,7 +252,7 @@ mod tests { #[test] fn parse_locale() { - let out = &fluent_langneg::accepted_languages::parse("tr_tr")[0]; + let out = &accepted_languages::parse("tr_tr")[0]; let tr: LanguageIdentifier = "tr-TR".parse().unwrap(); assert_eq!(out.to_string(), tr.to_string()); } diff --git a/src/lib.rs b/src/lib.rs index 1971484..116cb02 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ #![allow(clippy::trivial_regex)] +#![allow(clippy::borrowed_box)] #[macro_use] extern crate lazy_static; @@ -6,17 +7,19 @@ extern crate num_cpus; use crate::config::CONF; -use colored::{ColoredString, Colorize}; use git2::{Oid, Repository, Signature}; use i18n::LocalText; use inflector::Inflector; use regex::Regex; use std::ffi::OsStr; -use std::{error, fmt, path, result, str}; +use std::{env, error, fmt, path, result, str}; pub mod cli; pub mod config; pub mod i18n; +pub mod ui; +pub mod ui_ascii; +pub mod ui_indicatif; // Subcommands pub mod make; @@ -78,23 +81,38 @@ pub fn get_repo() -> Result { Ok(Repository::discover(project)?) } +/// Check to see if we're running in GitHub Actions +pub fn is_gha() -> bool { + env::var("GITHUB_ACTIONS").is_ok() +} + +/// Check to see if we're running in GitLab CI +pub fn is_glc() -> bool { + env::var("GITLAB_CI").is_ok() +} + pub fn commit(repo: Repository, oid: Oid, msg: &str) -> result::Result { let prefix = "[fontship]"; - let commiter = repo.signature()?; - let author = Signature::now("Fontship", commiter.email().unwrap())?; + let committer = repo.signature()?; + let author = Signature::now("Fontship", committer.email().unwrap())?; let parent = repo.head()?.peel_to_commit()?; let tree = repo.find_tree(oid)?; let parents = [&parent]; repo.commit( Some("HEAD"), &author, - &commiter, + &committer, &[prefix, msg].join(" "), &tree, &parents, ) } +pub fn format_font_version(version: String) -> String { + let re = Regex::new(r"-r.*$").unwrap(); + String::from(re.replace(version.as_str(), "")) +} + pub fn locale_to_language(lang: String) -> String { let re = Regex::new(r"[-_\.].*$").unwrap(); let locale_frag = lang.as_str().to_lowercase(); @@ -105,51 +123,6 @@ pub fn locale_to_language(lang: String) -> String { } } -pub fn format_font_version(version: String) -> String { - let re = Regex::new(r"-r.*$").unwrap(); - String::from(re.replace(version.as_str(), "")) -} - -/// Output welcome header at start of run before moving on to actual commands -pub fn show_welcome() { - let welcome = LocalText::new("welcome").arg("version", VERSION.to_string()); - eprintln!("{} {}", "┏━".cyan(), welcome.fmt().cyan()); -} - -/// Output welcome header at start of run before moving on to actual commands -pub fn show_outro() { - let outro = LocalText::new("outro"); - eprintln!("{} {}", "┗━".cyan(), outro.fmt().cyan()); -} - -/// Output header before starting work on a subcommand -pub fn show_header(key: &str) { - let text = LocalText::new(key); - eprintln!("{} {}", "┣━".cyan(), text.fmt().yellow()); -} - -pub fn display_check(key: &str, val: bool) { - if CONF.get_bool("debug").unwrap() || CONF.get_bool("verbose").unwrap() { - eprintln!( - "{} {} {}", - "┠─".cyan(), - LocalText::new(key).fmt(), - fmt_t_f(val) - ); - }; -} - -/// Format a localized string just for true / false status prints -fn fmt_t_f(val: bool) -> ColoredString { - let key = if val { "setup-true" } else { "setup-false" }; - let text = LocalText::new(key).fmt(); - if val { - text.green() - } else { - text.red() - } -} - #[cfg(unix)] pub fn bytes2path(b: &[u8]) -> &path::Path { use std::os::unix::prelude::*; diff --git a/src/main.rs b/src/main.rs index 9d603d7..d7c3540 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use clap::{Args, Command, FromArgMatches as _}; use fontship::cli::{Cli, Commands}; use fontship::config::CONF; +use fontship::ui::{UserInterface, FONTSHIPUI}; use fontship::{make, setup, status}; use fontship::{Result, VERSION}; @@ -13,13 +14,13 @@ fn main() -> Result<()> { let matches = cli.get_matches(); let args = Cli::from_arg_matches(&matches).expect("Unable to parse arguments"); CONF.merge_args(&args)?; - fontship::show_welcome(); + FONTSHIPUI.welcome(); let subcommand = Commands::from_arg_matches(&matches)?; let ret = match subcommand { Commands::Make { target } => make::run(target), Commands::Setup {} => setup::run(), Commands::Status {} => status::run(), }; - fontship::show_outro(); + FONTSHIPUI.farewell(); ret } diff --git a/src/make/mod.rs b/src/make/mod.rs index 8ef1bb9..4e244bc 100644 --- a/src/make/mod.rs +++ b/src/make/mod.rs @@ -1,10 +1,12 @@ use crate::i18n::LocalText; +use crate::ui::*; use crate::*; -use colored::Colorize; +use console::style; use itertools::Itertools; use regex::Regex; use std::io::prelude::*; +use std::path::PathBuf; use std::{ffi::OsString, io}; use subprocess::{Exec, ExitStatus, Redirection}; @@ -12,33 +14,47 @@ use subprocess::{Exec, ExitStatus, Redirection}; /// Build specified target(s) pub fn run(target: Vec) -> Result<()> { setup::is_setup()?; - show_header("make-header"); + let mut subcommand_status = FONTSHIPUI.new_subcommand("make"); let mut makeflags: Vec = Vec::new(); - let cpus = num_cpus::get(); - makeflags.push(OsString::from(format!("--jobs={}", cpus))); + let cpus = &num_cpus::get().to_string(); + makeflags.push(OsString::from(format!("--jobs={cpus}"))); let mut makefiles: Vec = Vec::new(); - let rules = status::get_rules()?; - makefiles.push(OsString::from("-f")); - makefiles.push(OsString::from(format!( - "{}{}", - CONFIGURE_DATADIR, "rules/fontship.mk" + let mut rules = status::get_rules()?; + rules.insert( + 0, + PathBuf::from(format!("{}/rules/fontship.mk", CONFIGURE_DATADIR)), + ); + rules.push(PathBuf::from(format!( + "{}/rules/rules.mk", + CONFIGURE_DATADIR ))); for rule in rules { makefiles.push(OsString::from("-f")); let p = rule.into_os_string(); makefiles.push(p); } - makefiles.push(OsString::from("-f")); - makefiles.push(OsString::from(format!( - "{}{}", - CONFIGURE_DATADIR, "rules/rules.mk" - ))); + let mut targets: Vec<_> = target.into_iter().collect(); + if targets.is_empty() { + targets.push(String::from("default")); + } + let is_gha = status::status_is_gha()?; + let is_glc = status::status_is_glc()?; + if is_gha { + targets.push(String::from("_gha")); + } + if is_glc { + targets.push(String::from("_glc")); + } + if (is_gha || is_glc) + && targets.first().unwrap() != "debug" + && targets.first().unwrap() != ".gitignore" + { + targets.push(String::from("install-dist")); + } let mut process = Exec::cmd("make") .args(&makeflags) .args(&makefiles) - .args(&target); - let targets: Vec<_> = target.into_iter().collect(); - // Start deprecating non-CLI usage + .args(&targets); let gitname = status::get_gitname()?; let sources = status::get_sources()?; let sources_str = format!( @@ -52,6 +68,7 @@ pub fn run(target: Vec) -> Result<()> { process = process .env("BUILDDIR", CONF.get_string("builddir")?) .env("FONTSHIP_CLI", "true") + .env("FONTHSIP_JOBS", cpus) .env("FONTSHIPDIR", CONFIGURE_DATADIR) .env("CONTAINERIZED", status::is_container().to_string()) .env("LANGUAGE", locale_to_language(CONF.get_string("language")?)) @@ -77,129 +94,115 @@ pub fn run(target: Vec) -> Result<()> { let process = process.stderr(Redirection::Merge).stdout(Redirection::Pipe); let mut popen = process.popen()?; let buf = io::BufReader::new(popen.stdout.as_mut().unwrap()); - let mut backlog: Vec = Vec::new(); let seps = Regex::new(r"").unwrap(); - let mut ret: u32 = 0; for line in buf.lines() { - let text: &str = &line.unwrap(); + let text: &str = + &line.unwrap_or_else(|_| String::from("INVALID UTF-8 FROM CHILD PROCESS STREAM")); let fields: Vec<&str> = seps.splitn(text, 4).collect(); match fields[0] { "FONTSHIP" => match fields[1] { - "PRE" => report_start(fields[2]), + "PRE" => { + let target = fields[2].to_owned(); + let target = MakeTarget::new(&target); + subcommand_status.new_target(target); + } "STDOUT" => { - if targets.contains(&"_gha".into()) { - println!("{}", fields[3]); - } else if CONF.get_bool("verbose")? { - report_line(fields[3]); - } else { - backlog.push(String::from(fields[3])); + let target = fields[2].to_owned(); + let target = MakeTarget::new(&target); + let target_status = subcommand_status.get_target(target.clone()); + match target_status { + Some(target_status) => { + target_status.stdout(fields[3]); + } + None => { + let text = LocalText::new("make-error-unknown-target") + .arg("target", style(target).white()) + .fmt(); + subcommand_status.error(format!("{}", style(text).red())); + subcommand_status.error(fields[3].to_string()); + } } } "STDERR" => { - if CONF.get_bool("verbose")? { - report_line(fields[3]); - } else { - backlog.push(String::from(fields[3])); + let target = fields[2].to_owned(); + let target = MakeTarget::new(&target); + let target_status = subcommand_status.get_target(target.clone()); + match target_status { + Some(target_status) => { + target_status.stderr(fields[3]); + } + None => { + let text = LocalText::new("make-error-unknown-target") + .arg("target", style(target).white()) + .fmt(); + subcommand_status.error(format!("{}", style(text).red())); + subcommand_status.error(fields[3].to_string()); + } } } - "POST" => match fields[2] { - "0" => { - report_end(fields[3]); - } - val => { - report_fail(fields[3]); - ret = val.parse().unwrap_or(1); + "POST" => { + let target = fields[2].to_owned(); + let target = MakeTarget::new(&target); + let target_status = subcommand_status.get_target(target); + match target_status { + Some(target_status) => match fields[3] { + "0" => { + target_status.pass(); + } + val => { + let code = val.parse().unwrap_or(1); + target_status.fail(code); + } + }, + None => { + let text = LocalText::new("make-error-unknown-target").fmt(); + subcommand_status.error(format!("{}", style(text).red())); + } } - }, + } _ => { let errmsg = LocalText::new("make-error-unknown-code").fmt(); - panic!("{}", errmsg) + subcommand_status.error(format!("Make wrapper failed: {errmsg}")); } }, - _ => backlog.push(String::from(fields[0])), + _ => { + subcommand_status.error(format!( + "Output not captured by target wrapper: {:?}", + fields + )); + } } } let status = popen.wait(); - match status { - Ok(ExitStatus::Exited(int)) => { - let combined_code = int + ret; - match combined_code { - 0 => { - if targets.contains(&"debug".into()) { - dump_backlog(&backlog) - }; - Ok(()) - } - 1 => { - dump_backlog(&backlog); - Err(Box::new(io::Error::new( - io::ErrorKind::InvalidInput, - LocalText::new("make-error-unfinished").fmt(), - ))) - } - 2 => { - dump_backlog(&backlog); - Err(Box::new(io::Error::new( - io::ErrorKind::InvalidInput, - LocalText::new("make-error-build").fmt(), - ))) - } - 3 => { - if !CONF.get_bool("verbose")? { - dump_backlog(&backlog); - } - Err(Box::new(io::Error::new( - io::ErrorKind::InvalidInput, - LocalText::new("make-error-target").fmt(), - ))) - } - _ => { - dump_backlog(&backlog); - Err(Box::new(io::Error::new( - io::ErrorKind::InvalidInput, - LocalText::new("make-error-unknown").fmt(), - ))) - } - } - } + let ret = match status { + Ok(ExitStatus::Exited(code)) => match code { + 0 => Ok(()), + 1 => Err(Box::new(io::Error::new( + io::ErrorKind::InvalidInput, + LocalText::new("make-error-unfinished").fmt(), + ))), + 2 => Err(Box::new(io::Error::new( + io::ErrorKind::InvalidInput, + LocalText::new("make-error-build").fmt(), + ))), + 3 => Err(Box::new(io::Error::new( + io::ErrorKind::InvalidInput, + LocalText::new("make-error-target").fmt(), + ))), + 137 => Err(Box::new(io::Error::new( + io::ErrorKind::InvalidInput, + LocalText::new("make-error-oom").fmt(), + ))), + _ => Err(Box::new(io::Error::new( + io::ErrorKind::InvalidInput, + LocalText::new("make-error-unknown").fmt(), + ))), + }, _ => Err(Box::new(io::Error::new( io::ErrorKind::InvalidInput, LocalText::new("make-error").fmt(), ))), - } -} - -fn dump_backlog(backlog: &[String]) { - let start = LocalText::new("make-backlog-start").fmt(); - eprintln!("{} {}", "┖┄".cyan(), start); - for line in backlog.iter() { - eprintln!("{}", line); - } - let end = LocalText::new("make-backlog-end").fmt(); - eprintln!("{} {}", "┎┄".cyan(), end); -} - -fn report_line(line: &str) { - eprintln!("{} {}", "┠╎".cyan(), line.dimmed()); -} - -fn report_start(target: &str) { - let text = LocalText::new("make-report-start") - .arg("target", target.white().bold()) - .fmt(); - eprintln!("{} {}", "┠┄".cyan(), text.yellow()); -} - -fn report_end(target: &str) { - let text = LocalText::new("make-report-end") - .arg("target", target.white().bold()) - .fmt(); - eprintln!("{} {}", "┠┄".cyan(), text.green()); -} - -fn report_fail(target: &str) { - let text = LocalText::new("make-report-fail") - .arg("target", target.white().bold()) - .fmt(); - eprintln!("{} {}", "┠┄".cyan(), text.red()); + }; + subcommand_status.end(ret.is_ok()); + Ok(ret?) } diff --git a/src/setup/mod.rs b/src/setup/mod.rs index 07eba76..cfa4b62 100644 --- a/src/setup/mod.rs +++ b/src/setup/mod.rs @@ -1,7 +1,8 @@ use crate::i18n::LocalText; +use crate::ui::*; use crate::*; -use colored::Colorize; +use console::style; use git2::{Repository, Status}; use git_warp_time::reset_mtimes; use std::io::prelude::*; @@ -12,10 +13,10 @@ use subprocess::{Exec, NullFile, Redirection}; // FTL: help-subcommand-setup /// Setup a font project for use with Fontship pub fn run() -> Result<()> { - show_header("setup-header"); + let subcommand_status = FONTSHIPUI.new_subcommand("setup"); let project = &CONF.get_string("project")?; let metadata = fs::metadata(project)?; - match metadata.is_dir() { + let ret = match metadata.is_dir() { true => match is_repo()? { true => { regen_gitignore(get_repo()?)?; @@ -34,11 +35,14 @@ pub fn run() -> Result<()> { io::ErrorKind::InvalidInput, LocalText::new("setup-error-not-dir").fmt(), ))), - } + }; + subcommand_status.end(ret.is_ok()); + Ok(ret?) } /// Evaluate whether this project is properly configured pub fn is_setup() -> Result { + let subcommand_status = FONTSHIPUI.new_subcommand("is-setup"); let results = Arc::new(RwLock::new(Vec::new())); // First round of tests, entirely independent @@ -72,41 +76,40 @@ pub fn is_setup() -> Result { } let ret = results.read().unwrap().iter().all(|&v| v); - let msg = LocalText::new(if ret { "setup-good" } else { "setup-bad" }).fmt(); - eprintln!( - "{} {}", - "┠─".cyan(), - if ret { msg.green() } else { msg.red() } - ); + subcommand_status.end(ret); Ok(ret) } /// Are we in a git repo? pub fn is_repo() -> Result { + let status = FONTSHIPUI.new_check("setup-is-repo"); let ret = get_repo().is_ok(); - display_check("setup-is-repo", ret); + status.end(ret); Ok(ret) } /// Is this repo a deep clone? pub fn is_deep() -> Result { + let status = FONTSHIPUI.new_check("setup-is-deep"); let ret = !get_repo()?.is_shallow(); - display_check("setup-is-deep", ret); + status.end(ret); Ok(ret) } /// Are we not in the Fontship source repo? pub fn is_not_fontship_source() -> Result { + let status = FONTSHIPUI.new_check("setup-is-not-fontship"); let repo = get_repo()?; let workdir = repo.workdir().unwrap(); - let testfile = workdir.join("make-shell.zsh.in"); - let ret = fs::File::open(&testfile).is_err(); - display_check("setup-is-not-fontship", ret); + let testfile = workdir.join("Makefile.am"); + let ret = fs::File::open(testfile).is_err(); + status.end(ret); Ok(ret) } /// Is the git repo we are in writable? pub fn is_writable() -> Result { + let status = FONTSHIPUI.new_check("setup-is-writable"); let repo = get_repo()?; let workdir = repo.workdir().unwrap(); let testfile = workdir.join(".fontship-write-test"); @@ -114,24 +117,26 @@ pub fn is_writable() -> Result { file.write_all(b"test")?; fs::remove_file(&testfile)?; let ret = true; - display_check("setup-is-writable", ret); - Ok(true) + status.end(ret); + Ok(ret) } /// Check if we can execute the system's `make` utility pub fn is_make_exectuable() -> Result { + let status = FONTSHIPUI.new_check("setup-is-make-executable"); let ret = Exec::cmd("make") .arg("-v") .stdout(NullFile) .stderr(NullFile) .join() .is_ok(); - display_check("setup-is-make-executable", ret); - Ok(true) + status.end(ret); + Ok(ret) } /// Check that the system's `make` utility is GNU Make pub fn is_make_gnu() -> Result { + let status = FONTSHIPUI.new_check("setup-is-make-gnu"); let out = Exec::cmd("make") .arg("-v") .stdout(Redirection::Pipe) @@ -139,32 +144,35 @@ pub fn is_make_gnu() -> Result { .capture()? .stdout_str(); let ret = out.starts_with("GNU Make 4."); - display_check("setup-is-make-gnu", ret); - Ok(true) + status.end(ret); + Ok(ret) } fn regen_gitignore(repo: Repository) -> Result<()> { - let target = vec![String::from(".gitignore")]; - make::run(target)?; + let targets = vec![String::from(".gitignore")]; + make::run(targets)?; let path = path::Path::new(".gitignore"); let mut index = repo.index()?; index.add_path(path)?; let oid = index.write_tree()?; match repo.status_file(path) { Ok(Status::CURRENT) => { - let text = LocalText::new("setup-gitignore-fresh").fmt(); - eprintln!("{} {}", "┠┄".cyan(), text); + let status = FONTSHIPUI.new_check("setup-gitignore-fresh"); + status.end(true); Ok(()) } _ => { - let text = LocalText::new("setup-gitignore-committing").fmt(); - eprintln!("{} {}", "┠┄".cyan(), text); + let status = FONTSHIPUI.new_check("setup-gitignore-committing"); match commit(repo, oid, "Update .gitignore") { Ok(_) => { index.write()?; + status.end(true); Ok(()) } - Err(error) => Err(Box::new(error)), + Err(error) => { + status.end(false); + Err(Box::new(error)) + } } } } @@ -173,16 +181,16 @@ fn regen_gitignore(repo: Repository) -> Result<()> { fn warp_time(repo: Repository) -> Result<()> { let opts = git_warp_time::Options::new(); let text = LocalText::new("setup-warp-time").fmt(); - eprintln!("{} {}", "┠┄".cyan(), text); + eprintln!("{} {}", style("┠┄").cyan(), text); let files = reset_mtimes(repo, opts)?; match CONF.get_bool("verbose")? { true => { for file in files.iter() { let path = file.clone().into_os_string().into_string().unwrap(); let text = LocalText::new("setup-warp-time-file") - .arg("path", path.white().bold()) + .arg("path", style(path).white().bold()) .fmt(); - eprintln!("{} {}", "┠┄".cyan(), text); + eprintln!("{} {}", style("┠┄").cyan(), text); } } false => {} @@ -192,7 +200,7 @@ fn warp_time(repo: Repository) -> Result<()> { fn configure_short_shas(repo: Repository) -> Result<()> { let text = LocalText::new("setup-short-shas").fmt(); - eprintln!("{} {}", "┠┄".cyan(), text); + eprintln!("{} {}", style("┠┄").cyan(), text); let mut conf = repo.config()?; Ok(conf.set_i32("core.abbrev", 7)?) } diff --git a/src/status/mod.rs b/src/status/mod.rs index 2e890da..7ab112d 100644 --- a/src/status/mod.rs +++ b/src/status/mod.rs @@ -1,15 +1,17 @@ +use crate::ui::*; use crate::*; use git2::{DescribeFormatOptions, DescribeOptions}; use regex::Regex; -use std::{env, path}; +use std::path; // FTL: help-subcommand-status /// Show status information about setup, configuration, and build state pub fn run() -> Result<()> { - show_header("status-header"); + let is_setup = setup::is_setup()?; + let subcommand_status = FONTSHIPUI.new_subcommand("status"); CONF.set_bool("verbose", true)?; - setup::is_setup()?; + subcommand_status.end(is_setup); Ok(()) } @@ -29,9 +31,18 @@ fn run_as() -> RunAsMode { } /// Check to see if we're running in GitHub Actions -pub fn is_gha() -> Result { - let ret = env::var("GITHUB_ACTIONS").is_ok(); - display_check("status-is-gha", ret); +pub fn status_is_gha() -> Result { + let ret = is_gha(); + let status = FONTSHIPUI.new_check("status-is-gha"); + status.end(ret); + Ok(ret) +} + +/// Check to see if we're running in GitLab CI +pub fn status_is_glc() -> Result { + let ret = is_glc(); + let status = FONTSHIPUI.new_check("status-is-glc"); + status.end(ret); Ok(ret) } @@ -55,29 +66,23 @@ pub fn get_gitname() -> Result { .as_str(); Ok(String::from(name)) } - fn path() -> Result { - let path = &CONF.get_string("path")?; - let file = path::Path::new(path) + fn project() -> Result { + let project = &CONF.get_string("project")?; + let file = path::Path::new(project) .file_name() - .ok_or_else(|| Error::new("error-no-path"))? + .ok_or_else(|| Error::new("error-no-project"))? .to_str(); Ok(file.unwrap().to_string()) } let default = Ok(String::from("fontship")); - origin().or_else(|_| path().or(default)) + origin().or_else(|_| project().or(default)) } /// Scan for existing makefiles with Fontship rules pub fn get_rules() -> Result> { let repo = get_repo()?; let root = repo.workdir().unwrap(); - let files = vec![ - "GNUMakefile", - "makefile", - "Makefile", - "fontship.mk", - "rules.mk", - ]; + let files = vec!["fontship.mk", "rules.mk"]; let mut rules = Vec::new(); for file in &files { let p = root.join(file); diff --git a/src/ui.rs b/src/ui.rs new file mode 100644 index 0000000..db4d8ee --- /dev/null +++ b/src/ui.rs @@ -0,0 +1,206 @@ +use crate::i18n::LocalText; +use crate::ui_ascii::AsciiInterface; +use crate::ui_indicatif::IndicatifInterface; +use crate::VERSION; +use crate::*; + +use console::user_attended; +use std::collections::HashMap; +use std::str; +use std::sync::Arc; +use std::sync::RwLock; + +static ERROR_UI_WRITE: &str = "Unable to gain write lock on ui status wrapper"; + +lazy_static! { + #[derive(Debug)] + pub static ref FONTSHIPUI: RwLock> = RwLock::new(UISwitcher::pick()); +} + +pub type JobMap = HashMap>; + +#[derive(Debug, Clone, Default, Eq, Hash, PartialEq)] +pub struct MakeTarget { + target: String, +} + +impl MakeTarget { + pub fn new(target: &String) -> Self { + Self { + target: target.to_string(), + } + } +} + +impl std::ops::Deref for MakeTarget { + type Target = String; + fn deref(&self) -> &Self::Target { + &self.target + } +} + +impl fmt::Display for MakeTarget { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.write_str(self.target.as_str())?; + Ok(()) + } +} + +#[derive(Debug, Default)] +pub struct UISwitcher {} + +impl UISwitcher { + pub fn pick() -> Box { + if !user_attended() { + Box::::default() + } else { + Box::::default() + } + } +} + +pub trait UserInterface: Send + Sync { + fn welcome(&self); + fn farewell(&self); + fn new_check(&self, key: &str) -> Box; + fn new_subcommand(&self, key: &str) -> Box; +} + +impl UserInterface for FONTSHIPUI { + fn welcome(&self) { + self.write().expect(ERROR_UI_WRITE).welcome() + } + fn farewell(&self) { + self.write().expect(ERROR_UI_WRITE).farewell() + } + fn new_check(&self, key: &str) -> Box { + self.write().expect(ERROR_UI_WRITE).new_check(key) + } + fn new_subcommand(&self, key: &str) -> Box { + self.write().expect(ERROR_UI_WRITE).new_subcommand(key) + } +} + +pub trait SubcommandStatus: Send + Sync { + fn end(&self, status: bool); + fn error(&mut self, msg: String); + fn new_target(&mut self, target: MakeTarget); + fn get_target(&self, target: MakeTarget) -> Option<&Box>; +} + +pub trait SetupCheck: Send + Sync { + fn end(&self, ret: bool) { + if ret { + self.pass() + } else { + self.fail() + } + } + fn pass(&self); + fn fail(&self); +} + +pub trait JobStatus: Send + Sync { + fn push(&self, line: JobBacklogLine); + fn stdout(&self, line: &str) { + let line = JobBacklogLine { + stream: JobBacklogStream::StdOut, + line: line.into(), + }; + self.push(line); + } + fn stderr(&self, line: &str) { + let line = JobBacklogLine { + stream: JobBacklogStream::StdErr, + line: line.into(), + }; + self.push(line); + } + fn must_dump(&self) -> bool; + fn dump(&self); + fn pass(&self) { + self.pass_msg(); + if CONF.get_bool("debug").unwrap() || self.must_dump() + // TODO: figure out how to handle output from -p + // || targets.contains(&"-p".into()) + { + self.dump(); + } + } + fn pass_msg(&self); + fn fail(&self, code: u32) { + self.fail_msg(code); + self.dump(); + } + fn fail_msg(&self, code: u32); +} + +// TODO: implement destroy for job status to catch unfinished jobs + +#[derive(Debug, Default)] +pub struct UserInterfaceMessages { + pub welcome: String, + // pub farewell: String, +} + +impl UserInterfaceMessages { + pub fn new() -> Self { + let welcome = LocalText::new("welcome").arg("version", *VERSION).fmt(); + // let farewell = LocalText::new("farewell").arg("duration", time).fmt(); + Self { + welcome, + // farewell, + } + } +} + +#[derive(Debug)] +pub struct SubcommandHeaderMessages { + pub msg: String, + pub good_msg: String, + pub bad_msg: String, +} + +impl SubcommandHeaderMessages { + pub fn new(key: &str) -> Self { + let msg_key = format!("{key}-header"); + let msg = LocalText::new(msg_key.as_str()).fmt().to_string(); + let good_key = format!("{key}-good"); + let good_msg = LocalText::new(good_key.as_str()).fmt(); + let bad_key = format!("{key}-bad"); + let bad_msg = LocalText::new(bad_key.as_str()).fmt(); + Self { + msg, + good_msg, + bad_msg, + } + } +} + +#[derive(Debug, Default)] +pub enum JobBacklogStream { + StdErr, + #[default] + StdOut, +} + +#[derive(Debug, Default)] +pub struct JobBacklogLine { + pub stream: JobBacklogStream, + pub line: String, +} + +#[derive(Debug, Default)] +pub struct JobBacklog { + pub target: String, + pub lines: Arc>>, +} + +impl JobBacklog { + pub fn push(&self, line: JobBacklogLine) { + self.lines.write().unwrap().push(line); + } + // pub fn extract(&self) -> Vec { + // self.lines.read().unwrap() + // } +} diff --git a/src/ui_ascii.rs b/src/ui_ascii.rs new file mode 100644 index 0000000..5317178 --- /dev/null +++ b/src/ui_ascii.rs @@ -0,0 +1,204 @@ +use crate::i18n::LocalText; +use crate::ui::*; +use crate::*; + +use console::style; +use indicatif::HumanDuration; +use std::time::Instant; + +#[derive(Debug)] +pub struct AsciiInterface { + messages: UserInterfaceMessages, + started: Instant, +} + +impl Default for AsciiInterface { + fn default() -> Self { + let started = Instant::now(); + let messages = UserInterfaceMessages::new(); + Self { messages, started } + } +} + +impl UserInterface for AsciiInterface { + fn welcome(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let welcome = &self.messages.welcome; + let welcome = style(welcome).cyan(); + println!("{welcome}"); + } + fn farewell(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let time = HumanDuration(self.started.elapsed()); + let farewell = LocalText::new("farewell").arg("duration", time).fmt(); + let farewell = style(farewell).cyan(); + println!("{farewell}"); + } + fn new_check(&self, key: &str) -> Box { + Box::new(AsciiSetupCheck::new(self, key)) + } + fn new_subcommand(&self, key: &str) -> Box { + Box::new(AsciiSubcommandStatus::new(key)) + } +} + +#[derive(Default)] +pub struct AsciiSubcommandStatus { + jobs: JobMap, +} + +impl AsciiSubcommandStatus { + fn new(_key: &str) -> Self { + Self { + jobs: JobMap::new(), + } + } +} + +impl SubcommandStatus for AsciiSubcommandStatus { + fn end(&self, _status: bool) {} + fn error(&mut self, msg: String) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let msg = style(msg).red().dim(); + eprintln!("{msg}"); + } + fn new_target(&mut self, target: MakeTarget) { + let target_status = Box::new(AsciiJobStatus::new(target.clone())); + self.jobs.insert(target, target_status); + } + fn get_target(&self, target: MakeTarget) -> Option<&Box> { + self.jobs.get(&target) + } +} + +#[derive(Debug, Default)] +pub struct AsciiSetupCheck { + message: String, +} + +impl AsciiSetupCheck { + fn new(_ui: &AsciiInterface, key: &str) -> Self { + let message = LocalText::new(key).fmt(); + Self { message } + } +} + +impl SetupCheck for AsciiSetupCheck { + fn pass(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let msg = &self.message; + let yes = LocalText::new("setup-true").fmt(); + let yes = style(yes).green(); + println!("{msg} {yes}"); + } + fn fail(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let msg = &self.message; + let no = LocalText::new("setup-false").fmt(); + let no = style(no).red(); + eprintln!("{msg} {no}"); + } +} + +#[derive(Debug, Default)] +pub struct AsciiJobStatus { + target: MakeTarget, + log: JobBacklog, +} + +impl AsciiJobStatus { + fn new(target: MakeTarget) -> Self { + if !CONF.get_bool("passthrough").unwrap() { + // Without this, copying the string in the terminal as a word brings a U+2069 with it + // c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72 + let mut printable_target: String = target.to_string(); + printable_target.push(' '); + let printable_target = style(printable_target).white().bold(); + let msg = LocalText::new("make-report-start") + .arg("target", printable_target) + .fmt(); + let msg = style(msg).yellow().bright(); + println!("{msg}"); + } + Self { + target, + log: JobBacklog::default(), + } + } +} + +impl JobStatus for AsciiJobStatus { + fn push(&self, line: JobBacklogLine) { + self.log.push(line); + } + fn must_dump(&self) -> bool { + self.target.starts_with("debug") + } + fn dump(&self) { + if !CONF.get_bool("passthrough").unwrap() { + let start = LocalText::new("make-backlog-start") + .arg("target", self.target.clone()) + .fmt(); + println!("{}{start}", style("----- ").cyan()); + } + let lines = self.log.lines.read().unwrap(); + for line in lines.iter() { + match line.stream { + JobBacklogStream::StdOut => { + let line = style(line.line.clone()).dim(); + println!("{}", line); + } + JobBacklogStream::StdErr => { + let line = style(line.line.clone()).dim(); + eprintln!("{}", line); + } + } + } + if !CONF.get_bool("passthrough").unwrap() { + let end = LocalText::new("make-backlog-end").fmt(); + println!("{} {end}", style("----- ").cyan()); + } + } + fn pass_msg(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + // Without this, copying the string in the terminal as a word brings a U+2069 with it + // c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72 + let mut printable_target: String = self.target.to_string(); + printable_target.push(' '); + let target = printable_target; + let target = style(target).white().bold(); + let msg = LocalText::new("make-report-pass") + .arg("target", target) + .fmt(); + let msg = style(msg).green().bright(); + println!("{msg}") + } + fn fail_msg(&self, code: u32) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + // Without this, copying the string in the terminal as a word brings a U+2069 with it + let mut printable_target: String = self.target.to_string(); + printable_target.push(' '); + let target = printable_target; + let target = style(target).white().bold(); + let msg = LocalText::new("make-report-fail") + .arg("target", target) + .arg("code", code) + .fmt(); + let msg = style(msg).red().bright(); + eprintln!("{msg}") + } +} diff --git a/src/ui_indicatif.rs b/src/ui_indicatif.rs new file mode 100644 index 0000000..e8f6079 --- /dev/null +++ b/src/ui_indicatif.rs @@ -0,0 +1,334 @@ +use crate::config::CONF; +use crate::i18n::LocalText; +use crate::ui::*; +use crate::*; + +use console::style; +use indicatif::{HumanDuration, MultiProgress, ProgressBar, ProgressDrawTarget, ProgressStyle}; +use std::time::Instant; + +fn finalize_bar(bar: ProgressBar, msg: String) { + let prefix = bar.prefix(); + if !bar.is_hidden() { + bar.suspend(|| { + println!("{prefix} {msg}"); + }); + } + bar.finish_and_clear(); +} + +#[derive(Debug)] +pub struct IndicatifInterface { + progress: MultiProgress, + messages: UserInterfaceMessages, + started: Instant, +} + +impl std::ops::Deref for IndicatifInterface { + type Target = MultiProgress; + fn deref(&self) -> &Self::Target { + &self.progress + } +} + +impl Default for IndicatifInterface { + fn default() -> Self { + let progress = MultiProgress::new(); + progress.set_move_cursor(true); + if CONF.get_bool("passthrough").unwrap() { + progress.set_draw_target(ProgressDrawTarget::hidden()); + } + let started = Instant::now(); + let messages = UserInterfaceMessages::new(); + Self { + progress, + messages, + started, + } + } +} + +impl IndicatifInterface { + pub fn bar(&self) -> ProgressBar { + let prefix = style("⛫").cyan().to_string(); + let pstyle = ProgressStyle::with_template("{prefix} {msg}").unwrap(); + let bar = ProgressBar::new_spinner() + .with_style(pstyle) + .with_prefix(prefix); + if CONF.get_bool("passthrough").unwrap() { + bar.set_draw_target(ProgressDrawTarget::hidden()); + } + bar + } + pub fn show(&self, msg: String) { + let bar = self.bar(); + let msg = style(msg).cyan().bright().to_string(); + finalize_bar(bar, msg); + } +} + +impl UserInterface for IndicatifInterface { + fn welcome(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let msg = &self.messages.welcome; + self.show(msg.to_string()); + } + fn farewell(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let time = HumanDuration(self.started.elapsed()); + let msg = LocalText::new("farewell").arg("duration", time).fmt(); + self.show(msg); + } + fn new_check(&self, key: &str) -> Box { + Box::new(IndicatifSetupCheck::new(self, key)) + } + fn new_subcommand(&self, key: &str) -> Box { + Box::new(IndicatifSubcommandStatus::new(self, key)) + } +} + +pub struct IndicatifSubcommandStatus { + progress: MultiProgress, + bar: ProgressBar, + messages: SubcommandHeaderMessages, + jobs: JobMap, +} + +impl std::ops::Deref for IndicatifSubcommandStatus { + type Target = ProgressBar; + fn deref(&self) -> &Self::Target { + &self.bar + } +} + +impl IndicatifSubcommandStatus { + pub fn new(ui: &IndicatifInterface, key: &str) -> Self { + let messages = SubcommandHeaderMessages::new(key); + let prefix = style("⟳").yellow().to_string(); + let pstyle = ProgressStyle::with_template("{prefix} {msg}").unwrap(); + let bar = ProgressBar::new_spinner() + .with_style(pstyle) + .with_prefix(prefix); + if CONF.get_bool("passthrough").unwrap() { + bar.set_draw_target(ProgressDrawTarget::hidden()); + } + let bar = ui.add(bar); + let msg = style(messages.msg.to_owned()).yellow().bright().to_string(); + bar.set_message(msg); + Self { + progress: ui.progress.clone(), + bar, + messages, + jobs: JobMap::new(), + } + } + pub fn pass(&self) { + if !CONF.get_bool("passthrough").unwrap() { + return; + } + let prefix = style("✔").green().to_string(); + self.set_prefix(prefix); + let msg = style(self.messages.good_msg.to_owned()) + .green() + .bright() + .to_string(); + finalize_bar(self.bar.clone(), msg); + } + pub fn fail(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let prefix = style("✗").red().to_string(); + self.set_prefix(prefix); + let msg = style(self.messages.bad_msg.to_owned()) + .red() + .bright() + .to_string(); + finalize_bar(self.bar.clone(), msg); + } +} + +impl SubcommandStatus for IndicatifSubcommandStatus { + fn end(&self, status: bool) { + (status).then(|| self.pass()).unwrap_or_else(|| self.fail()); + } + fn error(&mut self, msg: String) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + self.bar.suspend(|| { + eprintln!("{}", style(msg).red().dim()); + }); + } + fn new_target(&mut self, target: MakeTarget) { + let target_status = Box::new(IndicatifJobStatus::new(self, target.clone())); + self.jobs.insert(target, target_status); + } + fn get_target(&self, target: MakeTarget) -> Option<&Box> { + self.jobs.get(&target) + } +} + +#[derive(Debug)] +pub struct IndicatifSetupCheck(ProgressBar); + +impl std::ops::Deref for IndicatifSetupCheck { + type Target = ProgressBar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl IndicatifSetupCheck { + pub fn new(ui: &IndicatifInterface, key: &str) -> Self { + let msg = LocalText::new(key).fmt(); + let bar = if CONF.get_bool("passthrough").unwrap() { + ProgressBar::hidden() + } else if CONF.get_bool("debug").unwrap() || CONF.get_bool("verbose").unwrap() { + let bar = ProgressBar::new_spinner() + .with_prefix("-") + .with_style(ProgressStyle::with_template("{msg}").unwrap()); + ui.add(bar) + } else { + ProgressBar::hidden() + }; + if !bar.is_hidden() { + bar.set_message(msg); + } + Self(bar) + } +} + +impl SetupCheck for IndicatifSetupCheck { + fn pass(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let msg = self.message(); + let yes = style(LocalText::new("setup-true").fmt()) + .green() + .to_string(); + finalize_bar(self.0.clone(), format!("{msg} {yes}")); + } + fn fail(&self) { + if CONF.get_bool("passthrough").unwrap() { + return; + } + let msg = self.message(); + let no = style(LocalText::new("setup-false").fmt()).red().to_string(); + finalize_bar(self.0.clone(), format!("{msg} {no}")); + } +} + +#[derive(Debug)] +pub struct IndicatifJobStatus { + bar: ProgressBar, + target: MakeTarget, + log: JobBacklog, +} + +impl std::ops::Deref for IndicatifJobStatus { + type Target = ProgressBar; + fn deref(&self) -> &Self::Target { + &self.bar + } +} + +impl IndicatifJobStatus { + // pub fn new(ui: &IndicatifInterface, mut target: String) -> Self { + pub fn new(subcommand: &IndicatifSubcommandStatus, target: MakeTarget) -> Self { + // Without this, copying the string in the terminal as a word brings a U+2069 with it + // c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72 + let mut printable_target: String = target.to_string(); + printable_target.push(' '); + let msg = style( + LocalText::new("make-report-start") + .arg("target", style(printable_target).white().bold()) + .fmt(), + ) + .yellow() + .bright() + .to_string(); + let pstyle = ProgressStyle::with_template("{spinner} {msg}") + .unwrap() + .tick_strings(&["↻", "✔"]); + let bar = ProgressBar::new_spinner() + .with_prefix("✔") // not relevant for spinner, but we use it for our finalized mode + .with_style(pstyle) + .with_message(msg); + if CONF.get_bool("passthrough").unwrap() { + bar.set_draw_target(ProgressDrawTarget::hidden()); + } + let bar = subcommand.progress.add(bar); + bar.tick(); + Self { + bar, + target, + log: JobBacklog::default(), + } + } +} + +impl JobStatus for IndicatifJobStatus { + fn push(&self, line: JobBacklogLine) { + self.log.push(line); + } + fn must_dump(&self) -> bool { + self.target.starts_with("debug") + } + fn dump(&self) { + let start = LocalText::new("make-backlog-start") + .arg("target", self.target.clone()) + .fmt(); + let start = format!("{} {start}", style(style("┄┄┄┄┄").cyan())); + self.bar.println(start); + let was_hidden = self.bar.is_hidden(); + if was_hidden { + self.bar.set_draw_target(ProgressDrawTarget::stdout()); + } + let lines = self.log.lines.read().unwrap(); + for line in lines.iter() { + let msg = style(line.line.as_str()).dim().to_string(); + self.bar.println(msg); + } + if was_hidden { + self.bar.set_draw_target(ProgressDrawTarget::hidden()); + } + let end = LocalText::new("make-backlog-end").fmt(); + let end = format!("{} {end}", style(style("┄┄┄┄┄").cyan())); + self.bar.println(end); + } + fn pass_msg(&self) { + let target = self.target.clone(); + let allow_hide = !CONF.get_bool("debug").unwrap() && !CONF.get_bool("verbose").unwrap(); + if allow_hide && target.starts_with(".fontship") { + // UI.remove(&self.bar); + } else { + let msg = style( + LocalText::new("make-report-pass") + .arg("target", style(target).white().bold()) + .fmt(), + ) + .green() + .bright() + .to_string(); + finalize_bar(self.bar.clone(), msg); + } + } + fn fail_msg(&self, code: u32) { + let msg = style( + LocalText::new("make-report-fail") + .arg("target", style(self.target.clone()).white().bold()) + .arg("code", style(code).white().bold()) + .fmt(), + ) + .red() + .bright() + .to_string(); + finalize_bar(self.bar.clone(), msg); + } +} From fc0e4f29b74aa2d90508b60f2a4f5b7a3584dd48 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 26 Aug 2024 23:45:09 +0300 Subject: [PATCH 5/6] fix(rules): Use python protobuf, our protoc is too new for gftools --- rules/rules.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules/rules.mk b/rules/rules.mk index 78792de..ad3cef3 100644 --- a/rules/rules.mk +++ b/rules/rules.mk @@ -310,6 +310,7 @@ $(BUILDDIR)/%-hinted.ttf: $(BUILDDIR)/%.ttf $(TTFAUTOHINT) $(TTFAUTOHINTFLAGS) -n $< $@ $(STATICTTFS): %.ttf: $(BUILDDIR)/%-instance$(and $(HINT),-hinted).ttf $(BUILDDIR)/last-commit + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python $(GFTOOLS) $(GFTOOLSFLAGS) fix-font -o $@ $< $(normalizeVersion) @@ -317,14 +318,17 @@ $(BUILDDIR)/%-subr.otf: $(BUILDDIR)/%-instance$(and $(HINT),-hinted).otf $(PYTHON) -m cffsubr -o $@ $< $(STATICOTFS): %.otf: $(BUILDDIR)/%-subr.otf $(BUILDDIR)/last-commit + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python $(GFTOOLS) $(GFTOOLSFLAGS) fix-font -o $@ $< $(normalizeVersion) $(VARIABLEOTFS): %.otf: $(BUILDDIR)/%-variable$(and $(_VTTSOURCES),-hinted).otf $(BUILDDIR)/last-commit + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python $(GFTOOLS) $(GFTOOLSFLAGS) fix-font -o $@ $< $(normalizeVersion) $(VARIABLETTFS): %.ttf: $(BUILDDIR)/%-variable$(and $(_VTTSOURCES),-hinted).ttf $(BUILDDIR)/last-commit + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python $(GFTOOLS) $(GFTOOLSFLAGS) fix-font -o $@ $< $(normalizeVersion) From 4dec1ca934247974b37e5beac55dcecf45bcb8b2 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Tue, 27 Aug 2024 00:28:44 +0300 Subject: [PATCH 6/6] ci: Overhaul CI by copying from CaSILE --- .github/linters/.dockerfilelintrc | 2 -- .github/linters/.hadolint.yml | 4 --- .github/linters/.markdown-lint.yml | 5 --- .github/workflows/build.yml | 55 ------------------------------ .github/workflows/commitlint.yml | 6 ++-- .github/workflows/deploy.yml | 17 +++++---- .github/workflows/release.yml | 14 +++++--- .github/workflows/rust_bloat.yml | 10 +++--- .github/workflows/rust_lint.yml | 13 ++++--- .github/workflows/rust_test.yml | 9 +++-- .github/workflows/versioning.yml | 4 +-- 11 files changed, 44 insertions(+), 95 deletions(-) delete mode 100644 .github/linters/.dockerfilelintrc delete mode 100644 .github/linters/.hadolint.yml delete mode 100644 .github/linters/.markdown-lint.yml delete mode 100644 .github/workflows/build.yml diff --git a/.github/linters/.dockerfilelintrc b/.github/linters/.dockerfilelintrc deleted file mode 100644 index 3b9a1b2..0000000 --- a/.github/linters/.dockerfilelintrc +++ /dev/null @@ -1,2 +0,0 @@ -rules: - missing_tag: off diff --git a/.github/linters/.hadolint.yml b/.github/linters/.hadolint.yml deleted file mode 100644 index 8191faa..0000000 --- a/.github/linters/.hadolint.yml +++ /dev/null @@ -1,4 +0,0 @@ -ignored: - - SC2016 - - SC2039 - - DL4006 diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml deleted file mode 100644 index efbaf04..0000000 --- a/.github/linters/.markdown-lint.yml +++ /dev/null @@ -1,5 +0,0 @@ -MD001: false -MD012: false -MD013: false -MD014: false -MD024: false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 4d9fa17..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Build - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-20.04 - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Fetch Tags - run: | - git fetch --prune --tags ||: - - name: Setup system dependencies - run: | - sudo add-apt-repository universe - sudo apt-get update - sudo apt-get install autoconf-archive fontmake fonttools libgit2-dev psautohint python3 python3-defcon python3-pip python3-ufo2ft python3-ufolib2 sfnt2woff-zopfli ttfautohint ufonormalizer woff2 zsh - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Cache cargo - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: cargo-build-${{ hashFiles('**/Cargo.lock') }} - - name: Setup Python dependencies - run: pip install cffsubr font-v gftools pcpp git+git://github.com/alif-type/sfdLib.git@v1.0.7#egg=sfdLib sfdnormalize skia-pathops vttLib - - name: Configure - run: | - export PATH="$HOME/.local/bin:$PATH" - ./bootstrap.sh - ./configure - echo "VERSION=$(cat .version)" >> $GITHUB_ENV - echo "MAKEFLAGS=-j$(nproc) -Otarget" >> $GITHUB_ENV - - name: Build - run: | - export PATH="$HOME/.local/bin:$PATH" - make - - name: Build source package - run: | - export PATH="$HOME/.local/bin:$PATH" - make dist - - name: Upload Artifacts - uses: actions/upload-artifact@v2 - with: - name: fontship-${{ env.VERSION }} - path: fontship*-${{ env.VERSION }}.zip diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index ffac1bb..16e8510 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -5,13 +5,13 @@ on: [push, pull_request] jobs: commitlint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Run ‘commitlint’ linter - uses: wagoid/commitlint-github-action@v2 + uses: wagoid/commitlint-github-action@v5 with: configFile: '.commitlintrc.yml' diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a81cc07..7e1e18f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,10 +13,10 @@ jobs: ghcr: strategy: fail-fast: false - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Fetch tags @@ -24,18 +24,21 @@ jobs: git fetch --prune --tags ||: - name: Setup system dependencies run: | - sudo apt-get install autoconf-archive + sudo apt-get install clang mold - name: Configure run: | - echo "REF=${GITHUB_REF##refs/*/}" >> $GITHUB_ENV ./bootstrap.sh - ./configure --without-{bash,fish,zsh}-completion-dir --disable-dependency-checks - - name: Publish Docker Image to GH Pakcages + ./configure \ + --without-{bash,fish,zsh}-completion-dir \ + --enable-developer-mode \ + --disable-dependency-checks \ + CURL=curl DOCKER=docker DIFF=diff TR=tr SORT=sort + - name: Publish Docker Image to GH Container Registry run: | make docker-build-push env: DOCKER_REGISTRY: ghcr.io DOCKER_REPO: ${{ github.repository }} - DOCKER_TAG: ${{ env.REF }} + DOCKER_TAG: ${{ github.ref_name }} DOCKER_USERNAME: ${{ github.actor }} DOCKER_PAT: ${{ secrets.CR_FONTSHIP }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e0241e..a884953 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,26 +10,30 @@ jobs: ghrelase: strategy: fail-fast: false - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup system dependencies run: | - sudo apt-get install autoconf-archive + sudo apt-get install clang mold - name: Configure run: | echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV echo "${GITHUB_REF#refs/*/v}" > .tarball-version ./bootstrap.sh - ./configure --without-{bash,fish,zsh}-completion-dir --disable-dependency-checks + ./configure \ + --enable-developer-mode \ + --without-{bash,fish,zsh}-completion-dir \ + --disable-dependency-checks - name: Build source package run: | make dist - name: Publish Release uses: softprops/action-gh-release@v1 + if: github.repository == 'tehleagueof/fontship' && startsWith(github.ref, 'refs/tags/v') with: body_path: fontship-${{ env.VERSION }}.md files: | fontship-${{ env.VERSION }}.zip - fontship-${{ env.VERSION }}.tar.xz + fontship-${{ env.VERSION }}.tar.zst diff --git a/.github/workflows/rust_bloat.yml b/.github/workflows/rust_bloat.yml index 1cdc82b..d77eb57 100644 --- a/.github/workflows/rust_bloat.yml +++ b/.github/workflows/rust_bloat.yml @@ -5,17 +5,19 @@ on: [ "pull_request" ] jobs: cargo_bloat: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Rust uses: actions-rs/toolchain@v1 with: profile: minimal - name: Cache Rust - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - name: Run cargo bloat - uses: orf/cargo-bloat-action@v1 + # https://github.com/orf/cargo-bloat-action/pull/302 + # uses: orf/cargo-bloat-action@v1 + uses: Kobzol/cargo-bloat-action@github-actions-cache with: token: ${{ github.token }} diff --git a/.github/workflows/rust_lint.yml b/.github/workflows/rust_lint.yml index ed4555a..583b278 100644 --- a/.github/workflows/rust_lint.yml +++ b/.github/workflows/rust_lint.yml @@ -10,17 +10,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Rust uses: actions-rs/toolchain@v1 with: profile: minimal components: rustfmt - name: Cache Rust - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - name: Run rustfmt run: | - git ls-files '*.rs' | xargs rustfmt --check + git ls-files '*.rs' '*.rs.in' | xargs rustfmt --check --config skip_children=true clippy: strategy: @@ -28,14 +28,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + - name: Setup system dependencies + run: | + sudo apt-get install clang mold - name: Install Rust uses: actions-rs/toolchain@v1 with: profile: minimal components: clippy - name: Cache Rust - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - uses: actions-rs/clippy-check@v1 with: token: ${{ github.token }} diff --git a/.github/workflows/rust_test.yml b/.github/workflows/rust_test.yml index 7f5cbf2..2ce96c2 100644 --- a/.github/workflows/rust_test.yml +++ b/.github/workflows/rust_test.yml @@ -5,19 +5,22 @@ on: [push, pull_request] jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Fetch tags run: | git fetch --prune --tags ||: + - name: Setup system dependencies + run: | + sudo apt-get install clang mold - name: Install Rust uses: actions-rs/toolchain@v1 - name: Cache Rust - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test diff --git a/.github/workflows/versioning.yml b/.github/workflows/versioning.yml index d8e458d..33a6032 100644 --- a/.github/workflows/versioning.yml +++ b/.github/workflows/versioning.yml @@ -7,11 +7,11 @@ on: jobs: actions-tagger: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - uses: Actions-R-Us/actions-tagger@v2 with: publish_latest_tag: true