Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF-PSA-Crypto Doxygen Adaptations #115

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/all-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ pre_initialize_variables () {

config_files="$CRYPTO_CONFIG_H $CONFIG_TEST_DRIVER_H"
fi
export TF_PSA_CRYPTO_ROOT_DIR

# Files that are clobbered by some jobs will be backed up. Use a different
# suffix from auxiliary scripts so that all.sh and auxiliary scripts can
Expand Down Expand Up @@ -228,6 +229,8 @@ pre_initialize_variables () {
: ${CLANG_EARLIEST:="clang-earliest"}
: ${GCC_LATEST:="gcc-latest"}
: ${GCC_EARLIEST:="gcc-earliest"}
export OUT_OF_SOURCE_DIR

# if MAKEFLAGS is not set add the -j option to speed up invocations of make
if [ -z "${MAKEFLAGS+set}" ]; then
export MAKEFLAGS="-j$(all_sh_nproc)"
Expand Down
22 changes: 17 additions & 5 deletions scripts/apidoc_full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@

set -eu

CONFIG_H='include/mbedtls/mbedtls_config.h'
. $(dirname "$0")/project_detection.sh

if in_mbedtls_repo; then
CONFIG_H='include/mbedtls/mbedtls_config.h'
elif in_tf_psa_crypto_repo; then
CONFIG_H='include/psa/crypto_config.h'
fi

if [ -r $CONFIG_H ]; then :; else
echo "$CONFIG_H not found" >&2
Expand All @@ -22,7 +28,13 @@ fi
CONFIG_BAK=${CONFIG_H}.bak
cp -p $CONFIG_H $CONFIG_BAK

scripts/config.py realfull
make apidoc

mv $CONFIG_BAK $CONFIG_H
if in_mbedtls_repo; then
scripts/config.py realfull
make apidoc
mv $CONFIG_BAK $CONFIG_H
elif in_tf_psa_crypto_repo; then
cd $OUT_OF_SOURCE_DIR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cd $OUT_OF_SOURCE_DIR
cd $OUT_OF_SOURCE_DIR

This is specific to all.sh and we want this script to work on its own. Here you can just build in tree:
cmake -DCMAKE_BUILD_TYPE:String=Check ..

cmake -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON "$TF_PSA_CRYPTO_ROOT_DIR"
make tfpsacrypto-apidoc
mv $TF_PSA_CRYPTO_ROOT_DIR/$CONFIG_BAK $TF_PSA_CRYPTO_ROOT_DIR/$CONFIG_H
fi
18 changes: 12 additions & 6 deletions scripts/check-doxy-blocks.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
use File::Basename;

# C/header files in the following directories will be checked
my @directories = qw(include/mbedtls library doxygen/input);
my @mbedtls_directories = qw(include/mbedtls library doxygen/input);
my @tf_psa_crypto_directories = qw(include/psa drivers core doxygen/input);

# very naive pattern to find directives:
# everything with a backslach except '\0' and backslash at EOL
Expand Down Expand Up @@ -53,13 +54,18 @@ sub check_dir {
}
}

open my $project_file, "scripts/project_name.txt" or die "This script must be run from Mbed TLS or TF-PSA-Crypto root directory";
my $project = <$project_file>;
my @directories;

if ($project eq "TF-PSA-Crypto") {
@directories = @tf_psa_crypto_directories
} elsif ($project eq "Mbed TLS") {
@directories = @mbedtls_directories
}
# Check that the script is being run from the project's root directory.
for my $dir (@directories) {
if (! -d $dir) {
die "This script must be run from the Mbed TLS root directory";
} else {
check_dir($dir)
}
check_dir($dir)
}

exit $exit_code;
Expand Down
14 changes: 11 additions & 3 deletions scripts/doxygen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
# Abort on errors (and uninitialised variables)
set -eu

if [ -d library -a -d include -a -d tests ]; then :; else
echo "Must be run from Mbed TLS root" >&2
. $(dirname "$0")/project_detection.sh

if in_mbedtls_repo || in_tf_psa_crypto_repo; then :; else
echo "Must be run from Mbed TLS root or TF-PSA-Crypto root" >&2
exit 1
fi

Expand All @@ -28,5 +30,11 @@ if grep -E "(warning|error):" doc.filtered; then
exit 1;
fi

make apidoc_clean
if in_mbedtls_repo; then
make apidoc_clean
elif in_tf_psa_crypto_repo; then
cd $TF_PSA_CRYPTO_ROOT_DIR
rm -rf $OUT_OF_SOURCE_DIR
Comment on lines +36 to +37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

fi

rm -f doc.out doc.err doc.filtered