Skip to content

Commit

Permalink
#1835 Extracted java-dependent code to a separate module with optiona…
Browse files Browse the repository at this point in the history
…l java dependency
  • Loading branch information
hurricup committed Nov 9, 2024
1 parent 6d1555a commit 8e87898
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 26 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ intellijPlatform {
dependencies {
listOf(
":core",
":java",
).forEach {
compileOnly(project(it))
testCompileOnly(project(it))
Expand Down
24 changes: 0 additions & 24 deletions core/src/main/java/org/ice1000/julia/lang/module/julia-modules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,3 @@ class JuliaModuleType : ModuleType<JuliaModuleBuilder>(JULIA_MODULE_ID) {
}
}

/**
* Module Configure
* Inspired by Haskell plugin
* @author: zxj5470
* @date: 2018/1/29
*/
class JuliaModuleConfigEditor : ModuleConfigurationEditorProvider {
override fun createEditors(state: ModuleConfigurationState): Array<ModuleConfigurationEditor> {
val module = state.rootModel?.module ?: return emptyArray()
return arrayOf(ContentEntriesEditor(module.name, state),
JuliaCompileOutputEditor(state))
}
}

class JuliaCompileOutputEditor(state: ModuleConfigurationState) : ModuleElementsEditor(state) {
var editor: BuildElementsEditor = object : BuildElementsEditor(state) {
}

override fun createComponentImpl() = editor.createComponentImpl()
override fun saveData() = editor.saveData()
override fun getDisplayName() = "Paths"
override fun getHelpTopic() = editor.helpTopic
}

27 changes: 27 additions & 0 deletions java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.grammarkit.tasks.GenerateLexerTask
import org.jetbrains.grammarkit.tasks.GenerateParserTask
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.kt3k.gradle.plugin.coveralls.CoverallsTask
import java.nio.file.Paths

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)

dependencies{
listOf(
":core",
).forEach {
compileOnly(project(it))
testCompileOnly(project(it))
runtimeOnly(project(it))
}
intellijPlatform{
val platformVersionProvider: Provider<String> by rootProject.extra
create("IC", platformVersionProvider.get(), useInstaller = properties("useInstaller").get().toBoolean())
bundledPlugins("com.intellij.java")
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Julia language support plugin for Intellij-based IDEs.
* Copyright (C) 2024 julia-intellij contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.ice1000.julia.java.ui.configuration

import com.intellij.openapi.roots.ui.configuration.BuildElementsEditor
import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState
import com.intellij.openapi.roots.ui.configuration.ModuleElementsEditor

class JuliaCompileOutputEditor(state: ModuleConfigurationState) : ModuleElementsEditor(state) {
var editor: BuildElementsEditor = object : BuildElementsEditor(state) {
}

override fun createComponentImpl() = editor.createComponentImpl()
override fun saveData() = editor.saveData()
override fun getDisplayName() = "Paths"
override fun getHelpTopic() = editor.helpTopic
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Julia language support plugin for Intellij-based IDEs.
* Copyright (C) 2024 julia-intellij contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.ice1000.julia.java.ui.configuration

import com.intellij.openapi.module.ModuleConfigurationEditor
import com.intellij.openapi.roots.ui.configuration.ContentEntriesEditor
import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationEditorProvider
import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState

class JuliaModuleConfigEditorProvider : ModuleConfigurationEditorProvider {
override fun createEditors(state: ModuleConfigurationState): Array<ModuleConfigurationEditor> {
val module = state.currentRootModel?.module ?: return emptyArray()
return arrayOf(ContentEntriesEditor(module.name, state),
JuliaCompileOutputEditor(state))
}
}
8 changes: 8 additions & 0 deletions java/src/main/resources/org.ice1000.julia.java.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<idea-plugin package="org.ice1000.julia.java">
<dependencies>
<plugin id="com.intellij.modules.java"/>
</dependencies>
<extensions defaultExtensionNs="com.intellij">
<moduleConfigurationEditorProvider implementation="org.ice1000.julia.java.ui.configuration.JuliaModuleConfigEditorProvider"/>
</extensions>
</idea-plugin>
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ pluginManagement {
rootProject.name = "julia-intellij"
include("core")
project(":core").projectDir = file("core")
include("java")
project(":java").projectDir = file("java")
8 changes: 6 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<idea-plugin>
<id>"org.ice1000.julia</id>
<idea-plugin url="https://github.com/JuliaEditorSupport/julia-intellij/">
<id>org.ice1000.julia</id>
<name>Julia</name>
<vendor email="[email protected]" url="https://github.com/hurricup">Alexandr Evstigneev</vendor>
<category>Custom Languages</category>
Expand All @@ -10,6 +10,10 @@
<depends optional="true" config-file="plugin-goland.xml">com.intellij.modules.go</depends>
<depends optional="true" config-file="plugin-idea.xml">com.intellij.modules.idea</depends>

<content>
<module name="org.ice1000.julia.java"/>
</content>

<extensions defaultExtensionNs="com.intellij">
<liveTemplateContext implementation="org.ice1000.julia.lang.editing.JuliaTemplateContextType$Base"/>
<liveTemplateContext implementation="org.ice1000.julia.lang.editing.JuliaTemplateContextType$Module"/>
Expand Down

0 comments on commit 8e87898

Please sign in to comment.