From 98f5bee6e3e56dc6e28f07c99bd3b558ad1236e8 Mon Sep 17 00:00:00 2001 From: danieldouglas92 Date: Mon, 12 Feb 2024 22:20:15 -0600 Subject: [PATCH] Add developer documentation for astyle --- .../start_devel_and_contrib/tools/astyle.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/sphinx/developer_manual/start_devel_and_contrib/tools/astyle.md b/doc/sphinx/developer_manual/start_devel_and_contrib/tools/astyle.md index 5db8f9ee5..8f82f5b5a 100644 --- a/doc/sphinx/developer_manual/start_devel_and_contrib/tools/astyle.md +++ b/doc/sphinx/developer_manual/start_devel_and_contrib/tools/astyle.md @@ -2,6 +2,16 @@ Astyle ===== -```{todo} -Explain what Astyle does, why it is important and how to get the right version. -``` \ No newline at end of file +Astyle (Artistic Style) is a tool that automates the formatting of code. Executing astyle will automatically indent new code to the standard that the Geodynamic WorldBuilder uses, and should be done before each pull request to ensure that the indenter tests do not fail. + +GWB requires the use of astyle v2.04, which can be downloaded from sourceforge [here](https://sourceforge.net/projects/astyle/files/astyle/astyle%202.04/) for mac, linux or windows. + +An example one line command for how to build and install the correct version of astyle on linux is shown below, followed by a more general description on building astyle and linking it to the GWB. + +`mkdir astyle && cd astyle && wget 'https://sourceforge.net/projects/astyle/files/astyle/astyle 2.04/astyle_2.04_linux.tar.gz' && tar -zxvf astyle_2.04_linux.tar.gz && cd astyle/build/gcc && make && sudo make install` + +After the download is complete, simply unzip the files in your desired directory, and compile the astyle executible. To do this, run `make` in the `$ASTYLE_DIR/build/$COMPILER`. Here `$ASTYLE_DIR` is the path to the unzipped astyle directory, and `$COMPILER` is the directory within `$ASTYLE_DIR/build/` that corresponds to the compiler you will use to generate astyle (gcc, clang, intel, etc.). This should generate the astyle executible in `$ASTYLE_DIR/build/$COMPILER/bin/`. For the GWB to see this executible, you now need to add this to your `$PATH`. For mac, open your `~/.bash_profile` and add the following line: + +`export PATH=$ASTYLE_DIR/build/$COMPILER/bin/:$PATH` + +Now, if you navigate to `$WORLDBUILDER_SOURCE_DIR/build` and run `make indent`, astyle will run and automatically format all files within `$WORLDBUILDER_SOURCE_DIR`. \ No newline at end of file