Open muffl0n opened 10 years ago
This one is tricky :)
Thanks go out to my coworker who stresses wro4j with cascaded imports as if there were no tomorrow. :)
The only reason it works on the first run seems to be that the directory "generated2" does not exist. See ro.isdc.wro.maven.plugin.Wro4jMojo.isIncrementalCheckRequired():
@Override
protected boolean isIncrementalCheckRequired() {
return super.isIncrementalCheckRequired() && destinationFolder.exists();
}
A possible solution could be holding a storage per group (which is expensive), or treating import statements differently when dealing with change detection...
My first idea was to store the hashes not only by path
/scss/header.scss=77141eb86ceb6a88beabe40d81fd1a65b5ce9e64
but also by group
base:/scss/header.scss=77141eb86ceb6a88beabe40d81fd1a65b5ce9e64
base2:/scss/header.scss=77141eb86ceb6a88beabe40d81fd1a65b5ce9e64
But I'm not sure if this is a good solution.
This is similar to have storage per group. The disadvantage is that there will be multiple checks for change for the same resource when it is referred from different groups.
I would prefer not checking twice for change. Instead of keeping a Map<String, Boolean>
(<uri>, <change flag>)
, to keep Map<String, Map<String, Boolean>
(where map holds the flag for each group).
In my project muffl0n/wro4j-scss-test I have two different groups using two different scss-files: wro.xml:
The base.scss and base2.scss however both import the same header.scss:
On the first run the plugin does just fine:
But after changing the header.scss from
to
only the first group get's regenerated:
The problem seems to be that on the first plugin execution "css_test" the new fingerprint for header.scss get's written to the fallbackStorage. On the second execution "css_test2" the "previousFingerprint" is the one that was just written to the fallbackStorage by the first execution and not that one that was written there by the previouse run of the plugin. See: ro.isdc.wro.maven.plugin.support.ResourceChangeHandler.isResourceChanged(Resource).previousFingerprint
So in fact, if two executions share the same resources they have a problem sharing the same fallbackStorage, too.