Giter Site home page Giter Site logo

janscheible / pocketsaw Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 0.0 1.58 MB

Compile time sub-module system, aimed at package group dependency organization within a Maven project resp. Java 9 module (and even more, see the Angular example).

License: MIT License

Java 95.81% HTML 4.12% JavaScript 0.07%

pocketsaw's People

Contributors

dependabot[bot] avatar janscheible avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pocketsaw's Issues

weighted code edges in dependency graph

Currently code dependencies are binary. Either there or not.
To show if an dependency is rather weak or strong it would be good to add the number of dependency relations in the code to the dependency graph.

Maven plugin with requiresProject=false in addition to CLI

In addition to the CLI a Maven plugin with a Mojo that has requiresProject=false could be added.
That would allow and invocation like

mvn com.scheible.pocketsaw:pocketsaw-maven-plugin:run -DsubModules=sub-module.json -Ddependencies=dependencies.json -Dsource=dependency-cruiser -Doutput=pocketsaw-dependency-graph.html

even without having a surrounding Maven project.

native support of es6 modules

Currently JavaScript (and TypeScript) support is available via Dependency cruiser. Disadvantage is that Dependency cruiser requires nodejs. For native support it should be enough for a beginning to extract all static and dynamic import statements and resolve them.

integration with jQAssistant

Identifying code level dependencies and scanning for all @SubModule and @ExternalFunctionalities annotated classes is a perfect fit with jQAssistant.

The main question is how the integration should look like. Perhaps Pocketsaw can be called in a jQAssistant plugin.

layered representation of code dependencies

The current dependency graph with a physic based layout gets rather confusing as the number of sub-modules increases.
For graph drawing there are algorithms for Layered graph drawing.
To deal with cycles one approach would be to remove edges with lowest number of code dependencies (introduced in #16) until there are no cycles left.
That would leave us with all allowed dependencies going from top to bottom. Only the illegal ones will go from bottom to top.

improve support for multi module projects

Some investigations are needed:

  • How to share external functionality definitions?
  • How to create a unified dependency graph for all modules?
    • Hierarchical drill down in the visualization would be great. :-)

integration with Dependency Cruiser

With dependency-cruise -T json Dependency Cruiser can output all its informations into a JSON file that can easily be parsed. Together with the support for generic third-party dependency information sources (#11) this output can be used in Pocketsaw.

support for generic third-party dependency information

Some Java interface like:

interface PackageDependencySource {
  PackageDependencies read(File file);
}

It can then be implemented for any third-party dependency information source and be passed to Pocketsaw invocation. Third-party dependency information source selection must later also be available for the CLI (see #12).

extraction of pocketsaw-api

In order to clearly see the exposes API surface all classes visible to the outside (mainly unit tests but also classes implementing PackageDependencySource) should go to that artifact. The annotations should go to something like pocketsaw-annotations.

wrong cycles are reported

For a graph with nodes a, b, c and edges a -> b, b -> c, c -> b an incorrect cycle of a -> b -> c -> a is reported. Reason for that is that the cycle is correctly detected but the access route starting from a is treated as part of the cycle.

improve CycleDetector class

For now the cycle detector in com.scheible.pocketsaw.impl.dependency.CycleDetector is very basic. It finds any cycle in a non deterministic way. That also means it is not always the shortest cycle.

Perhaps Highwheel can be used or at least an inspiration.

command line support

Something like: pocketsaw <sub-module.json> <dependencies.file> {<first-deps-source>|<second-deps-source>} <pocketsaw-dependency-graph.html>.
In order to support a workflow similar to Workflow for using Pocketsaw in a project there must also be a way to skip the check for illegal code dependencies (e.g. --ignore-illegal-code-dependencies).
Also meaningfull error codes will make integration into some scripts easier.

unmatched package when generating code

When for example using openapi-generator-maven-plugin to generate an API client in a package outside of the base package this works with Pocketsaw.analizeClasspath(...) but not with Pocketsaw.analizeCurrentProject(). The reason is that ClassgraphClasspathScanner (currently the only DependencyAwareClasspathScanner implementation) respects the base package but the otherwise used JdepsWrapper not.

Jdeps wrong path on Arch Linux

Unit test fails on an Arch Linux system:

java.io.UncheckedIOException: java.io.IOException: Cannot run program "/usr/lib/jvm/java-11-openjdk/../bin/jdeps": error=2, No such file or directory

The correct path on my system is:

$ which jdeps
/usr/lib/jvm/default/bin/jdeps

(This is a symlink, on Arch Linux you can easily change the Java version using a script)

Or the direct path:

$ /usr/lib/jvm/java-11-openjdk/bin/jdeps -version
11.0.4

JAVA_HOME is not set

jshell> System.getProperty("java.home");
$1 ==> "/usr/lib/jvm/java-11-openjdk"

It seems like the system property does not include the bin directory while the environment variable does.

duplicate key exception in DependencyGraphFactory

Happens since 1.2.0 and was observed in several different projects:

java.lang.IllegalStateException: Duplicate key 1
	at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
	at java.util.HashMap.merge(HashMap.java:1254)
	at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at com.scheible.pocketsaw.impl.dependency.DependencyGraphFactory.lambda$create$4(DependencyGraphFactory.java:34)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at com.scheible.pocketsaw.impl.dependency.DependencyGraphFactory.create(DependencyGraphFactory.java:31)

descriptor auto matching

Sub-module and external functionality descriptors should be generated automatically if they are not explicitly defined.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.