A collection of sbt plugins designed to provide unified configuration and extended build functionality for Shuwari Africa Ltd. projects. It also includes CI/CD and release-related optimisations.
While optimised for internal use, these plugins can be used for other projects where their configurations are relevant. Report any issues via the issue tracker.
- Introduction
- Usage
- Core Plugins
- ShuwariCorePlugin
- ShuwariHeaderPlugin
- BuildModePlugin
- ScalacOptionsPlugin
- Supplementary Plugins
- ShuwariJsPlugin
- Licence
sbt-shuwari
is a suite of sbt plugins tailored to Shuwari Africa Ltd. projects. It offers:
- Centralised default settings for organising sbt builds.
- Advanced integration to manage build environments (Development, Integration, Release).
- Plugins for adding standardised headers to source files.
- Default configurations for scalac and Scala.js.
To include all core plugins in your build, add the following to plugins.sbt
:
addSbtPlugin("africa.shuwari.sbt" % "sbt-shuwari" % "0.14.1")
Individual plugins can also be added selectively by specifying their dependencies. See the specific plugin details below.
All core plugins are AutoPlugins, meaning they are enabled automatically if their dependencies are met.
ShuwariCorePlugin
addSbtPlugin("africa.shuwari.sbt" % "sbt-shuwari-core" % "0.14.1")
- Automatically sets common settings such as
organizationName
,organizationHomepage
, andversionScheme
. - Includes developer information and other organisational settings for standardisation.
- Ensures projects can be omitted from publishing if required.
shuwariProject
:- Adds organisational defaults like
organizationName
,organizationHomepage
, anddevelopers
. - Default settings:
organizationName := "Shuwari Africa Ltd." organizationHomepage := Some(url("https://shuwari.africa")) versionScheme := Some("semver-spec") developers := List( Developer( "shuwari-dev", "Shuwari Africa Ltd. Developer Team", "developers at shuwari dot africa", url("https://shuwari.africa") ) )
- Adds organisational defaults like
notPublished
:- Configures the project to skip all publishing tasks.
- Default settings:
publish / skip := true publish := {} publishLocal := {} publishArtifact := false
dependsOn
:- Simplified utility to depend on external libraries.
Example usage:
lazy val myProject = project
.shuwariProject
.notPublished
ShuwariHeaderPlugin
addSbtPlugin("africa.shuwari.sbt" % "sbt-shuwari-header" % "0.14.1")
- Automatically detects the licensing model used in your project.
- Supports custom, Apache 2.0, or GPLv3-style licence headers.
- Includes configurable copyright holders.
-
headerCopyrightHolder
:- Defines the entity owning the copyright.
- Default:
None
.
-
headerLicense
:- The licence header included in source files.
- Default: Automatically detects from the project configuration.
- Defaults to an internal licence if no licence is specified.
- Can be explicitly set to Apache 2.0 or GPLv3 headers.
Example:
lazy val project = (project in file("."))
.settings(apacheLicensed)
BuildModePlugin
addSbtPlugin("africa.shuwari.sbt" % "sbt-shuwari-mode" % "0.14.1")
- Dynamically resolves the
buildMode
from theBUILD_MODE
environment variable. - Configures different behaviours for development, integration, and release builds.
buildMode
:- Configures the current build mode.
- Default: Automatically detects from
BUILD_MODE
, defaults toDevelopment
. Valid values:"DEVELOPMENT"
→Mode.Development
."INTEGRATION"
→Mode.Integration
."RELEASE"
→Mode.Release
.
Example:
ThisBuild / buildMode := Mode.Release
ScalacOptionsPlugin
addSbtPlugin("africa.shuwari.sbt" % "sbt-shuwari-scalac" % "0.14.1")
-
Seamlessly integrates with
BuildModePlugin
andTpolecatPlugin
, enabling dynamic assignment of scalac options. -
Adjusts configurations for stricter linting and compilation optimisations based on the active build mode.
-
tpolecatOptionsMode
:- Dynamically maps
TpolecatPlugin
modes to the current build mode, as provided bysbt-shuwari-mode
. This ensures tailored compiler flags for various scenarios:VerboseMode
corresponds toMode.Development
, promoting detailed feedback for debugging.CiMode
aligns withMode.Integration
, focusing on consistency and maintainability.ReleaseMode
associates withMode.Release
, ensuring production-ready builds.
For more details, refer to the section on sbt-shuwari-mode.
- Dynamically maps
-
basePackages
:- A list of base package names used to tune deeper optimisations across the project.
- Default:
List.empty
.
-
tpolecatDevModeOptions
,tpolecatCiModeOptions
,tpolecatReleaseModeOptions
:- These keys provide customisation points for scalac options unique to each build mode. Use them to override or extend default configurations.
ShuwariJsPlugin
addSbtPlugin("africa.shuwari.sbt" % "sbt-shuwari-js" % "0.14.1")
scalaJSLinkerConfig
:- Configures the linker for Scala.js builds, automatically adjusting based on the current
buildMode
.
- Configures the linker for Scala.js builds, automatically adjusting based on the current
-
Development Mode:
Configured for faster builds and easier debugging. Uses ES modules for compatibility with modern JavaScript environments and applies theFewestModules
strategy for minimal module splitting. -
Release/Integration Mode:
Optimised for production and integration builds. Uses theSmallestModules
splitting strategy for reducing bundle sizes and enables Closure Compiler for advanced optimisations. -
tpolecatExcludeOptions
:- Excludes Scala.js-incompatible scalac options, such as:
explicitNulls
- JVM-specific checks like
checkMods
.
- Excludes Scala.js-incompatible scalac options, such as:
Copyright © Shuwari Africa Ltd. All rights reserved. Licensed under the Apache License, Version 2.0 (the "Licence"). You may obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an"AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND. See the Licence for details.