Skip to content

Commit

Permalink
Add example project
Browse files Browse the repository at this point in the history
  • Loading branch information
steinybot committed Mar 7, 2021
1 parent 434f32f commit 40f3879
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: sbt ++${{ matrix.scala }} scripted

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

- name: Upload target directories
uses: actions/upload-artifact@v2
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ It comes as a standalone library, a CLI tool and an sbt plugin.
Scala2PlantUML consumes [SemanticDB] files so you will need to know how to create those or simply follow the sbt setup
instructions below.

Example:

```shell mdoc
scala2PlantUML
```

## sbt

### Enable SemanticDB
Expand Down
20 changes: 14 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ val supportedScalaVersions = List(scala212, scala213)
val logbackVersion = "1.2.3"
val scalaCollectionCompatibilityVersion = "2.3.2"
val scoptVersion = "4.0.0"
val sdbVersion = "4.4.10"
val slf4jVersion = "1.7.30"
val utestVersion = "0.7.7"

Expand Down Expand Up @@ -107,10 +108,8 @@ val metaProjectSettings = List(
publish / skip := true
)

val libraryProjectSettings = commonProjectSettings

lazy val root = (project in file("."))
.aggregate(cli, core, docs, sbtProject)
.aggregate(cli, core, docs, example, sbtProject)
.settings(metaProjectSettings)
.settings(
crossScalaVersions := supportedScalaVersions,
Expand All @@ -122,7 +121,7 @@ lazy val root = (project in file("."))
)

lazy val core = project
.settings(libraryProjectSettings)
.settings(commonProjectSettings)
.settings(
libraryDependencies ++= collectionsCompatibilityDependency.value,
libraryDependencies ++= List(
Expand All @@ -135,7 +134,7 @@ lazy val core = project
),
name := s"${(LocalRootProject / name).value}",
semanticdbEnabled := true,
semanticdbVersion := "4.4.10",
semanticdbVersion := sdbVersion,
testFrameworks += new TestFramework("utest.runner.Framework"),
Test / managedSourceDirectories += (Test / semanticdbTargetRoot).value,
Test / fullClasspath += (Test / semanticdbTargetRoot).value
Expand All @@ -144,7 +143,7 @@ lazy val core = project
lazy val cli = project
.dependsOn(core)
.enablePlugins(BuildInfoPlugin)
.settings(libraryProjectSettings)
.settings(commonProjectSettings)
.settings(
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := s"${organization.value}.${(LocalRootProject / name).value}",
Expand Down Expand Up @@ -211,6 +210,15 @@ lazy val docs = (project in file("doc-templates"))
unusedCompileDependenciesFilter -= moduleFilter("org.scalameta", "mdoc*")
)

lazy val example = project
.settings(commonProjectSettings)
.settings(
semanticdbEnabled := true,
semanticdbIncludeInJar := true,
semanticdbVersion := sdbVersion,
versionPolicyFirstVersion := Some("0.1.13"),
)

def isScala213Setting: Def.Initialize[Boolean] = Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n == 13 => true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package nz.co.bottech.scala2plantuml.example

class A extends B {
override def b: C = C(this)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package nz.co.bottech.scala2plantuml.example

trait B {

def b: C
}

object B {

val Const: String = "X"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package nz.co.bottech.scala2plantuml.example

final case class C(value: A)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package nz.co.bottech.scala2plantuml.example

object Main extends App {

{
val _ = new A
}
}

0 comments on commit 40f3879

Please sign in to comment.