Skip to content

Conversation

@gselzer
Copy link
Member

@gselzer gselzer commented Jul 28, 2021

This PR adds a set of package enforcement rules to all incubator builds. As of this writing, we enforce two rules:

  • No package cycles
  • No subpackage dependence

TODO:

Closes scijava/scijava#62

@gselzer gselzer requested a review from ctrueden July 28, 2021 18:36
@gselzer gselzer self-assigned this Jul 28, 2021
@gselzer gselzer added the enhancement New feature or request label Jul 28, 2021
@gselzer gselzer force-pushed the scijava/incubator/package-enforcement branch from 44ed928 to 97684b3 Compare August 5, 2021 17:59
@gselzer gselzer force-pushed the scijava/incubator/package-enforcement branch from 97684b3 to 4628318 Compare September 14, 2021 19:13
@ctrueden ctrueden assigned ctrueden and unassigned gselzer Nov 12, 2021
OpEnvironment returns an OpBuilder, so OpBuilder should be in the same
package
Since OpEnvironments have Hints, the Hints need to be in the base
package.
This commit also makes some changes to SimplifiedOpRef that make it more
correct. I chose to throw UnsupportedOperationException for many of
the standard OpRef methods because the concrete type that the
SimplifiedOpRef is asking for is rather indeterminate - it is really
asking for an Op that is of a set of Types, so to pin a particualar set
of arguments, a particular output type, etc. is not possible until you
have a SimplifiedOpInfo to narrow down these Types. Similarly, we throw
an UnsupportedOperationException for typesMatch because the typing of
the SimplifiedOpRef is unclear. We could match against all possible
permutations of the input/output types, but we don't really have enough
information about how to form the opType. We could probably find a way
to devise all opType permutations, but this would be a pretty
computationally expensive method to run, so for now we'll just throw an
error
This prevents us from having to declare it. There was no reason why we
should
These methods do not depend on Ops, so we should export them for broader
usage
This allows us to later remove the org.scijava.param fork
This commit also adds an isRequired() field to Member.
@ctrueden ctrueden force-pushed the scijava/incubator/package-enforcement branch from a4fd461 to d4f9fc4 Compare November 19, 2021 22:24
Forked from
de.andrena.tools.nopackagecycles:no-package-cycles-enforcer-rule.
The current situation is untenable since Creators depends on the
net.imagej.ops2.create.kernel and net.imagej.ops2.create.img packages.
Ideally, we'd split out the image- and kernel create Ops into their own
packages like we had, but the kernel and image creator Op fields rely on
the (non-static) Op fields in the main package. Therefore if we moved
these Ops to the subpackages, we would have to duplicate code. To
prevent this duplication, we shall just consolidate to one package.
There seemed to be no reason for this package. The contents did not
really deal with Meshes, and many Ops in the net.imagej.ops2.geom.geom3d
package (that actually imported Mesh) depended on this subpackage (which
is bad). For these reasons, let's just absorb the mesh subpackage into
the geom3d package
This was a tough decision, as I'd like to keep the provenance stuff
separate from the matcher, but we have to take the OpHistory in the
OpWrappers, so we have to make this change. It is probably worth
considering making a scijava-ops-provenance module that can stand alone
from scijava-ops(-engine)
@ctrueden ctrueden force-pushed the scijava/incubator/package-enforcement branch from d4f9fc4 to 90b38f0 Compare November 19, 2021 23:59
@ctrueden ctrueden marked this pull request as ready for review November 20, 2021 00:06
Copy link
Member

@ctrueden ctrueden left a comment

Choose a reason for hiding this comment

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

I released a new scijava-maven-plugin 2.0.0 with the two new package rules, and updated this PR accordingly, such that there are no more WIP commits. LGTM now.

@ctrueden ctrueden merged commit e5114b8 into main Nov 20, 2021
@ctrueden ctrueden deleted the scijava/incubator/package-enforcement branch November 20, 2021 00:08
@ctrueden ctrueden removed their assignment Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

Enforce better package relationships at build time

3 participants