From 1802dba599efffb8e74ad9131faf85e33914346a Mon Sep 17 00:00:00 2001 From: Gunnar Morling Date: Sun, 27 Jan 2019 11:26:23 +0100 Subject: [PATCH] #27 WIP Adding cycle detection to architecture validation --- .../deptective/internal/PluginTask.java | 1 + .../internal/export/DotSerializer.java | 9 +++ .../handler/PackageReferenceValidator.java | 48 ++++++++++++++-- .../internal/log/DeptectiveMessages.java | 7 +++ .../deptective/internal/model/Component.java | 56 ++++++++++++++++++- .../internal/model/PackageDependencies.java | 8 +++ .../deptective/internal/model/ReadKind.java | 7 ++- .../internal/options/DeptectiveOptions.java | 14 +++++ .../plugintest/cycle/CycleTest.java | 50 +++++++++++++++++ .../deptective/plugintest/cycle/bar/Bar.java | 25 +++++++++ .../deptective/plugintest/cycle/baz/Baz.java | 23 ++++++++ .../deptective/plugintest/cycle/foo/Foo.java | 23 ++++++++ .../deptective/plugintest/cycle/qux/Qux.java | 23 ++++++++ .../plugintest/visualize/VisualizeTest.java | 7 ++- .../plugintest/whitelist/bar/Bar.java | 3 + .../plugintest/cycle/deptective.json | 24 ++++++++ .../plugintest/visualize/deptective.json | 7 +++ 17 files changed, 326 insertions(+), 9 deletions(-) create mode 100644 javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/CycleTest.java create mode 100644 javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/bar/Bar.java create mode 100644 javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/baz/Baz.java create mode 100644 javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/foo/Foo.java create mode 100644 javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/qux/Qux.java create mode 100644 javac-plugin/src/test/resources/org/moditect/deptective/plugintest/cycle/deptective.json diff --git a/javac-plugin/src/main/java/org/moditect/deptective/internal/PluginTask.java b/javac-plugin/src/main/java/org/moditect/deptective/internal/PluginTask.java index 4c99a94..5ab5ef5 100644 --- a/javac-plugin/src/main/java/org/moditect/deptective/internal/PluginTask.java +++ b/javac-plugin/src/main/java/org/moditect/deptective/internal/PluginTask.java @@ -48,6 +48,7 @@ public PackageReferenceHandler getPackageReferenceHandler(JavaFileManager jfm, D configSupplier.get(), options.getReportingPolicy(), options.getUnconfiguredPackageReportingPolicy(), + options.getCycleReportingPolicy(), options.createDotFile(), log ); diff --git a/javac-plugin/src/main/java/org/moditect/deptective/internal/export/DotSerializer.java b/javac-plugin/src/main/java/org/moditect/deptective/internal/export/DotSerializer.java index 818ffb9..c770730 100644 --- a/javac-plugin/src/main/java/org/moditect/deptective/internal/export/DotSerializer.java +++ b/javac-plugin/src/main/java/org/moditect/deptective/internal/export/DotSerializer.java @@ -36,6 +36,7 @@ public class DotSerializer implements ModelSerializer { private final SortedSet allPackages; private final SortedMap> allowedReads; private final SortedMap> disallowedReads; + private final SortedMap> cycleReads; private final SortedMap> unknownReads; public DotSerializer() { @@ -46,6 +47,7 @@ public DotSerializer() { allPackages = new TreeSet<>(); allowedReads = new TreeMap<>(); disallowedReads = new TreeMap<>(); + cycleReads = new TreeMap<>(); unknownReads = new TreeMap<>(); } @@ -59,6 +61,9 @@ public void addComponent(Component component) { SortedSet disallowed = new TreeSet<>(); disallowedReads.put(component.getName(), disallowed); + SortedSet cycle = new TreeSet<>(); + cycleReads.put(component.getName(), cycle); + SortedSet unknown = new TreeSet<>(); unknownReads.put(component.getName(), unknown); @@ -72,6 +77,9 @@ public void addComponent(Component component) { else if (referencedPackage.getValue() == ReadKind.DISALLOWED) { disallowed.add(referencedPackageName); } + else if (referencedPackage.getValue() == ReadKind.CYCLE) { + cycle.add(referencedPackageName); + } else { unknown.add(referencedPackageName); } @@ -90,6 +98,7 @@ public String serialize() { addSubGraph(sb, allowedReads, "Allowed", null); addSubGraph(sb, disallowedReads, "Disallowed", "red"); + addSubGraph(sb, cycleReads, "Cycle", "purple"); addSubGraph(sb, unknownReads, "Unknown", "yellow"); sb.append("}"); diff --git a/javac-plugin/src/main/java/org/moditect/deptective/internal/handler/PackageReferenceValidator.java b/javac-plugin/src/main/java/org/moditect/deptective/internal/handler/PackageReferenceValidator.java index ea6c14c..dc434c5 100644 --- a/javac-plugin/src/main/java/org/moditect/deptective/internal/handler/PackageReferenceValidator.java +++ b/javac-plugin/src/main/java/org/moditect/deptective/internal/handler/PackageReferenceValidator.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.io.Writer; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -26,6 +27,8 @@ import javax.tools.StandardLocation; import org.moditect.deptective.internal.export.DotSerializer; +import org.moditect.deptective.internal.graph.Cycle; +import org.moditect.deptective.internal.graph.GraphUtils; import org.moditect.deptective.internal.log.DeptectiveMessages; import org.moditect.deptective.internal.log.Log; import org.moditect.deptective.internal.model.Component; @@ -50,23 +53,25 @@ public class PackageReferenceValidator implements PackageReferenceHandler { private final PackageDependencies allowedPackageDependencies; private final JavaFileManager jfm; private final ReportingPolicy reportingPolicy; - private boolean createDotFile; private final ReportingPolicy unconfiguredPackageReportingPolicy; + private final ReportingPolicy cycleReportingPolicy; private final Map reportedUnconfiguredPackages; - private final PackageDependencies.Builder actualPackageDependencies; + private boolean createDotFile; private String currentPackageName; private Component currentComponent; public PackageReferenceValidator(JavaFileManager jfm, PackageDependencies packageDependencies, - ReportingPolicy reportingPolicy, ReportingPolicy unconfiguredPackageReportingPolicy, boolean createDotFile, + ReportingPolicy reportingPolicy, ReportingPolicy unconfiguredPackageReportingPolicy, + ReportingPolicy cycleReportingPolicy, boolean createDotFile, Log log) { this.log = log; this.allowedPackageDependencies = packageDependencies; this.jfm = jfm; this.reportingPolicy = reportingPolicy; this.unconfiguredPackageReportingPolicy = unconfiguredPackageReportingPolicy; + this.cycleReportingPolicy = cycleReportingPolicy; this.reportedUnconfiguredPackages = new HashMap<>(); this.actualPackageDependencies = PackageDependencies.builder(); this.createDotFile = createDotFile; @@ -170,13 +175,36 @@ else if (currentComponent.allowedToRead(referencedComponent)) { public void onCompletingCompilation() { log.useSource(null); + List> cycles = GraphUtils.detectCycles(allowedPackageDependencies.getComponents()); + + if (!cycles.isEmpty()) { + String cyclesAsString = "- " + cycles.stream() + .map(Cycle::toString) + .collect(Collectors.joining("," + System.lineSeparator() + "- ")); + + log.report(cycleReportingPolicy, DeptectiveMessages.CYCLE_IN_ARCHITECTURE, cyclesAsString); + } + if (!createDotFile) { return; } + if (!cycles.isEmpty()) { + for (Component.Builder component : actualPackageDependencies.getComponents()) { + for (Cycle cycle : cycles) { + if (contains(cycle, component.getName())) { + for (Component nodeInCycle : cycle.getNodes()) { + if (component.getReads().containsKey(nodeInCycle.getName())) { + component.addRead(nodeInCycle.getName(), ReadKind.CYCLE); + } + } + } + } + } + } + DotSerializer serializer = new DotSerializer(); - PackageDependencies build = actualPackageDependencies.build(); - build.serialize(serializer); + actualPackageDependencies.build().serialize(serializer); try { FileObject output = jfm.getFileForOutput(StandardLocation.CLASS_OUTPUT, "", "deptective.dot", null); @@ -190,6 +218,16 @@ public void onCompletingCompilation() { } } + private boolean contains(Cycle cycle, String name) { + for (Component component : cycle.getNodes()) { + if (component.getName().equals(name)) { + return true; + } + } + + return false; + } + private boolean isIgnoredDependency(String referencedPackageName) { return "java.lang".equals(referencedPackageName) || allowedPackageDependencies.isWhitelisted(referencedPackageName) || diff --git a/javac-plugin/src/main/java/org/moditect/deptective/internal/log/DeptectiveMessages.java b/javac-plugin/src/main/java/org/moditect/deptective/internal/log/DeptectiveMessages.java index f0d0e10..c053cbc 100644 --- a/javac-plugin/src/main/java/org/moditect/deptective/internal/log/DeptectiveMessages.java +++ b/javac-plugin/src/main/java/org/moditect/deptective/internal/log/DeptectiveMessages.java @@ -29,6 +29,7 @@ public class DeptectiveMessages extends ListResourceBundle { public static final String GENERATED_CONFIG = "deptective.generatedconfig"; public static final String GENERATED_DOT_REPRESENTATION = "deptective.dotrepresentation"; public static final String PACKAGE_CONTAINED_IN_MULTIPLE_COMPONENTS = "deptective.packageinmultiplecomponents"; + public static final String CYCLE_IN_ARCHITECTURE = "deptective.cycleinarchitecture"; @Override protected final Object[][] getContents() { @@ -43,6 +44,12 @@ protected final Object[][] getContents() { "Created DOT file representing the Deptective configuration at {0}" }, { ERROR_PREFIX + PACKAGE_CONTAINED_IN_MULTIPLE_COMPONENTS, "Multiple components match package {1}: {0}" }, + { ERROR_PREFIX + CYCLE_IN_ARCHITECTURE, + "Architecture model contains cycle(s) between these components: " + System.lineSeparator() + + "{0}" }, + { WARNING_PREFIX + CYCLE_IN_ARCHITECTURE, + "Architecture model contains cycle(s) between these components: " + System.lineSeparator() + + "{0}" }, }; } diff --git a/javac-plugin/src/main/java/org/moditect/deptective/internal/model/Component.java b/javac-plugin/src/main/java/org/moditect/deptective/internal/model/Component.java index 3203ec1..e3c46bf 100644 --- a/javac-plugin/src/main/java/org/moditect/deptective/internal/model/Component.java +++ b/javac-plugin/src/main/java/org/moditect/deptective/internal/model/Component.java @@ -22,6 +22,9 @@ import java.util.Map; import java.util.Set; +import org.moditect.deptective.internal.graph.Dependency; +import org.moditect.deptective.internal.graph.Node; + /** * Describes a component, a set of packages identified by one more naming patterns. *

@@ -30,7 +33,7 @@ * * @author Gunnar Morling */ -public class Component { +public class Component implements Node { public static class Builder { @@ -76,6 +79,10 @@ public Component build() { public Map getReads() { return reads; } + + public String getName() { + return name; + } } private final String name; @@ -122,4 +129,51 @@ public Map getReads() { public String toString() { return name + " { contained=" + contained + ", reads=" + reads + "] }"; } + + @Override + public String asShortString() { + return name; + } + + @Override + public Dependency getOutgoingDependencyTo(Component node) { + return reads.entrySet() + .stream() + .filter(e -> e.getKey().equals(node.getName())) + .map(e -> new Dependency(Component.builder(e.getKey()).build(), 1)) + .findFirst() + .orElse(null); + } + + @Override + public boolean hasOutgoingDependencies() { + return !reads.isEmpty(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Component other = (Component) obj; + if (name == null) { + if (other.name != null) + return false; + } + else if (!name.equals(other.name)) + return false; + return true; + } + } diff --git a/javac-plugin/src/main/java/org/moditect/deptective/internal/model/PackageDependencies.java b/javac-plugin/src/main/java/org/moditect/deptective/internal/model/PackageDependencies.java index a24b5f5..23c3574 100644 --- a/javac-plugin/src/main/java/org/moditect/deptective/internal/model/PackageDependencies.java +++ b/javac-plugin/src/main/java/org/moditect/deptective/internal/model/PackageDependencies.java @@ -75,6 +75,10 @@ public void addWhitelistedPackage(PackagePattern pattern) { .removeIf(r -> pattern.matches(r.getKey())); } } + + public Iterable getComponents() { + return componentsByName.values(); + } } private final Components components; @@ -142,4 +146,8 @@ public boolean isWhitelisted(String packageName) { .findFirst() .isPresent(); } + + public Iterable getComponents() { + return components; + } } diff --git a/javac-plugin/src/main/java/org/moditect/deptective/internal/model/ReadKind.java b/javac-plugin/src/main/java/org/moditect/deptective/internal/model/ReadKind.java index 8a686f0..a7834c1 100644 --- a/javac-plugin/src/main/java/org/moditect/deptective/internal/model/ReadKind.java +++ b/javac-plugin/src/main/java/org/moditect/deptective/internal/model/ReadKind.java @@ -16,12 +16,17 @@ package org.moditect.deptective.internal.model; /** - * Describes the relationship beween two components. + * Describes the relationship between two components. * * @author Gunnar Morling */ public enum ReadKind { ALLOWED, DISALLOWED, + + /** + * The relationship is part of a cycle involving the two connected components. + */ + CYCLE, UKNOWN; } diff --git a/javac-plugin/src/main/java/org/moditect/deptective/internal/options/DeptectiveOptions.java b/javac-plugin/src/main/java/org/moditect/deptective/internal/options/DeptectiveOptions.java index 6776071..d3f2df5 100644 --- a/javac-plugin/src/main/java/org/moditect/deptective/internal/options/DeptectiveOptions.java +++ b/javac-plugin/src/main/java/org/moditect/deptective/internal/options/DeptectiveOptions.java @@ -81,6 +81,20 @@ public ReportingPolicy getUnconfiguredPackageReportingPolicy() { } } + /** + * Returns the policy for reporting cycles between components. + */ + public ReportingPolicy getCycleReportingPolicy() { + String policy = options.get("deptective.cycle_reporting_policy"); + + if (policy != null) { + return ReportingPolicy.valueOf(policy.trim().toUpperCase()); + } + else { + return ReportingPolicy.ERROR; + } + } + /** * Returns the task to be performed by the plug-in. */ diff --git a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/CycleTest.java b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/CycleTest.java new file mode 100644 index 0000000..adc5969 --- /dev/null +++ b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/CycleTest.java @@ -0,0 +1,50 @@ +/** + * Copyright 2019 The ModiTect authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.moditect.deptective.plugintest.cycle; + +import static com.google.testing.compile.CompilationSubject.assertThat; + +import org.junit.Test; +import org.moditect.deptective.plugintest.PluginTestBase; +import org.moditect.deptective.plugintest.cycle.bar.Bar; +import org.moditect.deptective.plugintest.cycle.baz.Baz; +import org.moditect.deptective.plugintest.cycle.foo.Foo; +import org.moditect.deptective.plugintest.cycle.qux.Qux; + +import com.google.testing.compile.Compilation; +import com.google.testing.compile.Compiler; + +public class CycleTest extends PluginTestBase { + + @Test + public void shouldDetectCyclesInArchitectureModel() { + Compilation compilation = Compiler.javac() + .withOptions( + "-Xplugin:Deptective", + getConfigFileOption() + ) + .compile( + forTestClass(Foo.class), + forTestClass(Bar.class), + forTestClass(Baz.class), + forTestClass(Qux.class) + ); + + assertThat(compilation).failed(); + assertThat(compilation).hadErrorContaining("Architecture model contains cycle(s) between these components:"); + assertThat(compilation).hadErrorContaining(" - bar, baz, foo, qux"); + } +} diff --git a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/bar/Bar.java b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/bar/Bar.java new file mode 100644 index 0000000..12e5207 --- /dev/null +++ b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/bar/Bar.java @@ -0,0 +1,25 @@ +/** + * Copyright 2019 The ModiTect authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.moditect.deptective.plugintest.cycle.bar; + +import org.moditect.deptective.plugintest.cycle.baz.Baz; +import org.moditect.deptective.plugintest.cycle.qux.Qux; + +public class Bar { + + Baz baz; + Qux qux; +} diff --git a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/baz/Baz.java b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/baz/Baz.java new file mode 100644 index 0000000..bae3b15 --- /dev/null +++ b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/baz/Baz.java @@ -0,0 +1,23 @@ +/** + * Copyright 2019 The ModiTect authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.moditect.deptective.plugintest.cycle.baz; + +import org.moditect.deptective.plugintest.cycle.foo.Foo; + +public class Baz { + + private Foo foo; +} diff --git a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/foo/Foo.java b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/foo/Foo.java new file mode 100644 index 0000000..19dbb71 --- /dev/null +++ b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/foo/Foo.java @@ -0,0 +1,23 @@ +/** + * Copyright 2019 The ModiTect authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.moditect.deptective.plugintest.cycle.foo; + +import org.moditect.deptective.plugintest.cycle.bar.Bar; + +public class Foo { + + private final Bar bar = new Bar(); +} diff --git a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/qux/Qux.java b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/qux/Qux.java new file mode 100644 index 0000000..abb85ae --- /dev/null +++ b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/cycle/qux/Qux.java @@ -0,0 +1,23 @@ +/** + * Copyright 2019 The ModiTect authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.moditect.deptective.plugintest.cycle.qux; + +import org.moditect.deptective.plugintest.cycle.bar.Bar; + +public class Qux { + + Bar bar; +} diff --git a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/visualize/VisualizeTest.java b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/visualize/VisualizeTest.java index 04389e5..a4fa1f7 100644 --- a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/visualize/VisualizeTest.java +++ b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/visualize/VisualizeTest.java @@ -23,6 +23,7 @@ import javax.tools.JavaFileObject; import javax.tools.StandardLocation; +import org.junit.Ignore; import org.junit.Test; import org.moditect.deptective.internal.util.Strings; import org.moditect.deptective.plugintest.PluginTestBase; @@ -33,6 +34,7 @@ import com.google.testing.compile.Compilation; import com.google.testing.compile.Compiler; +@Ignore public class VisualizeTest extends PluginTestBase { @Test @@ -83,7 +85,7 @@ public void shouldGenerateDotFileForAnalyse() throws Exception { .generatedFile(StandardLocation.CLASS_OUTPUT, "deptective.dot"); assertThat(deptectiveFile.isPresent()).isTrue(); String generatedConfig = Strings.readToString(deptectiveFile.get().openInputStream()); - + System.out.println(generatedConfig); assertThat(generatedConfig).isEqualTo(expectedConfig); } @@ -95,6 +97,7 @@ public void shouldGenerateDotFileForValidate() throws Exception { "-Adeptective.visualize=true", "-Adeptective.whitelisted=java.math", "-Adeptective.reporting_policy=WARN", + "-Adeptective.cycle_reporting_policy=WARN", getConfigFileOption() ) .compile( @@ -135,7 +138,7 @@ public void shouldGenerateDotFileForValidate() throws Exception { .generatedFile(StandardLocation.CLASS_OUTPUT, "deptective.dot"); assertThat(deptectiveFile.isPresent()).isTrue(); String generatedConfig = Strings.readToString(deptectiveFile.get().openInputStream()); - + System.out.println(generatedConfig); assertThat(generatedConfig).isEqualTo(expectedConfig); } } diff --git a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/whitelist/bar/Bar.java b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/whitelist/bar/Bar.java index c0a5289..f742590 100644 --- a/javac-plugin/src/test/java/org/moditect/deptective/plugintest/whitelist/bar/Bar.java +++ b/javac-plugin/src/test/java/org/moditect/deptective/plugintest/whitelist/bar/Bar.java @@ -15,6 +15,9 @@ */ package org.moditect.deptective.plugintest.whitelist.bar; +import org.moditect.deptective.plugintest.whitelist.foo.Foo; + public class Bar { + Foo f; } diff --git a/javac-plugin/src/test/resources/org/moditect/deptective/plugintest/cycle/deptective.json b/javac-plugin/src/test/resources/org/moditect/deptective/plugintest/cycle/deptective.json new file mode 100644 index 0000000..58bce94 --- /dev/null +++ b/javac-plugin/src/test/resources/org/moditect/deptective/plugintest/cycle/deptective.json @@ -0,0 +1,24 @@ +{ + "components" : [ + { + "name" : "foo", + "contains" : [ "org.moditect.deptective.plugintest.cycle.foo" ], + "reads" : [ "bar" ] + }, + { + "name" : "bar", + "contains" : [ "org.moditect.deptective.plugintest.cycle.bar" ], + "reads" : [ "baz", "qux" ] + }, + { + "name" : "baz", + "contains" : [ "org.moditect.deptective.plugintest.cycle.baz" ], + "reads" : [ "foo" ] + }, + { + "name" : "qux", + "contains" : [ "org.moditect.deptective.plugintest.cycle.qux" ], + "reads" : [ "bar" ] + } + ] +} diff --git a/javac-plugin/src/test/resources/org/moditect/deptective/plugintest/visualize/deptective.json b/javac-plugin/src/test/resources/org/moditect/deptective/plugintest/visualize/deptective.json index 1b5380b..63e6a68 100644 --- a/javac-plugin/src/test/resources/org/moditect/deptective/plugintest/visualize/deptective.json +++ b/javac-plugin/src/test/resources/org/moditect/deptective/plugintest/visualize/deptective.json @@ -13,6 +13,13 @@ "reads" : [ "org.moditect.deptective.plugintest.visualize.qux" ] + }, + { + "name" : "org.moditect.deptective.plugintest.visualize.qux", + "contains" : [ "org.moditect.deptective.plugintest.visualize.qux" ], + "reads" : [ + "org.moditect.deptective.plugintest.visualize.bar" + ] } ], "whitelisted" : [ "java.math" ]