This is a JetBrains IntelliJ Platform plugin (PHPStorm/WebStorm) for Drupal project maintainers. Written in Kotlin, built with Gradle (Kotlin DSL).
cd drupal-toolkit
./gradlew buildPlugin # Build the plugin distribution
./gradlew check # Run all tests + verification
./gradlew verifyPlugin # Verify plugin structure./gradlew test # Run all tests
./gradlew test --tests "MyPluginTest" # Run specific test class
./gradlew test --tests "MyPluginTest.testXMLFile" # Run single test method./gradlew qodana # Run Qodana static analysis (or use qodana.yml config)
./gradlew kover # Generate code coverage report./gradlew runIde # Run IDE with plugin installed (uses Run Plugin.run.xml)- Language: Kotlin (JVM 21)
- Build System: Gradle with Kotlin DSL (
*.gradle.kts) - Package:
com.github.drupaltools.drupaltoolkit
- Follow standard Kotlin import ordering (stdlib → external → internal)
- Use explicit imports; avoid wildcard imports except for stdlib
- 4 spaces for indentation (IntelliJ default for Kotlin)
- Follow Kotlin idiomatic style (use expression bodies where appropriate)
- Max line length: 120 characters (IntelliJ default)
- Classes/Objects: PascalCase (
MyPluginTest,MyProjectService) - Functions/Properties: camelCase (
testXMLFile,getRandomNumber) - Constants: UPPER_SNAKE_CASE
- Packages: lowercase with dots
- Use explicit types for public APIs
- Type inference acceptable for local variables
- Nullable types:
String?(notString!) - Use
valby default,varonly when mutation is needed
- Use Kotlin's
try-catchfor recoverable errors - Use
assert*methods from test framework for assertions - Avoid empty catch blocks
- Extend
BasePlatformTestCasefrom IntelliJ Platform - Use
@TestDataPathannotation for test data files - Test files go in
src/test/kotlin/ - Test data goes in
src/test/testData/
- Plugin XML:
src/main/resources/META-INF/plugin.xml - Services:
src/main/kotlin/.../services/ - Tool Windows:
src/main/kotlin/.../toolWindow/ - Startup:
src/main/kotlin/.../startup/
// Register in plugin.xml or via @Service annotation
class MyProjectService : ProjectService {
fun getRandomNumber(): Int = Random.nextInt()
}
// Usage in tests
val projectService = project.service<MyProjectService>()- Implement
ToolWindowFactory - Register in
plugin.xmlwithtoolWindowextension point
- Register extensions in
plugin.xml(actions, listeners, etc.)
- IntelliJ IDEA 2025.2+ (matches platformVersion)
- Kotlin plugin enabled
- Java 21 SDK configured
Run Plugin.run.xml- Run IDE with pluginRun Tests.run.xml- Run testsRun Verifications.run.xml- Run plugin verifier
The build workflow (.github/workflows/build.yml) runs:
buildPlugin- Creates distributioncheck- Tests + verificationqodana- Static analysisverifyPlugin- IntelliJ Plugin Verifier
- IntelliJ Platform: 2025.2.5 (platformVersion in gradle.properties)
- Kotlin: Via Gradle version catalog (
gradle/libs.versions.toml) - Testing:
opentest4j,junit
| Purpose | Path |
|---|---|
| Main source | src/main/kotlin/ |
| Test source | src/test/kotlin/ |
| Resources | src/main/resources/ |
| Gradle config | build.gradle.kts |
| Properties | gradle.properties |
| Version catalog | gradle/libs.versions.toml |