Skip to content
Permalink
Browse files

Add a generic task to get the major and minor scala version

  • Loading branch information
daniel0611 committed Nov 1, 2019
1 parent cb69ba1 commit 1ae8d78d3b4ffd900fe4ea34cd10f2d2a1b2b013
Showing with 13 additions and 6 deletions.
  1. +9 −0 build/src/main/scala/org/codeoverflow/chatoverflow/build/BuildUtils.scala
  2. +4 −6 keys.sbt
@@ -2,6 +2,8 @@ package org.codeoverflow.chatoverflow.build

import java.io.File

import sbt.{Def, Task}
import sbt.Keys.scalaVersion
import sbt.internal.util.ManagedLogger

object BuildUtils {
@@ -64,4 +66,11 @@ object BuildUtils {
else
Seq("--release", "8") // please compile against Java 8
}

/**
* A task that returns the major and minor version of the currently used version of scala, e.g. 2.12.
*/
lazy val scalaMajorVersion: Def.Initialize[Task[String]] = Def.task {
scalaVersion.value.split('.').dropRight(1).mkString(".")
}
}
@@ -27,18 +27,16 @@ lazy val gui = TaskKey[Unit]("gui", "Installs GUI dependencies and builds it usi
// Tasks

import org.codeoverflow.chatoverflow.build.GUIUtility
import org.codeoverflow.chatoverflow.build.BuildUtils.scalaMajorVersion
import org.codeoverflow.chatoverflow.build.deployment.DeploymentUtility
import org.codeoverflow.chatoverflow.build.plugins.{PluginCreateWizard, PluginUtility}

create := new PluginCreateWizard(streams.value.log).createPluginTask(pluginFolderNames.value, PluginCreateWizard.getApiVersion.value)
fetch := new PluginUtility(streams.value.log).fetchPluginsTask(pluginFolderNames.value, pluginBuildFileName.value,
pluginTargetFolderNames.value, apiProjectPath.value)
copy := new PluginUtility(streams.value.log).copyPluginsTask(pluginFolderNames.value, pluginTargetFolderNames.value,
scalaVersion.value.split('.').dropRight(1).mkString("."))
deploy := DeploymentUtility.prepareDeploymentTask(streams.value.log,
scalaVersion.value.split('.').dropRight(1).mkString("."))
deployDev := DeploymentUtility.prepareDevDeploymentTask(streams.value.log,
scalaVersion.value.split('.').dropRight(1).mkString("."), apiProjectPath.value)
copy := new PluginUtility(streams.value.log).copyPluginsTask(pluginFolderNames.value, pluginTargetFolderNames.value, scalaMajorVersion.value)
deploy := DeploymentUtility.prepareDeploymentTask(streams.value.log, scalaMajorVersion.value)
deployDev := DeploymentUtility.prepareDevDeploymentTask(streams.value.log, scalaMajorVersion.value, apiProjectPath.value)
gui := new GUIUtility(streams.value.log).guiTask(guiProjectPath.value, streams.value.cacheDirectory / "gui")


0 comments on commit 1ae8d78

Please sign in to comment.
You can’t perform that action at this time.