Ada Utility Library
This Ada library contains various utility packages for building
Ada applications. This includes:
- A logging framework close to Java log4j framework,
- Support for INI and property files,
- A serialization/deserialization framework for XML, JSON, CSV, Forms
- Ada beans framework,
- Encoding/decoding framework (Base16, Base32, Base64, SHA, HMAC-SHA, AES-256),
- A composing stream framework (raw, files, buffers, pipes, sockets, encryption, decryption, LZMA compression, LZMA decompression),
- Several concurrency tools (reference counters, counters, pools, fifos, arrays),
- Process creation and pipes,
- Support for loading shared libraries (on Windows or Unix),
- HTTP client library on top of CURL or AWS.
Ada Util also provides a small test utility library on top of
Ahven or AUnit to help in writing unit tests. Ahven is the default testing
framework as it provides better reports.
Version 2.8.0 - Under development
- Cleanup build environment to drop configure
- Improvement of Util.Files.Walk to scan and honor a root .gitignore from any child directory
- Feature #55: Support indentation when writing JSON streams
- Feature #56: Support for pseudo tty when launching a process
- Feature #57: Support for OpenBSD
Version 2.7.0 - Jun 2024
- New package Util.Files.Walk to iterate over directory trees and honor .gitignore
- Add support for custom log formatter (allow to translate log messages, filter messages, ...)
- Feature #48: Change the log time from UTC to Local Time (configurable)
- Fix #49: Perf report generates incorrect XML title attributes
- Fix #50: 128Bit AES-CTR Encoding doesn't work (thanks Adam Jasinski)
- Fix #53: Executor does not always stop the worker tasks
- Used spdx-tool to use
SPDX-License-Identifier
in headers
List all versions
Using with Alire
If you are using Alire in your project, run the following command
within your Alire project to use the library:
alr with utilada
Depending on your project, you may need one or some of the following other components:
alr with utilada_aws
alr with utilada_curl
alr with utilada_lzma
alr with utilada_unit
alr with utilada_xml
Using without Alire
If you don't have Alire or want to build and install the library
on a specific place, run a setup
command to configure the build as well as installation
directory.
For a detailed description on how you can configure, build and install the library
refer to the Installation guide.
Otherwise, you can easily configure and build the library with the steps described below.
The support for AWS, Curl, LZMA and XML/Ada are enabled only when a HAVE_XXX=yes
configuration
variable has defined. Run the setup command that records in the Makefile.conf
the configuration
you want to build.
The HAVE_ALIRE
configuration allows you to build with Alire or not.
The UTIL_OS
configuration is mandatory for the setup to indicate the build host configuration.
It must one of the allowed values defined in utilada_conf.gpr
GNAT project in the
Os_Version_Type
declaration:
type Os_Version_Type is ("none", "unix", "windows",
"linux32", "linux64", "win32", "win64", "macos64",
"netbsd32", "netbsd64", "freebsd32", "freebsd64");
The example below enables the XML/Ada and AWS components but disables
the Curl and LZMA support and disables the use of Alire to build
the library.
make setup BUILD=debug PREFIX=/build/install \
UTIL_OS=linux64 \
HAVE_XML_ADA=yes HAVE_AWS=yes \
HAVE_CURL=no HAVE_LZMA=no HAVE_ALIRE=no
Then build, run the unit tests and install by using:
make
make test
make install
To use the installed libraries, make sure your ADA_PROJECT_PATH
contains the directory
where you installed the libraries (configured by the PREFIX=<path>
option in the setup phase).
The installed GNAT projects are the same as those used when using Alire.
Samples
The samples are built by using:
cd samples
alr build
or by running:
make samples
Package |
Example |
Util.Dates.Formats |
date.adb |
Util.Beans.Objects |
objcalc.adb, jsonobj.adb, jsonread.adb |
Util.Beans.Objects.Maps |
jsonobj.adb, genentities.adb |
Util.Beans.Objects.Vectors |
datasets.adb, jsonobj.adb |
Util.Beans.Objects.Datasets |
datasets.adb |
Util.Beans.Objects.Iterators |
jsonread.adb |
Util.Encoders |
encodes.adb |
Util.Encoders.AES |
decrypt.adb, encrypt.adb |
Util.Encoders.SHA256 |
sha256.adb |
Util.Files |
realpath.adb, gperfhash.adb |
Util.Files.Rolling |
rolling_file.adb |
Util.Files.Walk |
tree.adb |
Util.Http.Clients |
wget.adb |
Util.Log.Loggers |
log.adb, syslog_appenders.adb, multipro_refs.adb, date.adb, xmlrd.adb, gperfhash.adb, multipro.adb, mapping.adb, csv_city.adb, bundles.adb |
Util.Measures |
measures.adb |
Util.Processes |
launch.adb, env.adb, popen.adb |
Util.Properties |
properties.adb, proplist.adb, bundles.adb |
Util.Refs |
multipro_refs.adb |
Util.Streams.AES |
decrypt.adb, encrypt.adb |
Util.Streams.Base64 |
lzma_encrypt_b64.adb, lzma_decrypt_b64.adb, dumpcert.adb |
Util.Streams.Buffered.Parts |
multipart.adb, dumpcert.adb |
Util.Streams.Files |
copy.adb, sha256.adb, compress.adb, decompress.adb, decrypt.adb, encrypt.adb, lzma_encrypt.adb, lzma_decrypt.adb |
Util.Streams.Pipes |
launch.adb, popen.adb |
Util.Serialize.IO.CSV |
csv_city.adb |
Util.Serialize.IO.JSON |
serialize.adb, json.adb, jsonobj.adb, jsonread.adb, genentities.adb |
Util.Serialize.IO.XML |
serialize_xml.adb, xmi.adb, xmlrd.adb |
Util.Serialize.Mappers |
csv_reader.adb, csv_city.adb, xmi.adb, xmlrd.adb |
Util.Serialize.Mappers.Record_Mapper |
xmi.adb, xmlrd.adb |
Util.Serialize.Mappers.Vector_Mapper |
json.adb, xmlrd.adb |
Util.Strings |
cut.adb, escape.adb |
Util.Strings.Tokenizers |
cut.adb, escape.adb |
Util.Strings.Transforms |
escape.adb, gperfhash.adb |
Util.Strings.Vectors |
gperfhash.adb |
Documentation
Articles