Application to automatically generate printable 1-2 page PDF of course descriptions.
Made with:
Example given:
Client | Student / Developer | Supervisor |
---|---|---|
Anne-Isabelle Giuntini | Noah Munz | Dr. Guillaume Chanel |
This project was made using
- a JavaFx JavaFx GUI using mainly the framework/library Jfoenix
- a Scala application to fetch data from the unige database and generate markdown containing that data that each pdf will hold
- a Rust part to convert those markdown files to pdfs with pandoc
and to link everything as well as act as a native launcher.
The rust launcher also handles error handling displaying windowed pop-up for the user...
An image is worth a 1000 words so here is the use case diagram:
NB: The scala part is available in the scala branch
Meeting reports are available here. They are numbered and dated and contains a quick summary of what was discussed during the meeting as well as a list of all the participants.
The file howto.md contains a quick summary of which/how technology has been used as well as some brief commands.
Its goal is not to be documentation on how to use the project but rather to categorize the "major steps" this project went through and to give some information on how to reproduce some of these steps.
"Published" documentation is available here: Scala-Documentation
If you just want to know which command to run and look at the details after / only if something goes wrong, just do this.
Download wkhtmltopdf, sbt and cargo. Then, we only have 2 commands.
sbt assembly
cargo build --release
.
That's all.You just have to put the jar produced by sbt in files/res/java and and the executable generated by cargo should work. (Once you placed it at the root of the repo)
From clone to executable:
git clone -b scalight https://github.com/David-Kyrat/Course-Description-Automation.git
cd Course-Description-Automation
sbt # (sbt shell will popup, then enter:)
clean; reload; assembly
exit
cp target/scala-2.13/course-description-automation.jar .. # copy the jar outside
# Now build rust
git checkout master
# put jar produced by sbt in java folder
mv ../course-description-automation.jar files/res/java
cd src/main/rust
cargo build --release
# put the executable at the root of the repo
cp target/release/Course-Description-Automation.exe ../../../
Now while this may look big and tedious, 70% of what's done here
is just cloning and copying/moving a built artifact.
The only Interaction we've had with the build tools were, in fact, just sbt assembly
and
cargo build --release
.
- wkhtmltopdf (pandoc dependency)
wkhtmltopdf
must be findable by pandoc (i.e. in $PATH
) for this to work.
Building the gui is currently not supported. Please use the following to launch it. (depends on)
- core-[version].jar
- fancyform.jar
- javafx-swt.jar
- jfoenix-[version].jar
- jvm.driver-[version].jar
command:
java --module-path <javaFx/lib directory> --add-modules javafx.controls,javafx.fxml,javafx.graphics -jar fancyform.jar <path to abbrev.tsv file (usually /files/res/abbrev.tsv)>
e.g. (in /files/res/java
)
jdk-17/bin/java --module-path javafx-sdk-17/lib --add-modules javafx.controls,javafx.fxml,javafx.graphics -jar fancyform.jar ../abbrev.tsv
NB: On windows use javafx-sdk-19 instead of 17. (17 is the mac version)
NB: If you want to make your own, it is very easy to integrate it with the actual project.
Everything the JavafxGui is sending 1 string as argument to the scala application.
the string is of the form course_id1,course_id2,...#student_plan_id1,student_plan_id2...
.
The #
is not optional.
i.e. course_id1#
or #student_plan_id1
is a valid input, but not course_id1
or student_plan_id1
.
- Scala build tool: sbt
Others are directly managed via sbt. (configured via build.sbt
)
(We have the scala lang base module, scala lang parallel collections module and Gson, the google json library for java)
- Rust build tool: Cargo installable via https://www.rust-lang.org/tools/install
To build the scala part go to the scalight
branch that contains only scala related source & resource.
(We will see later why this is needed / important)
and simply run sbt
at the root of the project the sbt shell should pop up.
Once it has, enter the command clean; reload; assembly
like so:
sbt:Course-Description-Automation> clean; reload; assembly
(if you haven't modified build.sbt
you can just enter assembly
).
assembly
will compile & package everything in the src
directory as long as the library to make one "fat-jar" located at target/scala-2.13/course-description-automation.jar
.
(If we had our rust code in this branch, then sbt would've added the entiere rust project with it as well as some uneeded resources present only in master
).
Like for sbt this is pretty straightforward.
Go to src/main/rust
and enter cargo build --release
like so:
.../Course-Description-Automation/src/main/rust $: cargo build --release
the compiled binary should be at src/main/rust/target/release/Course-Description-Automation
Now that you've build the project, it should have the following structure to work.
./
├── Course-Description-Automation (executable)
│
├── files/
│ └── res/
│ └── bin-converters/
│ ├── pandoc
│ ├── java/
│ │ ├── javafx-sdk-17
│ │ ├── jdk17
│ │ ├── core-[version].jar
│ │ ├── fancyform.jar
│ │ ├── javafx-swt.jar
│ │ ├── jfoenix-[version].jar
│ │ ├── jvm.driver-[version].jar
│ │ │
│ │ └── course-description-automation.jar
│ │
│ ├── log/ (optional will get generated at runtime)
│ ├── md/
│ ├── pdf/
│ ├── templates/
│ │ ├── course-desc.css
│ │ ├── template.html
│ │ └── unige.png
│ ├── abbrev.tsv
│ └── logging_config.yaml
│
└── pdfs/ --> ./files/res/pdf/ (shortcut)
│
└── LICENSE
You can get the files
directory from a release on the release page. Its the same one.
The symlink to ./files/res/pdf
is not mandatory but its convenient for the user.