Skip to content

Commit 40f3879

Browse files
committed
Add example project
1 parent 434f32f commit 40f3879

File tree

7 files changed

+42
-13
lines changed

7 files changed

+42
-13
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
run: sbt ++${{ matrix.scala }} scripted
6161

6262
- name: Compress target directories
63-
run: tar cf targets.tar sbt/target target doc-templates/target cli/target core/target project/target
63+
run: tar cf targets.tar sbt/target target doc-templates/target cli/target core/target example/target project/target
6464

6565
- name: Upload target directories
6666
uses: actions/upload-artifact@v2

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ It comes as a standalone library, a CLI tool and an sbt plugin.
1111
Scala2PlantUML consumes [SemanticDB] files so you will need to know how to create those or simply follow the sbt setup
1212
instructions below.
1313

14-
Example:
15-
16-
```shell mdoc
17-
scala2PlantUML
18-
```
19-
2014
## sbt
2115

2216
### Enable SemanticDB

build.sbt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ val supportedScalaVersions = List(scala212, scala213)
55
val logbackVersion = "1.2.3"
66
val scalaCollectionCompatibilityVersion = "2.3.2"
77
val scoptVersion = "4.0.0"
8+
val sdbVersion = "4.4.10"
89
val slf4jVersion = "1.7.30"
910
val utestVersion = "0.7.7"
1011

@@ -107,10 +108,8 @@ val metaProjectSettings = List(
107108
publish / skip := true
108109
)
109110

110-
val libraryProjectSettings = commonProjectSettings
111-
112111
lazy val root = (project in file("."))
113-
.aggregate(cli, core, docs, sbtProject)
112+
.aggregate(cli, core, docs, example, sbtProject)
114113
.settings(metaProjectSettings)
115114
.settings(
116115
crossScalaVersions := supportedScalaVersions,
@@ -122,7 +121,7 @@ lazy val root = (project in file("."))
122121
)
123122

124123
lazy val core = project
125-
.settings(libraryProjectSettings)
124+
.settings(commonProjectSettings)
126125
.settings(
127126
libraryDependencies ++= collectionsCompatibilityDependency.value,
128127
libraryDependencies ++= List(
@@ -135,7 +134,7 @@ lazy val core = project
135134
),
136135
name := s"${(LocalRootProject / name).value}",
137136
semanticdbEnabled := true,
138-
semanticdbVersion := "4.4.10",
137+
semanticdbVersion := sdbVersion,
139138
testFrameworks += new TestFramework("utest.runner.Framework"),
140139
Test / managedSourceDirectories += (Test / semanticdbTargetRoot).value,
141140
Test / fullClasspath += (Test / semanticdbTargetRoot).value
@@ -144,7 +143,7 @@ lazy val core = project
144143
lazy val cli = project
145144
.dependsOn(core)
146145
.enablePlugins(BuildInfoPlugin)
147-
.settings(libraryProjectSettings)
146+
.settings(commonProjectSettings)
148147
.settings(
149148
buildInfoKeys := Seq[BuildInfoKey](version),
150149
buildInfoPackage := s"${organization.value}.${(LocalRootProject / name).value}",
@@ -211,6 +210,15 @@ lazy val docs = (project in file("doc-templates"))
211210
unusedCompileDependenciesFilter -= moduleFilter("org.scalameta", "mdoc*")
212211
)
213212

213+
lazy val example = project
214+
.settings(commonProjectSettings)
215+
.settings(
216+
semanticdbEnabled := true,
217+
semanticdbIncludeInJar := true,
218+
semanticdbVersion := sdbVersion,
219+
versionPolicyFirstVersion := Some("0.1.13"),
220+
)
221+
214222
def isScala213Setting: Def.Initialize[Boolean] = Def.setting {
215223
CrossVersion.partialVersion(scalaVersion.value) match {
216224
case Some((2, n)) if n == 13 => true
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package nz.co.bottech.scala2plantuml.example
2+
3+
class A extends B {
4+
override def b: C = C(this)
5+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package nz.co.bottech.scala2plantuml.example
2+
3+
trait B {
4+
5+
def b: C
6+
}
7+
8+
object B {
9+
10+
val Const: String = "X"
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package nz.co.bottech.scala2plantuml.example
2+
3+
final case class C(value: A)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package nz.co.bottech.scala2plantuml.example
2+
3+
object Main extends App {
4+
5+
{
6+
val _ = new A
7+
}
8+
}

0 commit comments

Comments
 (0)