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

simpleUrlUpdate without sbt-rjs = updated /app/assets sources, not /target/web/ #6

Open
helllamer opened this issue Apr 23, 2015 · 12 comments
Assignees
Labels

Comments

@helllamer
Copy link

I've detected a bug, that takes place, if NO rjs presents in pipeline.

/app
  /assets
    /stylesheets
      /1.css

File 1.css contains something like this:

.some-icon {
    background-repeat: no-repeat;
    background-image: url('/assets/images/16.png');
}

build.sbt contains this:

pipelineStages ++= Seq(uglify, cssCompress, digest, simpleUrlUpdate, digest)

After calling sbt stage, original source file 1.css is modified by simpleUrlUpdate:

    background-image: url('/assets/images/0e62383352fa6de7092f51a29143260f-16.png');

Need to do hg revert after such stage...

File plugins.sbt contains this:

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.2.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "1.0.3")

addSbtPlugin("net.ground5hark.sbt" % "sbt-css-compress" % "0.1.3")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0-M3")
@neomaclin
Copy link
Owner

@helllamer thanks, I will try to see if I can reproduce the same error, my guess is that the rjs started the pipeline "correctly" by copying the assets to /target/web first. if that is the case, I believe we might need a solution out side of this plugin. Either had some sort of dummy plugin to first copy the the assets to the target path or we will need some changes upstream.

@neomaclin
Copy link
Owner

Should be fixed with latest commit

@helllamer
Copy link
Author

I've build and tried latest revision against sbt-web-1.2.0. There are a conflict somewhere near sbt-digest and packager.

$ sbt clean stage
...
[trace] Stack trace suppressed: run last mywww1/web-assets:packageBin for the full output.
[error] (mywww1/web-assets:packageBin) java.util.zip.ZipException: duplicate entry: public/main.js.md5

$ find ./target/web/ -name main.js.md5
./target/web/digest/main.js.md5
./target/web/simpleUrlUpdate/main.js.md5

One oblivious idea how to fix it in build.sbt:

excludeFilter in simpleUrlUpdate := "*.md5"

, but it does not help for unknown reason. I've tried sbt clean stage, but .md5 files from sbt-digest still copied into target/web/simpleUrlUpdate.

includeFilter also does not help/work.

sbt-web pipeline value was:

pipelineStages ++= Seq(digest, simpleUrlUpdate, digest)

UPD: If rjs presents in pipeline, same error occurs.

@neomaclin
Copy link
Owner

hmm, that is odd. I had the changes tested with activator stage and here was the some of the testing output I had.

[info] Packaging /Users/neo.lin/NurunRepo/wm_browse/target/walmart-ca-1.0-assets.jar ...
[info] Done packaging.
[success] Total time: 221 s, completed 23-Apr-2015 5:27:45 PM
$ find . | grep cartCheck
3282:./app/assets/css/cartCheckoutShared.less
45688:./target/walmart-ca-1.0-assets/public/css/07646129fd7579a0a281faa0b5d7dbd2-cartCheckoutShared.min.css.map
45692:./target/walmart-ca-1.0-assets/public/css/1061281195cbe53a700eccc41c5eb7a0-cartCheckoutShared.min.css
45698:./target/walmart-ca-1.0-assets/public/css/26102dd9b801231dcda56d6bb85c8787-cartCheckoutShared.min.css
45778:./target/walmart-ca-1.0-assets/public/css/cartCheckoutShared.less
45779:./target/walmart-ca-1.0-assets/public/css/cartCheckoutShared.min.css
45780:./target/walmart-ca-1.0-assets/public/css/cartCheckoutShared.min.css.map
45781:./target/walmart-ca-1.0-assets/public/css/cartCheckoutShared.min.css.map.md5
45782:./target/walmart-ca-1.0-assets/public/css/cartCheckoutShared.min.css.md5
49397:./target/web/classes/main/META-INF/resources/webjars/walmart-ca/1.0/css/cartCheckoutShared.less
49398:./target/web/classes/main/META-INF/resources/webjars/walmart-ca/1.0/css/cartCheckoutShared.min.css
49399:./target/web/classes/main/META-INF/resources/webjars/walmart-ca/1.0/css/cartCheckoutShared.min.css.map
50220:./target/web/digest/css/07646129fd7579a0a281faa0b5d7dbd2-cartCheckoutShared.min.css.map
50224:./target/web/digest/css/1061281195cbe53a700eccc41c5eb7a0-cartCheckoutShared.min.css
50230:./target/web/digest/css/26102dd9b801231dcda56d6bb85c8787-cartCheckoutShared.min.css
50301:./target/web/digest/css/cartCheckoutShared.min.css.map.md5
50302:./target/web/digest/css/cartCheckoutShared.min.css.md5
52599:./target/web/less/main/css/cartCheckoutShared.min.css
52600:./target/web/less/main/css/cartCheckoutShared.min.css.map
52716:./target/web/simpleUrlUpdate/css/07646129fd7579a0a281faa0b5d7dbd2-cartCheckoutShared.min.css.map
52720:./target/web/simpleUrlUpdate/css/1061281195cbe53a700eccc41c5eb7a0-cartCheckoutShared.min.css
52780:./target/web/simpleUrlUpdate/css/cartCheckoutShared.less
52781:./target/web/simpleUrlUpdate/css/cartCheckoutShared.min.css
52782:./target/web/simpleUrlUpdate/css/cartCheckoutShared.min.css.map
52783:./target/web/simpleUrlUpdate/css/cartCheckoutShared.min.css.map.md5
52784:./target/web/simpleUrlUpdate/css/cartCheckoutShared.min.css.md5

yes the md5 files are in both digest and suu folder, but it didn't report the duplicate exeception?

@helllamer
Copy link
Author

Ok, I will make more experiments on/after weekend in different configurations and report results here.

@helllamer
Copy link
Author

@neomaclin I've tried to continue work after summer vacation, but 1.0.1 totally doesn't work for me on my fat project in all cases (with and without sbt-rjs) with errors like this:

/web-assets:packageBin) java.util.zip.ZipException: duplicate entry: public/main.js.md5

Hope to will find source of problem.

1.0.0 works very ok even with latest play-2.4.2, but i've found other problem (fixed in fe5b346 , see commit message). Will do PR in couple of days.

@neomaclin
Copy link
Owner

Thanks @helllamer . The duplication error I believe is due to the fact I didn't have a filtering on file names with in the pipeline. And the reason myself does have that error could be related to how our project is structured(like a forced "clean" on each stage). one of the fixes I have was to do a move(rather than copy) in the sbt task itself.

But thanks for the follow up on this.

@cornerman
Copy link

I had a similar problem with source files being rewritten in version 1.0.0. For me, this was fixed by updating to version 1.0.1 (no problems so far). What is the status on this? Are you planning on publishing this version also?

@neomaclin
Copy link
Owner

@cornerman my publishing repo rights has been renounced...for awhile. I am not sure I would be able to do a follow up on the binary release anytime soon.

As for the solution itself. I do not have a working environment for me now as I have moved to another company/work, not sure I want to have a "fix" fully tested before I push out the changes.

@cornerman
Copy link

difficult indeed. I did not do heavy testing, as I have just one html file in which the asset filenames need to be adapted. But it works. Just, locally publishing is tedious.

As an alternative, do you maybe have an idea what configuration causes the problems with 1.0.0? I use it here to update the file assets/public/index.html in the target directory.

Does it make sense for you to release it as a snapshot? Otherwise, I would consider forking and releasing it myself if that is okay with you; as I will need something similar.

@neomaclin
Copy link
Owner

You are welcomed to mold it to any shape or form as per your needs.

As per usage you linked, it might, just my guess, be related you have only used the "digest" filter once.

But I am not very sure if that really is the cause, as I do believe you are not using it with other static files like js or css, which required the second stage "digest" to update the md5 values for related files.

The solution wouldn't be really be done via the configuration.

Reading my own input couple years back, I believe it has to be done with code itself:

The duplication error I believe is due to the fact I didn't have a filtering on file names with in the pipeline. And the reason myself does have that error could be related to how our project is structured(like a forced "clean" on each stage). one of the fixes I have was to do a move(rather than copy) in the sbt task itself.

@cornerman
Copy link

Thank you for the input! As the current version works for me, I would then fork this repo and release it as is, just under my org. for now as a snapshot and if it keeps on working as 1.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants