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

Commit d85d12b

Browse files
authored
Merge pull request #103 from codeoverflow-org/feature/21-plugin-dev-env
Add deployment for plugin developers
2 parents 61f0665 + f3c6bb4 commit d85d12b

25 files changed

+409
-75
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ project/plugins/project/
3333
/bin/
3434
/lib/
3535
/deploy/
36+
/deployDev/
3637
/wiki/
3738

3839
# Plugin Data

.idea/runConfigurations/Deploy_dev__sbt_deployDev_.xml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/_DeployDev__Generate_Bootstrap_Launcher_and_deploy_plugin_dev_environment.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ simple_run:
1515

1616
bootstrap_deploy:
1717
sbt clean
18-
sbt compile
1918
sbt gui
2019
sbt package copy
2120
sbt bs "project bootstrapProject" assembly
2221
sbt deploy
2322

23+
bootstrap_deploy_dev:
24+
sbt clean
25+
sbt gui
26+
sbt package copy
27+
sbt deployDev
28+
2429
create:
2530
sbt create
2631
sbt fetch
@@ -29,6 +34,9 @@ create:
2934
deploy:
3035
sbt deploy
3136

37+
deploy_dev:
38+
sbt deployDev
39+
3240
fetch:
3341
sbt fetch
3442

build.sbt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ libraryDependencies += "net.dv8tion" % "JDA" % "3.8.3_463"
6565
libraryDependencies += "com.fazecast" % "jSerialComm" % "[2.0.0,3.0.0)"
6666

6767
// Socket.io
68-
libraryDependencies += "io.socket" % "socket.io-client"% "1.0.0"
68+
libraryDependencies += "io.socket" % "socket.io-client" % "1.0.0"
6969
// ---------------------------------------------------------------------------------------------------------------------
7070
// PLUGIN FRAMEWORK DEFINITIONS
7171
// ---------------------------------------------------------------------------------------------------------------------
@@ -83,6 +83,7 @@ lazy val fetch = TaskKey[Unit]("fetch", "Searches for plugins in plugin director
8383
lazy val copy = TaskKey[Unit]("copy", "Copies all packaged plugin jars to the target plugin folder.")
8484
lazy val bs = TaskKey[Unit]("bs", "Updates the bootstrap project with current dependencies and chat overflow jars.")
8585
lazy val deploy = TaskKey[Unit]("deploy", "Prepares the environment for deployment, fills deploy folder.")
86+
lazy val deployDev = TaskKey[Unit]("deployDev", "Prepares the environment for plugin developers, fills deployDev folder.")
8687
lazy val gui = TaskKey[Unit]("gui", "Installs GUI dependencies and builds it using npm.")
8788

8889
pluginBuildFileName := "plugins.sbt"
@@ -97,6 +98,7 @@ fetch := BuildUtility(streams.value.log).fetchPluginsTask(pluginFolderNames.valu
9798
copy := BuildUtility(streams.value.log).copyPluginsTask(pluginFolderNames.value, pluginTargetFolderNames.value, scalaMajorVersion)
9899
bs := BootstrapUtility.bootstrapGenTask(streams.value.log, s"$scalaMajorVersion$scalaMinorVersion", getDependencyList.value)
99100
deploy := BootstrapUtility.prepareDeploymentTask(streams.value.log, scalaMajorVersion)
101+
deployDev := BootstrapUtility.prepareDevDeploymentTask(streams.value.log, scalaMajorVersion, apiProjectPath.value, libraryDependencies.value.toList)
100102
gui := BuildUtility(streams.value.log).guiTask(guiProjectPath.value, streams.value.cacheDirectory / "gui")
101103

102104
Compile / packageBin := {
@@ -111,6 +113,7 @@ Compile / unmanagedJars := (crossTarget.value ** "chatoverflow-gui*.jar").classp
111113
// ---------------------------------------------------------------------------------------------------------------------
112114

113115
// Util task for bs, gets a dependency list kinda like "sbt dependencyList", but only includes deps required for runtime
116+
// Filters out all chatoverflow modules, because those are not actual dependencies.
114117
lazy val getDependencyList = Def.task[List[ModuleID]] {
115118
// only get deps required for runtime and not for anything else like testing
116119
val updateReport = update.value.configuration(ConfigRef("runtime"))
@@ -119,6 +122,8 @@ lazy val getDependencyList = Def.task[List[ModuleID]] {
119122
List()
120123
} else {
121124
updateReport.get.modules.map(m => m.module).toList
125+
.filterNot(m => m.name == s"chatoverflow-api_$scalaMajorVersion" ||
126+
m.name == s"chatoverflow_$scalaMajorVersion")
122127
}
123128
}
124129

File renamed without changes.
File renamed without changes.

deployment-files/plugin-dev/.idea/runConfigurations/Clean__sbt_clean_.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment-files/plugin-dev/.idea/runConfigurations/Create_Plugin__sbt_create_fetch_reload_.xml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment-files/plugin-dev/.idea/runConfigurations/Fetch_plugins__sbt_fetch_.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment-files/plugin-dev/.idea/runConfigurations/List_plugin_versions__sbt_version_.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment-files/plugin-dev/.idea/runConfigurations/Package_and_copy_plugins__sbt_package_copy_.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment-files/plugin-dev/.idea/runConfigurations/Reload__sbt_reload_.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment-files/plugin-dev/.idea/runConfigurations/_Advanced__Full_Reload_and_Run_ChatOverflow.xml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment-files/plugin-dev/.idea/runConfigurations/_Simple__Rebuild_plugins_and_Run_ChatOverflow.xml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment-files/plugin-dev/build.sbt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// 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+
// ---------------------------------------------------------------------------------------------------------------------
8+
9+
name := "ChatOverflow"
10+
version := "0.3"
11+
12+
// One version for all sub projects. Use "retrieveManaged := true" to download and show all library dependencies.
13+
val scalaMajorVersion = "2.12"
14+
val scalaMinorVersion = ".5"
15+
inThisBuild(List(
16+
scalaVersion := s"$scalaMajorVersion$scalaMinorVersion",
17+
retrieveManaged := false)
18+
)
19+
20+
unmanagedBase := file("bin")
21+
22+
// ---------------------------------------------------------------------------------------------------------------------
23+
// PLUGIN FRAMEWORK DEFINITIONS
24+
// ---------------------------------------------------------------------------------------------------------------------
25+
26+
// Plugin framework settings
27+
lazy val pluginBuildFileName = settingKey[String]("The filename of the plugin build file. Remember to gitignore it!")
28+
lazy val pluginFolderNames = settingKey[List[String]]("The folder names of all plugin source directories.")
29+
lazy val pluginTargetFolderNames = settingKey[List[String]]("The folder names of compiled and packaged plugins. Remember to gitignore these!")
30+
lazy val apiProjectPath = settingKey[String]("The path to the api sub project. Remember to gitignore it!")
31+
32+
// Plugin framework tasks
33+
lazy val create = TaskKey[Unit]("create", "Creates a new plugin. Interactive command using the console.")
34+
lazy val fetch = TaskKey[Unit]("fetch", "Searches for plugins in plugin directories, builds the plugin build file.")
35+
lazy val copy = TaskKey[Unit]("copy", "Copies all packaged plugin jars to the target plugin folder.")
36+
37+
pluginBuildFileName := "plugins.sbt"
38+
pluginFolderNames := List("plugins-public", "plugins-private")
39+
pluginTargetFolderNames := List("plugins", s"target/scala-$scalaMajorVersion/plugins")
40+
apiProjectPath := "api"
41+
42+
create := PluginCreateWizard(streams.value.log).createPluginTask(pluginFolderNames.value)
43+
fetch := BuildUtility(streams.value.log).fetchPluginsTask(pluginFolderNames.value, pluginBuildFileName.value,
44+
pluginTargetFolderNames.value, apiProjectPath.value)
45+
copy := BuildUtility(streams.value.log).copyPluginsTask(pluginFolderNames.value, pluginTargetFolderNames.value, scalaMajorVersion)

0 commit comments

Comments
 (0)