Skip to content

Conversation

@snazy
Copy link
Contributor

@snazy snazy commented Nov 15, 2025

@Goooler I've created a couple new transformers. Would you mind taking a look which ones you think make sense for the project? I would then create individual PRs including tests for each of those.

  • Deduplicating transformer - to include the same path for the same content only once, detects conflicts
  • Merge property files transformer - to merge the properties of property files with the same path, detecting conflicts
  • Merge license files transformer - to produce a license with with the project's license and the license files from the dependencies (but yea, no info about the actual Maven GAV)
  • Enhance the Apache Notice transformer to make the output-path and source file patterns configurable
  • Tool/convenience task to find dependencies that contain a matching pattern-filterable to debug conflicts.
  • Helper class for the above task + transformers (hide boilerplate code)

* Multiple files with the same path but different content lead to an error.
*/
@CacheableTransformer
public open class DeduplicatingResourceTransformer
Copy link
Member

Choose a reason for hiding this comment

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

Part of a duplicate of #1548.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kind of, except that it validates that the content's the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe extend the existing one?

Copy link
Member

Choose a reason for hiding this comment

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

You can add new properties and new logic to that transformer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realized that PropertiesFileTransformer may not be suitable for reproducible builds, as it relies on j,u.Hashtable (the order of map entries isn't deterministic). Let me see what can be done about that.

public open class ApacheNoticeResourceTransformer @Inject constructor(
final override val objectFactory: ObjectFactory,
) : ResourceTransformer {
) : WithPatternFilterable(
Copy link
Member

Choose a reason for hiding this comment

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

Forgot to revert changes in ApacheNoticeResourceTransformer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really. I found some dependencies with a legit NOTICE file, with the path /NOTICE (not in META-INF/).
So the idea was to keep the existing patterns, but allow users to override the defaults.

Copy link
Member

Choose a reason for hiding this comment

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

I misread... We can extract a common pattern class for these, inspired by #1848 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Ref to #1850 for the migration.

Copy link
Member

Choose a reason for hiding this comment

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

So the idea was to keep the existing patterns, but allow users to override the defaults.

Users can use include/setIncludes to do so. Noted include/exclude magic in #1850, may note setIncludes/setExcludes too.

*/
@Suppress("unused")
@CacheableTransformer
public open class MergeLicenseResourceTransformer @Inject constructor(objectFactory: ObjectFactory) :
Copy link
Member

Choose a reason for hiding this comment

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

Fine to add.

Copy link
Member

Choose a reason for hiding this comment

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

You can create a PR for this first.

Copy link
Member

@Goooler Goooler Nov 17, 2025

Choose a reason for hiding this comment

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

This could be addressed into a separate PR for now.

@snazy snazy force-pushed the all-the-transformers branch 3 times, most recently from b70a321 to 665583e Compare November 17, 2025 11:45
@snazy
Copy link
Contributor Author

snazy commented Nov 17, 2025

(Just maintaining the branch for this draft PR as a "collection of things to split out".)

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.

2 participants