@@ -28,156 +28,186 @@ object OssumIncPlugin extends AutoPlugin {
2828 // Clauses to customize the major declarations
2929 object With {
3030
31- def akka : ConfigFunc = helpers.Akka .configure
32-
33- def Akka = helpers.Akka
31+ // ===== PascalCase helpers (preferred) =====
3432
3533 /** Use this to provide dependencies on most recent Akka libraries */
34+ def Akka : helpers.Akka .type = helpers.Akka
3635
3736 /** Use this to provide handy sbt command line aliases */
38- def aliases : ConfigFunc = helpers.HandyAliases .configure
39-
40- /** Use this to configure AsciiDoc document generation for static websites and PDFs */
41- val AsciiDoc = helpers.AsciiDoc
37+ def Aliases : helpers.HandyAliases .type = helpers.HandyAliases
4238
43- /** Use this to have the build generate build information. "I know this because sbt knows
44- * this"
45- */
46- def build_info : ConfigFunc = helpers.BuildInfo .configure
39+ /** Use this to configure AsciiDoc document generation */
40+ val AsciiDoc : helpers.AsciiDoc .type = helpers.AsciiDoc
4741
42+ /** Use this to have the build generate build information */
4843 def BuildInfo : helpers.BuildInfo .type = helpers.BuildInfo
4944
50- /** Configure the project to require a certain percentage of coverage in test cases */
51- def coverage (percent : Double = 50.0d )(project : Project ): Project =
52- project
53- .configure(helpers.ScalaCoverage .configure)
54- .settings(
55- helpers.ScalaCoverage .Keys .coveragePercent := percent
56- )
57-
58- /** Use dynamic versioning based on the most recent tag, and the commit hash and data/time
59- * stamp if necessary
60- */
61- def dynver : ConfigFunc = helpers.DynamicVersioning .configure
45+ /** Use dynamic versioning based on git tags */
46+ def DynVer : helpers.DynamicVersioning .type = helpers.DynamicVersioning
6247
6348 /** Use this to get git command line support at the sbt prompt */
64- def git : ConfigFunc = helpers.Git .configure
49+ def Git : helpers. Git . type = helpers.Git
6550
66- /** Configure this project to be published as a Maven GitHub Package in the organization
67- * specified by Root
51+ /** Configure publishing to GitHub Packages
6852 * @note
69- * Do not combine this with SonatypePublishing
53+ * Do not combine with SonatypePublishing
7054 */
71- def GithubPublishing : ConfigFunc = helpers.GithubPublishing .configure
55+ def GithubPublishing : helpers. GithubPublishing . type = helpers.GithubPublishing
7256
73- /** Use this to get the `headerCheck` and `headerCreate` sbt commands to generate source file
74- * headers automatically
75- */
76- def header : ConfigFunc = helpers.Header .configure
57+ /** Use this to manage source file headers automatically */
58+ def Header : helpers.Header .type = helpers.Header
7759
60+ /** Configure IntelliJ IDEA plugin development */
7861 def IdeaPlugin : helpers.IdeaPlugin .type = helpers.IdeaPlugin
7962
8063 /** Use this to enable compilation of Java code too */
81- def java : ConfigFunc = helpers.Java .configure
82-
83- /** Use this to configure your project to compile Scala to ScalaJS via scala.js */
84- def ScalaJS : helpers.ScalaJS .type = helpers.ScalaJS
85- def scalajs : ConfigFunc = helpers.ScalaJS .configure
86-
87- /** @deprecated Use ScalaJS instead - this alias will be removed in 2.0 */
88- @ deprecated(" Use ScalaJS instead" , " 1.0.0" )
89- def Javascript : helpers.ScalaJS .type = helpers.ScalaJS
64+ def Java : helpers.Java .type = helpers.Java
9065
91- /** Use this to configure your project to include typical laminar dependencies */
66+ /** Use this to configure Laminar dependencies */
9267 def Laminar : helpers.Laminar .type = helpers.Laminar
9368
69+ /** Configure binary compatibility checking */
9470 def MiMa : helpers.MiMa .type = helpers.MiMa
9571
96- /** Use this to configure your project to build native code with Scala. Native */
72+ /** Use this to build native code with Scala Native */
9773 def Native : helpers.Native .type = helpers.Native
9874
99- /** Do not configure this project for Lightbend's Migration Manager */
100- def noMiMa : ConfigFunc = helpers.MiMa .without
101-
102- /** Configure this project to produce no artifact and not be published */
103- def noPublishing (project : Project ): Project =
104- project.settings(
105- publishArtifact := false , // no artifact to publish for the virtual root project
106- publish := {}, // just to be sure
107- publishLocal := {}, // and paranoid
108- publishTo := Some (Resolver .defaultLocal),
109- publish / skip := true
110- )
111-
75+ /** Configure sbt-native-packager */
11276 def Packaging : helpers.Packaging .type = helpers.Packaging
11377
114- /** Configure this project to be published as open source
115- * @note
116- * Do not combine this with SonatypePublishing
117- */
118- def SonatypePublishing : ConfigFunc = helpers.SonatypePublishing .configure
119-
120- /** Configure this project to support releasing with a systematic release procedure */
121- def release : ConfigFunc = helpers.Release .configure
78+ /** Configure the release process */
79+ def Release : helpers.Release .type = helpers.Release
12280
123- /** Add extra resolvers to the build for this project */
124- def resolvers : ConfigFunc = helpers.Resolvers .configure
81+ /** Add extra resolvers to the build */
82+ def Resolvers : helpers. Resolvers . type = helpers.Resolvers
12583
126- /** Configure dependency on a version of the RIDDL library */
127- def riddl : ConfigFunc = helpers.Riddl .configure
128- def Riddl = helpers.Riddl
84+ /** Configure dependency on RIDDL library */
85+ def Riddl : helpers.Riddl .type = helpers.Riddl
12986
13087 /** Compile scala code as Scala 2.13.latest */
131- def scala2 : ConfigFunc = helpers.Scala2 .configure
88+ def Scala2 : helpers. Scala2 . type = helpers.Scala2
13289
13390 /** Compile scala code as Scala 3's latest LTS release */
134- def scala3 : ConfigFunc = helpers.Scala3 .configure
91+ def Scala3 : helpers.Scala3 .type = helpers.Scala3
92+
93+ /** Configure ScalablyTyped for TypeScript facades */
94+ def ScalablyTyped : helpers.ScalablyTyped .type = helpers.ScalablyTyped
13595
136- /** Configure this project to use standard Scalafmt formatting rules. */
96+ /** Configure code coverage testing */
97+ def ScalaCoverage : helpers.ScalaCoverage .type = helpers.ScalaCoverage
98+
99+ /** Configure standard Scalafmt formatting rules */
137100 def Scalafmt : helpers.Scalafmt .type = helpers.Scalafmt
138101
139- /** Add scalaTest libraries to the libraryDependencies */
140- def Scalatest : helpers.Scalatest .type = helpers.Scalatest
102+ /** Configure Scala.js compilation */
103+ def ScalaJS : helpers.ScalaJS .type = helpers.ScalaJS
141104
142- /** Configure this project to enable coverage testing */
143- def scoverage : ConfigFunc = helpers.ScalaCoverage .configure
105+ /** Add ScalaTest libraries to the libraryDependencies */
106+ def Scalatest : helpers. Scalatest . type = helpers.Scalatest
144107
145- def ScalablyTyped : helpers.ScalablyTyped .type = helpers.ScalablyTyped
108+ /** Configure publishing to Sonatype/Maven Central
109+ * @note
110+ * Do not combine with GithubPublishing
111+ */
112+ def SonatypePublishing : helpers.SonatypePublishing .type = helpers.SonatypePublishing
146113
114+ /** Configure unified API documentation */
147115 def Unidoc : helpers.Unidoc .type = helpers.Unidoc
148116
117+ // ===== Deprecated lowercase aliases (will be removed in 2.0) =====
118+
119+ @ deprecated(" Use Akka instead" , " 1.1.0" )
120+ def akka : helpers.Akka .type = helpers.Akka
121+
122+ @ deprecated(" Use Aliases instead" , " 1.1.0" )
123+ def aliases : helpers.HandyAliases .type = helpers.HandyAliases
124+
125+ @ deprecated(" Use BuildInfo instead" , " 1.1.0" )
126+ def build_info : helpers.BuildInfo .type = helpers.BuildInfo
127+
128+ @ deprecated(" Use DynVer instead" , " 1.1.0" )
129+ def dynver : helpers.DynamicVersioning .type = helpers.DynamicVersioning
130+
131+ @ deprecated(" Use Git instead" , " 1.1.0" )
132+ def git : helpers.Git .type = helpers.Git
133+
134+ @ deprecated(" Use Header instead" , " 1.1.0" )
135+ def header : helpers.Header .type = helpers.Header
136+
137+ @ deprecated(" Use Java instead" , " 1.1.0" )
138+ def java : helpers.Java .type = helpers.Java
139+
140+ @ deprecated(" Use ScalaJS instead" , " 1.1.0" )
141+ def Javascript : helpers.ScalaJS .type = helpers.ScalaJS
142+
143+ @ deprecated(" Use Release instead" , " 1.1.0" )
144+ def release : helpers.Release .type = helpers.Release
145+
146+ @ deprecated(" Use Resolvers instead" , " 1.1.0" )
147+ def resolvers : helpers.Resolvers .type = helpers.Resolvers
148+
149+ @ deprecated(" Use Riddl instead" , " 1.1.0" )
150+ def riddl : helpers.Riddl .type = helpers.Riddl
151+
152+ @ deprecated(" Use Scala2 instead" , " 1.1.0" )
153+ def scala2 : helpers.Scala2 .type = helpers.Scala2
154+
155+ @ deprecated(" Use Scala3 instead" , " 1.1.0" )
156+ def scala3 : helpers.Scala3 .type = helpers.Scala3
157+
158+ @ deprecated(" Use ScalaJS instead" , " 1.1.0" )
159+ def scalajs : helpers.ScalaJS .type = helpers.ScalaJS
160+
161+ @ deprecated(" Use ScalaCoverage instead" , " 1.1.0" )
162+ def scoverage : helpers.ScalaCoverage .type = helpers.ScalaCoverage
163+
164+ // ===== Special helpers =====
165+
166+ /** Configure code coverage with minimum threshold */
167+ def coverage (percent : Double = 50.0d )(project : Project ): Project =
168+ project
169+ .configure(helpers.ScalaCoverage )
170+ .settings(
171+ helpers.ScalaCoverage .Keys .coveragePercent := percent
172+ )
173+
174+ /** Do not configure binary compatibility checking */
175+ def noMiMa : ConfigFunc = helpers.MiMa .without
176+
177+ /** Configure project to produce no artifact and not be published */
178+ def noPublishing (project : Project ): Project =
179+ project.settings(
180+ publishArtifact := false ,
181+ publish := {},
182+ publishLocal := {},
183+ publishTo := Some (Resolver .defaultLocal),
184+ publish / skip := true
185+ )
186+
187+ /** Apply multiple configuration functions */
149188 def these (cfuncs : ConfigFunc * )(project : Project ): Project =
150189 cfuncs.foldLeft(project) { (p, func) =>
151190 p.configure(func)
152191 }
153192
154- /** Use this to more easily configure:
155- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.aliases ]],
156- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.dynver ]]
157- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.git ]]
158- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.header ]]
159- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.resolvers ]] more easily
160- */
161- def basic (project : Project ): Project =
162- these(aliases, dynver, git, header, resolvers)(project)
193+ // ===== Composite helpers =====
163194
164- /** Configure support for all the simple things:
165- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.typical ]]
166- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.java ]]
167- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.build_info ]]
168- * - [[com.ossuminc.sbt.OssumIncPlugin.autoImport.With.release ]]
169- */
170- def everything (project : Project ): Project = {
171- project.configure(typical)
172- these(java, release)(project)
173- }
195+ /** Configure: Aliases, DynVer, Git, Header, Resolvers */
196+ def basic (project : Project ): Project =
197+ these(Aliases , DynVer , Git , Header , Resolvers )(project)
174198
175- /** Use this to enable the [[ basic ]] features as well as [[ scala3 ]] and [[ build_info ]] */
199+ /** Configure: basic + Scala3 + Scalatest */
176200 def typical (project : Project ): Project = {
177201 project
178202 .configure(basic)
179- .configure(scala3)
180- .configure(Scalatest ())
203+ .configure(Scala3 )
204+ .configure(Scalatest )
205+ }
206+
207+ /** Configure: typical + Java + Release */
208+ def everything (project : Project ): Project = {
209+ project.configure(typical)
210+ these(Java , Release )(project)
181211 }
182212 }
183213 }
0 commit comments