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

Add deployment for plugin developers #103

Merged
merged 16 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ project/plugins/project/
/bin/
/lib/
/deploy/
/deployDev/
/wiki/

# Plugin Data
Expand Down
20 changes: 20 additions & 0 deletions .idea/runConfigurations/Deploy_dev__sbt_deployDev_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ simple_run:

bootstrap_deploy:
sbt clean
sbt compile
sbt gui
sbt package copy
sbt bs "project bootstrapProject" assembly
sbt deploy

bootstrap_deploy_dev:
sbt clean
sbt gui
sbt package copy
sbt deployDev

create:
sbt create
sbt fetch
Expand All @@ -29,6 +34,9 @@ create:
deploy:
sbt deploy

deploy_dev:
sbt deployDev

fetch:
sbt fetch

Expand Down
7 changes: 6 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ libraryDependencies += "net.dv8tion" % "JDA" % "3.8.3_463"
libraryDependencies += "com.fazecast" % "jSerialComm" % "[2.0.0,3.0.0)"

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

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

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

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

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions deployment-files/plugin-dev/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// This is a stripped down version of the build.sbt found in the main framework.
// Its almost like the one from the framework but without some sbt tasks like 'deploy' that aren't needed for plugin developers
// and without dependencies, because those get their own generated file.

// ---------------------------------------------------------------------------------------------------------------------
// PROJECT INFORMATION
// ---------------------------------------------------------------------------------------------------------------------

name := "ChatOverflow"
version := "0.3"

// One version for all sub projects. Use "retrieveManaged := true" to download and show all library dependencies.
val scalaMajorVersion = "2.12"
val scalaMinorVersion = ".5"
inThisBuild(List(
scalaVersion := s"$scalaMajorVersion$scalaMinorVersion",
retrieveManaged := false)
)

unmanagedBase := file("bin")

// ---------------------------------------------------------------------------------------------------------------------
// PLUGIN FRAMEWORK DEFINITIONS
// ---------------------------------------------------------------------------------------------------------------------

// Plugin framework settings
lazy val pluginBuildFileName = settingKey[String]("The filename of the plugin build file. Remember to gitignore it!")
lazy val pluginFolderNames = settingKey[List[String]]("The folder names of all plugin source directories.")
lazy val pluginTargetFolderNames = settingKey[List[String]]("The folder names of compiled and packaged plugins. Remember to gitignore these!")
lazy val apiProjectPath = settingKey[String]("The path to the api sub project. Remember to gitignore it!")

// Plugin framework tasks
lazy val create = TaskKey[Unit]("create", "Creates a new plugin. Interactive command using the console.")
lazy val fetch = TaskKey[Unit]("fetch", "Searches for plugins in plugin directories, builds the plugin build file.")
lazy val copy = TaskKey[Unit]("copy", "Copies all packaged plugin jars to the target plugin folder.")

pluginBuildFileName := "plugins.sbt"
pluginFolderNames := List("plugins-public", "plugins-private")
pluginTargetFolderNames := List("plugins", s"target/scala-$scalaMajorVersion/plugins")
apiProjectPath := "api"

create := PluginCreateWizard(streams.value.log).createPluginTask(pluginFolderNames.value)
fetch := BuildUtility(streams.value.log).fetchPluginsTask(pluginFolderNames.value, pluginBuildFileName.value,
pluginTargetFolderNames.value, apiProjectPath.value)
copy := BuildUtility(streams.value.log).copyPluginsTask(pluginFolderNames.value, pluginTargetFolderNames.value, scalaMajorVersion)
Loading