#make #rust

app lmake_version_from_date

In cargo.toml and service_worker.js writes the version as the date

2 releases

✓ Uses Rust 2018 edition

0.3.38 May 21, 2020
0.3.32 Apr 29, 2020

#98 in Build Utils

MIT license

21KB
260 lines

lmake_version_from_date

version: 0.3.37 date: 2020-05-21 authors: Luciano Bestia
In cargo.toml and service_worker.js writes the version as the date.

In cargo.toml writes the version as the date yyyy.mmdd.HHMM ex. 2019.1221.2359.
For non-library projects, the semver specification is not really useful.
Having the version as the date is just fine for executables and much more human readable.
The util exe must be executed in the root project folder where is the cargo.toml.

service_worker.js

Inside the PWA service worker javascript file is also needed to change the version.
The program searches for service_worker.js and modify the version.

no need to change version if no files changed

If src/*.rs or cargo.tom. files are not changed from last compile, than no need to change version.
This happend is workspaces when one project is modified and the others are not.
I need to store the dates somewhere.
Probably the Target folder is ok. The filename will be lmakeversionfromdate.json. Warning: I don't check if the service worker has changed because it rarely does.

Install

cargo install lmake_version_from_date

Makefile.toml for cargo-make

In Makefile.toml for cargo make add a task like this:

[tasks.dev]
description = "cargo build release"
clear = true
dependencies = [
    "lmake_version_from_date",
    "build_release",
    "post_build",
]

[tasks.lmake_version_from_date]
clear = true
private = true
description = "in cargo.toml change version to today date"
script= ["lmake_version_from_date"]

cargo crev reviews and advisory

It is recommended to always use cargo-crev
to verify the trustworthiness of each of your dependencies.
Please, spread this info.
On the web use this url to read crate reviews. Example:
https://bestia.dev/cargo_crev_web/query/num-traits

Dependencies

~2.2–3MB
~56K SLoC