Xtend Compiler
A Gradle plugin for compiling Xtend source code.
Getting Started
Apply the latest org.xtext.xtend plugin. Then add the Xtend library.
plugins {
id "org.xtext.xtend" version "4.0.0"
}
repositories.mavenCentral()
dependencies {
compile 'org.eclipse.xtend:org.eclipse.xtend.lib:2.30.0'
}
Features
- Incrementally compiles Xtend sources to Java
- Enhances Java classes with Xtend debug information
- Integrates seamlessly with the Xtext Builder plugin and other Xtext languages
- Hooks into ‘gradle eclipse’, so the Xtend compiler is configured for your project when you import it into Eclipse
- Supports Gradle 7.1 and above (tested up to 8.0)
- Supports Xtend 2.17 and above (tested up to 29.0)
Options
The Xtend plugin comes with good default settings that will suit most projets. But you can customize every aspect:
xtend {
generator {
//whether to generate @SuppressWarnings("all"), enabled by default
suppressWarningsAnnotation = false
//whether to generate the @Generated annotation, disabled by default
generatedAnnotation {
active = true
comment = "Copyright My Cool Company"
includeDate = true
}
}
debugger {
//how to install debug info into generated Java code
//SMAP adds Xtend debug info on top of Java
//PRIMARY makes Xtend the only debug info (throws away Java line numbers)
//default is SMAP
sourceInstaller = 'SMAP' //or 'PRIMARY' or 'NONE'
//whether to hide synthetic variables in the debugger
hideSyntheticVariables = true
}
validator {
//adjust severity of issues
//available levels are error, warning, info and ignore
error 'org.eclipse.xtend.core.validation.IssueCodes.unused_private_member'
// These issue IDs can be found in your Eclipse project's .settings/org.eclipse.xtend.core.Xtend.prefs
// after enabling Project > Properties > Xtend > Errors/Warnings: [X] Enable project specific settings
}
}
The output folder can be configured for each sourceSet. By default it will be build/xtend/<sourceSet.name>
.
sourceSets {
main.xtend.outputDir = 'xtend-gen'
test.xtend.outputDir = 'test/xtend-gen'
}