1- // ---------------------------------------------------------------------------------------------------------------------
2- // PROJECT INFORMATION
3- // ---------------------------------------------------------------------------------------------------------------------
4-
5- /*
6- * A brief introduction of the sbt related folder structure:
7- * root
8- * | build.sbt
9- * | plugins.sbt (produced by the fetch task)
10- * | -> api project (required to build plugins and the framework)
11- * | -> a plugin source directory
12- * | -> -> a plugin folder = plugin
13- * | -> -> -> build.sbt
14- * | -> -> -> source etc.
15- * | -> -> another folder = another plugin
16- * | -> -> -> build.sbt
17- * | -> -> -> source etc.
18- * | -> another plugin source directory (optional)
19- * | -> gui project (build will be skipped, if missing)
20- * | -> bootstrap launcher (for end-user deployments)
21- * | -> build project (contains code for all sbt tasks and sbt related things)
22- */
23-
1+ // Main project config
242name := " ChatOverflow"
253version := " 3.0.0"
26- mainClass := Some (" org.codeoverflow.chatoverflow.Launcher" )
27-
28- // One version for all sub projects. Use "retrieveManaged := true" to download and show all library dependencies.
29- val scalaMajorVersion = " 2.12"
30- val scalaMinorVersion = " .5"
31- inThisBuild(List (
32- scalaVersion := s " $scalaMajorVersion$scalaMinorVersion" ,
33- retrieveManaged := false )
34- )
354
36- import org .codeoverflow .chatoverflow .build .BuildUtils
37- javacOptions ++= BuildUtils .getJava8CrossOptions
38-
39- // Link the launcher
5+ // Main class and sub projects
6+ mainClass := Some (" org.codeoverflow.chatoverflow.Launcher" )
407lazy val launcherProject = project in file(" launcher" )
8+ lazy val buildProject = project in file(" build" ) // needed for intelliJ support
419
42- // not actually used. Just required to say IntelliJ to mark the build directory as a sbt project, otherwise it wouldn't detect it.
43- lazy val buildProject = project in file(" build" )
44-
45- // ---------------------------------------------------------------------------------------------------------------------
46- // LIBRARY DEPENDENCIES
47- // ---------------------------------------------------------------------------------------------------------------------
48-
49- // Command Line Parsing
50- libraryDependencies += " com.github.scopt" %% " scopt" % " 3.5.0"
51-
52- // log4j Logger
53- libraryDependencies += " org.slf4j" % " slf4j-log4j12" % " 1.7.22"
54-
55- // Scalatra (REST, ...)
56- libraryDependencies ++= Seq (
57- " org.scalatra" %% " scalatra" % " 2.6.5" ,
58- " org.scalatra" %% " scalatra-scalate" % " 2.6.5" ,
59- " org.scalatra" %% " scalatra-specs2" % " 2.6.5" ,
60- " ch.qos.logback" % " logback-classic" % " 1.2.3" % " provided" ,
61- " org.eclipse.jetty" % " jetty-webapp" % " 9.4.7.v20170914" % " provided" ,
62- " javax.servlet" % " javax.servlet-api" % " 3.1.0" % " provided" ,
63- " org.scalatra" %% " scalatra-json" % " 2.6.3" ,
64- " org.scalatra" %% " scalatra-swagger" % " 2.6.5" ,
65- )
66-
67- // JSON Lib (Jackson)
68- libraryDependencies += " org.json4s" %% " json4s-jackson" % " 3.5.2"
69-
70- // PIRCBotX
71- libraryDependencies += " org.pircbotx" % " pircbotx" % " 2.1"
72-
73- // Reflections API for annotation indexing
74- libraryDependencies += " org.reflections" % " reflections" % " 0.9.11"
75-
76- // Akka Actors
77- libraryDependencies ++= Seq (
78- " com.typesafe.akka" %% " akka-actor" % " 2.5.18" ,
79- // "com.typesafe.akka" %% "akka-testkit" % "2.5.18" % Test
80- )
10+ // Settings
11+ inThisBuild(List (scalaVersion := " 2.12.5" ))
8112
82- // Google GSON
83- libraryDependencies += " com.google.code.gson" % " gson" % " 2.8.5"
84-
85- // JDA
86- resolvers += " jcenter-bintray" at " https://jcenter.bintray.com"
87- libraryDependencies += " net.dv8tion" % " JDA" % " 3.8.3_463"
88-
89- // Serial Communication
90- libraryDependencies += " com.fazecast" % " jSerialComm" % " 2.5.1"
91-
92- // Socket.io
93- libraryDependencies += " io.socket" % " socket.io-client" % " 1.0.0"
94-
95- // Coursier
96- libraryDependencies += " io.get-coursier" %% " coursier" % " 2.0.0-RC3-2"
97-
98- // ---------------------------------------------------------------------------------------------------------------------
99- // PLUGIN FRAMEWORK DEFINITIONS
100- // ---------------------------------------------------------------------------------------------------------------------
101-
102- // Plugin framework settings
103- lazy val pluginBuildFileName = settingKey[String ](" The filename of the plugin build file. Remember to gitignore it!" )
104- lazy val pluginFolderNames = settingKey[List [String ]](" The folder names of all plugin source directories." )
105- lazy val pluginTargetFolderNames = settingKey[List [String ]](" The folder names of compiled and packaged plugins. Remember to gitignore these!" )
106- lazy val apiProjectPath = settingKey[String ](" The path to the api sub project. Remember to gitignore it!" )
107- lazy val guiProjectPath = settingKey[String ](" The path of the Angular gui." )
108-
109- // Plugin framework tasks
110- lazy val create = TaskKey [Unit ](" create" , " Creates a new plugin. Interactive command using the console." )
111- lazy val fetch = TaskKey [Unit ](" fetch" , " Searches for plugins in plugin directories, builds the plugin build file." )
112- lazy val copy = TaskKey [Unit ](" copy" , " Copies all packaged plugin jars to the target plugin folder." )
113- lazy val deploy = TaskKey [Unit ](" deploy" , " Prepares the environment for deployment, fills deploy folder." )
114- lazy val deployDev = TaskKey [Unit ](" deployDev" , " Prepares the environment for plugin developers, fills deployDev folder." )
115- lazy val gui = TaskKey [Unit ](" gui" , " Installs GUI dependencies and builds it using npm." )
116-
117- pluginBuildFileName := " plugins.sbt"
118- pluginFolderNames := List (" plugins-public" , " plugins-private" )
119- pluginTargetFolderNames := List (" plugins" , s " target/scala- $scalaMajorVersion/plugins " )
120- apiProjectPath := " api"
121- guiProjectPath := " gui"
122-
123-
124- import org .codeoverflow .chatoverflow .build .GUIUtility
125- import org .codeoverflow .chatoverflow .build .deployment .DeploymentUtility
126- import org .codeoverflow .chatoverflow .build .plugins .{PluginCreateWizard , PluginUtility }
127-
128- create := new PluginCreateWizard (streams.value.log).createPluginTask(pluginFolderNames.value, PluginCreateWizard .getApiVersion.value)
129- fetch := new PluginUtility (streams.value.log).fetchPluginsTask(pluginFolderNames.value, pluginBuildFileName.value,
130- pluginTargetFolderNames.value, apiProjectPath.value)
131- copy := new PluginUtility (streams.value.log).copyPluginsTask(pluginFolderNames.value, pluginTargetFolderNames.value, scalaMajorVersion)
132- deploy := DeploymentUtility .prepareDeploymentTask(streams.value.log, scalaMajorVersion)
133- deployDev := DeploymentUtility .prepareDevDeploymentTask(streams.value.log, scalaMajorVersion, apiProjectPath.value, libraryDependencies.value.toList)
134- gui := new GUIUtility (streams.value.log).guiTask(guiProjectPath.value, streams.value.cacheDirectory / " gui" )
135-
136- Compile / packageBin := {
137- new GUIUtility (streams.value.log).packageGUITask(guiProjectPath.value, crossTarget.value)
138- (Compile / packageBin).value
139- }
140-
141- Compile / unmanagedJars := new GUIUtility (streams.value.log).getGUIJarClasspath(guiProjectPath.value, crossTarget.value)
142-
143- fork in run := true // Start ChatOverflow in it's own java process when starting it with 'sbt run'
13+ import org .codeoverflow .chatoverflow .build .BuildUtils
14414
145- // Clears the built GUI dir on clean
146- cleanFiles += baseDirectory.value / guiProjectPath.value / " dist "
15+ javacOptions ++= BuildUtils .getJava8CrossOptions
16+ fork in run := true // Start ChatOverflow in it's own java process when starting it with 'sbt run'
0 commit comments