Skip to content

Commit 2d463ba

Browse files
authored
feat: Docker plugin dependency removal. (#222)
Signed-off-by: Chao Wang <[email protected]>
1 parent 26a1f70 commit 2d463ba

File tree

56 files changed

+3017
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3017
-136
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,52 @@ according to your preferences.
193193

194194
![ Animated screenshot showing the inline reporting feature of Image Analysis ](src/main/resources/images/image-analysis.gif)
195195

196+
## Development
197+
198+
### Custom Dockerfile Parser
199+
200+
This plugin implements a custom Dockerfile parser to provide syntax highlighting and analysis without requiring the Docker plugin dependency. The parser is built using JFlex lexer and Grammar-Kit parser generators.
201+
202+
#### Parser Architecture
203+
204+
- **Grammar Definition**: `src/main/java/org/jboss/tools/intellij/image/build/dockerfile.bnf` - Defines Dockerfile syntax rules using Grammar-Kit BNF format
205+
- **Lexer Specification**: `src/main/java/org/jboss/tools/intellij/image/build/dockerfile.flex` - Defines token patterns using JFlex format
206+
- **Generated Classes**: PSI (Program Structure Interface) classes are generated in `src/main/java/org/jboss/tools/intellij/image/build/psi/`
207+
208+
#### Regenerating Parser Classes
209+
210+
When modifying the grammar or lexer files, you need to regenerate the parser classes:
211+
212+
1. **Install JFlex** (if not already installed):
213+
```bash
214+
# Download JFlex 1.9.2 or later
215+
wget https://github.com/jflex-de/jflex/releases/download/v1.9.2/jflex-1.9.2.jar
216+
```
217+
218+
2. **Generate Lexer**:
219+
```bash
220+
java -jar jflex-1.9.2.jar src/main/java/org/jboss/tools/intellij/image/build/dockerfile.flex
221+
```
222+
223+
3. **Generate Parser** (using Grammar-Kit plugin in IntelliJ):
224+
- Open the `.bnf` file in IntelliJ IDEA
225+
- Right-click and select "Generate Parser Code" from context menu
226+
- Or use Tools → Grammar Kit → Generate Parser Code
227+
228+
4. **Important Notes**:
229+
- Always use `IMAGE_NAME_TOKEN` (not `IMAGE_NAME`) in both grammar and lexer to avoid naming conflicts
230+
- The `ANY_CHAR` token serves as a catch-all for any non-whitespace characters in Dockerfile instructions
231+
- Generated PSI classes should be committed to git to ensure reproducible builds
232+
233+
#### Supported Dockerfile Features
234+
235+
- All standard Dockerfile instructions (FROM, RUN, COPY, ADD, etc.)
236+
- Multi-stage builds with AS aliases
237+
- Platform specifications (--platform flag)
238+
- Variable substitution (${VAR} and $VAR)
239+
- Comments and complex shell commands
240+
- Comprehensive syntax error handling
241+
196242
- **Excluding dependencies with `exhortignore`**
197243
<br >You can exclude a package from analysis by marking the package for exclusion.
198244
If you want to ignore vulnerabilities for a dependency in a `pom.xml` file, you must add `exhortignore` as a comment

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ gradleVersion=8.5
1010

1111
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1212
platformBundledPlugins=org.jetbrains.plugins.yaml,com.intellij.java,org.jetbrains.idea.maven
13-
platformPlugins=com.redhat.devtools.intellij.telemetry:1.1.0.52,Docker:251.23774.37
13+
platformPlugins=com.redhat.devtools.intellij.telemetry:1.1.0.52
1414

1515
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
1616
kotlin.stdlib.default.dependency=false

0 commit comments

Comments
 (0)