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

feat: prepare 0.24.0 release #78

Merged
merged 12 commits into from
Jan 19, 2023
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

## [Unreleased]

## [0.24.0]

- Added: enable download sources
- Added: attach sources for jbang lib when syncing dependencies
- Added: NATIVE_OPTIONS support
- Fixed: support for quoted arguments in the build configuration

## [0.23.0]

- Fixed: Compatible with IntelliJ IDEA 2022.3
Expand Down
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.gradle.internal.impldep.org.junit.experimental.categories.Categories.CategoryFilter.exclude
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
Expand All @@ -11,7 +10,7 @@ plugins {
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.6.10"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij") version "1.9.0"
id("org.jetbrains.intellij") version "1.12.0"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "1.3.1"
// Gradle Qodana Plugin
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pluginGroup = dev.jbang.intellij.plugins
pluginName = jbang-idea-plugin
# SemVer format -> https://semver.org
pluginVersion = 0.23.0
pluginVersion = 0.24.0

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand All @@ -23,7 +23,7 @@ platformPlugins = com.intellij.java,org.jetbrains.kotlin,org.intellij.groovy,com
javaVersion = 11

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 7.4
gradleVersion = 7.5.1

# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 6 additions & 2 deletions src/main/kotlin/dev/jbang/idea/JBang.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ val jbangIcon = IconLoader.getIcon("icons/jbang-16x16.png", JBangCli::class.java
val jbangIcon12 = IconLoader.getIcon("icons/jbang-12x12.png", JBangCli::class.java)
val kotlinIcon = IconLoader.getIcon("icons/kotlin.svg", JBangCli::class.java)
val groovyIcon = IconLoader.getIcon("icons/groovy.svg", JBangCli::class.java)
val jshellIcon = IconLoader.getIcon("icons/jshell-16x16.png",JBangCli::class.java)
val mavenIcon = IconLoader.getIcon("icons/maven.svg",JBangCli::class.java)
val jshellIcon = IconLoader.getIcon("icons/jshell-16x16.png", JBangCli::class.java)
val mavenIcon = IconLoader.getIcon("icons/maven.svg", JBangCli::class.java)
val NOTIFICATION_GROUP_INFO = "JBang Info"
val NOTIFICATION_GROUP_SUCCESS = "JBang Success"
val NOTIFICATION_GROUP_FAILURE = "JBang Failure"
Expand All @@ -26,6 +26,8 @@ fun getJBangCmdAbsolutionPath(): String {
return if (SystemInfo.isWindows) {
if (File(System.getenv("JBANG_HOME") ?: "", "bin/jbang.cmd").exists()) {
File(System.getenv("JBANG_HOME") ?: "", "bin/jbang.cmd").absolutePath
} else if (File(userHome, ".sdkman/candidates/jbang/current/bin/jbang.cmd").exists()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not following why sdkman should get special treatment - everywhere else we check JBANG_HOME, PATH and ~/.jbang/bin

With this change users can't reliably know which jbang gets used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got. I will remove it in version 0.25.0

File(userHome, ".sdkman/candidates/jbang/current/bin/jbang.cmd").absolutePath
} else {
File(userHome, ".jbang/bin/jbang.cmd").absolutePath
}
Expand All @@ -34,6 +36,8 @@ fun getJBangCmdAbsolutionPath(): String {
File(System.getenv("JBANG_HOME") ?: "", "bin/jbang").absolutePath
} else if (File("/usr/local/bin/jbang").exists()) {
"/usr/local/bin/jbang"
} else if (File(userHome, ".sdkman/candidates/jbang/current/bin/jbang").exists()) {
File(userHome, ".sdkman/candidates/jbang/current/bin/jbang").absolutePath
} else {
File(userHome, ".jbang/bin/jbang").absolutePath
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.JavaSdk
import com.intellij.openapi.projectRoots.ProjectJdkTable
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.roots.DependencyScope
import com.intellij.openapi.roots.LanguageLevelModuleExtension
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.ModuleRootModificationUtil
Expand Down Expand Up @@ -375,7 +374,10 @@ class SyncDependenciesAction : AnAction() {
}
// add jbang dependencies
if (newDependencies.isNotEmpty()) {
ModuleRootModificationUtil.addModuleLibrary(module, libName, newDependencies.map { "jar://${it}!/" }.toList(), listOf())
ModuleRootModificationUtil.addModuleLibrary(module, libName,
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if the sources jar is not there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worry, and IDEA will ignore it if source file does not exist.

newDependencies.map { "jar://${it}!/" }.toList(),
newDependencies.map { "jar://${it}!/" }.map { it.replace(".jar", "-sources.jar") }.toList()
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ abstract class JBangBaseDirectiveCompletionContributor(language: Language) : Com
"REPOS" to "Which repositories to use",
"JAVAC_OPTIONS" to "Options passed to javac",
"JAVA_OPTIONS" to "Options passed to java",
"NATIVE_OPTIONS" to "Options passed to native-image",
"JAVAAGENT" to "Activate agent packaging",
"CDS" to "Activate Class Data Sharing"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void testCompletionInJava() {
myFixture.complete(CompletionType.BASIC);
List<String> lookupElementStrings = myFixture.getLookupElementStrings();
assertNotNull(lookupElementStrings);
assertSameElements(lookupElementStrings, "CDS ", "DEPS ", "DESCRIPTION ","FILES ", "GAV ", "JAVA ", "JAVA_OPTIONS ", "JAVAAGENT ", "JAVAC_OPTIONS ", "MANIFEST ", "REPOS ", "SOURCES ");
assertSameElements(lookupElementStrings, "CDS ", "DEPS ", "DESCRIPTION ","FILES ", "GAV ", "JAVA ", "JAVA_OPTIONS ", "JAVAAGENT ", "JAVAC_OPTIONS ", "MANIFEST ", "NATIVE_OPTIONS ", "REPOS ", "SOURCES ");
}

// @Test disabled unttil can figure out why kotlin and groovy are not activated intests
Expand Down