Skip to content

Commit 2a9fdf7

Browse files
committed
feat: Docker plugin dependency removal.
Signed-off-by: Chao Wang <[email protected]>
1 parent 0e89dd1 commit 2a9fdf7

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
@@ -191,6 +191,52 @@ according to your preferences.
191191

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

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