Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/check-license.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright (c) 2014-2020 Zephir Team
# Copyright (c) 2014-2026 Zephir Team
#
# This source file is subject the MIT license, that is bundled with
# this package in the file LICENSE, and is available through the
Expand All @@ -13,7 +13,7 @@
set -eu

COPYRIGHT_NOTICE=$(cat <<-EOF
// Copyright \\(c\\) 2014-2020 Zephir Team
// Copyright \\(c\\) 2014-2026 Zephir Team
//
// This source file is subject the MIT license, that is bundled with
// this package in the file LICENSE, and is available through the
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020 Zephir Team
# Copyright (c) 2014-2026 Zephir Team
#
# This source file is subject the MIT license, that is bundled with
# this package in the file LICENSE, and is available through the
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020 Zephir Team
# Copyright (c) 2014-2026 Zephir Team
#
# This source file is subject the MIT license, that is bundled with
# this package in the file LICENSE, and is available through the
Expand Down Expand Up @@ -26,20 +26,21 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v6
with:
fetch-depth: 5

- name: Set Up JDK 1.8
uses: actions/setup-java@v1
- name: Set Up JDK 21
uses: actions/setup-java@v5
with:
java-version: 1.8
distribution: temurin
java-version: '21'

- name: Grant Execute Permission for Gradle
run: chmod +x gradlew

- name: Cache Gradle packages
uses: actions/cache@v1
uses: actions/cache@v5
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand All @@ -52,7 +53,7 @@ jobs:
run: ./gradlew buildPlugin

- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v7
with:
name: intellij-zephir-distributions
path: build/distributions
Expand All @@ -71,14 +72,14 @@ jobs:

- name: Upload Tests Result
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v7
with:
name: intellij-zephir-tests-result
path: tests-result

- name: Upload Tests Report
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v7
with:
name: intellij-zephir-tests-reports
path: build/reports/tests
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020 Zephir Team
# Copyright (c) 2014-2026 Zephir Team
#
# This source file is subject the MIT license, that is bundled with
# this package in the file LICENSE, and is available through the
Expand Down Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v6
with:
fetch-depth: 1

Expand All @@ -53,7 +53,7 @@ jobs:
sudo apt-get install --no-install-recommends -q -y pcregrep

- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v6
with:
fetch-depth: 1

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020 Zephir Team
# Copyright (c) 2014-2026 Zephir Team
#
# This source file is subject the MIT license, that is bundled with
# this package in the file LICENSE, and is available through the
Expand Down
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
and this project adheres to [Semantic Versioning](http://semver.org).

## [Unreleased][Unreleased]

## [0.5.0][0.5.0] - 2026-03-19
### Added
- Added `docker-compose.yml` with a persistent Gradle cache volume for reproducible local builds

### Changed
- Requires IntelliJ Platform 2024.1 or newer (minimum build `241`)
- Gradle wrapper updated from 6.5.1 to 8.9
- `org.jetbrains.intellij` plugin updated from 0.4.21 to 1.17.4
- `org.jetbrains.grammarkit` plugin updated from 2020.1 to 2022.3.2
- Kotlin JVM plugin updated from 1.3.72 to 2.1.0
- Replaced `jcenter()` repository with `mavenCentral()`
- JVM target updated from 1.8 to 17
- Grammar: added `mixed`, `object`, `callable`, `resource` as recognized type keywords
- Grammar: added `mixed` type to type hints in method scope completion
- Replaced deprecated `IconLoader.getIcon(String)` with `IconLoader.getIcon(String, ClassLoader)`

## [0.4.0][0.4.0] - 2020-05-24
### Added
- Amended Color Scheme configuration
Expand Down Expand Up @@ -92,7 +109,8 @@ and this project adheres to [Semantic Versioning](http://semver.org).
### Added
- Initial release

[Unreleased]: https://github.com/zephir-lang/idea-plugin/compare/0.4.0...HEAD
[Unreleased]: https://github.com/zephir-lang/idea-plugin/compare/0.5.0...HEAD
[0.5.0]: https://github.com/zephir-lang/idea-plugin/compare/0.4.0...0.5.0
[0.4.0]: https://github.com/zephir-lang/idea-plugin/compare/0.3.6...0.4.0
[0.3.6]: https://github.com/zephir-lang/idea-plugin/compare/0.3.5...0.3.6
[0.3.5]: https://github.com/zephir-lang/idea-plugin/compare/0.3.4...0.3.5
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2014-2020 Zephir Team
Copyright (c) 2014-2026 Zephir Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ missing functionality that you would want to see. Check out

## License

Copyright (c) 2014-2020 Zephir Team.
Copyright (c) 2014-2026 Zephir Team.

Licensed under the [MIT](./LICENSE) License.

Expand Down
181 changes: 104 additions & 77 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,35 +1,55 @@
// Copyright (c) 2014-2020 Zephir Team
// Copyright (c) 2014-2026 Zephir Team
//
// This source file is subject the MIT license, that is bundled with
// this package in the file LICENSE, and is available through the
// world-wide-web at the following url:
//
// https://github.com/zephir-lang/idea-plugin/blob/master/LICENSE

import org.jetbrains.intellij.tasks.PatchPluginXmlTask
import org.jetbrains.grammarkit.tasks.GenerateLexer
import org.jetbrains.grammarkit.tasks.GenerateParser
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.gradle.api.internal.HasConvention
import org.jetbrains.grammarkit.tasks.GenerateLexerTask
import org.jetbrains.grammarkit.tasks.GenerateParserTask
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
idea
id("net.saliman.properties") version "1.5.2"
id("org.jetbrains.intellij.platform") version "2.13.1"
id("org.jetbrains.grammarkit") version "2022.3.2"
kotlin("jvm") version "2.1.0"
}

group = "com.zephir"
version = prop("version")
description = prop("pluginDescription")

repositories {
jcenter()
}
val grammarKitClassPath = "grammarKitClassPath"

plugins {
idea
id("org.jetbrains.intellij") version "0.4.21"
id("org.jetbrains.grammarkit") version "2020.1"
id("net.saliman.properties") version "1.5.1"
kotlin("jvm") version "1.3.72"
repositories {
// Local Maven repo for IDE artifacts that are too large to download reliably.
// Populated manually via: ~/temp/local-maven. Remove once CI can download reliably.
val localMaven = File(System.getProperty("user.home"), "temp/local-maven")
if (localMaven.exists()) {
maven { url = uri(localMaven.toURI()) }
}
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}

dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation("junit:junit:4.13.2")
testImplementation("org.opentest4j:opentest4j:1.3.0")
// Grammar-kit 2022.3.2 uses these Kotlin runtime libraries at generation time.
// The IntelliJ 2022.3 platform Maven modules (pulled via intellijRelease) do not
// declare them as transitive deps, so we add them explicitly to the tool classpath.
grammarKitClassPath("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4")
grammarKitClassPath("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.5")

intellijPlatform {
intellijIdeaCommunity(prop("ideVersion"))
testFramework(TestFrameworkType.Platform)
}
}

idea {
Expand All @@ -38,91 +58,98 @@ idea {
}
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
pluginName = prop("pluginName")
version = prop("ideVersion")
updateSinceUntilBuild = false
intellijPlatform {
pluginConfiguration {
name = prop("pluginName")
version = prop("version")

ideaVersion {
sinceBuild = "243"
}

changeNotes = readChangeNotes("CHANGELOG.md", prop("version"))?.let {
"""
<b>Changes in version ${prop("version")}:</b>
$it
<p>
To see full list of changes to this plugin refer to
<a href="${prop("repository")}/blob/master/CHANGELOG.md">GitHub repo</a>.
</p>
""".trimIndent()
} ?: ""
}

pluginVerification {
ides {
recommended()
}
}
}

// Use IntelliJ 2022.3 platform JARs for grammar generation — grammar-kit 2022.3.2
// was built against that SDK. Without this, the tool gets 2024.3 JARs which have
// additional runtime requirements (OpenTelemetry, etc.) that break the generator.
grammarKit {
intellijRelease.set("223.8617.56")
}

// The IntelliJ 2022.3 platform dependency tree pulls in optional AI/spellchecker
// and remote-dev JARs that are not available in public Maven repos. Grammar-kit
// doesn't use any of these for source generation, so we exclude them.
configurations.named(grammarKitClassPath) {
exclude(group = "com.jetbrains.infra")
exclude(group = "ai.grazie.spell")
exclude(group = "ai.grazie.utils")
exclude(group = "ai.grazie.nlp")
exclude(group = "ai.grazie.model")
exclude(group = "ai.grazie.api")
exclude(group = "org.roaringbitmap")
exclude(group = "com.jetbrains.rd")
}

sourceSets {
// Only add gen/ for generated Java sources — all other dirs are already at their defaults.
main {
java.srcDirs("gen")
kotlin.srcDirs("src/main/kotlin")
resources.srcDirs("src/main/resources")
}
test {
kotlin.srcDirs("src/test/kotlin")
resources.srcDirs("src/test/resources")
}
}

tasks.getByName<PatchPluginXmlTask>("patchPluginXml") {
version(version)
sinceBuild("191")

changeNotes("""
<b>Changes in version $version:</b>
${readChangeNotes("CHANGELOG.md", version).orEmpty()}
<p>
To see full list of changes to this plugin refer to
<a href="${prop("repository")}/blob/master/CHANGELOG.md">GitHub repo</a>.
</p>
""".trimIndent()
)
}

val generateLexer = task<GenerateLexer>("generateLexer") {
val generateLexer = tasks.named<GenerateLexerTask>("generateLexer") {
group = "build setup"
description = "Generate the Lexer"
source = "src/main/grammar/Zephir.flex"
targetDir = "gen/com/zephir/lang/core/lexer/"
targetClass = "_ZephirLexer"
skeleton = "src/main/grammar/Lexer.skeleton"
purgeOldFiles = true
sourceFile.set(file("src/main/grammar/Zephir.flex"))
targetDir.set("gen/com/zephir/lang/core/lexer/")
targetClass.set("_ZephirLexer")
skeleton.set(file("src/main/grammar/Lexer.skeleton"))
purgeOldFiles.set(true)
}

val generateParser = task<GenerateParser>("generateParser") {
val generateParser = tasks.named<GenerateParserTask>("generateParser") {
group = "build setup"
description = "Generate the Parser and PsiElement classes"
source = "src/main/grammar/Zephir.bnf"
targetRoot = file("gen")
pathToParser = "/com/zephir/lang/core/parser/ZephirParser.java"
pathToPsiRoot = "/com/zephir/lang/core/psi"
purgeOldFiles = true
sourceFile.set(file("src/main/grammar/Zephir.bnf"))
targetRoot.set("gen")
pathToParser.set("com/zephir/lang/core/parser/ZephirParser.java")
pathToPsiRoot.set("com/zephir/lang/core/psi")
purgeOldFiles.set(true)
}

tasks {
runIde {
jvmArgs("--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED")
}

compileKotlin {
kotlinOptions.jvmTarget = "1.8"
dependsOn(
generateLexer,
generateParser
)
dependsOn(generateLexer, generateParser)
}

compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
// buildSearchableOptions runs a sandboxed IDE to index plugin settings for the
// Settings search. Safe to disable — only affects whether plugin settings appear
// in the IDE's Settings search box, which Zephir does not use.
buildSearchableOptions {
enabled = false
}
}

configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
kotlin {
jvmToolchain(21)
}


val SourceSet.kotlin: SourceDirectorySet
get() =
(this as HasConvention)
.convention
.getPlugin(KotlinSourceSet::class.java)
.kotlin

fun prop(name: String): String =
extra.properties[name] as? String
?: error("Property `$name` is not defined in gradle.properties")
Expand Down
Loading