Newer
Older
gradle-lectures / 01_lecture / build.gradle
plugins {
    id "lecture"
    // for debugging task dependencies
    // https://plugins.gradle.org/plugin/org.barfuin.gradle.taskinfo
    // id "org.barfuin.gradle.taskinfo" version "2.0.0"
}

// Configure the lecture.
lecture {
    // TYPICAL CONFIGURATION

    // Specify the document targets for this lecture. Defaults to
    // ["slides", "handout", "notes", "examples"], which are also the
    // only valid values. Remove any you don't need.
    docTargets = [
        "slides",
        "handout",
        // "notes",
        // "examples",
    ]

    // Specify the list of images used (\includegraphics) in the lecture
    // documents. Defaults to []. These will become dependencies of the
    // lecture documents. If the images are generated, use the name of
    // the generated product, NOT the source file (e.g., use "foo.pdf",
    // not "foo.puml").
    // slidesImages = [
    //     "image1.png",
    //     "image2.pdf",
    //     "image3.pdf",
    // ]

    // ADVANCED CONFIGURATION
    // (i.e., DON'T TOUCH unless you know what you're doing!)

    // Set the lecture number. This defaults to the numeric prefix of
    // the lecture folder (e.g., "01_whatever"), but you can override
    // it if needed. Use a zero-padded string.
    // lectureNum = "01"

    // Set the filename prefix for lecture documents. Defaults to "lecture".
    // Lecture document filenames are formatted as "prefix_whatever.foo"
    // e.g., "lecture_slides.tex".
    // docPrefix = "foo"

    // Set the images directory where included images are kept. Default
    // "images". A lot of other things derive from this!
    // imageDir = project.projectDir.dir("foo")

    // Set the PDFs directory where the numbered versions of the lecture
    // documents are written. Default "pdfs".
    // pdfDir = project.projectDir.dir("foo")

    // Specify the list of files used (\input) in the lecture documents.
    // Defaults to the three files shown below, which are REQUIRED. All
    // files in the list will become dependencies of the lecture documents.
    // slidesFiles = [
    //     "paper_init.tex",
    //     "lecturedates.tex",
    //     "doc_init.tex"
    // ]

    // Also:
    //  examplesImages = [ ... ] list of images used in the examples document
    //  examplesFiles = [ ... ] list of files used in the examples document
    //  cleanFiles = [ ... ]: list of files to be removed by the "clean" targets
    //  cleanDirs = [ ... ]: list of directories to be removed by the "clean" targets
    //  latexFlags = [ ... ]: list of LaTeX flags
}

// Typical task to generate images from PlantUML.
// By convention the task name is "images.whatever", but it can really be
// anything you like. Gradle will find these tasks by class name if need be.
//
// By default this includes all files matching *.pu, *.puml, or *.plantuml.
// You can ADD files, e.g., include "foo.uml", "*.pml".
// You can EXCLUDE files, e.g., exclude "bar.pu", "*.plantuml".
// You can REPLACE the defaults, e.g., setIncludes(["foo.uml", "*.pml"]).
// (There is also a setExcludes() but that defaults to empty anyway.)
// Note that the argument is a list value.
//
// Other options:
//  outputFormat can be one of "pdf", "png", or "svg"
//  add "salt = true" if there are Salt diagrams
//  sourceDir and outputDir default to lecture.imageDir but can be overidden
def pu2pdf = tasks.register("images.plantuml2pdf", nz.stanger.lecture.GenerateImageFromPlantumlTask) {
    outputFormat = "pdf"
    description = "Generate PDF from PlantUML."

    // Uncomment the following line if there are any Salt diagrams.
    // salt = true
}

// Typical task to generate images from SVG. The name is again arbitrary.
// By default this includes all files matching *.svg, You can include and
// exclude as outlined above.
//
// Other options:
//  outputFormat can be one of "pdf" or "png"
def svg2pdf = tasks.register("images.svg2pdf", nz.stanger.lecture.GenerateImageFromSvgTask) {
    outputFormat = "pdf"
    description = "Generate PDF from SVG."

    // If you have multiple image tasks, you have to specify their order to
    // avoid "implicit dependency" errors. It usually doesn't matter what
    // order they run in, but the order must be specified.
    // mustRunAfter pu2pdf
}