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

Fix dependency handling in JlinkPlugin (+ general improvements) #1226

Merged
merged 3 commits into from
May 28, 2019

Conversation

nigredo-tori
Copy link
Collaborator

@nigredo-tori nigredo-tori commented May 17, 2019

As outlined here:

  1. Since jdeps --print-module-deps is unreliable - switch to parsing the full jdepsoutput.
  2. The new jdeps behavior (throwing an error for missing dependencies) seems to be useful - include similar functionality into the new implementation.
  3. Add a fine-grained way to silence missing dependencies from the previous point (jlinkIgnoreMissingDependency). Add convenience helpers (JlinkPlugin.Ignore).
  4. Add a test for the new functionality.
  5. Test the plugin against JDK 12.

General improvements:

  1. Add a task for the list of modules (jlinkModules) to allow manually adding/removing these.
  2. Add a level of indirection when using Compile / fullClasspath to allow injecting classpath elements for the scan. This can be useful if not all the relevant dependencies should be a part of the actual classpath (I have a use case for that).

@muuki88 muuki88 added the jlink label May 24, 2019
Copy link
Contributor

@muuki88 muuki88 left a comment

Choose a reason for hiding this comment

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

Some minor remarks. If you have time to fix, it would be nice. Otherwise I'll merge and release :)

val jlinkModules = TaskKey[Seq[String]]("jlinkModules", "Modules to link")

val jlinkIgnoreMissingDependency =
TaskKey[((String, String)) => Boolean](
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some docs what the the function types represent in `(String, String) => Boolean)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

final case class Module(name: String) extends Source
final case class JarOrDir(name: String) extends Source

private val pattern = """^\s+([^\s]+)\s+->\s+([^\s]+)\s+([^\s].*?)\s*$""".r
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add examples for some common patterns that occur?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@muuki88 muuki88 merged commit 4702cc5 into sbt:master May 28, 2019
@muuki88
Copy link
Contributor

muuki88 commented May 28, 2019

Thanks @nigredo-tori for your work ❤️

@muuki88
Copy link
Contributor

muuki88 commented May 28, 2019

1.3.22 release is on its way

@muuki88
Copy link
Contributor

muuki88 commented May 28, 2019

@nigredo-tori given your recent activity and incredible contributions, are you interested in commit rights and being more active for native-packager.

If you are interested, but are unsure what this implies, we can either chat/email/hangout and I can answer any questions.

@nigredo-tori nigredo-tori deleted the jlink-missing-deps branch May 29, 2019 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants