Skip to content

Commit 779f55c

Browse files
authored
Merge branch 'main' into fix/member-symbol
2 parents 1235fc8 + 75fa832 commit 779f55c

File tree

14 files changed

+48
-5
lines changed

14 files changed

+48
-5
lines changed

core/src/main/scala/nz/co/bottech/scala2plantuml/AggregationProcessor.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ private[scala2plantuml] object AggregationProcessor {
8989
aggregates.filterNot { symbol =>
9090
symbol == aggregator ||
9191
TerminalTypes.contains(symbol) ||
92+
!symbolIndex.indexOf(symbol) ||
9293
nonClassSymbol(symbol, symbolIndex)
9394
}.map(Aggregation(aggregator, _))
9495

core/src/main/scala/nz/co/bottech/scala2plantuml/SymbolProcessor.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ private[scala2plantuml] object SymbolProcessor {
116116
import symbolInformation.{displayName, symbol}
117117
val parentSymbols =
118118
if (excludeParents) Seq.empty
119-
else clazz.parents.flatMap(typeSymbols(_, includeArguments = false))
119+
else
120+
clazz.parents
121+
.flatMap(typeSymbols(_, includeArguments = false))
122+
.filter(symbolIndex.indexOf)
120123
val typeParameters = optionalScopeTypeParameters(clazz.typeParameters, symbolIndex)
121124
if (isTrait(symbolInformation))
122125
Interface(displayName, symbol, parentSymbols, typeParameters)

sbt/src/main/scala/nz/co/bottech/scala2plantuml/sbt/Scala2PlantUML.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ object Scala2PlantUML {
1818
config.symbol,
1919
config.prefixes(projects, sourceRoots),
2020
config.ignore,
21-
classLoader(config)
21+
classLoader(config),
22+
config.maxLevel
2223
)
2324
val file = config.outputFile
2425
Option(file.getParentFile).foreach(_.mkdirs())

sbt/src/main/scala/nz/co/bottech/scala2plantuml/sbt/Scala2PlantUMLParser.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import sbt.file
77

88
private[sbt] object Scala2PlantUMLParser {
99

10-
private val SymbolParser = token(StringBasic, "symbol")
10+
private val SymbolParser = Space ~> token(StringBasic, "symbol")
1111

1212
private val IncludeParser = optionStringParser("-i", "--include", "pattern", _.addInclude(_))
1313
private val ExcludeParser = optionStringParser("-e", "--exclude", "pattern", _.addExclude(_))
@@ -37,14 +37,14 @@ private[sbt] object Scala2PlantUMLParser {
3737
parser: Parser[A],
3838
f: (Config, A) => Config
3939
) =
40-
(token(literal(short) | long) ~> token(Space) ~> token(parser, label)).map(a => (c: Config) => f(c, a))
40+
Space ~> (token(literal(short) | long) ~> token(Space) ~> token(parser, label)).map(a => (c: Config) => f(c, a))
4141

4242
def apply(): Parser[Config] = {
4343
// TODO: Add .puml extension auto complete.
4444
val options = OutputFileParser | MaxLevelParser | IncludeParser | ExcludeParser
4545
// TODO: Get example symbols.
4646
// FIXME: OutputFileParser and MaxLevelParser should only be allowed at most once.
47-
val parser = Space ~> options.* ~ SymbolParser ~ options.*
47+
val parser = options.* ~ SymbolParser ~ options.*
4848
parser.map { case ((optionsBefore, symbol), optionsAfter) =>
4949
def configure(config: Config, f: Config => Config) = f(config)
5050
val outputFile = file(s"${symbolToScalaIdentifier(symbol)}.puml")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semanticdbEnabled := true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@startuml
2+
interface A extends B {
3+
+ {abstract} {method} a
4+
}
5+
interface B extends C
6+
interface C
7+
@enduml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sys.props.get("plugin.version") match {
2+
case Some(version) => addSbtPlugin("nz.co.bottech" % "sbt-scala2plantuml" % version)
3+
case _ => sys.error("""|The system property 'plugin.version' is not defined.
4+
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
5+
}
6+
7+
libraryDependencies += "com.lihaoyi" %% "utest" % "0.7.7"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.example
2+
3+
trait A extends B with internal.AInternal {
4+
5+
def a: internal.AInternal
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.example
2+
3+
trait B extends C
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.example
2+
3+
trait C extends D

0 commit comments

Comments
 (0)