ArchUnit icon indicating copy to clipboard operation
ArchUnit copied to clipboard

Split ArchUnit into separate artifacts

Open OLibutzki opened this issue 3 years ago • 8 comments

ArchUnit contains three layers: Core, Lang and Library.

There are some use cases (in my case archifacts ) that just use the core layer, but ArchUnit is distributed as a single jar file.

Have you thought about splitting the ArchUnit layers into different jar files?

This might be related to #206.

OLibutzki avatar Jan 02 '22 11:01 OLibutzki

I haven't really thought about it so far because it didn't seem like there are too many users of just the core layer. But principally I would be open about it, if it makes sense. What would be your main intention though? Is it so strip mental burden (of having classes on the classpath that you don't need?) or is it artifacts size? Because for the latter I'm unfortunately not sure if splitting would do much good, because most of the size comes from the repackaged Guava classes :grimacing: (assuming that a couple of MB more or less are irrelevant in 2021 :man_shrugging:)

codecholeric avatar Jan 02 '22 14:01 codecholeric

What would be your main intention though? Is it so strip mental burden (of having classes on the classpath that you don't need?) or is it artifacts size?

The former. With archifacts I try to have as few deps as possible (especially in the core).

Having some stuff in the classpath which is not relevant might be confusing/misleading.

I think about using the Lang API, too (see https://github.com/archifacts/archifacts/issues/27), but this would be part of another archifacts module with potentially other deps.

OLibutzki avatar Jan 02 '22 14:01 OLibutzki

I'll see if I get around to this! I do see that the core alone does provide its own value and thus it makes sense to publish it on its own. Should also not be too hard to refactor this, but it will take a little time until everything is tested then, that the publishing works correctly, etc.

codecholeric avatar Jan 13 '22 18:01 codecholeric

I do see that the core alone does provide its own value

Definitely, without the core, I would not have started with archifacts.

Maybe you can use the current artifact id as an umbrella for the different layer jars. One modules which just depends on the outsourced modules.

By doing this you don't break existing usages.

OLibutzki avatar Jan 13 '22 18:01 OLibutzki

Yeah, that was my plan :slightly_smiling_face: I would just introduce archunit-core and let the artifact archunit depend on it. That way no dependencies out there would need to be adjusted :+1:

codecholeric avatar Jan 13 '22 18:01 codecholeric

But I would probably only extract core for now until there is a further request :slightly_smiling_face: Keep it simple :man_shrugging:

codecholeric avatar Jan 13 '22 18:01 codecholeric

Yeah, no further request from my side. 😃

OLibutzki avatar Jan 13 '22 19:01 OLibutzki

Quick update, I tried this time-boxed but unfortunately ran into some problems :disappointed: The code can be split quite easily, but the repackaging of the libraries causes some headache. Unfortunately, that part has somewhat "grown historically" :zany_face:. Before we do this I think we need to clean up the Gradle tasks to use both normal and shadow configuration in a clean way.

codecholeric avatar Feb 20 '22 07:02 codecholeric