Skip to content

Commit

Permalink
Set hydra.log location, Fix #30
Browse files Browse the repository at this point in the history
  • Loading branch information
maris123 committed Nov 13, 2017
1 parent 9080b71 commit c3e42af
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class HydraCompilerSettings(project: Project) extends PersistentStateComponent[H

var hydraStorePath: String = getDefaultHydraStorePath

var hydraLogLocation: String = Paths.get(getDefaultHydraStorePath, "hydra.log").toString

var sourcePartitioner: String = Auto.value

override def getState: HydraCompilerSettingsState = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,23 @@ import com.intellij.openapi.project.Project
* @author Maris Alexandru
*/
object HydraCompilerSettingsManager {

private val HydraLogKey = "hydra.logFile"

def showHydraCompileSettingsDialog(project: Project): Unit = ShowSettingsUtil.getInstance().showSettingsDialog(project, "Hydra Compiler")

def getHydraLogJvmParameter(project: Project): String = {
val settings = HydraCompilerSettings.getInstance(project)
if (settings.isHydraEnabled)
s"-Dhydra.logFile=${settings.hydraLogLocation}"
else
""
}

def setHydraLogSystemProperty(project: Project): Unit = {
if (System.getProperty(HydraLogKey) == null) {
val settings = HydraCompilerSettings.getInstance(project)
System.setProperty(HydraLogKey, settings.hydraLogLocation)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class ScalaHydraCompilerConfigurationPanel(project: Project, settings: HydraComp

hydraGlobalSettings.getState

HydraCompilerSettingsManager.setHydraLogSystemProperty(project)

hydraRepository.setText(hydraGlobalSettings.getHydraRepositoryUrl)
hydraRepository.getDocument.addDocumentListener(documentAdapter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.io.{File, IOException}
import javax.swing.event.HyperlinkEvent

import com.intellij.compiler.server.BuildManager
import com.intellij.ide.plugins.{PluginManager, IdeaPluginDescriptor}
import com.intellij.ide.plugins.{IdeaPluginDescriptor, PluginManager}
import com.intellij.notification.{Notification, NotificationListener, NotificationType, Notifications}
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.ApplicationComponent
Expand All @@ -20,6 +20,7 @@ import com.intellij.util.PathUtil
import com.intellij.util.net.NetUtils
import gnu.trove.TByteArrayList
import org.jetbrains.jps.incremental.BuilderService
import org.jetbrains.plugins.hydra.compiler.HydraCompilerSettingsManager
import org.jetbrains.plugins.scala.compiler.CompileServerLauncher._
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.project.{Platform, ProjectExt}
Expand Down Expand Up @@ -109,7 +110,7 @@ class CompileServerLauncher extends ApplicationComponent {
} else Nil

val commands = jdk.executable.canonicalPath +: bootclasspathArg ++: "-cp" +: classpath +: jvmParameters ++: shutdownDelayArg ++:
ngRunnerFqn +: freePort.toString +: id.toString +: Nil
HydraCompilerSettingsManager.getHydraLogJvmParameter(project) +: ngRunnerFqn +: freePort.toString +: id.toString +: Nil

val builder = new ProcessBuilder(commands.asJava)

Expand Down

0 comments on commit c3e42af

Please sign in to comment.