Modifying Build Options
Steven J Zeil
The build.gradle files in each directory of the website source control a variety of options as to how the website will be built.
For the most part, these have been provided with reasonable defaults. But when the default behavior is not what you want, you have options.
1 Document Set Options
Each document set will have a build.grade file in its directory. At a minimum, this will consist of a single line:
apply plugin: 'edu.odu.cs.cowem.Documents'
More generally, this file would have the form:
apply plugin: 'edu.odu.cs.cowem.Documents'
documents {
⋮
}
with any of the following appearing in the documents area:
primary= fileName- indicates that the name of the primary document will not be the same as the name of the directory holding the document set ( followed by “
.md”), but will be _fileName-.[^This feature has not been extensively tested.] formats = [list-of-formats]- Sets the list of formats in which the the primary document will be generated. Possibilities are: 1_, pages, slides, directory, navigation, modules, and topics.
Example:
formats = [slides, scroll]A primary document
foo.mdproduces a webpagefoo___format_.htmlfor each format listed. There are two underscore characters between the document name and the format (to reduce the chances of an accidental conflict with support file names.
index = format : One format of the primary document is designated as the “index” of the document set. It can be accessed as index.html, and this is the format that other documents will l8ink to when using the doc: URL shortcut.
By default, the first format named in the `formats =` specification is the
index format.
docsfile-specification- Adds some files to the list of secondary documents for this document set. Secondary documents will be converted to ‘scroll’ format.
By default, the secondary documents are all
*.mmdand*.mdfiles (excluding the primary document).A secondary document
foo.mmdproduces a webpagefoo.mmd.html.To add a single file
secondary.mtxtto the list of secondary documents, just saydocs 'secondary.mtxt'To add all files ending in ‘
.mtxt’ use thefileTreeconstruct of Gradle:docs fileTree('.').include('*.mtxt')It is also possible to add a
.exclude(_pattern_‘)’ to exclude selected files. Intead of the'.', the current document set directory, secondary documents could be loaded from a subdirectory.
clearDocs() : Clears the entire list of secondary documents. Not even the normal defaults will be retained.
listingsfile-specification- Adds some files to the list of listing documents for this document set. Listings are processed into ‘scroll’ format while preserving all indentation and line breaks.
By default, the listing documents are all
*.h, .cpp,.javaand*.listing` files.A secondary document
foo.cppproduces a webpagefoo.cpp.html.To add a single file
bar.plto the list of listing documents, just saylistings 'bar.pl'fileTrees can also be used to add multiple listing files at a time, as described for secondary documents, above.
clearListings() : Clears the entire list of listing documents. Not even the normal defaults will be retained.
supportfile-specification- Adds some files to the list of support documents for this document set. Support documents are copied, unchanged, to the website.
By default, the support documents are all
*.html, .css,.js` and most common graphics format files.To add a single file
bar.gifto the list of listing documents, just saysupport 'bar.gif'fileTrees can also be used to add multiple listing files at a time, as described for secondary documents, above.
filteredfile-specification- Adds some files to the list of filtered documents for this document set. Support documents are copied to the website after changing all tokens of the form
@propertyName@by the corresponding property.For example, if the main course
build.gradlesaidcourse { courseName = 'CS252' courseTitle = 'Introduction to Unix for Programmers' semester = 'Spring 2017' sem = 's17' instructor = 'Steven J Zeil' ⋮and we had a file named
tag.txtcontainingCoWeM will be taught by Steven J Zeil in v1.25.0, January 2026.Then adding
filtered 'tag.txt'to the document
build.gradlewould cause that file to be copied to the website asCS252 will be taught by Steven J Zeil in Spring 2017.By default, the filtered documents list is empty.
clearListings()- Clears the entire list of listing documents. Not even the normal defaults will be retained.
math =_mode_- Sets the mode used for mathematics processing. Valid values are:
latex: Detect and render LaTeX mathematicsascii: Detect and render AsciiMath mathematicsnone: Do not use MathJax to render mathematics
2 Group Options
Document groups (the directories containing one or more document sets) are not required to have a build.gradle file. They can, however, use one to establish defaults for all document sets within the group.
Such a group build.gradle would take the form:
apply plugin: 'edu.odu.cs.cwm.Group'
subprojects {
project.documents {
⋮
}
}
Within the project.documents area, you can place any of the document set options described in the previous section. These will become the defaults for all document sets within the group. They can still be overidden by the build.gradle specification for individual document sets.
One difference is that any uses of fileTree must now be written as project.fileTree and placed in side { } brackets.
For example:
apply plugin: 'edu.odu.cs.cwm.Group'
subprojects {
project.documents {
formats = ['scroll', 'slides']
support {
project.fileTree('.').include('*.zip')
}
}
}
3 Course Options
3.1 Adding and Removing Groups
The number and name of the document groups is established within the settings.gradle file in the root directory.
def includeFrom = {
dir -> new File(rootDir,dir).eachFileRecurse { f ->
if ( f.name == "build.gradle" ) {
String relativePath = f.parentFile.absolutePath - rootDir.absolutePath
String projectName = relativePath.replaceAll("[\\\\\\/]", ":")
include projectName
}
}
}
// Don't touch anything abode this line
rootProject.name = 'CS350' // any short descriptive word or phrase - no blanks
// The following lines establish the course groups.
includeFrom('Directory')
includeFrom('Public')
includeFrom('Protected')
In general, you need at least one group, but can have as many as you like. The only restrictions:
-
If you have any pages in directory, modules, or topics format, you need a
Directorygroup and a navigation document set within that group. -
If you intend to export your course website to Blackboard, you need a
Directorygroup and a navigation document set within that group.
That said, most websites will have a Directory group and both outline and navigation document sets within that group.
3.2 Course Options
The root directory’s build.gradle file describes the course for which the website is being built.
// Top-level build.gradle for a course.
buildscript {
repositories {
jcenter()
mavenCentral()
ivy { // Use my own CS dept repo
url 'https://secweb.cs.odu.edu/~zeil/ivyrepo'
}
}
dependencies {
classpath 'org.hidetake:gradle-ssh-plugin:2.3.0+'
classpath 'edu.odu.cs.zeil:cowem-plugin:1.0+'
}
}
apply plugin: 'edu.odu.cs.cowem.CourseWebsite'
course {
⋮
}
Within the course area, any of the following can be specified
3.2.1 Required Properties
courseName =string- The short name of course, generally in DeptNumber form.
courseTitle =string- The full name of course.
semester =string- The semester of this offering.
sem =string- Abbreviated name for the semester of this offering.
instructor =string- The instructor name.
3.2.2 Optional Parameters: Course properties
email =string- The email address for inquiries about the course. This appears as a
mailto:link at the top and bottom of most pages.
copyright =string- A copyright notification.
delivery =string- The course delivery style, commonly used in conditional text within documents to select variant text for web versus face to face courses.
Typical values are “online” or “live”
homeURL =URL- URL used in “home” links from documents (generally in document footers). If omitted, such links should be suppressed.
3.2.3 Optional Parameters: Deployment
baseURL =URL- The URL at which the root directory of the website will be located. This is only used when preparing “thin” packages that allow Blackboard or other Learning Management Systems to link to a course website.
Currently used only with the Gradle
bbthintarget.
deployDestination = _local-directory`
: A directory on the local machine to which course materials should be copied to deploy the website.
Used only with the Gradle `deploy` target.
sshDeployURL =URL- An ssh URL, usually on a remote machine, to which course materials should be copied to deploy the website.
Used only with the Gradle
deployBySshtarget.
sshDeployKey =file- An ssh key used for deploying to a remote machine.
Used only with the Gradle
deployBySshtarget.
rsyncDeployURL =URL- An ssh URL, usually on a remote machine, to which course materials should be copied to deploy the website.
Used only with the Gradle
deployByRsynctarget.
rsyncDeployKey =file- An ssh key used for deploying to a remote machine.
Used only with the Gradle
deployByRsynctarget.
3.2.4 Optional Properties; Website
mathjaxURL =URL- The URL used for mathematics rendering. Defaults to
https://cdn.mathjax.org/mathjax/latest highlightjsURL =URL- The URL used for code highlighting.

