openrewrite / rewrite-jenkins

OpenRewrite recipes to continuously modernize Jenkins plugins.
Apache License 2.0
9 stars 8 forks source link

Replace `DomNode#asText` with `DomNode#asNormalizedTest` #18

Open basil opened 1 year ago

basil commented 1 year ago

HtmlUnit 2.55.0 removed the deprecated DomNode#asText in favor of DomNode#asNormalizedTest. Plugins with a very old plugin parent POM (one with HtmlUnit 2.54.0 or earlier) will likely still be using asText and will thus fail to compile until these usages are converted to asNormalizedText.

basil commented 1 year ago

This and org.openrewrite.jenkins.UpgradeHtmlUnit_3_3_0 could likely be generalized into higher-level OpenRewrite functionality as it is specific to HtmlUnit but not specific to Jenkins.

timtebeek commented 1 year ago

Looks like this recipe would be a couple of lines of Yaml added to src/main/resources/META-INF/rewrite/htmlunit-3.yml. Would you want to get a first change?

We could indeed create a separate rewrite-htmlunit down the line; right now we only have those yaml recipes I believe, but that could expand once we run against more projects. Let me know if that's something you'd be willing to help maintain, or know folks that would.

timtebeek commented 1 year ago

For good measure I've also added the HtmlUnit organization repositories to the Moderne platform, if you want to create some goodwill with PRs their way. :)

basil commented 1 year ago

We could indeed create a separate rewrite-htmlunit down the line

I see no reason why we should have a separate rewrite-htmlunit. This seems like a better fit for https://github.com/openrewrite/rewrite-testing-frameworks since HtmlUnit is a testing framework.

timtebeek commented 1 year ago

That could work as well; let me know if you'd like to take that on, or want me to do so.