Skip to content

Commit

Permalink
Update dependencies for (hopefully) easier dev setup and fix a bunch …
Browse files Browse the repository at this point in the history
…of deprecated API usage

- Gradle now 7.3.3
- IntelliJ gradle plugin now 1.3.0
- run tests with IntelliJ 2021.3.1
- Use at least openjdk-11

Upgrade a little bit. Still more to go, but this is working

Update to Java 11 and IntelliJ gradle plugin 1.0

Update to gradle 7.3.3 and IntelliJ gradle plugin 1.3.0

- both current releases

Remove use of more deprecated IntelliJ stuff

run tests against slightly newer IntelliJ

upgrade to latest kotlin and build against latest IntelliJ
  • Loading branch information
slackersoft committed Jan 20, 2022
1 parent f05dbec commit 039aa5f
Show file tree
Hide file tree
Showing 15 changed files with 112 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
# specify the version you desire here
- image: cimg/openjdk:8.0.312-node
- image: cimg/openjdk:11.0.13-node

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand Down
34 changes: 15 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
plugins {
id "org.jetbrains.kotlin.jvm" version "1.3.21"
id "org.jetbrains.intellij" version "0.4.2"
id "org.jetbrains.kotlin.jvm" version "1.6.10"
id "org.jetbrains.intellij" version "1.3.0"
}

apply plugin: "kotlin"
apply plugin: 'org.jetbrains.intellij'

intellij {
version ideaVersion
pluginName name
plugins 'JavaScriptLanguage', 'CSS'
updateSinceUntilBuild false
version.set(ideaVersion)
pluginName.set(name)
plugins.set(['JavaScriptLanguage', 'CSS'])
updateSinceUntilBuild.set(false)
}

def latestReleaseNotesFile() {
return fileTree("release_notes")
.getFiles()
.sort()
.last()
}

patchPluginXml {
changeNotes file("release_notes/" + version + ".md").text
changeNotes.set(provider { latestReleaseNotesFile().text })
}

repositories {
Expand All @@ -23,17 +30,6 @@ repositories {

prepareSandbox {
from('src/main/resources/intellij_reporter.js') {
into "${intellij.pluginName}/lib/"
into "${intellij.pluginName.get()}/lib/"
}
}

publishPlugin {
/* token System.getenv('IJ_PUBLISH_TOKEN') */
username System.getenv('IJ_PUBLISH_USER')
password System.getenv('IJ_PUBLISH_PASSWORD')
channels publishChannels
}

dependencies {
compile("org.jetbrains.kotlin:kotlin-stdlib")
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = IdeaJasmine
group = io.pivotal.jasmine
version = 1.6
ideaVersion = IU-2018.3.4
ideaVersion = IU-2021.3.1
publishChannels = Stable
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Aug 20 09:48:12 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
51 changes: 31 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# 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
#
# https://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.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down Expand Up @@ -138,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -159,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
21 changes: 20 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class JasmineConfigurationEditor(private var project: Project) : SettingsEditor<
private var rootForm: JPanel

init {
nodeOptionsField.dialogCaption = "Node Options"
rootForm = FormBuilder()
.setAlignLabelOnRight(false)
.addLabeledComponent("Node &interpreter", nodeJsInterpreterField)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.pivotal.intellij.jasmine
import com.intellij.execution.configurations.ConfigurationFactory
import com.intellij.execution.configurations.ConfigurationTypeBase
import com.intellij.execution.configurations.ConfigurationTypeUtil
import com.intellij.execution.configurations.RunConfigurationSingletonPolicy
import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.project.Project
import icons.JSJasmineIcons
Expand All @@ -12,8 +13,7 @@ class JasmineConfigurationType : ConfigurationTypeBase("JavascriptTestRunnerJasm
addFactory(object : ConfigurationFactory(this) {
override fun getId() = type.id
override fun createTemplateConfiguration(project: Project) = JasmineRunConfiguration(project, this, "Jasmine")
override fun isConfigurationSingletonByDefault() = true
override fun canConfigurationBeSingleton() = false
override fun getSingletonPolicy() = RunConfigurationSingletonPolicy.SINGLE_INSTANCE_ONLY
})
}

Expand All @@ -25,6 +25,6 @@ class JasmineConfigurationType : ConfigurationTypeBase("JavascriptTestRunnerJasm


private object Holder {
val INSTANCE = ConfigurationTypeUtil.findConfigurationType<JasmineConfigurationType>(JasmineConfigurationType::class.java)
val INSTANCE = ConfigurationTypeUtil.findConfigurationType(JasmineConfigurationType::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.pivotal.intellij.jasmine

import com.google.common.collect.ImmutableList
import com.intellij.execution.actions.ConfigurationContext
import com.intellij.execution.configurations.ConfigurationFactory
import com.intellij.javascript.testFramework.jasmine.JasmineFileStructureBuilder
import com.intellij.javascript.testing.JsTestRunConfigurationProducer
import com.intellij.json.psi.JsonFile
Expand All @@ -16,7 +17,11 @@ import com.intellij.util.ObjectUtils
import io.pivotal.intellij.jasmine.scope.JasmineScope
import io.pivotal.intellij.jasmine.util.JasmineUtil

class JasmineRunConfigurationProducer : JsTestRunConfigurationProducer<JasmineRunConfiguration>(JasmineConfigurationType.getInstance(), ImmutableList.of("jasmine")) {
class JasmineRunConfigurationProducer : JsTestRunConfigurationProducer<JasmineRunConfiguration>(ImmutableList.of("jasmine")) {
override fun getConfigurationFactory(): ConfigurationFactory {
return JasmineConfigurationType.getInstance().configurationFactories.get(0)
}

override fun isConfigurationFromCompatibleContext(runConfig: JasmineRunConfiguration, context: ConfigurationContext): Boolean {
val element = context.psiLocation ?: return false

Expand All @@ -40,7 +45,7 @@ class JasmineRunConfigurationProducer : JsTestRunConfigurationProducer<JasmineRu
override fun setupConfigurationFromCompatibleContext(runConfig: JasmineRunConfiguration, context: ConfigurationContext, sourceElement: Ref<PsiElement>): Boolean {
val element = context.psiLocation ?: return false

if (!isTestRunnerPackageAvailableFor(element)) {
if (!isTestRunnerPackageAvailableFor(element, context)) {
return false
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<depends>JavaScript</depends>

<description><![CDATA[
Run your Jasmine 3.0 tests right from Intelli-J
Run your Jasmine 3.0+ tests right from Intelli-J
]]></description>

<change-notes><![CDATA[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class JasmineConfigIconProviderTest : LightPlatformCodeInsightFixtureTestCase()

val jasmineIcon = JasmineConfigIconProvider().getIcon(jasmineConfigFile, 0) as CachedImageIcon

assertThat(jasmineIcon.toString(), endsWith("/icons/jasmine.png"))
assertThat(jasmineIcon.originalPath.toString(), endsWith("/icons/jasmine.png"))
}

fun `test does not show jasmine icon on other files`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ class JasmineRunConfigurationProducerTest : LightPlatformCodeInsightFixtureTestC
return this.findElementAt(myFixture.caretOffset)!!
}

private fun assertConfigFromContext(config: JasmineRunConfiguration?, context: ConfigurationContext) {
private fun assertConfigFromContext(config: JasmineRunConfiguration, context: ConfigurationContext) {
assertTrue(configProducer.isConfigurationFromContext(config, context))
}

private fun assertConfigNotFromContext(config: JasmineRunConfiguration?, context: ConfigurationContext) {
private fun assertConfigNotFromContext(config: JasmineRunConfiguration, context: ConfigurationContext) {
assertFalse(configProducer.isConfigurationFromContext(config, context))
}

Expand Down
Loading

0 comments on commit 039aa5f

Please sign in to comment.