Skip to content

Commit 1546728

Browse files
Merge pull request #409 from Checkmarx/feature/project_ignite_AST-131708
Project Ignite Phase I - Forking Jetbrains Plugin (AST-131708)
2 parents 69b040e + 16370da commit 1546728

File tree

465 files changed

+9464
-3203
lines changed

Some content is hidden

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

465 files changed

+9464
-3203
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ jobs:
4444
export DISPLAY=:99.0
4545
Xvfb -ac :99 -screen 0 1920x1080x24 &
4646
sleep 10
47-
./gradlew -i runIdeForUiTests > idea.log 2>&1 &
47+
./gradlew -i :plugin-checkmarx-ast:runIdeForUiTests > idea.log 2>&1 &
48+
sleep 30
4849
# Wait for IDEA to be started
4950
- name: Health Check
5051
run: curl --fail -sv --retry "15" --retry-delay "10" --retry-connrefused "http://127.0.0.1:8580"
5152
# Run tests
5253
- name: Tests
5354
run: |
5455
export DISPLAY=:99.0
55-
./gradlew test -PuiWaitDuration=800 --info --tests com.checkmarx.intellij.ui*
56+
./gradlew :plugin-checkmarx-ast:test -PuiWaitDuration=800 --info --tests "com.checkmarx.intellij.ast.test.ui*"
5657
- name: Move video
5758
if: ${{ failure() }}
5859
run: mv video build/reports
@@ -92,28 +93,35 @@ jobs:
9293
- name: Run Tests with coverage report
9394
id: test_results
9495
run: |
95-
./gradlew test --tests "com.checkmarx.intellij.unit*" jacocoTestReport \
96-
-PjacocoTask=unit
96+
./gradlew :plugin-checkmarx-ast:test --tests "com.checkmarx.intellij.ast.test.unit*" \
97+
:devassist-lib:test --tests "com.checkmarx.intellij.devassist.test*" \
98+
:plugin-checkmarx-devassist:test --tests "com.checkmarx.intellij.cxdevassist.test*" \
99+
:plugin-checkmarx-ast:jacocoTestReport \
100+
:devassist-lib:jacocoTestReport \
101+
:plugin-checkmarx-devassist:jacocoTestReport \
102+
-PjacocoTask=unit
97103
98104
- name: Generate JaCoCo Badge
99105
uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 #v2.11.0
100106
with:
101-
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
107+
jacoco-csv-file: plugin-checkmarx-ast/build/reports/jacoco/test/jacocoTestReport.csv
102108

103109
# Save coverage report as an artifact
104110
- name: Upload Coverage Report
105111
uses: actions/upload-artifact@v4
106112
with:
107113
name: unit-coverage-report
108-
path: build/reports/jacoco/test/html/
114+
path: plugin-checkmarx-ast/build/reports/jacoco/test/html/
109115
# Save report if tests fail
110116
- name: Save fails report
111117
if: ${{ failure() }}
112118
uses: actions/upload-artifact@v4
113119
with:
114-
name: test-fails-report-integration
120+
name: test-fails-report-unit
115121
path: |
116-
build/reports
122+
plugin-checkmarx-ast/build/reports/tests
123+
devassist-lib/build/reports/tests
124+
plugin-checkmarx-devassist/build/reports/tests
117125
118126
testIntegration:
119127
runs-on: ubuntu-latest
@@ -134,25 +142,26 @@ jobs:
134142
- name: Run Tests with coverage report
135143
id: test_results
136144
run: |
137-
./gradlew test --tests "com.checkmarx.intellij.integration.standard*" jacocoTestReport \
138-
-PjacocoTask=integration
145+
./gradlew :plugin-checkmarx-ast:test --tests "com.checkmarx.intellij.ast.test.integration.standard*" \
146+
:plugin-checkmarx-ast:jacocoTestReport \
147+
-PjacocoTask=integration
139148
140149
- name: Generate JaCoCo Badge
141150
uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 #v2.11.0
142151
with:
143-
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
152+
jacoco-csv-file: plugin-checkmarx-ast/build/reports/jacoco/test/jacocoTestReport.csv
144153

145154
# Save coverage report as an artifact
146155
- name: Upload Coverage Report
147156
uses: actions/upload-artifact@v4
148157
with:
149158
name: integration-coverage-report
150-
path: build/reports/jacoco/test/html/
159+
path: plugin-checkmarx-ast/build/reports/jacoco/test/html/
151160
# Save report if tests fail
152161
- name: Save fails report
153162
if: ${{ failure() }}
154163
uses: actions/upload-artifact@v4
155164
with:
156165
name: test-fails-report-integration
157166
path: |
158-
build/reports
167+
plugin-checkmarx-ast/build/reports/tests

.github/workflows/update-wrapper-version.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
description: "Specify a version (e.g., 1.2.3). Leave empty for the latest official version."
88
required: false
99
default: ""
10+
base_branch:
11+
description: "Target branch for PR (e.g., main, demo). Leave empty for default branch."
12+
required: false
13+
default: ""
1014
repository_dispatch:
1115
types: [java-wrapper-version-update]
1216

@@ -20,12 +24,19 @@ jobs:
2024
steps:
2125
- name: Checkout Repository
2226
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.event.inputs.base_branch || github.event.repository.default_branch }}
2329

2430
- name: Determine Version
2531
id: get_version
2632
run: |
33+
# Check for manual workflow_dispatch input first
2734
if [[ -n "${{ github.event.inputs.version }}" ]]; then
2835
VERSION="${{ github.event.inputs.version }}"
36+
# Then check for repository_dispatch payload
37+
elif [[ -n "${{ github.event.client_payload.cli_version }}" ]]; then
38+
VERSION="${{ github.event.client_payload.cli_version }}"
39+
# Fall back to fetching latest version
2940
else
3041
VERSION=$(curl -s "https://api.github.com/repos/Checkmarx/ast-cli-java-wrapper/releases" | jq -r '[.[] | .tag_name | select(test("^[0-9]+\\.[0-9]+\\.[0-9]+$"))] | sort_by(split(".") | map(tonumber)) | .[-1]')
3142
fi
@@ -42,15 +53,15 @@ jobs:
4253
echo "VERSION=$VERSION"
4354
echo "VERSION=$VERSION" >> $GITHUB_ENV
4455
45-
- name: Update build.gradle File
56+
- name: Update gradle.properties File
4657
run: |
47-
sed -i "s|com.checkmarx.ast:ast-cli-java-wrapper:[0-9]*\\.[0-9]*\\.[0-9]*|com.checkmarx.ast:ast-cli-java-wrapper:${VERSION}|" build.gradle
58+
sed -i "s|defaultJavaWrapperVersion=[0-9]*\\.[0-9]*\\.[0-9]*|defaultJavaWrapperVersion=${VERSION}|" gradle.properties
4859
4960
- name: Commit Changes
5061
run: |
5162
git config --global user.name "github-actions"
5263
git config --global user.email "github-actions@github.com"
53-
git add build.gradle
64+
git add gradle.properties
5465
git commit -m "Update AST CLI Java Wrapper to version ${VERSION}"
5566
5667
- name: Create Pull Request
@@ -63,5 +74,6 @@ jobs:
6374
Updates the AST CLI Java Wrapper to version `${{ env.VERSION }}`
6475
6576
Auto-generated by [create-pull-request][2]
77+
base: ${{ github.event.inputs.base_branch || github.event.repository.default_branch }}
6678
labels: cxone
6779
branch: other/update_java_wrapper_${{ env.VERSION }}

build.gradle

Lines changed: 55 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,82 @@
11
plugins {
2-
id 'io.freefair.lombok' version '8.6'
3-
id 'org.jetbrains.intellij' version '1.17.4'
2+
id 'io.freefair.lombok' version "${lombokPluginVersion}"
3+
id 'org.jetbrains.intellij' version "${intellijPluginVersion}"
44
id 'java'
55
id 'jacoco'
66
}
77

8-
group 'com.checkmarx'
9-
version System.getenv('RELEASE_VERSION') ?: "dev"
8+
def javaWrapperVersion = System.getenv('JAVA_WRAPPER_VERSION') ?: defaultJavaWrapperVersion
109

11-
def javaWrapperVersion = System.getenv('JAVA_WRAPPER_VERSION')
12-
def remoteRobotVersion = '0.11.23'
10+
// Common configuration for all projects
11+
allprojects {
12+
group "${projectGroup}"
13+
version System.getenv('RELEASE_VERSION') ?: "dev"
1314

14-
repositories {
15-
16-
mavenCentral()
17-
maven {
18-
url = 'https://packages.jetbrains.team/maven/p/ij/intellij-dependencies'
19-
}
20-
maven {
21-
url = 'https://oss.sonatype.org/content/repositories/snapshots'
15+
repositories {
16+
mavenCentral()
17+
maven {
18+
url = 'https://packages.jetbrains.team/maven/p/ij/intellij-dependencies'
19+
}
20+
maven {
21+
url = 'https://oss.sonatype.org/content/repositories/snapshots'
22+
}
2223
}
2324
}
2425

25-
jacoco {
26-
toolVersion = "0.8.12"
27-
}
26+
// Common configuration for all submodules
27+
subprojects {
28+
apply plugin: 'java'
2829

29-
dependencies {
30-
testImplementation 'com.intellij.remoterobot:remote-robot:' + remoteRobotVersion
31-
testImplementation('com.intellij.remoterobot:remote-fixtures:' + remoteRobotVersion) {
32-
exclude group: 'com.square.okio', module: 'okio'
30+
java {
31+
toolchain {
32+
languageVersion.set(JavaLanguageVersion.of(Integer.parseInt(javaVersion)))
33+
}
3334
}
34-
testImplementation 'com.squareup.okio:okio:3.8.0'
35-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
36-
testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
37-
testImplementation 'junit:junit:4.11-redhat-1'
38-
testImplementation 'junit:junit:4.13.1'
39-
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.15.2'
4035

41-
// Video Recording
42-
testImplementation('com.automation-remarks:video-recorder-junit5:2.0') {
43-
exclude group: 'log4j', module: 'log4j'
44-
}
45-
testImplementation 'org.apache.logging.log4j:log4j-api:2.23.1'
46-
testImplementation 'org.apache.logging.log4j:log4j-core:2.23.1'
47-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
36+
dependencies {
37+
testImplementation "com.intellij.remoterobot:remote-robot:${remoteRobotVersion}"
38+
testImplementation("com.intellij.remoterobot:remote-fixtures:${remoteRobotVersion}") {
39+
exclude group: 'com.square.okio', module: 'okio'
40+
}
41+
testImplementation "com.squareup.okio:okio:${okioVersion}"
42+
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitBomVersion}"
43+
testImplementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
44+
testImplementation 'junit:junit:4.11-redhat-1'
45+
testImplementation 'junit:junit:4.13.1'
46+
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.15.2'
47+
48+
// Video Recording
49+
testImplementation('com.automation-remarks:video-recorder-junit5:2.0') {
50+
exclude group: 'log4j', module: 'log4j'
51+
}
52+
testImplementation "org.apache.logging.log4j:log4j-api:${log4jVersion}"
53+
testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
54+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitEngineVersion}"
4855

49-
// https://mvnrepository.com/artifact/com.miglayout/miglayout-swing
50-
implementation 'com.miglayout:miglayout-swing:11.3'
56+
// https://mvnrepository.com/artifact/com.miglayout/miglayout-swing
57+
implementation "com.miglayout:miglayout-swing:${miglayoutVersion}"
5158

52-
if (javaWrapperVersion == "" || javaWrapperVersion == null) {
53-
implementation('com.checkmarx.ast:ast-cli-java-wrapper:2.4.20'){
54-
exclude group: 'junit', module: 'junit'
55-
}
56-
} else {
57-
implementation('com.checkmarx.ast:ast-cli-java-wrapper:' + javaWrapperVersion){
59+
implementation("com.checkmarx.ast:ast-cli-java-wrapper:${javaWrapperVersion}"){
5860
exclude group: 'junit', module: 'junit'
5961
}
62+
implementation(platform("com.fasterxml.jackson:jackson-bom:${jacksonBomVersion}"))
63+
// Temporary workaround https://github.com/FasterXML/jackson-databind/issues/3428
64+
65+
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
66+
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
6067
}
61-
implementation(platform("com.fasterxml.jackson:jackson-bom:2.16.1"))
62-
// Temporary workaround https://github.com/FasterXML/jackson-databind/issues/3428
6368

64-
testImplementation 'org.mockito:mockito-core:5.0.0'
65-
testImplementation 'org.mockito:mockito-junit-jupiter:5.0.0' // maybe remove
69+
jacoco {
70+
toolVersion = "${jacocoVersion}"
71+
}
6672
}
6773

6874
// See https://github.com/JetBrains/gradle-intellij-plugin/
6975
intellij {
70-
version = '2022.2.1'
76+
version = "${intellijVersion}"
7177
updateSinceUntilBuild = false
7278
}
7379

7480
runPluginVerifier {
75-
ideVersions = ['IC-2023.1', 'IC-2023.2', 'IC-2023.3', 'IC-2024.1']
76-
}
77-
78-
downloadRobotServerPlugin {
79-
version = remoteRobotVersion
80-
}
81-
82-
test {
83-
useJUnitPlatform()
84-
systemProperty 'uiWaitDuration', project.findProperty('uiWaitDuration') ?: 300
85-
testLogging {
86-
events "passed", "skipped", "failed", "standardOut", "standardError"
87-
showExceptions true
88-
showCauses true
89-
showStackTraces true
90-
showStandardStreams = true
91-
}
92-
jacoco {
93-
includeNoLocationClasses = true
94-
excludes = ["jdk.internal.*"]
95-
}
96-
}
97-
98-
runIdeForUiTests {
99-
systemProperty 'jb.privacy.policy.text', '<!--999.999-->'
100-
systemProperty 'jb.consents.confirmation.enabled', 'false'
101-
}
102-
103-
def jacocoTask = project.hasProperty('jacocoTask') ? project.jacocoTask : "unit"
104-
105-
jacocoTestReport {
106-
dependsOn test
107-
classDirectories.setFrom(instrumentCode)
108-
109-
if (jacocoTask == "integration") {
110-
afterEvaluate {
111-
classDirectories.setFrom(files(classDirectories.files.collect {
112-
fileTree(dir: it, include: 'com/checkmarx/intellij/commands/**',
113-
exclude: 'com/checkmarx/intellij/commands/results/obj')
114-
}))
115-
}
116-
}
117-
118-
reports {
119-
csv.required = true
120-
html.required = true
121-
}
122-
}
123-
124-
125-
126-
publishPlugin {
127-
token.set System.getenv("PUBLISH_TOKEN")
128-
if (project.hasProperty("rchannels")) {
129-
channels = [rchannels.toString()]
130-
}
131-
}
132-
133-
java {
134-
toolchain {
135-
languageVersion.set(JavaLanguageVersion.of(11))
136-
}
137-
}
138-
139-
patchPluginXml {
140-
sinceBuild = '222'
141-
}
142-
81+
ideVersions = verifierIdeVersions.split(',').toList()
82+
}

common-lib/build.gradle

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
id 'java-library'
3+
id 'io.freefair.lombok'
4+
id 'org.jetbrains.intellij'
5+
}
6+
7+
group = 'com.checkmarx.intellij.common'
8+
version = rootProject.version
9+
10+
intellij {
11+
version = "${intellijVersion}"
12+
updateSinceUntilBuild = false
13+
}
14+
15+
tasks.withType(JavaCompile).configureEach {
16+
options.encoding = 'UTF-8'
17+
}
18+
19+
test {
20+
useJUnitPlatform()
21+
}

0 commit comments

Comments
 (0)