Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#60 / #63 Resolving package cycle and setting up Deptective #62

Merged
merged 2 commits into from
Jun 23, 2022

Conversation

gunnarmorling
Copy link
Contributor

@gunnarmorling gunnarmorling commented Jun 21, 2022

Fixes #60.
Fixes #63.

@gunnarmorling
Copy link
Contributor Author

Note this also reduces the dependencies from frame to netty, but doesn't fully gte rid of them.

@gunnarmorling gunnarmorling marked this pull request as ready for review June 21, 2022 14:21
@gunnarmorling
Copy link
Contributor Author

Actually, this is growing on me. I think it's a step into the right direction. @tombentley, feel free to merge it, if you're happy with it, too.

@gunnarmorling gunnarmorling changed the title #60 WIP #60 / #63 Resolving package cycle and setting up Deptective Jun 21, 2022
@@ -263,5 +263,39 @@
</plugins>
</build>
</profile>
<profile>
<id>architecture-check</id>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is actually very fast, so it could be part of the "qe" profile and just always run. I've kept it separate for two reasons:

  • There's no stable Deptective release available on Maven Central yet (working on this atm.), pulling it via JitPack for now
  • Deptective currently doesn't work with Java 17; while we agreed on not moving to 17 for the time being (as in actively using its features), I don't want to give up on the capability to run the build with 17


import io.netty.buffer.ByteBuf;

public interface ByteBufAccessor extends Writable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we document what it's for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -22,10 +22,11 @@
* depends on NIO ByteBuffer, so copying between ByteBuffer and ByteBuf cannot
* always be avoided.
*/
public class ByteBufAccessor implements Readable, Writable {
public class ByteBufAccessorImpl implements ByteBufAccessor, Readable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have an asymmetry here between the Readable and Writable now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because clients of ByteBufAccessor currently only access the Writable methods, so I limited what it exposes (following my general preference for being restrictive in terms of what gets exposed). Do you see a need for exposing Readable there as well?

Comment on lines +3 to +5
"name" : "io.kroxylicious.proxy",
"contains" : [ "io.kroxylicious.proxy" ],
"reads" : [ "io.kroxylicious.proxy.filter", "io.kroxylicious.proxy.internal", "io.kroxylicious.proxy.internal.filter", "io.netty.*", "org.apache.logging.log4j" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm I understand this:

  • name is a logical name for this "rule"?
  • contains is a package name or pattern for matching packages?
  • reads is basically "is allowed to import/use from these other packages"? And may be package names or patterns

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and yes to the first two. On reads, it's references to other "components" (what you referred to as "rules"). not packages.

<showWarnings>true</showWarnings>
<compilerArgs>
<!-- <arg>-Xplugin:Deptective mode=ANALYZE components=io.netty.*:io.netty*;org.apache.kafka.*:org.apache.kafka*;io.kroxylicious.proxy.example.*:io.kroxylicious.proxy.example* visualize=true</arg> -->
<arg>-Xplugin:Deptective mode=VALIDATE cycle_reporting_policy=ERROR reporting_policy=WARN visualize=true</arg>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I guess all I really want to know is:

  • Will this fail the CI when the rules are broken?
  • Will the report contain the cute graph visualisation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No and no, as of now. Although ideally I'd want that to change to yes and yes eventually. The former will be easy, just a matter of running the build with that profile. On the latter, I was discussing it with @aalmiray (my partner in crime working on ModiTect), the following would have to happen:

  • Have Deptective produce Mermaid syntax rather than dot file (GraphViz)
  • Have a GH bot which takes the Mermaid stuff from a defined file in the workspace and pushes a comment with it

The latter is organizationally challenging, as we'll need a runtime environment for that bot. Unfortunately, regular GH Actions cannot push comments to PRs.

In any case, I'd leave all that to a follow-up issue.

@gunnarmorling
Copy link
Contributor Author

@tombentley, any more concerns about this one?

@tombentley tombentley merged commit 2457b4c into kroxylicious:main Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up Deptective for architecture validation Break up circular package dependencies
2 participants