Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDEA 2022.x support #1097

Merged
merged 11 commits into from
Apr 2, 2023
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
16 changes: 15 additions & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 34 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@

plugins {
id 'de.undercouch.download' version '3.3.0'
id 'org.jetbrains.intellij' version '0.4.9'
id "org.jetbrains.grammarkit" version "2020.3.2"
id 'org.jetbrains.intellij' version '1.10.1'
id "org.jetbrains.grammarkit" version "2022.3"
id "com.asarkar.gradle.build-time-tracker" version "2.0.4"
}

import org.jetbrains.intellij.DependenciesUtils
import org.jetbrains.grammarkit.tasks.*

if (!project.hasProperty('targetVersion')) {
Expand Down Expand Up @@ -97,25 +98,27 @@ allprojects {
type = 'IU'
version = "IU-${ideaVersion}"
pluginName = "intellij-haxe-${ideaVersion}"
ideaDependencyCachePath "${ideaBaseDir}"
ideaDependencyCachePath = "${ideaBaseDir}"
// Specify the sandbox so that Gradle doesn't try to make it relative to each sub-project.
sandboxDirectory "${project.rootDir}/build/idea-sandbox"
sandboxDir = "${project.rootDir}/build/idea-sandbox"
// Don't let gradle fill in since/until, we fill them via patchCustomTags using the properties file.
updateSinceUntilBuild false
updateSinceUntilBuild = false

// Include the "java" built-in plugin for 2019.2 and later builds.
if (requiresJavaPlugin) {
System.println("Including java plugin for version >= 2019.2")
plugins += 'java' // 2019.2 + only. Causes build errors on earlier versions.
plugins.add('java') // 2019.2 + only. Causes build errors on earlier versions.
}
// Flex support was unbundled for version 2020.2.
if (requiresFlexPlugin) {
System.println("Including Flex plugin for version >= 2020.2")
String versionWithMajor = ideaVersion.substring(0, 6);
switch (versionWithMajor) {
case "2020.2" : plugins += 'com.intellij.flex:202.6397.59'; break
case "2020.3" : plugins += 'com.intellij.flex:203.5981.155'; break
case "2021.1" : plugins += 'com.intellij.flex:211.6693.111'; break
case "2020.2" : plugins.add('com.intellij.flex:202.6397.59'); break
case "2020.3" : plugins.add('com.intellij.flex:203.5981.155'); break
case "2021.1" : plugins.add('com.intellij.flex:211.6693.111'); break
case "2022.3" : plugins.add('com.intellij.flex:223.7571.4'); break
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested specifically on 2022.3, not compatible with 2022.3.3

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think its about time we drop support for older versions if they are holding us back due to API changes etc. but perhaps a do a release for all older versions before we move on. it would be nice if we could follow the latest version so people can upgrade their IDEs

case "2022.3.3" : plugins.add('com.intellij.flex:223.8617.9'); break
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested specifically on 2022.3.3, not compatible with 2022.3

}

}
Expand Down Expand Up @@ -152,14 +155,15 @@ idea.module { generatedSourceDirs += file('gen') }


dependencies {
implementation 'ch.qos.reload4j:reload4j:1.2.25'

compile files('gen') {
implementation files('gen') {
builtBy 'generateSources'
}

compile project(':common')
compile project(':jps-plugin')
compile project(':hxcpp-debugger-protocol')
implementation project(':common')
implementation project(':jps-plugin')
implementation project(':hxcpp-debugger-protocol')

String flexPluginDir = "${ideaTargetDir}"
if (requiresFlexPlugin) {
Expand All @@ -181,15 +185,15 @@ dependencies {

testCompileOnly files(flexShared)
testCompileOnly files(flexSupport)
testCompileOnly files("${ideaTargetDir}/lib/ openapi.jar")
testCompileOnly files("${ideaTargetDir}/lib/openapi.jar")
testCompileOnly files("${ideaTargetDir}/lib/util.jar")

}

afterEvaluate {
dependencies {
if (requiresJavaPlugin) {
compile intellijPlugin('java') { include("${ideaTargetDir}/plugins/java/lib/jps-builders.jar") }
implementation DependenciesUtils.intellijPlugin(project, 'java') { include("${ideaTargetDir}/plugins/java/lib/jps-builders.jar") }
}
}
}
Expand All @@ -201,7 +205,7 @@ runIde {
Properties props = System.getProperties()
for (String pname : props.propertyNames()) {
for (String prefix : prefixesToInclude) {
if (pname.startsWith(prefix)) {
if (pname.startsWith(prefix) && pname != 'idea.home.path') {
String pval = props.get(pname)
if (pval.contains(" ") && !pval.startsWith("'")) {
// Strings containing spaces require quoting.
Expand Down Expand Up @@ -241,10 +245,14 @@ processResources {
}

patchPluginXml {
def props = findSdkValuesAndProperties(file("${ideaTargetDir}/build.txt"))
sinceBuild = props.getProperty("plugin.installable.since")
untilBuild = props.getProperty("plugin.installable.until")

pluginXmlFiles = [
'src/META-INF/plugin.xml',
'src/META-INF/debugger-support.xml',
'src/META-INF/flex-debugger-support.xml'
file('src/META-INF/plugin.xml'),
file('src/META-INF/debugger-support.xml'),
file('src/META-INF/flex-debugger-support.xml')
]
}

Expand Down Expand Up @@ -320,13 +328,13 @@ task cleanGenerated(type: Delete, group: 'generate') {
task generateHaxeParser(dependsOn: ':setupTools', type: JavaExec, group: 'generate') {
workingDir = "${toolDir}"
main '-jar'
args = ['grammar-kit.jar', "${generatedSrcDir}", "${grammarHaxe}"]
args = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED', '--add-opens=java.base/java.util=ALL-UNNAMED', '--add-opens=java.base/java.lang=ALL-UNNAMED', 'grammar-kit.jar', "${generatedSrcDir}", "${grammarHaxe}"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these and next jvmArgs are added as reflection is restricted on newer JREs

Copy link

@lppedd lppedd Mar 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these and next jvmArgs are added as reflection is restricted on newer JREs

@rosingrind beware that GrammarKit has a Gradle plugin now, exposing GenerateLexerTask and GenerateParserTask.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totally understandable, however the next step you should consider to perform transition to newer versions - dropping gradle-grammar-kit-plugin completely as it does not work as expected, see JetBrains/gradle-grammar-kit-plugin#3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left gradle-grammar-kit-plugin configurations as-is because it haven't introduced new problems yet, but it may do so potentially. Correct implementation of utilizing gradle-grammar-kit-plugin means double-pass generation as there are some clashing problems in gradle JVM and gk-plugin generation steps, see linked issue for more info

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rosingrind interesting. I wasn't aware of this, and I see it's a long standing issue too. Good catch, thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have wanted to upgrade grammar-kit and use the plugin but the reason why we stuck with the old version was because newer versions would output different code on different operating systems. but this could have been solved by now, so we could test the plugin and se how it goes


inputs.file "${grammarHaxe}"
outputs.upToDateWhen { file("${generatedSrcDir}/com/intellij/plugins/haxe/lang").exists() }
}

task generateHaxeLexer(group: 'generate', dependsOn:'generateHaxeParser', type: GenerateLexer) {
task generateHaxeLexer(group: 'generate', dependsOn:'generateHaxeParser', type: GenerateLexerTask) {
source = "${haxeFlex}"
targetDir = "${generatedSrcDir}/com/intellij/plugins/haxe/lang/lexer"
targetClass = "com.intellij.plugins.haxe.lang.lexer._HaxeLexer"
Expand All @@ -335,7 +343,7 @@ task generateHaxeLexer(group: 'generate', dependsOn:'generateHaxeParser', type:
outputs.upToDateWhen { file("${generatedSrcDir}/com/intellij/plugins/haxe/lang/lexer/_HaxeLexer.java").exists() }

}
task generateHxmlLexer(group: 'generate', dependsOn:'generateHxmlParser', type: GenerateLexer) {
task generateHxmlLexer(group: 'generate', dependsOn:'generateHxmlParser', type: GenerateLexerTask) {
source = "${hxmlFlex}"
targetDir = "${generatedSrcDir}/com/intellij/plugins/haxe/hxml/lexer"
targetClass = "com.intellij.plugins.haxe.hxml.lexer.HXMLLexer"
Expand All @@ -344,7 +352,7 @@ task generateHxmlLexer(group: 'generate', dependsOn:'generateHxmlParser', type:
outputs.upToDateWhen { file("${generatedSrcDir}/com/intellij/plugins/haxe/hxml/lexer/HXMLLexer.java").exists() }

}
task generateMetadataLexer(group: 'generate', dependsOn:'generateMetadataParser', type: GenerateLexer) {
task generateMetadataLexer(group: 'generate', dependsOn:'generateMetadataParser', type: GenerateLexerTask) {
source = "${metadataFlex}"
targetDir = "${generatedSrcDir}/com/intellij/plugins/haxe/metadata/lexer"
targetClass = "com.intellij.plugins.haxe.metadata.lexer.MetadataLexer"
Expand All @@ -359,7 +367,7 @@ task generateMetadataLexer(group: 'generate', dependsOn:'generateMetadataParser'
task generateHxmlParser(dependsOn: ':setupTools', type: JavaExec, group: 'generate') {
workingDir = "${toolDir}"
main '-jar'
args = ['grammar-kit.jar', "${generatedSrcDir}", "${grammarHxml}"]
args = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED', '--add-opens=java.base/java.util=ALL-UNNAMED', '--add-opens=java.base/java.lang=ALL-UNNAMED', 'grammar-kit.jar', "${generatedSrcDir}", "${grammarHxml}"]

inputs.file "${grammarHxml}"
outputs.upToDateWhen { file("${generatedSrcDir}/com/intellij/plugins/haxe/hxml").exists() }
Expand All @@ -368,7 +376,7 @@ task generateHxmlParser(dependsOn: ':setupTools', type: JavaExec, group: 'genera
task generateMetadataParser(dependsOn: ':setupTools', type: JavaExec, group: 'generate') {
workingDir = "${toolDir}"
main '-jar'
args = ['grammar-kit.jar', "${generatedSrcDir}", "${grammarMetadata}"]
args = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED', '--add-opens=java.base/java.util=ALL-UNNAMED', '--add-opens=java.base/java.lang=ALL-UNNAMED', 'grammar-kit.jar', "${generatedSrcDir}", "${grammarMetadata}"]

inputs.file "${grammarMetadata}"
outputs.upToDateWhen { file("${generatedSrcDir}/com/intellij/plugins/haxe/metadata").exists() }
Expand Down Expand Up @@ -430,6 +438,7 @@ Properties findSdkValuesAndProperties(File buildFile) {
// Lookup table for properties files. Add new versions here.
def propertiesFile = ""
switch (Integer.valueOf(codeLine, 10)) {
case 223: propertiesFile = "idea_v22.properties"; break
case 211: propertiesFile = "idea_v21.properties"; break
case 203: propertiesFile = "idea_v20.3.properties"; break
case 202: propertiesFile = "idea_v20.properties"; break
Expand Down
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ org.gradle.daemon.idletimeout=1
# Avoid out of memmory on compile
org.gradle.jvmargs=-Xms512m -Xmx512m

defaultIdeaVersion=2020.2.1

latest2022Version=2022.3.3
latest2020Version=2020.2.1
latest2019Version=2019.3.5
latest2018Version=2018.3.6
latest2017Version=2017.3.5
latest2016Version=2016.3.8

defaultIdeaVersion=2021.1
defaultIdeaVersion=2022.3

jarNametruncateMinor=true

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion intellij-haxe.iml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/out" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
2 changes: 1 addition & 1 deletion jps-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ buildSearchableOptions.enabled = false
sourceSets.main.java.srcDir "src"

dependencies {
compile project(':common')
implementation project(':common')
}

processResources {
Expand Down
33 changes: 33 additions & 0 deletions properties/idea_v22.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright 2023 rosingrind
#

#
# Properties for building against IDEA version 2022.
#

# Target version of IDEA that we typically build for.
# This is appended to the name of the intellij-haxe-XXX jar file.
idea.version=2022

# Human-readable versions of IDEA that this build is compatible with.
plugin.compatibility.description=IDEA 2022.x

# ###################################################
# IDEA build IDs that are compatible with this plugin.
# ###################################################
#
# IDEA builds prior to this one will not install this plugin.
#
plugin.installable.since=223
#
# IDEA builds after this one will not install this plugin.
#
plugin.installable.until=223.*


# ###################################################
# Java compatibility.
# ###################################################
plugin.java.source.compatibility=17
plugin.java.target.compatibility=17
Loading