There's two main parts to the build system and testing procedure:
- Python pagegen for generated content (html templates, files in the
./test/out
folder) - Gradle for static content (js, sass -> css and images)
Here's a brief description on what each of the folders are for that we understand:
gradle
- contains the gradle wrapper jar
images
- contains png and svg images
js
- contains JavaScript files that are put on various places of Forge's websites
python
- the PageGen code
test
- this is where you can test your changes
maven
- contains dummy data used by pagegen, generated by the
setupTest
Gradle task - you can make your own by running the
publish
command on most Forge projects and copy the literal folder calledrepo
from there over to here - poms and the like don't seem to be used by the pagegen, so feel free to make folders, add files inside and change up the json as you see fit to aid testing.
- As long as it follows the expected format similar to the dummy data, it should work
- contains dummy data used by pagegen, generated by the
out
- the generated output by pagegen
static
- contains compiled static content, such as the css, js and images, made by the
setupTest
- contains compiled static content, such as the css, js and images, made by the
sass
- poorly named, actually has scss files inside which are used for styling
- they get compiled to css by the gradle part of the build system
static
- contains compiled static content, such as the css, js and images
- during testing, you probably want to compile to this folder and tell pagegen to use this with the
--static
arg - this folder also contains a copy of the images folder
templates
- the HTML templates used by the Python pagegen side of the build system
Here's some instructions on how to setup the environment and work with it.
Firstly, we need to setup the Python side:
- Make sure Python is installed. At the time of writing, the latest Python 3.10.4 seems to work
Now, let's setup the Gradle side:
- Import the
build.gradle
into your IDE - Run
gradlew setupTest
- Run
gradlew runTestPageGen
- Open the pages you want to test, they can be found in the
./test/out
folder
For HTML:
- Edit the appropriate file(s) in the
./templates
folder - Run
gradlew runTestPageGen
- Open the pages you want to test in the
./test/out
folder
For CSS:
- Edit the appropriate file(s) in the
./css
folder - Run
gradlew setupTest
- Run
gradlew runTestPageGen
- Open the pages you want to test in the
./test/out
folder
For SCSS:
- Edit the appropriate file(s) in the
./sass
folder - Run
gradlew setupTest
- Run
gradlew runTestPageGen
- Open the pages you want to test in the
./test/out
folder
For JS:
- Edit the appropriate file(s) in the
./js
folder - Run
gradlew setupTest
- Run
gradlew runTestPageGen
- Open the pages you want to test in the
./test/out
folder
For images:
- Edit the appropriate file(s) in the
./images
folder - Run
gradlew setupTest
- Run
gradlew runTestPageGen
- Open the pages you want to test in the
./test/out
folder
For the Python side of the build system:
- Edit the appropriate file(s) in the
./python
folder and therequirements.txt
- Run
setupPageGen
if you changed therequirements.txt
- Test PageGen with
runTestPageGen
and opening the pages you want to test in the./test/out
folder
For the Gradle side of the build system:
- Edit the appropriate Gradle file(s), such as
build.gradle
,gradlew
,gradlew.bat
and the./gradle
folder - Refresh Gradle as usual
In your PR, commit any changed files inside the ./css
, ./sass
, ./js
, ./templates
, ./images
and ./python
folders
Note: The test html files generated in Step 2 are not intended to be published to a live site, as they contain file://
references to your machine for some static resources, which won't work for anyone else.