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

Caching for Osgi-bundles. #6

Closed
wants to merge 3 commits into from
Closed

Conversation

markehammons
Copy link

This is a modification I made to your plugin a couple of months back to speed up builds of my project. It makes the bundler regenerate a bundle if and only if the following have changed:

  • The classpath
  • The manifest
  • The embedded jars
  • The resources

If the bundle doesn't exist it will be generated no matter what.

…nifest, properties, etc of the bundle has changed.
@hseeberger
Copy link
Member

I don't understand why this is necessary, because – at least by default – a bundle is only created when running publish. Is it really necessary to speed that up? I think caching is one of the most tricky things in programming and hence I need a good reason to include it. And good tests, of course ;-)

@markehammons
Copy link
Author

My project must run publish-local every time a compile happens due to the way it's set up. Even if I managed to remove the publish-local requirement, it would still require osgi-bundle to be called on 40-45 subprojects each compile. That osgi-bundle step ends up costing me 30-40 seconds per rebuild, no matter if anything has changed. The caching I added reduces our minimum build time from 45s to 15s, so yes it's a pretty necessary speed up for our project.

I'm fairly certain it works since my project has been relying on this functionality for every build for about 2 months, but I can try to develop some tests to prove it's safe.

@harrah
Copy link
Member

harrah commented Nov 4, 2013

Caching tasks like this is a good idea. Maybe only publish creates a bundle by default, but it wouldn't be unreasonable for custom tasks to do something with it.

@reggert
Copy link
Contributor

reggert commented Nov 17, 2013

This PR conflicts significantly with the two other PR's I just merged (which conflicted with each other, but only by 1 line). From looking at the code, the conflict shouldn't be difficult to resolve (you just need to modify your code to account for the 1 character my PR removed, and the half-line the other PR added). Additionally, this change needs unit tests to verify that it works correctly. Please rebase your branch and add some tests.

@markehammons
Copy link
Author

I'll get it done.

Would a unit test showing the inputs to the bundle function are properly converted to a Set[File] to be fed to FileFunction.cached be fine?

@reggert
Copy link
Contributor

reggert commented Nov 17, 2013

Good question. The existing unit tests for the plugin are woefully inadequate. Currently, nothing tests the bundleTask function at all. All of the existing tests just test the individual subroutines that bundleTask calls (seqToStrOpt, headersToProperties, includeResourceProperty, etc.). This will need to be remedied some time in the (hopefully near) future. In the meantime, it would probably be sufficient to break out as much of your code into separate functions as possible and then test those, unless you feel ambitious enough to take on the task of running an end-to-end test for bundleTask.

@reggert
Copy link
Contributor

reggert commented Nov 17, 2013

I've just submitted issue #11 to try to address this to some degree.

@markehammons
Copy link
Author

Maybe on my vacation :)

On Sunday, November 17, 2013 09:42:55 AM Richard W. Eggert II wrote:

Good question. The existing unit tests for the plugin are woefully
inadequate. Currently, nothing tests the bundleTask function at all. All
of the existing tests just test the individual subroutines that
bundleTask calls (seqToStrOpt, headersToProperties,
includeResourceProperty, etc.). This will need to be remedied some time
in the (hopefully near) future. In the meantime, it would probably be
sufficient to break out as much of your code into separate functions as
possible and then test those, unless you feel ambitious enough to take on
the task of running an end-to-end test for bundleTask.


Reply to this email directly or view it on GitHub:
#6 (comment)

Conflicts:
	build.sbt
	src/main/scala/com/typesafe/sbt/osgi/Osgi.scala
	src/main/scala/com/typesafe/sbt/osgi/SbtOsgi.scala

	modified:   project/plugins.sbt
@markehammons
Copy link
Author

I've fixed the merge conflicts and better documented my code. I can help split up the bundle function soon, cause it's getting really complex.

@romainreuillon
Copy link
Contributor

Hi,

any new on this caching functionality being merged ?

Cheers,
Romain

@reggert
Copy link
Contributor

reggert commented Jun 22, 2014

I'm not really familiar enough with the sbt build process to understand the implications of this change to be comfortable with merging this. Maybe Mark or one of the Typesafe guys could take a look at it and verify that's it not going to cause the universe to implode or anything like that?

I'm mainly concerned that there may be edge cases where this would prevent the bundle from being rebuilt when it should be.

@ktoso
Copy link
Member

ktoso commented Feb 13, 2018

I'm very sorry that this has been dropped like this. Truth is, no one has maintained this plugin over the last years. With the Akka team occassionally stepping in to fix bugs that impacted our build...

I have to close this, as it's been a number of years, I'm not comfortable merging it, and it is currently conflicting.

Please reopen if you'd like to give it another shot though.

@ktoso ktoso closed this Feb 13, 2018
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.

6 participants