diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-29 01:59:51 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-29 01:59:51 -0800 |
commit | 23cef1eccce3030166a6731823fc78d67b345261 (patch) | |
tree | c4042dd49359ebc74428730c0bbecefca5af416e /core/src/test | |
parent | 7250a28ac4c14f57cfdbaff1339bfcefca5f0525 (diff) | |
download | mill-23cef1eccce3030166a6731823fc78d67b345261.tar.gz mill-23cef1eccce3030166a6731823fc78d67b345261.tar.bz2 mill-23cef1eccce3030166a6731823fc78d67b345261.zip |
Kill old `LabelledTarget` classes
Diffstat (limited to 'core/src/test')
6 files changed, 28 insertions, 30 deletions
diff --git a/core/src/test/scala/mill/define/GraphTests.scala b/core/src/test/scala/mill/define/GraphTests.scala index 9442f9ab..d17f125f 100644 --- a/core/src/test/scala/mill/define/GraphTests.scala +++ b/core/src/test/scala/mill/define/GraphTests.scala @@ -157,7 +157,7 @@ object GraphTests extends TestSuite{ Graph.transitiveTargets(OSet.from(goals)) ) val grouped = Graph.groupAroundImportantTargets(topoSorted) { - case t: Target[_] if mapping.value.contains(t) || goals.contains(t) => t + case t: NamedTask[Any] if mapping.modules.contains(t.owner) => t case t if goals.contains(t) => t } grouped.keyCount diff --git a/core/src/test/scala/mill/discover/CrossModuleTests.scala b/core/src/test/scala/mill/discover/CrossModuleTests.scala index 135d76e3..99d33800 100644 --- a/core/src/test/scala/mill/discover/CrossModuleTests.scala +++ b/core/src/test/scala/mill/discover/CrossModuleTests.scala @@ -2,7 +2,7 @@ package mill.discover import mill.{Module, T} import mill.define.Cross -import mill.discover.Mirror.{LabelledTarget, Segment} +import mill.discover.Mirror.Segment import mill.discover.Mirror.Segment.Label import mill.util.TestUtil.test import utest._ @@ -75,17 +75,17 @@ object CrossModuleTests extends TestSuite{ } 'crossTargetDiscovery - { - val discovered = Discovered.make[singleCross.type].targets(singleCross) + val discovered = Discovered.mapping(singleCross) - val segments = discovered.map(_.segments) - val expectedSegments = List( + val segments = discovered.targets.values.toSet + val expectedSegments = Set( List(Label("cross"), Segment.Cross(List("210")), Label("suffix")), List(Label("cross"), Segment.Cross(List("211")), Label("suffix")), List(Label("cross"), Segment.Cross(List("212")), Label("suffix")) ) assert(segments == expectedSegments) - val targets = discovered.map(_.target) - val expected = List( + val targets = discovered.targets.keys.toSet + val expected = Set( singleCross.cross("210").suffix, singleCross.cross("211").suffix, singleCross.cross("212").suffix @@ -94,25 +94,24 @@ object CrossModuleTests extends TestSuite{ } 'doubleCrossTargetDiscovery - { - val discovered = Discovered.make[doubleCross.type] - val targets = discovered.targets(doubleCross).map(_.target) + val discovered = Discovered.mapping(doubleCross) + val targets = discovered.targets.keys.toSet - val expected = List( + val expected = Set( doubleCross.cross("jvm", "210").suffix, doubleCross.cross("js", "210").suffix, doubleCross.cross("jvm", "211").suffix, doubleCross.cross("js", "211").suffix, doubleCross.cross("jvm", "212").suffix, doubleCross.cross("js", "212").suffix, - doubleCross.cross("native", "212").suffix, - + doubleCross.cross("native", "212").suffix ) assert(targets == expected) } 'nestedCrosses - { - val discovered = Discovered.make[nestedCrosses.type].targets(nestedCrosses) - assert(discovered.length == 9) + val discovered = Discovered.mapping(nestedCrosses).targets + assert(discovered.size == 9) } } } diff --git a/core/src/test/scala/mill/discover/DiscoveredTests.scala b/core/src/test/scala/mill/discover/DiscoveredTests.scala index 31d6119e..b2d14080 100644 --- a/core/src/test/scala/mill/discover/DiscoveredTests.scala +++ b/core/src/test/scala/mill/discover/DiscoveredTests.scala @@ -12,7 +12,7 @@ object DiscoveredTests extends TestSuite{ val tests = Tests{ 'targets - { - val discovered = Discovered.make[nestedModule.type] + val discovered = Discovered.mapping(nestedModule) def flatten(h: Mirror[nestedModule.type, _]): Seq[Any] = { h.node(nestedModule, Nil) :: h.children.flatMap{case (label, c) => flatten(c)} @@ -26,7 +26,7 @@ object DiscoveredTests extends TestSuite{ ) assert(flattenedHierarchy == expectedHierarchy) - val mapped = discovered.targets(nestedModule).map(x => x.segments -> x.target) + val mapped = discovered.targets.map(_.swap) val expected = Seq( (List(Label("classInstance"), Label("single")), nestedModule.classInstance.single), @@ -37,9 +37,9 @@ object DiscoveredTests extends TestSuite{ } 'traitWithModule - { - val discovered = Discovered.make[TraitWithModuleObject.type] - val mapped = discovered.targets(TraitWithModuleObject).map(x => x.segments -> x.target) - val expected = Seq( + val discovered = Discovered.mapping(TraitWithModuleObject) + val mapped = discovered.targets.map(_.swap) + val expected = Map( ( List(Label("TraitModule"), Label("testFramework")), TraitWithModuleObject.TraitModule.testFramework diff --git a/core/src/test/scala/mill/discover/LabelingTests.scala b/core/src/test/scala/mill/discover/LabelingTests.scala index fa417373..71c6a6bf 100644 --- a/core/src/test/scala/mill/discover/LabelingTests.scala +++ b/core/src/test/scala/mill/discover/LabelingTests.scala @@ -16,7 +16,7 @@ object LabelingTests extends TestSuite{ def check(mapping: Discovered.Mapping[_], t: Task[_], relPath: Option[String]) = { - val names: Seq[(Task[_], Seq[Mirror.Segment])] = mapping.value.mapValues(_.segments).toSeq + val names: Seq[(Task[_], Seq[Mirror.Segment])] = mapping.targets.toSeq val nameMap = names.toMap val targetLabel = nameMap.get(t).map(_.map{case Label(v) => v}.mkString(".")) diff --git a/core/src/test/scala/mill/eval/JavaCompileJarTests.scala b/core/src/test/scala/mill/eval/JavaCompileJarTests.scala index 7587b3d9..2b5bcb58 100644 --- a/core/src/test/scala/mill/eval/JavaCompileJarTests.scala +++ b/core/src/test/scala/mill/eval/JavaCompileJarTests.scala @@ -58,7 +58,7 @@ object JavaCompileJarTests extends TestSuite{ Right(Tuple2( evaluated.rawValues(0).asInstanceOf[Result.Success[T]].value, evaluated.evaluated.collect{ - case t: Target[_] if mapping.value.contains(t) => t + case t: Target[_] if mapping.targets.contains(t) => t case t: mill.define.Command[_] => t }.size )) @@ -73,7 +73,7 @@ object JavaCompileJarTests extends TestSuite{ val evaluated = evaluator.evaluate(targets) .evaluated .flatMap(_.asTarget) - .filter(mapping.value.contains) + .filter(mapping.targets.contains) assert(evaluated == expected) } diff --git a/core/src/test/scala/mill/util/TestGraphs.scala b/core/src/test/scala/mill/util/TestGraphs.scala index 86d331bb..46ca9ff9 100644 --- a/core/src/test/scala/mill/util/TestGraphs.scala +++ b/core/src/test/scala/mill/util/TestGraphs.scala @@ -187,14 +187,13 @@ object TestGraphs{ } } object doubleCross{ - val cross = - for{ - scalaVersion <- mill.define.Cross("210", "211", "212") - platform <- mill.define.Cross("jvm", "js", "native") - if !(platform == "native" && scalaVersion != "212") - } yield new Module{ - def suffix = T{ scalaVersion + "_" + platform } - } + val cross = for{ + scalaVersion <- mill.define.Cross("210", "211", "212") + platform <- mill.define.Cross("jvm", "js", "native") + if !(platform == "native" && scalaVersion != "212") + } yield new Module{ + def suffix = T{ scalaVersion + "_" + platform } + } } object indirectNestedCrosses{ |