From 0978543ccf89d3f243cdc6125f1644ffbf35afac Mon Sep 17 00:00:00 2001 From: Maris Date: Wed, 25 Oct 2017 19:54:26 +0300 Subject: [PATCH] Artifacts repository is configurable and changed default hydra version to latest. Fix #6 Fix #18 --- .../scala/data/CompilationData.scala | 5 ++- .../plugins/hydra/HydraVersions.scala | 12 +++--- .../compiler/HydraCompilerConfigurable.scala | 8 +++- .../HydraCompilerConfigurationPanel.form | 32 ++++++++++++++++ .../HydraCompilerConfigurationPanel.java | 12 ++++++ .../compiler/HydraCompilerSettings.scala | 5 ++- ...ScalaHydraCompilerConfigurationPanel.scala | 37 +++++++++++++++++-- .../settings/HydraApplicationSettings.scala | 18 +++++++++ .../plugins/scala/project/Versions.scala | 10 +++-- .../scala/project/template/Downloader.scala | 20 ++++++---- 10 files changed, 134 insertions(+), 25 deletions(-) diff --git a/scala/compiler-jps/src/org/jetbrains/jps/incremental/scala/data/CompilationData.scala b/scala/compiler-jps/src/org/jetbrains/jps/incremental/scala/data/CompilationData.scala index 846b86d3125..8e3c45a6f5d 100644 --- a/scala/compiler-jps/src/org/jetbrains/jps/incremental/scala/data/CompilationData.scala +++ b/scala/compiler-jps/src/org/jetbrains/jps/incremental/scala/data/CompilationData.scala @@ -82,12 +82,13 @@ object CompilationData { val hydraSettings = SettingsManager.getHydraSettings(context.getProjectDescriptor.getProject) val hydraGlobalSettings = SettingsManager.getGlobalHydraSettings(context.getProjectDescriptor.getModel.getGlobal) val scalaVersion = CompilerData.compilerVersion(module) + val hydraConfigFolder = if (target.isTests) "test" else "main" val hydraOptions = if (hydraSettings.isHydraEnabled && scalaVersion.nonEmpty && hydraGlobalSettings.containsArtifactsFor(scalaVersion.get, hydraSettings.getHydraVersion)) Seq("-sourcepath", outputGroups.map(_._1).mkString(File.pathSeparator), "-cpus", hydraSettings.getNumberOfCores, - "-YsourcePartitioner:" + hydraSettings.getSourcePartitioner, "-YhydraStore", hydraSettings.getHydraStorePath, + "-YsourcePartitioner:" + hydraSettings.getSourcePartitioner, "-YhydraStore", Paths.get(hydraSettings.getHydraStorePath, module.getName, hydraConfigFolder).toString, "-YpartitionFile", Paths.get(hydraSettings.getHydraStorePath, module.getName).toString, "-YrootDirectory", hydraSettings.getProjectRoot, - "-YtimingsFile", Paths.get(hydraSettings.getHydraStorePath, "timings.csv").toString, "-YhydraTag", module.getName) + "-YtimingsFile", Paths.get(hydraSettings.getHydraStorePath, "timings.csv").toString, "-YhydraTag", s"${module.getName}/${hydraConfigFolder}") else Seq.empty Log.debug("Hydra options: " + hydraOptions.mkString(" ")) diff --git a/scala/scala-impl/src/org/jetbrains/plugins/hydra/HydraVersions.scala b/scala/scala-impl/src/org/jetbrains/plugins/hydra/HydraVersions.scala index 896209d47f4..a2db0616037 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/hydra/HydraVersions.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/hydra/HydraVersions.scala @@ -12,9 +12,9 @@ import scala.collection.breakOut */ object HydraVersions { - private val MinHydraVersion = "2.11.8" - private val UnsupportedHydraVersion = "2.12.0" - private val compilerRegex = """.*scala-compiler-(\d+\.\d+\.\d+)(-SNAPSHOT)?\.jar""".r + private val MinScalaVersion = "2.11.8" + private val UnsupportedScalaVersion = "2.12.0" + private val CompilerRegex = """.*scala-compiler-(\d+\.\d+\.\d+)(-SNAPSHOT)?\.jar""".r private final val Log: Logger = Logger.getInstance(this.getClass.getName) @@ -26,11 +26,11 @@ object HydraVersions { val scalaVersionsPerModule: Map[ScalaModule, String] = (for { module <- scalaModules classpathFile <- module.sdk.compilerClasspath - mtch <- compilerRegex.findFirstMatchIn(classpathFile.getName) + mtch <- CompilerRegex.findFirstMatchIn(classpathFile.getName) scalaVersion = mtch.group(1) - if scalaVersion != UnsupportedHydraVersion + if scalaVersion != UnsupportedScalaVersion version = Version(scalaVersion) - if version >= Version(MinHydraVersion) + if version >= Version(MinScalaVersion) } yield module -> version.presentation)(breakOut) if (scalaModules.size != scalaVersionsPerModule.size) { diff --git a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurable.scala b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurable.scala index 1991e9cf618..fb199b214d7 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurable.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurable.scala @@ -24,7 +24,9 @@ class HydraCompilerConfigurable (project: Project) extends AbstractConfigurable( form.selectedVersion != settings.hydraVersion || form.selectedNoOfCores != settings.noOfCores || form.selectedSourcePartitioner != settings.sourcePartitioner || - form.getHydraStoreDirectory != settings.hydraStorePath + form.getHydraStoreDirectory != settings.hydraStorePath || + form.getHydraRepository != hydraGlobalSettings.hydraRepositoryUrl || + form.getHydraRepositoryRealm != hydraGlobalSettings.hydraRepositoryRealm override def reset() { form.setUsername(HydraCredentialsManager.getLogin) @@ -34,6 +36,8 @@ class HydraCompilerConfigurable (project: Project) extends AbstractConfigurable( form.setSelectedVersion(settings.hydraVersion) form.setSelectedSourcePartitioner(settings.sourcePartitioner) form.setHydraStoreDirectory(settings.hydraStorePath) + form.setHydraRepository(hydraGlobalSettings.hydraRepositoryUrl) + form.setHydraRepositoryRealm(hydraGlobalSettings.hydraRepositoryRealm) } override def apply() { @@ -43,6 +47,8 @@ class HydraCompilerConfigurable (project: Project) extends AbstractConfigurable( settings.noOfCores = form.selectedNoOfCores settings.sourcePartitioner = form.selectedSourcePartitioner settings.hydraStorePath = form.getHydraStoreDirectory + hydraGlobalSettings.hydraRepositoryUrl = form.getHydraRepository + hydraGlobalSettings.hydraRepositoryRealm = form.getHydraRepositoryRealm HydraCredentialsManager.setCredentials(form.getUsername, form.getPassword) EditorNotifications.updateAll() } diff --git a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurationPanel.form b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurationPanel.form index 27122df17ff..ab392843975 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurationPanel.form +++ b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurationPanel.form @@ -140,6 +140,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurationPanel.java b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurationPanel.java index e925cf1c71a..dbcc350a9aa 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurationPanel.java +++ b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerConfigurationPanel.java @@ -24,6 +24,8 @@ public class HydraCompilerConfigurationPanel { protected SComboBox noOfCoresComboBox; protected SComboBox sourcePartitionerComboBox; protected TextFieldWithBrowseButton hydraStoreDirectoryField; + protected JTextField hydraRepository; + protected JTextField realmTextField; public HydraCompilerConfigurationPanel() { @@ -169,6 +171,16 @@ private void createUIComponents() { panel1.add(label6, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); hydraStoreDirectoryField = new TextFieldWithBrowseButton(); panel1.add(hydraStoreDirectoryField, new GridConstraints(6, 2, 1, 4, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label7 = new JLabel(); + label7.setText("Hydra Repository"); + panel1.add(label7, new GridConstraints(3, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + hydraRepository = new JTextField(); + panel1.add(hydraRepository, new GridConstraints(3, 4, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label8 = new JLabel(); + label8.setText("Repository Realm"); + panel1.add(label8, new GridConstraints(4, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + realmTextField = new JTextField(); + panel1.add(realmTextField, new GridConstraints(4, 4, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); } /** diff --git a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerSettings.scala b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerSettings.scala index 18fed1e658e..a9c0690287c 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerSettings.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/HydraCompilerSettings.scala @@ -1,6 +1,7 @@ package org.jetbrains.plugins.hydra.compiler import java.io.File +import java.nio.file.Paths import com.intellij.openapi.components._ import com.intellij.openapi.project.Project @@ -23,7 +24,7 @@ class HydraCompilerSettings(project: Project) extends PersistentStateComponent[H var isHydraSettingsEnabled: Boolean = false - var hydraVersion: String = "0.9.5" + var hydraVersion: String = "" var noOfCores: String = Math.ceil(Runtime.getRuntime.availableProcessors()/2D).toInt.toString @@ -52,7 +53,7 @@ class HydraCompilerSettings(project: Project) extends PersistentStateComponent[H isHydraSettingsEnabled = state.isHydraSettingsEnabled } - def getDefaultHydraStorePath: String = ProjectRoot + File.separator + ".hydra" + def getDefaultHydraStorePath: String = Paths.get(ProjectRoot, ".hydra", "idea").toString private def getProjectRootPath: String = project.getBaseDir.getPresentableUrl } diff --git a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/ScalaHydraCompilerConfigurationPanel.scala b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/ScalaHydraCompilerConfigurationPanel.scala index a15c29846dc..9ffc666fc53 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/ScalaHydraCompilerConfigurationPanel.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/hydra/compiler/ScalaHydraCompilerConfigurationPanel.scala @@ -22,25 +22,43 @@ class ScalaHydraCompilerConfigurationPanel(project: Project, settings: HydraComp private val fileChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false) private val documentAdapter = new DocumentAdapter { - override def textChanged(documentEvent: DocumentEvent): Unit = downloadButton.setEnabled(getUsername.nonEmpty && getPassword.nonEmpty) + override def textChanged(documentEvent: DocumentEvent): Unit = + downloadButton.setEnabled(getUsername.nonEmpty && getPassword.nonEmpty && getHydraRepository.nonEmpty) } private val focusListener = new FocusListener { override def focusGained(e: FocusEvent): Unit = {} override def focusLost(e: FocusEvent): Unit = if (getUsername.nonEmpty && getPassword.nonEmpty && - (HydraCredentialsManager.getLogin != getUsername || HydraCredentialsManager.getPlainPassword != getPassword)) { + (HydraCredentialsManager.getLogin != getUsername || + HydraCredentialsManager.getPlainPassword != getPassword || + hydraGlobalSettings.hydraRepositoryUrl != getHydraRepository || + hydraGlobalSettings.hydraRepositoryRealm != getHydraRepositoryRealm)) { + HydraCredentialsManager.setCredentials(getUsername, getPassword) + hydraGlobalSettings.hydraRepositoryUrl = getHydraRepository hydraVersionComboBox.setItems(HydraVersions.downloadHydraVersions) + hydraVersionComboBox.setSelectedItem(settings.hydraVersion) } } hydraGlobalSettings.getState + setDefaultHydraVersion + + hydraRepository.setText(hydraGlobalSettings.hydraRepositoryUrl) + hydraRepository.addFocusListener(focusListener) + hydraRepository.getDocument.addDocumentListener(documentAdapter) + + realmTextField.setText(hydraGlobalSettings.hydraRepositoryRealm) + realmTextField.addFocusListener(focusListener) + realmTextField.getDocument.addDocumentListener(documentAdapter) + userTextField.addFocusListener(focusListener) userTextField.getDocument.addDocumentListener(documentAdapter) + passwordTextField.getDocument.addDocumentListener(documentAdapter) passwordTextField.addFocusListener(focusListener) - hydraVersionComboBox.setItems(HydraVersions.downloadHydraVersions) + downloadButton.addActionListener((_: ActionEvent) => onDownload()) noOfCoresComboBox.setItems(Array.range(1, Runtime.getRuntime.availableProcessors() + 1).map(_.toString).sortWith(_ > _)) sourcePartitionerComboBox.setItems(SourcePartitioner.values.map(_.value).toArray) @@ -71,6 +89,14 @@ class ScalaHydraCompilerConfigurationPanel(project: Project, settings: HydraComp def setHydraStoreDirectory(path: String): Unit = hydraStoreDirectoryField.setText(path) + def getHydraRepository: String = hydraRepository.getText + + def setHydraRepository(repositoryUrl: String): Unit = hydraRepository.setText(repositoryUrl) + + def getHydraRepositoryRealm: String = realmTextField.getText + + def setHydraRepositoryRealm(realm: String): Unit = realmTextField.setText(realm) + def onDownload(): Unit = { val scalaVersions = HydraVersions.getSupportedScalaVersions(project) @@ -103,4 +129,9 @@ class ScalaHydraCompilerConfigurationPanel(project: Project, settings: HydraComp private def downloadVersion(scalaVersions: Seq[String], hydraVersion: String): (String => Unit) => Unit = (listener: (String) => Unit) => scalaVersions.foreach(version => HydraArtifactsCache.downloadIfNotPresent(version, hydraVersion, listener)) + private def setDefaultHydraVersion = { + val hydraVersions = HydraVersions.downloadHydraVersions + hydraVersionComboBox.setItems(hydraVersions) + setSelectedVersion(hydraVersions.head) + } } diff --git a/scala/scala-impl/src/org/jetbrains/plugins/hydra/settings/HydraApplicationSettings.scala b/scala/scala-impl/src/org/jetbrains/plugins/hydra/settings/HydraApplicationSettings.scala index 27adacc3ae7..30d0bbfd03a 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/hydra/settings/HydraApplicationSettings.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/hydra/settings/HydraApplicationSettings.scala @@ -1,6 +1,7 @@ package org.jetbrains.plugins.hydra.settings import java.io.File +import java.net.URL import java.util import com.intellij.openapi.components._ @@ -18,11 +19,14 @@ import scala.collection.JavaConverters._ class HydraApplicationSettings extends PersistentStateComponent[HydraApplicationSettingsState]{ var artifactPaths: Map[(String, String), List[String]] = Map.empty + var hydraRepositoryUrl: String = HydraApplicationSettings.DefaultHydraRepositoryUrl + var hydraRepositoryRealm: String = HydraApplicationSettings.DefaultHydraRepositoryRealm private val KeySeparator = "_" override def loadState(state: HydraApplicationSettingsState): Unit = { state.removeMapEntriesThatDontExist() artifactPaths = convertArtifactsFromStateToSettings(state.getGlobalArtifactPaths) + hydraRepositoryUrl = state.getHydraRepositoryUrl } override def getState: HydraApplicationSettingsState = { @@ -30,6 +34,7 @@ class HydraApplicationSettings extends PersistentStateComponent[HydraApplication val artifacts = artifactPaths map { case((scalaVer, hydraVer), value) => (scalaVer + KeySeparator + hydraVer, value.asJava)} state.setGlobalArtifactPaths(artifacts.asJava) state.removeMapEntriesThatDontExist() + state.setHydraRepositoryUrl(hydraRepositoryUrl) artifactPaths = convertArtifactsFromStateToSettings(state.getGlobalArtifactPaths) state } @@ -42,6 +47,10 @@ class HydraApplicationSettings extends PersistentStateComponent[HydraApplication for { (scalaVersion, _) <- artifactPaths.keySet.toArray } yield scalaVersion } + def getHydraRepositoryName: String = new URL(HydraApplicationSettings.getInstance().hydraRepositoryUrl).getHost + + def getHydraRepositoryUrl: String = if(hydraRepositoryUrl.endsWith("/")) hydraRepositoryUrl.dropRight(1) else hydraRepositoryUrl + private def convertArtifactsFromStateToSettings(artifacts: java.util.Map[String, java.util.List[String]]) = { val resultArtifacts = for { (key, value) <- artifacts.asScala @@ -57,6 +66,12 @@ class HydraApplicationSettingsState { @BeanProperty var globalArtifactPaths: java.util.Map[String, java.util.List[String]] = new java.util.HashMap() + @BeanProperty + var hydraRepositoryUrl: String = HydraApplicationSettings.DefaultHydraRepositoryUrl + + @BeanProperty + var hydraRepositoryRealm: String = HydraApplicationSettings.DefaultHydraRepositoryRealm + def removeMapEntriesThatDontExist(): Unit = { globalArtifactPaths = globalArtifactPaths.asScala.filter(entry => checkIfArtifactsExist(entry._2)).asJava } @@ -67,5 +82,8 @@ class HydraApplicationSettingsState { } object HydraApplicationSettings { + val DefaultHydraRepositoryName = "repo.triplequote.com" + val DefaultHydraRepositoryUrl = s"https://$DefaultHydraRepositoryName/artifactory" + val DefaultHydraRepositoryRealm = "Artifactory Realm" def getInstance(): HydraApplicationSettings = ServiceManager.getService(classOf[HydraApplicationSettings]) } \ No newline at end of file diff --git a/scala/scala-impl/src/org/jetbrains/plugins/scala/project/Versions.scala b/scala/scala-impl/src/org/jetbrains/plugins/scala/project/Versions.scala index fca40296d90..98e6d1694d2 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/scala/project/Versions.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/scala/project/Versions.scala @@ -2,6 +2,7 @@ package org.jetbrains.plugins.scala.project import com.intellij.util.net.HttpConfigurable import org.jetbrains.plugins.hydra.compiler.HydraCredentialsManager +import org.jetbrains.plugins.hydra.settings.HydraApplicationSettings import org.jetbrains.plugins.scala.buildinfo.BuildInfo import org.jetbrains.plugins.scala.project.Platform.{Dotty, Scala} @@ -55,7 +56,7 @@ object Versions { private def loadLinesFrom(url: String): Try[Seq[String]] = { Try(HttpConfigurable.getInstance().openHttpConnection(url)).map { connection => try { - if(url.contains(Entity.Hydra.url)) + if(url.contains(HydraApplicationSettings.getInstance().getHydraRepositoryUrl)) connection.setRequestProperty("Authorization", "Basic " + HydraCredentialsManager.getBasicAuthEncoding()) Source.fromInputStream(connection.getInputStream).getLines().toVector } finally { @@ -66,15 +67,16 @@ object Versions { private def loadVersionsForHydra() = { val entity = Entity.Hydra + val repoUrl = HydraApplicationSettings.getInstance().getHydraRepositoryUrl + entity.url def downloadHydraVersions(url: String): Seq[String] = loadVersionsFrom(url, { case entity.pattern(number) => number }).getOrElse(entity.hardcodedVersions).map(Version(_)) .filter(_ >= entity.minVersion).map(_.presentation) - loadVersionsFrom(entity.url, { + loadVersionsFrom(repoUrl, { case entity.pattern(number) => number }).map { versions => - versions.flatMap(version => downloadHydraVersions(s"""${entity.url}$version/""")).distinct + versions.flatMap(version => downloadHydraVersions(s"""$repoUrl$version/""")).distinct } } @@ -103,7 +105,7 @@ object Versions { Version("0.2.0"), Seq("0.2.0-RC1")) - val Hydra = Entity("https://repo.triplequote.com/artifactory/ivy-releases/com.triplequote/", + val Hydra = Entity("/ivy-releases/com.triplequote/", ".+>(.*\\d+\\.\\d+\\.\\d+.*)/<.*".r, Version("0.9.5"), Seq("0.9.5") diff --git a/scala/scala-impl/src/org/jetbrains/plugins/scala/project/template/Downloader.scala b/scala/scala-impl/src/org/jetbrains/plugins/scala/project/template/Downloader.scala index cca912e79e0..715c5ab5734 100644 --- a/scala/scala-impl/src/org/jetbrains/plugins/scala/project/template/Downloader.scala +++ b/scala/scala-impl/src/org/jetbrains/plugins/scala/project/template/Downloader.scala @@ -5,6 +5,7 @@ import java.io.{File, FileNotFoundException} import com.intellij.execution.process.{OSProcessHandler, ProcessAdapter, ProcessEvent} import com.intellij.openapi.util.Key import org.jetbrains.plugins.hydra.compiler.HydraCredentialsManager +import org.jetbrains.plugins.hydra.settings.HydraApplicationSettings import org.jetbrains.plugins.scala.project.Platform /** @@ -71,13 +72,18 @@ object Downloader { "updateClassifiers") } - private def sbtCommandsForHydra(platform: Platform, version: String) = Seq( - s"""set scalaVersion := "${version.split("_")(0)}"""", - s"""set credentials := Seq(Credentials("Artifactory Realm", "repo.triplequote.com", "${HydraCredentialsManager.getLogin}", "${HydraCredentialsManager.getPlainPassword}"))""", - s"""set resolvers := Seq(Resolver.url("Triplequote Plugins Ivy Releases", url("https://repo.triplequote.com/artifactory/ivy-releases/"))(Resolver.ivyStylePatterns), Resolver.url("Triplequote sbt-plugin-relseases", url("https://repo.triplequote.com/artifactory/sbt-plugins-release/"))(Resolver.ivyStylePatterns), "Triplequote Plugins Releases" at "https://repo.triplequote.com/artifactory/libs-release-local/")""", - s"""set libraryDependencies := Seq("com.triplequote" % "hydra_${version.split("_")(0)}" % "${version.split("_")(1)}", ("com.triplequote" % "hydra-bridge_1_0" % "${version.split("_")(1)}").sources())""", - "updateClassifiers", - "show dependencyClasspath") + private def sbtCommandsForHydra(platform: Platform, version: String) = { + val settings = HydraApplicationSettings.getInstance() + val repositoryName = settings.getHydraRepositoryName + val repositoryUrl = settings.getHydraRepositoryUrl + Seq( + s"""set scalaVersion := "${version.split("_")(0)}"""", + s"""set credentials := Seq(Credentials("${settings.hydraRepositoryRealm}", "${repositoryName}", "${HydraCredentialsManager.getLogin}", "${HydraCredentialsManager.getPlainPassword}"))""", + s"""set resolvers := Seq(Resolver.url("Triplequote Plugins Ivy Releases", url("${repositoryUrl}/ivy-releases/"))(Resolver.ivyStylePatterns), Resolver.url("Triplequote sbt-plugin-relseases", url("${repositoryUrl}/sbt-plugins-release/"))(Resolver.ivyStylePatterns), "Triplequote Plugins Releases" at "${repositoryUrl}/libs-release-local/")""", + s"""set libraryDependencies := Seq("com.triplequote" % "hydra_${version.split("_")(0)}" % "${version.split("_")(1)}", ("com.triplequote" % "hydra-bridge_1_0" % "${version.split("_")(1)}").sources())""", + "updateClassifiers", + "show dependencyClasspath") + } } class DownloadException(message: String) extends Exception(message) \ No newline at end of file