Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 0476593

Browse files
committed
Also split and clean sbt files in plugin dev environment
codeoverflow-org/chatoverflow#124 codeoverflow-org/chatoverflow@93ddc3f has done this for the main repo
1 parent 9ad183d commit 0476593

File tree

2 files changed

+44
-46
lines changed

2 files changed

+44
-46
lines changed

deployment-files/plugin-dev/build.sbt

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,14 @@
11
// This is a stripped down version of the build.sbt found in the main framework.
2-
// Its almost like the one from the framework but without some sbt tasks like 'deploy' that aren't needed for plugin developers
3-
// and without dependencies, because those get their own generated file.
4-
5-
// ---------------------------------------------------------------------------------------------------------------------
6-
// PROJECT INFORMATION
7-
// ---------------------------------------------------------------------------------------------------------------------
2+
// Its almost like the one from the framework but without some sbt tasks like 'deploy' that aren't needed for plugin developers.
83

4+
// Main project config
95
name := "ChatOverflow"
106
version := "3.0.0"
117

12-
// This task has to be overwritten, because sbt will only look in source files for main classes, but the class is in a jar.
13-
Compile / discoveredMainClasses := Seq("org.codeoverflow.chatoverflow.Launcher")
14-
15-
// One version for all sub projects. Use "retrieveManaged := true" to download and show all library dependencies.
16-
val scalaMajorVersion = "2.12"
17-
val scalaMinorVersion = ".5"
18-
inThisBuild(List(
19-
scalaVersion := s"$scalaMajorVersion$scalaMinorVersion",
20-
retrieveManaged := false)
21-
)
22-
23-
unmanagedBase := file("bin")
24-
25-
// ---------------------------------------------------------------------------------------------------------------------
26-
// PLUGIN FRAMEWORK DEFINITIONS
27-
// ---------------------------------------------------------------------------------------------------------------------
28-
29-
// Plugin framework settings
30-
lazy val pluginBuildFileName = settingKey[String]("The filename of the plugin build file. Remember to gitignore it!")
31-
lazy val pluginFolderNames = settingKey[List[String]]("The folder names of all plugin source directories.")
32-
lazy val pluginTargetFolderNames = settingKey[List[String]]("The folder names of compiled and packaged plugins. Remember to gitignore these!")
33-
lazy val apiProjectPath = settingKey[String]("The path to the api sub project. Remember to gitignore it!")
34-
35-
// Plugin framework tasks
36-
lazy val create = TaskKey[Unit]("create", "Creates a new plugin. Interactive command using the console.")
37-
lazy val fetch = TaskKey[Unit]("fetch", "Searches for plugins in plugin directories, builds the plugin build file.")
38-
lazy val copy = TaskKey[Unit]("copy", "Copies all packaged plugin jars to the target plugin folder.")
39-
40-
pluginBuildFileName := "plugins.sbt"
41-
pluginFolderNames := List("plugins-public", "plugins-private")
42-
pluginTargetFolderNames := List("plugins", s"target/scala-$scalaMajorVersion/plugins")
43-
apiProjectPath := "api"
44-
45-
46-
import org.codeoverflow.chatoverflow.build.plugins.{PluginCreateWizard, PluginUtility}
8+
// Main class and sub projects
9+
mainClass := Some("org.codeoverflow.chatoverflow.Launcher")
4710

48-
create := new PluginCreateWizard(streams.value.log).createPluginTask(pluginFolderNames.value, PluginCreateWizard.getApiVersion.value)
49-
fetch := new PluginUtility(streams.value.log).fetchPluginsTask(pluginFolderNames.value, pluginBuildFileName.value,
50-
pluginTargetFolderNames.value, apiProjectPath.value)
51-
copy := new PluginUtility(streams.value.log).copyPluginsTask(pluginFolderNames.value, pluginTargetFolderNames.value, scalaMajorVersion)
11+
// Settings
12+
inThisBuild(List(scalaVersion := "2.12.5"))
5213

53-
packageBin / includePom := false
5414
fork in run := true // Start ChatOverflow in it's own java process when starting it with 'sbt run'

deployment-files/plugin-dev/keys.sbt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// This is a stripped down version of the keys.sbt found in the main framework.
2+
// Its almost like the one from the framework but without some tasks like 'deploy' or 'gui' that aren't used by plugin developers.
3+
4+
// ONLY these two assignments is unique to the plugin dev environment:
5+
// This task has to be overwritten, because sbt will only look in source files for main classes, but the class is in a jar.
6+
Compile / discoveredMainClasses := Seq("org.codeoverflow.chatoverflow.Launcher")
7+
unmanagedBase := file("bin")
8+
9+
// Settings
10+
pluginBuildFileName := "plugins.sbt"
11+
pluginFolderNames := List("plugins-public", "plugins-private")
12+
pluginTargetFolderNames := List("plugins", s"target/scala-${scalaVersion.value.split('.').dropRight(1).mkString(".")}/plugins")
13+
apiProjectPath := "api"
14+
15+
16+
17+
// Plugin framework setting keys
18+
lazy val pluginBuildFileName = settingKey[String]("The filename of the plugin build file. Remember to gitignore it!")
19+
lazy val pluginFolderNames = settingKey[List[String]]("The folder names of all plugin source directories. Remember to gitignore it!")
20+
lazy val pluginTargetFolderNames = settingKey[List[String]]("The folder names of compiled and packaged plugins. Remember to gitignore these!")
21+
lazy val apiProjectPath = settingKey[String]("The path to the api sub project. Remember to gitignore it!")
22+
23+
// Plugin framework task keys
24+
lazy val create = TaskKey[Unit]("create", "Creates a new plugin. Interactive command using the console.")
25+
lazy val fetch = TaskKey[Unit]("fetch", "Searches for plugins in plugin directories, builds the plugin build file.")
26+
lazy val copy = TaskKey[Unit]("copy", "Copies all packaged plugin jars to the target plugin folder.")
27+
28+
29+
30+
// Tasks
31+
32+
import org.codeoverflow.chatoverflow.build.plugins.{PluginCreateWizard, PluginUtility}
33+
34+
create := new PluginCreateWizard(streams.value.log).createPluginTask(pluginFolderNames.value, PluginCreateWizard.getApiVersion.value)
35+
fetch := new PluginUtility(streams.value.log).fetchPluginsTask(pluginFolderNames.value, pluginBuildFileName.value,
36+
pluginTargetFolderNames.value, apiProjectPath.value)
37+
copy := new PluginUtility(streams.value.log).copyPluginsTask(pluginFolderNames.value, pluginTargetFolderNames.value,
38+
scalaVersion.value.split('.').dropRight(1).mkString("."))

0 commit comments

Comments
 (0)