Skip to content

Commit

Permalink
quick and dirty support for 2020.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-ku committed Apr 18, 2020
1 parent 6091e2c commit d175e8d
Show file tree
Hide file tree
Showing 16 changed files with 196 additions and 126 deletions.
4 changes: 4 additions & 0 deletions .idea/compiler.xml

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

2 changes: 1 addition & 1 deletion .idea/gradle.xml

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

5 changes: 4 additions & 1 deletion .idea/modules.xml

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

1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ env:
- IDEA_VERSION=2017.3.5
- IDEA_VERSION=2018.2.8
- IDEA_VERSION=2019.1.1
- IDEA_VERSION=2020.1
os:
- linux
- osx
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ environment:
- IDEA_VERSION: 2017.2.7
- IDEA_VERSION: 2017.3.5
- IDEA_VERSION: 2018.1.6

- IDEA_VERSION: 2019.1.1
- IDEA_VERSION: "2020.1"
install:
# disable windows update service
- ps: Set-Service wuauserv -StartupType Manual
Expand Down
44 changes: 25 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

plugins {
id 'de.undercouch.download' version '3.3.0'
id 'org.jetbrains.intellij' version '0.3.12'
id 'org.jetbrains.intellij' version '0.4.18'
}


Expand Down Expand Up @@ -75,7 +75,7 @@ allprojects {

intellij {
type = 'IU'
version = "IU-${ideaVersion}"
version = "${ideaVersion}"
pluginName = "intellij-haxe-${ideaVersion}"
ideaDependencyCachePath "${ideaBaseDir}"
// Don't let gradle fill in since/until, we fill them via patchCustomTags using the properties file.
Expand Down Expand Up @@ -124,7 +124,10 @@ dependencies {
compileOnly files("${ideaTargetDir}/plugins/flex/lib/FlexSupport.jar")
compileOnly files("${ideaTargetDir}/lib/openapi.jar")
compileOnly files("${ideaTargetDir}/lib/util.jar")

compileOnly files("${ideaTargetDir}/plugins/java/lib/java-api.jar")
compileOnly files("${ideaTargetDir}/plugins/java/lib/java-impl.jar")
compileOnly files("${ideaTargetDir}/plugins/ant/lib/antIntegration.jar")
compileOnly files("${ideaTargetDir}/plugins/ant/lib/ant-jps-plugin.jar")

testCompileOnly project(':jps-plugin')
testCompileOnly project(':common')
Expand All @@ -139,7 +142,7 @@ dependencies {
}

runIde {
jbreVersion 'jbrex8u152b1248.6'
jbrVersion 'jbrex8u152b1248.6'
}

compileJava {
Expand All @@ -156,17 +159,17 @@ processResources {

patchPluginXml {
pluginXmlFiles = [
'src/META-INF/plugin.xml',
'src/META-INF/debugger-support.xml',
'src/META-INF/flex-debugger-support.xml'
'src/META-INF/plugin.xml',
'src/META-INF/debugger-support.xml',
'src/META-INF/flex-debugger-support.xml'
]
}

patchPluginXml.finalizedBy('patchCustomTags')
task patchCustomTags() {
doFirst {
file(patchPluginXml.destinationDir.toString() + '/plugin.xml')
.renameTo(patchPluginXml.destinationDir.toString() + '/plugin.xml.partial')
.renameTo(patchPluginXml.destinationDir.toString() + '/plugin.xml.partial')
}
doLast {
copy {
Expand Down Expand Up @@ -254,17 +257,17 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

task generateIdeaSdkIdentifer(group: 'generate') {
doFirst {
copy {
file("${generatedSrcDir}/com/intellij/plugins/haxe/build/").mkdirs()
Properties properties = findSdkValuesAndProperties(file("${ideaTargetDir}/build.txt"))
from("${haxePluginDir}/src/common/com/intellij/plugins/haxe/build/IdeaSDKIdentifier.java.template") {
filter(ReplaceTokens, tokens: properties)
}
into "${generatedSrcDir}/com/intellij/plugins/haxe/build/"
rename('IdeaSDKIdentifier.java.template', 'IdeaSDKIdentifier.java')
doFirst {
copy {
file("${generatedSrcDir}/com/intellij/plugins/haxe/build/").mkdirs()
Properties properties = findSdkValuesAndProperties(file("${ideaTargetDir}/build.txt"))
from("${haxePluginDir}/src/common/com/intellij/plugins/haxe/build/IdeaSDKIdentifier.java.template") {
filter(ReplaceTokens, tokens: properties)
}
into "${generatedSrcDir}/com/intellij/plugins/haxe/build/"
rename('IdeaSDKIdentifier.java.template', 'IdeaSDKIdentifier.java')
}
}
}
}

task generateSources(group: 'generate') {
Expand Down Expand Up @@ -294,6 +297,9 @@ Properties findSdkValuesAndProperties(File buildFile) {
// Lookup table for properties files. Add new versions here.
def propertiesFile = ""
switch (Integer.valueOf(codeLine, 10)) {
case 203: propertiesFile = "idea_v20.properties"; break
case 202: propertiesFile = "idea_v20.properties"; break
case 201: propertiesFile = "idea_v20.properties"; break
case 192: propertiesFile = "idea_v19.properties"; break
case 191: propertiesFile = "idea_v19.properties"; break
case 183: propertiesFile = "idea_v18.properties"; break
Expand Down Expand Up @@ -335,7 +341,7 @@ tasks.withType(Test) {
// from https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time
testLogging {
events TestLogEvent.FAILED,
TestLogEvent.SKIPPED
TestLogEvent.SKIPPED

exceptionFormat TestExceptionFormat.FULL
showExceptions true
Expand Down
4 changes: 4 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ processResources {
from ('src') {
include '**/*.properties'
}
}

dependencies {
compileOnly files("${ideaTargetDir}/plugins/java/lib/java-api.jar")
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ org.gradle.daemon.idletimeout=1
# Avoid out of memmory on compile
org.gradle.jvmargs=-Xms512m -Xmx512m

defaultIdeaVersion=2019.1.1
defaultIdeaVersion=2020.1

latest2020Version=2020.1
latest2019Version=2019.1.1
latest2018Version=2018.3.6
latest2017Version=2017.3.5
Expand Down
1 change: 1 addition & 0 deletions jps-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ sourceSets.main.java.srcDir "src"

dependencies {
compile project(':common')
compileOnly files("${ideaTargetDir}/plugins/java/lib/jps-builders.jar")
}

processResources {
Expand Down
51 changes: 51 additions & 0 deletions properties/idea_v20.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# Copyright 2019 Eric Bishton
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# Properties for building against IDEA version 18.
#

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

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

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

# ###################################################
# Where to find Idea20-specific code.
# ###################################################
# Use the v16 source tree, until there is a compatibility issue.
# There are no version-specific classes at the moment.
# version.specific.code.location=src/16.0

# ###################################################
# Java compatibility.
# ###################################################
plugin.java.source.compatibility=1.8
plugin.java.target.compatibility=1.8
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.intellij.plugins.haxe.haxelib;

import com.intellij.compiler.ant.BuildProperties;
import com.intellij.ide.highlighter.XmlFileType;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
Expand Down Expand Up @@ -241,8 +240,8 @@ private void resolveModuleLibraries(ProjectTracker tracker, Module module, HaxeL
syncLibraryLists(moduleSdk,
HaxelibUtil.getModuleLibraries(module),
externalLibs,
/*modifies*/ toAdd,
/*modifies*/ toRemove);
/*modifies*/ toAdd,
/*modifies*/ toRemove);

updateModule(tracker, module, toRemove, toAdd);
}
Expand Down Expand Up @@ -465,8 +464,8 @@ public void run() {

// Figure out the list of project libraries that we should reference, if we can.
HaxeLibraryList projectLibraries = ModuleRootManager.getInstance(module).isSdkInherited()
? getProjectLibraryList(tracker)
: new HaxeLibraryList(module);
? getProjectLibraryList(tracker)
: new HaxeLibraryList(module);
final LibraryTable projectTable = ProjectLibraryTable.getInstance(tracker.getProject());

timeLog.stamp("<-- Time elapsed retrieving project libraries.");
Expand Down Expand Up @@ -593,21 +592,24 @@ private void syncOneModule(@NotNull final ProjectTracker tracker, @NotNull Modul
else {
// XXX: EMB - Not sure of the validity of using this path if xml lib isn't specified.

File dir = BuildProperties.getProjectBaseDir(project);
List<String> projectClasspaths =
HaxelibClasspathUtils.getProjectDisplayInformation(project, dir, "openfl",
HaxelibSdkUtils.lookupSdk(module));

for (String classpath : projectClasspaths) {
VirtualFile file = LocalFileFinder.findFile(classpath);
if (file != null) {
HaxeLibrary lib = libManager.getLibraryByPath(file.getPath());
if (null != lib) {
haxelibExternalItems.add(lib.createReference());
}
else {
// TODO: Figure out how to communicate this to the user.
LOG.warn("Library referenced by openFL configuration is not known to haxelib " + classpath);
String basePath = project.getBasePath();
if (basePath != null) {
File dir = new File(basePath);
List<String> projectClasspaths =
HaxelibClasspathUtils.getProjectDisplayInformation(project, dir, "openfl",
HaxelibSdkUtils.lookupSdk(module));

for (String classpath : projectClasspaths) {
VirtualFile file = LocalFileFinder.findFile(classpath);
if (file != null) {
HaxeLibrary lib = libManager.getLibraryByPath(file.getPath());
if (null != lib) {
haxelibExternalItems.add(lib.createReference());
}
else {
// TODO: Figure out how to communicate this to the user.
LOG.warn("Library referenced by openFL configuration is not known to haxelib " + classpath);
}
}
}
}
Expand Down Expand Up @@ -839,8 +841,8 @@ public boolean processEntry(HaxeLibraryReference entry) {
private void syncLibraryLists(@NotNull Sdk sdk,
@NotNull HaxeLibraryList currentList,
@NotNull HaxeLibraryList externallyRequired,
/*modifies*/ @NotNull HaxeLibraryList newLibrariesToAdd,
/*modifies*/ @NotNull HaxeLibraryList oldLibrariesToRemove) {
/*modifies*/ @NotNull HaxeLibraryList newLibrariesToAdd,
/*modifies*/ @NotNull HaxeLibraryList oldLibrariesToRemove) {

final HaxeLibraryList currentManagedEntries = new HaxeLibraryList(sdk);
final HaxeLibraryList currentUnmanagedEntries = new HaxeLibraryList(sdk);
Expand Down Expand Up @@ -905,8 +907,8 @@ private void syncProjectClasspath(@NotNull ProjectTracker tracker) {
syncLibraryLists(sdk,
HaxelibUtil.getProjectLibraries(tracker.getProject(),false, false),
new HaxeLibraryList(sdk),
/*modifies*/ toAdd,
/*modifies*/ toRemove );
/*modifies*/ toAdd,
/*modifies*/ toRemove );

if (!toAdd.isEmpty() && !toRemove.isEmpty()) {
timeLog.stamp("Add/Remove calculations finished. Queuing write task.");
Expand Down Expand Up @@ -1124,7 +1126,7 @@ public void setListFor(HaxeConfiguration buildConfig, HaxeLibraryList list) {

@NotNull
public HaxeLibraryList getNmmlList() {
return nmmlList != null ? nmmlList : new HaxeLibraryList(sdk);
return nmmlList != null ? nmmlList : new HaxeLibraryList(sdk);
}

@NotNull
Expand Down Expand Up @@ -1387,11 +1389,11 @@ public ProjectTracker get(@NotNull Project project) {

public boolean iterate(@NotNull Lambda<ProjectTracker> lambda) {
synchronized(this) {
for(ProjectTracker tracker : myMap.values()) {
if (!lambda.process(tracker)) {
return false;
}
}
for(ProjectTracker tracker : myMap.values()) {
if (!lambda.process(tracker)) {
return false;
}
}
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public PsiElement[] getPrimaryElements() {

@Override
public boolean processElementUsages(@NotNull PsiElement element,
@NotNull Processor<UsageInfo> processor,
@NotNull Processor<? super UsageInfo> processor,
@NotNull FindUsagesOptions options) {
final SearchScope scope = options.searchScope;

Expand Down Expand Up @@ -124,7 +124,7 @@ public boolean processElementUsages(@NotNull PsiElement element,
}

@NotNull
private static ReadActionProcessor<PsiReference> getSimpleSearchProcessor(@NotNull Processor<UsageInfo> processor) {
private static ReadActionProcessor<PsiReference> getSimpleSearchProcessor(@NotNull Processor<? super UsageInfo> processor) {
return new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(final PsiReference ref) {
Expand All @@ -136,7 +136,7 @@ public boolean processInReadAction(final PsiReference ref) {
}

@NotNull
private static ReadActionProcessor<PsiReference> getConstructorSearchProcessor(@NotNull Processor<UsageInfo> processor) {
private static ReadActionProcessor<PsiReference> getConstructorSearchProcessor(@NotNull Processor<? super UsageInfo> processor) {
return new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(PsiReference reference) {
Expand Down
Loading

0 comments on commit d175e8d

Please sign in to comment.