CT Gradle Plugin
The CT Gradle plugin (io.github.qishr.cascara-gradle-plugins.ct) provides first-class support for compiling .ct files as part of standard Gradle build routines.
Configuration Example
This example is based on the code in cascara-retro-theme.
Build File
The relevant parts of cascara-retro-theme's build.gradle are:
These lines from the plugins block:
The ct block:
ct {
formats {
// When a configuration (e.g. 'retroAmber') for a format (e.g. ghostty)
// doesn't specify an output filename, the output filename is assembled
// based on the configuration name (e.g. 'retroAmber') changed into
// -kebab-case- and the suffix is obtained from the format definition
// (e.g. res://ghostty.tc)
ghostty {
retroAmber { entry = "retro-amber-on-bright-beige.ct"; }
retroGreen { entry = "retro-green-on-bright-beige.ct"; }
}
iterm2 {
retroAmber { entry = "retro-amber-on-bright-beige.ct"; }
retroGreen { entry = "retro-green-on-bright-beige.ct"; }
}
vscode {
retroAmberOnBrightBeige { entry = "retro-amber-on-bright-beige.ct"; }
retroAmberOnDullBeige { entry = "retro-amber-on-dull-beige.ct"; }
retroAmberOnHeavyMetal { entry = "retro-amber-on-heavy-metal.ct"; }
retroGreenOnBrightBeige { entry = "retro-green-on-bright-beige.ct"; }
retroGreenOnDullBeige { entry = "retro-green-on-dull-beige.ct"; }
retroGreenOnHeavyMetal { entry = "retro-green-on-heavy-metal.ct"; }
}
}
}
In this example, ghostty, iterm2, and vscode are formats, while retroAmber, retroGreen, retroAmberOnBrightBeige, etc are configurations. The names of the formats must match the name of a Format declaration in the source set.
The name of each format will be used as an output directory name under build/themes.
Each configuration specifies options which will be passed as arguments to the ct compiler. In this example, we only use the entry options which specifies the "main" .ct file for the configuration. Other options include:
output: speicifies a file name to override the default output file nameverbose: set to true or false to enable or disable verbose output
Source Sets
ct has a source set, similar to Java. The default source set path is: src/main/ct.
Any arrangement of .ct source files can exist within the source set. For each configuration under a format in the ct Gradle block, an entry is specified. This entry must be the exact relative path to a .ct source file within the source set.
See language reference for information on how to write .ct source files.
Compiling
To compile the CT files into the specified theme formats, simply run:
The plugin dynamically generates task providers for each format and configuration and binds them to the aggregate compilation lifecycle. The following files are produced:
build
└── themes
├── ghostty
│ ├── retro-amber.conf
│ └── retro-green.conf
├── iterm2
│ ├── retro-amber.itermcolors
│ └── retro-green.itermcolors
└── vscode
├── retro-amber-on-bright-beige.json
├── retro-amber-on-dull-beige.json
├── retro-amber-on-heavy-metal.json
├── retro-green-on-bright-beige.json
├── retro-green-on-dull-beige.json
└── retro-green-on-heavy-metal.json