That worked really well. So I have added a warning that prints when an extern resource file can't be found. It's a very small, one line, change. In doing this I noticed it prints two paths that can't be found. The file I specified in my :externs that isn't there, and another path "closure-js/externs". Further digging revealed this is being added to the externs by lein-cljsbuild. lein-cljsbuild release notes say:
"Automatically add `closure-js/libs` to `:libs` and `closure-js/externs` to `:externs`. This means that libraries can put their libs and externs in `resources/closure-js/libs/<library-name>` and `resources/closure-js/externs/<library-name>`, respectively, and lein-cljsbuild will automatically pick them up." So if it prints a warning, it's going to print the warning on almost any lein-cljsbuild jobs. I could make it ignore "closure-js/libs", but then I've pulled a bit of cljsbuild implementation detail into clojurescript itself. I've made a pull request: https://github.com/clojure/clojurescript/pull/44 , but are people ok with it always printing a warning? Is there any other solution? Regards Crispin On Friday, January 30, 2015 at 5:11:06 PM UTC+8, Thomas Heller wrote: > > For the missing data.json, you probably need to run "./script/bootstrap". > > I tend to just run "lein install" but the version which gets installed is > [org.clojure/clojurescript "0.0-SNAPSHOT"] so you have to adjust the > version in your project as well. Or edit the clojurescript/project.clj to > set a specific version. > > Alternatively you can run "./script/build" which generates a proper > version off the number of git commits but that script touches some files so > extra take must be taken those changes don't end up in any git commit later. > > > On Friday, January 30, 2015 at 2:16:42 AM UTC+1, Crispin Wellington wrote: >> >> I got to the bottom of it. It's almost embarrassing to say. But the path >> to the w3c_audio.js extern file was wrong. Unfortunately, lein doesn't give >> any sort of warning or error if any of the externs files don't exist. I'm >> not sure if it's a cljsbuild issue, or a clojurescript issue, or a google >> closure compiler issue. >> >> So I am thinking I'll give adding this warning (or error?) to >> clojurescript a go. I notice in clojurescript source that closure.clj deals >> with running the closure compiler. I can see exactly where I want to add >> the warning (or tweak the calling of google closure compiler). I could do >> this, but I'm having trouble now running a locally built clojurescript. >> >> I've checked it out. Added some debug. Then I build a jar with 'lein >> jar'. I upload it to a local maven repository. I add that repository to my >> project-with-the-missing-extern's project.clj. I lein deps. It grabs the >> new jar. I lein cljsbuild, and the build begins, but then the build >> explodes with: >> >> Exception in thread "main" java.io.FileNotFoundException: Could not >> locate clojure/data/json__init.class or clojure/data/json.clj on classpath: >> , compiling:(cljs/source_map.clj:1:1) >> ... >> Caused by: java.io.FileNotFoundException: Could not locate >> clojure/data/json__init.class or clojure/data/json.clj on classpath: >> >> So this is now off the original topic, but how do you work on >> clojurescript itself? What step am I missing thats leading to the missing >> clojre/data/json.clj class on the classpath? What's the best workflow for >> hacking clojurescript itself? >> >> Regards >> >> Crispin >> >> On Wednesday, January 28, 2015 at 11:29:25 PM UTC+8, David Nolen wrote: >>> >>> Run a `lein deps :tree` to compare the version of the Google Closure >>> Compiler you are getting. >>> >>> David >>> >>> On Wed, Jan 28, 2015 at 9:58 AM, Crispin Wellington < >>> retrogr...@gmail.com> wrote: >>> >>>> OK something very strange is going on. I tried the let block, and it >>>> was the same in my project. >>>> >>>> So I created a new minimal project, lein new mies test-sound, and made >>>> a minimal test: https://github.com/retrogradeorbit/test-sound >>>> >>>> And here it works! >>>> >>>> Go back to my old project, and it doesn't. >>>> >>>> So now I have to go and gradually work through the project differences >>>> to see what's causing this. If I find anything, I'll post it. >>>> >>>> Thanks for your help >>>> >>>> Crispin >>>> >>>> On Wednesday, January 28, 2015 at 10:06:52 PM UTC+8, David Nolen wrote: >>>>> >>>>> I mentioned trying this in a `let` binding instead. What happens when >>>>> you try that? >>>>> >>>>> David >>>>> >>>>> On Wed, Jan 28, 2015 at 9:04 AM, Crispin Wellington < >>>>> retrogr...@gmail.com> wrote: >>>>> >>>>>> No, that's not it. So I tried: >>>>>> >>>>>> (def audio-context (js/AudioContext.)) >>>>>> (.decodeAudioData audio-context (js/ArrayBuffer. 256) #(println "ok" >>>>>> %) #(println "error" %)) >>>>>> >>>>>> and it compiled to: >>>>>> >>>>>> ;var zv = new AudioContext; >>>>>> zv.Rd(new ArrayBuffer(256), function(a) { >>>>>> return fo.c(mh(["ok", a], 0)); >>>>>> }, function(a) { >>>>>> return fo.c(mh(["error", a], 0)); >>>>>> }); >>>>>> >>>>>> This has really got me stumped. >>>>>> >>>>>> Crispin >>>>>> >>>>>> >>>>>> On Wednesday, January 28, 2015 at 6:23:29 PM UTC+8, Thomas Heller >>>>>> wrote: >>>>>>> >>>>>>> I just have a guess for you. >>>>>>> >>>>>>> AudioContext.decodeAudioData parameters are declared as ArrayBuffer, >>>>>>> Function, Function but you are passing "data" which is a String not an >>>>>>> ArrayBuffer. Maybe the type inference thinks you are calling a method >>>>>>> that >>>>>>> is not defined in the externs? >>>>>>> >>>>>>> Maybe it will work if you pass an ArrayBuffer? Other than that I see >>>>>>> no reason why it would munge the name. >>>>>>> >>>>>>> /thomas >>>>>>> >>>>>>> On Wednesday, January 28, 2015 at 2:14:31 AM UTC+1, Crispin >>>>>>> Wellington wrote: >>>>>>>> >>>>>>>> Hi there, >>>>>>>> >>>>>>>> I have been trying to compile some audio code in clojurescript in >>>>>>>> advanced mode. I have setup the w3c_audio.js extern (from: >>>>>>>> http://closureplease.com/externs/) into my extern list. When I >>>>>>>> compile, it prevents the munging of "AudioContext" (without the >>>>>>>> extern, >>>>>>>> this is being munged, so the extern is 'working'). But it doesn't >>>>>>>> prevent >>>>>>>> the munging of methods on AudioContext object. >>>>>>>> >>>>>>>> A super minimal example (but not working code): >>>>>>>> >>>>>>>> (def audio-context (js/AudioContext.)) >>>>>>>> (.decodeAudioData audio-context "data" #(println "ok" %) #(println >>>>>>>> "error" %)) >>>>>>>> >>>>>>>> compiles with advanced to: >>>>>>>> >>>>>>>> ;var zv = new AudioContext; >>>>>>>> zv.Rd("data", function(a) { >>>>>>>> return fo.c(mh([a], 0)); >>>>>>>> }, function() { >>>>>>>> return(0).call(null); >>>>>>>> }); >>>>>>>> >>>>>>>> zv.Rd is wrong. It should be zv.decodeAudioData. >>>>>>>> >>>>>>>> The externs file does indeed have this function prototype. here are >>>>>>>> the excerpts: >>>>>>>> >>>>>>>> /** >>>>>>>> * @constructor >>>>>>>> */ >>>>>>>> var AudioContext = function() {}; >>>>>>>> >>>>>>>> .... >>>>>>>> >>>>>>>> /** >>>>>>>> * @param {ArrayBuffer} audioData >>>>>>>> * @param {Function} successCallback >>>>>>>> * @param {Function=} errorCallback >>>>>>>> */ >>>>>>>> AudioContext.prototype.decodeAudioData = function(audioData, >>>>>>>> successCallback, >>>>>>>> errorCallback) {}; >>>>>>>> >>>>>>>> Why would closure compiler protect the AudioContext name, but munge >>>>>>>> the decodeAudioData name? What am I doing wrong? >>>>>>>> >>>>>>>> Regards >>>>>>>> >>>>>>>> Crispin Wellington >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Clojure" group. >>>>>> To post to this group, send email to clo...@googlegroups.com >>>>>> Note that posts from new members are moderated - please be patient >>>>>> with your first post. >>>>>> To unsubscribe from this group, send email to >>>>>> clojure+u...@googlegroups.com >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/clojure?hl=en >>>>>> --- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Clojure" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to clojure+u...@googlegroups.com. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To post to this group, send email to clo...@googlegroups.com >>>> Note that posts from new members are moderated - please be patient with >>>> your first post. >>>> To unsubscribe from this group, send email to >>>> clojure+u...@googlegroups.com >>>> For more options, visit this group at >>>> http://groups.google.com/group/clojure?hl=en >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to clojure+u...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.