All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.danilopianini.gradle.latex.PdfLatexTask.kt Maven / Gradle / Ivy

There is a newer version: 0.2.7
Show newest version
package org.danilopianini.gradle.latex

import org.gradle.api.tasks.TaskAction

/**
 * Gradle task to run pdflatex on a TeX file.
 * One such task is created for each Latex artifact.
 * 
 * @author csabasulyok
 */
open class PdfLatexTask : LatexTask() {

  override fun getDescription() =  "Uses pdflatex to compile ${artifact.tex} into ${artifact.pdf}"

  /**
   * Main task action.
   * Empties auxiliary directory.
   */
  @TaskAction
  fun pdfLatex() {
    Latex.LOG.info("Executing ${extension.pdfLatexCommand.get()} for {}", artifact.tex)
    val command = StringBuilder(extension.pdfLatexCommand.get())
      .append(if (artifact.quiet) " -quiet " else " ")
      .append(artifact.extraArgs.joinToString(" "))
      .append(' ')
      .append(artifact.tex.absolutePath)
      .toString()
    Latex.LOG.debug("Prepared command {}", command)
    command.runScript()
    command.runScript()
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy