-
Notifications
You must be signed in to change notification settings - Fork 444
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
Conversion of JDKPackager to use JDK-provided Ant tasks. #583
Conversation
* | ||
* see: https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/javafx_ant_task_reference.html | ||
*/ | ||
private[jdkpackager] def makeAntBuild( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue found: Method is longer than 50 lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue found: The number of parameters should not exceed 8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muuki88 How strict are you looking to be with the coding checks? I think the method "longer than 50 lines" in question is the one containing the Ant XML DOM. I can split it up into multiple functions, but you'd loose the one-to-one correspondence with what ends up getting written to the build.xml
file.
Also, in order to reduce the number of parameters to the DOM construction function I'd have to either introduce new intermediate container classes, or add some other level of indirection that I actually think adds complexity. That said, I'll submit something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a closer look. But for good reasons (e.g. clearly more readable), then rules should be broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So. This is a lot of XML inside a class. I know scala supports creating xml. However what do you think, putting this into an jdkpackager-ant.xml.template
and insert the dynamic parts with place holders?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would hate to looses the type checking, which has saved me a number of times. See what you think of the latest update, where I modularized it some.
see #583 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that looks cleaner.
object autoImport extends JDKPackagerKeys { | ||
val JDKPackager = config("jdkPackager") extend Universal | ||
} | ||
object autoImport extends JDKPackagerKeys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The autoImport
should also contain the JDKPackagerToolkit
so the user doesn't have to import it manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would hate to looses the type checking, which has saved me a number of times. See what you think of the latest update, where I modularized it some.
One thing regarding the PR. Could you squash the commits into one? |
@muuki88 Not sure I know how to collapse commits. Pointers? Sorry for such a n00b question. |
Sure :) In essence you do a |
5930052
to
30c8430
Compare
@muuki88 Thanks for your patience with this one. Glad to know how to |
No problem :) Always happy to help. |
In the test project on windows I get
On Ubuntu 15.04 with
Needed to set it manually with |
Ooof. Sorry about that. Thanks for the extra check. Will address soon. Wonder why Travis CI didn't catch the Linux one? |
Yeah, that's weird as travis uses the oracle jdk as well. However they have ubuntu 14.04 LTS I guess. |
This seems to be an Ubuntu specific problem. The old jdk-packager version doesn't work as well. |
jdkPackagerAssociations := Seq( | ||
FileAssociation("foobar", "application/foobar", "Foobar file type"), | ||
FileAssociation("barbaz", "application/barbaz", "Barbaz file type", jdkAppIcon.value) | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add one small section here, showing or to add other jdk-locations (if not found by default), like this
jdkPackagerTool := jdkPackagerTool.value orElse Some(file("/usr/lib/jvm/java-8-oracle/bin/javapackager"))
and how setting JDK_HOME
or JAVA_HOME
may help ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do! I assume you mean in the example build.sbt
file contents in jdkpackager.rst
? Or are you suggesting some more aggressive searching in the code?
one last comment. I think a small documentation hint should do the trick as jvm detection is already sophisticated and we can make it more sophisticated in follow up pull requests. |
@muuki88 On your last comment, do you mean additional info in the Sphinx docs, or do you mean in the error message? |
@metasim I meant sphinx. I think the error message is explanatory enough |
@muuki88 Regarding this:
What version of Java were you using? I'm wondering if the file association feature was added in JDK 8 build 40 (yes... Oracle added major new features in a build-increment release). It works on my build VM with JDK 1.8.0_45. |
I think I have an older one. Will try again, but as this is still experimental and working on your machine, we will refine later on. |
@muuki88 In addition to some updates to the documentation, I added debug mode logging of the search process for Are you OK with |
brilliant. can you squash again and I'll merge it right away :) |
4c48060
to
c683dd6
Compare
Provides more features and better configurability. History: * Fixed scripted property checking messages. * Reworked settings to use `.value` over `<<=` + `map` (and related constructs). * Initial attempt at resourcing mappings. * Updating tests for JDKPackagerPlugin. * Added call to Ant library to build package. * Added explicit icon to Ant build.xml. * Removed command-line mechanism for building package. Now completely Ant based. * Added ability to specify JVM user args and application args. * Added specification of runtime properties. * Added ability to define file associations. * Updated documentation. * Fixed expected output type. * Modularized Ant DOM building to appease static code checker. * Moved support case classes into autoImport. * Updated documentation in general, and specifically on specifying location of `ant-javafx.jar`. * Added debug logging messages during search for `ant-javafx.jar`.
c683dd6
to
6a40111
Compare
@muuki88 Squashed. :-) |
@muuki88 Just so you're aware (as the project lead), this plugin now depends on the |
Conversion of JDKPackager to use JDK-provided Ant tasks.
Awesome work ( as always ). Thanks for highlighting the dependency. The classpath plugins are getting used more and more, so using these is totally fine. |
I'll make an release ASAP |
@muuki88 Thanks so much. Don't forget to release the docs too (don't know if it's automatic).... old ones would really throw off users. File associations should be a winning feature for some. |
A major overhaul, replacing the command-line tool based package generation with an Ant task based one, thereby exposing new capabilities, including:
main
) argumentsThe task
jdkpackager:antBuildDefn
can be intercepted, allowing advanced customization via XML DOM processing.jdkpackager:writeAntBuild
generates the filetarget/jdkpackager/build.xml
, which can be inspected for debugging.