Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #40 from MarioAriasC/0.2.5
Browse files Browse the repository at this point in the history
0.2.5
  • Loading branch information
MarioAriasC authored Jul 30, 2023
2 parents acc9650 + 29e6def commit e5c9571
Show file tree
Hide file tree
Showing 24 changed files with 270 additions and 265 deletions.
133 changes: 106 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ name: Build
on:
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
push:
branches: [main]
branches: [ main ]
# Trigger the workflow on any pull request
pull_request:

Expand All @@ -31,6 +31,7 @@ jobs:
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
steps:
- name: Maximize Build Space
run: |
Expand All @@ -53,6 +54,9 @@ jobs:
distribution: zulu
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Set environment variables
- name: Export Properties
id: properties
Expand All @@ -71,7 +75,47 @@ jobs:
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
# Build plugin
- name: Build plugin
run: ./gradlew buildPlugin

# Prepare plugin archive content for creating artifact
- name: Prepare Plugin Artifact
id: artifact
shell: bash
run: |
cd ${{ github.workspace }}/build/distributions
FILENAME=`ls *.zip`
unzip "$FILENAME" -d content
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
# Store already-built plugin as an artifact for downloading
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*

# Run tests and upload a code coverage report
test:
name: Test
needs: [ build ]
runs-on: ubuntu-latest
steps:

# Check out current repository
- name: Fetch Sources zza
uses: actions/checkout@v3

# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
# Run tests
- name: Run Tests
run: ./gradlew check
Expand All @@ -88,16 +132,66 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: ${{ github.workspace }}/build/reports/kover/xml/report.xml
# Run Qodana inspections and provide report
inspectCode:
name: Inspect code
needs: [ build ]
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
pull-requests: write
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3

# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/[email protected]
with:
cache-default-branch-only: true

# Run plugin structure verification along with IntelliJ Plugin Verifier
verify:
name: Verify plugin
needs: [ build, test, inspectCode ]
runs-on: ubuntu-latest
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3

# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v3
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
Expand All @@ -107,34 +201,12 @@ jobs:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/[email protected]

# Prepare plugin archive content for creating artifact
- name: Prepare Plugin Artifact
id: artifact
shell: bash
run: |
cd ${{ github.workspace }}/build/distributions
FILENAME=`ls *.zip`
unzip "$FILENAME" -d content
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
# Store already-built plugin as an artifact for downloading
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*

# Prepare a draft release for GitHub Releases page for the manual verification
# If accepted and published, release workflow would be triggered
releaseDraft:
name: Release Draft
name: Release draft
if: github.event_name != 'pull_request'
needs: build
needs: [ build, verify ]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -144,6 +216,13 @@ jobs:
- name: Fetch Sources
uses: actions/checkout@v3

# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Remove old release drafts by using the curl request for the available releases with draft flag
- name: Remove Old Release Drafts
env:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ jobs:
with:
ref: ${{ github.event.release.tag_name }}

# Setup Java 11 environment for the next steps
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 17
cache: gradle

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Set environment variables
- name: Export Properties
id: properties
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ jobs:
with:
distribution: zulu
java-version: 17
cache: gradle
# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Run IDEA prepared for UI testing
- name: Run IDE
Expand Down
3 changes: 2 additions & 1 deletion .run/Run IDE for UI Tests.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
<option value="runIdeForUiTests" />
</list>
</option>
<option name="vmOptions" value="" />
<option name="vmOptions" value="-Xmx8G" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## [Unreleased]

### Added
- Support for the new IDEA platform version 2023.2
- Updated to the latest JetBrain's IntelliJ platform plugin version.

## [0.2.4] - 2023-04-08

### Added
Expand Down
30 changes: 14 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,12 @@ fun environment(key: String) = providers.environmentVariable(key)
plugins {
// Java support
id("java")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.8.10"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij") version "1.13.2"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "2.0.0"
// Gradle Qodana Plugin
id("org.jetbrains.qodana") version "0.1.13"
// Gradle Kover Plugin
id("org.jetbrains.kotlinx.kover") version "0.6.1"
// Grammar Kit
id("org.jetbrains.grammarkit") version "2021.2.2"
alias(libs.plugins.kotlin)
alias(libs.plugins.gradleIntelliJPlugin)
alias(libs.plugins.changelog)
alias(libs.plugins.qodana)
alias(libs.plugins.kover)
alias(libs.plugins.grammarkit)
}

group = properties("pluginGroup").get()
Expand Down Expand Up @@ -70,21 +64,25 @@ qodana {
showReport.set(environment("QODANA_SHOW_REPORT").map(String::toBoolean).getOrElse(false))
}

kover.xmlReport {
onCheck.set(true)
koverReport {
defaults {
xml {
onCheck = true
}
}
}

// generate code
val generateZigParser = task<GenerateParserTask>("generateZigParser") {
source.set("src/main/kotlin/org/ziglang/jb/grammar/zig.bnf")
sourceFile.set(file("src/main/kotlin/org/ziglang/jb/grammar/zig.bnf"))
targetRoot.set("src/main/gen")
pathToParser.set("/org/ziglang/jb/psi/parser/ZigParser.java")
pathToPsiRoot.set("org/ziglang/jb/psi")
purgeOldFiles.set(true)
}

val generateZigLexer = task<GenerateLexerTask>("generateZigLexer") {
source.set("src/main/kotlin/org/ziglang/jb/grammar/zig.flex")
sourceFile.set(file("src/main/kotlin/org/ziglang/jb/grammar/zig.flex"))
targetDir.set("src/main/gen/org/ziglang/jb/lexer")
targetClass.set("ZigLexer")
purgeOldFiles.set(true)
Expand Down
12 changes: 8 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
pluginGroup = com.github.marioariasc.zigsupport
pluginName = zig-support
pluginRepositoryUrl = https://github.com/MarioAriasC/zig-support
pluginVersion = 0.2.4
pluginVersion = 0.2.5

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild = 223
pluginUntilBuild = 231.*
pluginUntilBuild = 232.*


platformType = IU
Expand All @@ -22,12 +22,16 @@ platformPlugins =
# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
javaVersion = 17

gradleVersion = 8.0.2
gradleVersion = 8.2.1

# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
# suppress inspection "UnusedProperty"
kotlin.stdlib.default.dependency = false

# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.unsafe.configuration-cache = true
org.gradle.unsafe.configuration-cache = true

org.gradle.caching = true

systemProp.org.gradle.unsafe.kotlin.assignment = true
22 changes: 22 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[versions]
# libraries
annotations = "24.0.1"

# plugins
kotlin = "1.9.0"
changelog = "2.1.2"
gradleIntelliJPlugin = "1.15.0"
qodana = "0.1.13"
kover = "0.7.2"
grammarkit = "2022.3.1"

[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
grammarkit = { id = "org.jetbrains.grammarkit", version.ref = "grammarkit"}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# https://www.jetbrains.com/help/qodana/qodana-yaml.html

version: 1.0
linter: jetbrains/qodana-jvm-community:latest
projectJDK: 17
profile:
name: qodana.recommended
exclude:
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/org/ziglang/jb/ZigFileType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object ZigFileType : LanguageFileType(ZigLang) {

override fun getIcon(): Icon = ZigIcons.file

override fun getCharset(file: VirtualFile, content: ByteArray?): String = CHARSET
override fun getCharset(file: VirtualFile, content: ByteArray): String = CHARSET

private const val CHARSET = "UTF-8"
}
Loading

0 comments on commit e5c9571

Please sign in to comment.