Fork me on GitHub
#boot
<
2015-08-27
>
xifi07:08:54

@alandipert: thanks for the link. I still think the README should be changed. The wiki page for Windows describes how to setup an environment where you can build and install boot, but you already provide a pre-built executable. My issue is - if you just link to an executable people expect it to just work. This isn't true due to what we discussed with @micha and the user ends up installing boot, running it and getting huge stacktraces. That is not a good start. If the temp file deletions don't work and they are critical to do then the tool is broken on the platform.

xifi07:08:40

Something like "We're looking for a Windows developer to help us fix some issues we have on the platform. In the meantime you can use docker with our container." would set up the expectations and call for some help

onetom07:08:05

@martinklepsch: @juhoteperi @micha we see there is some dependency order carried within the boot fileset for cljs files https://github.com/cljsjs/boot-cljsjs/commit/35458dc31793782343953a405dcfb5cfab730c6e#diff-20583ae277bacc57514e87233552c403R37 since we have an issue with ordering, we were thinking if there is any docs about this somewhere? we would like to write an initialization script in CLJS and let a :foreign-lib :require it. but the CLJS code is located after the foreign-lib code in the :simple or :advanced optimized source, the foreign-lib can not see the effects of CLJS init code. can we use this :dependency-order somehow to control this ordering?

juhoteperi07:08:53

The dependency order set by boot-cljs doesn’t include foreign-libs

juhoteperi07:08:13

E.g it only works with cljs namespaces

juhoteperi07:08:32

though this doesn’t affect simple or advanced builds at all

onetom07:08:22

aren't cljs namespaces google closure module names too? (just to confirm)

juhoteperi07:08:57

But the dependency order is build from cljs namespaces and not closure modules currently

onetom07:08:06

can we influence the google closure compiler's ordering in optimized modes somehow?

juhoteperi07:08:20

Other than by provide and require, no

juhoteperi07:08:26

I would think it should work

juhoteperi07:08:34

If it doesn’t, it should be fixed upstream

juhoteperi07:08:45

I’m not sure if the problem is in Cljs or Closure

xifi07:08:36

@micha: you said the issue might be with non-closed handles on the files. Does this come from clojure's core? Can't that be fixed? However reading through the web I found that java might not be the only culprit - it is common for other programs to look through newly created files - search indexers, antivirus software etc. If these are using the file at the moment of deletion then it will fail.

onetom07:08:49

deraen: thanks!

onetom07:08:12

we will isolate the issue later then and just hack it around somehow for now

xifi07:08:43

I'm quite surprised this cannot be fixed, damn windows simple_smile Couldn't there be some safety code that e.g. tries to delete the file several times with some small delay, up till a fixed amount of retries?

juhoteperi07:08:00

@onetom: Did it work with no optimization? I’m seeing there might be a problem with changing contents of foreign-lib js

xifi08:08:38

reading through issues on JIRA for clj and cljs there are fixes on the file handle leaks but they'll only get into the next versions

xifi08:08:39

oh boy, it works with clojure 1.8.0-alpha4 and clojurescript 1.7.58 (107 died with some horrible error), which is strange because 1.7.58 doesn't include the fix on the leak yet

xifi08:08:08

@micha: this ^ means that going forward the new versions might fix these issues on windows. Mind you it still might fail randomly if any other program gets its hand on the file(s)

juhoteperi08:08:21

@onetom: Foreign-dep source is concatenated to start of output file in optimization mode by Cljs compiler

juhoteperi08:08:01

Few lines up, optimize is called with js sources, including compiled cljs files but excluding foreign-dep files and that creates the optimized source

juhoteperi08:08:42

I’m thinking that if you write the JS code as Closure module, it should work

juhoteperi08:08:31

But I couldn’t that to work either

martinklepsch09:08:47

@juhoteperi: are you talking about foreign libs reloading? Seems like fig wheel recently added such feature, maybe worth drawing inspiration from there

juhoteperi10:08:14

@martinklepsch: Problem is not with reloading but with Cljs compiler, it doesn’t copy changed foreign-dep files to output-dir, not much we can or should do

onetom10:08:58

@juhoteperi: in non optimised mode the execution order was correct IF we only required the foreign lib from the main namespace and let it trasitively require the cljs init code

onetom10:08:48

But since there is no explicit reference to the cljs init code from the foreign lib, it gets dead code eliminated in adv mode and combined in the wrong order in simple mode

juhoteperi10:08:20

I’m thinking the reason is different

juhoteperi10:08:33

Foreign-dep code is always prepended to optimized output

juhoteperi10:08:58

Foreign-dep files are not closure modules, they are not sorted with other files

onetom10:08:49

Im walking to the ferry atm but i will prep a demo repo as soon as i sat down

juhoteperi10:08:04

I did already test this

onetom10:08:18

What u say contradicts to why it works in opt none mode

juhoteperi10:08:13

In dev mode the files are copied to output folder and they have dependency data mocked

juhoteperi10:08:41

They still aren’t Closure modules though their dependency info is added to dependency index

juhoteperi10:08:41

In dev mode Closure compiler is not used at all (Closure lib is used)

juhoteperi10:08:17

In optimized mode Closure compiler takes care of concatenating the files to correct order but it doesn’t handle foreign-deps at all

onetom10:08:19

> In dev mode Closure compiler is not used at all (Closure lib is used) ^^^ this was unclear to me until now! so the cloSure compiler is not consuming the "mocked dependency data"?

juhoteperi10:08:46

That’s how I understand the code

juhoteperi10:08:12

https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1702-L1716 this is the relevant part and it does filter foreign-deps out of optimize call

onetom11:08:06

How come foreign-libs can get munged still? Or thats not what optimize does?

juhoteperi11:08:38

They should not be munged

onetom11:08:54

if i would ask: "can a foreign-lib depend on cljs code and expect the side-effects of the cljs code accessible to visible to the foreign-lib?" would that precisely summarize the issue im facing now?

juhoteperi11:08:32

@onetom: I’m not sure if side-effects are necessary?

onetom11:08:53

what do u mean by necessary? foreign-libs are stupid to expect global state before they start

juhoteperi11:08:43

Hmm, I guess defining vars is also a side-effecty

onetom11:08:46

here is a minimal example demonstrating the issue

juhoteperi11:08:51

dnolen wont look into examples using something else than Cljs compiler

juhoteperi11:08:56

Also check his message on #C03S1L9DN

onetom11:08:13

that's why im just sharing the link here simple_smile

micha12:08:40

@onetom you can make a foreign lib into a real google closure lib if you want. then it would behave exactly the way any lib in the goog.* namespaces do with respect to dependency ordering and cljs compiler will not treat it specially

micha12:08:16

@onetom: the way you do this is suppose you have my.js for example, with some js in it

micha12:08:35

goog.provide('my');
goog.require('some.cljs.namespace');
eval("...the my.js javascript contents...");

micha12:08:09

then it's a bona fide closure library and can be passed through the closure compiler etc

micha12:08:45

you still need to reference the things it creates via the js/* namespace

micha12:08:52

and you need to :require it

micha12:08:08

but it will participate 100% in the dependency graph

onetom12:08:18

i would still need to specify it in the :compiler-options within :libs?

micha12:08:36

yes i believe so

micha12:08:25

i had a task for this back in the early days of cljsjs

micha12:08:42

to package these things automatically

micha12:08:31

because i found :libs to be easier than :foreign-libs, fewer special cases and stuff

onetom12:08:36

hmm... all these things are relevant when im acquiring the foreign-lib during build time, not runtime. i just realized i forgot to think about the runtime case totally...

onetom12:08:04

am i correct if i say the difference between the 2 approach is the level of coupling?

micha12:08:37

the level of involvement by the cljs compiler is the real difference

onetom12:08:51

if i acquire the foreign lib at runtime (let the browser of the client download it) then the lib dev can seamlessly distribute minor version upgrades and im not forced to redeploy my app which depends on that lib

micha12:08:01

when you package it as a :lib i think you short circuit some of the cljs compiler stuff that might be messing you up

micha12:08:29

well runtime is a completely different thing

onetom12:08:32

but if i get the foreign lib at compile time, then i wont "benefit" from their minor version upgrades automatically

micha12:08:47

you need to use the closure runtime loader in your application for that

onetom12:08:29

wow... so there is such a thing too... simple_smile

micha12:08:34

i've never messed with that, because i want to lock down the versions of code that's running in my application to protect me from upstream regressions

micha12:08:45

also i personally feel like it's somewhat rude to load foreign code that i haven't seen into my page that has my SSL cert showing in the address bar in the green padlock

micha12:08:08

yeah exactly

micha12:08:52

you can't trust the browser, but i'd like you to be able to trust adzerk, inc. when you see the green padlock in the address bar

onetom12:08:09

so i guess my issues also boil down to another question then: do i want to load some of the functionality async into my page? * google analytics * hubspot analytics * hubspot form API * inspectlet these are all quite big libraries and i wouldn't want to delay my prerendered page coming alive by loading all these on top of the ~2MB javascript generated by CLJS

onetom12:08:01

if i were to load these async, then i would need to be able to have a callback on them, so i can kickstart them after they loaded

micha12:08:34

i don't know about hubspot etc, but most things can be hosted on your own servers

onetom12:08:03

ah, that's another thing i havent considered...

alandipert13:08:30

@xifi: that's fair, thanks for the feedback re: windows. btw would you happen to have access to windows 10?

xifi13:08:24

@alandipert: hi. No I don't. I'm only running win7 because I have to at work. Otherwise I'd wipe that virus out simple_smile

xifi13:08:29

i had win on my home laptop and wanted to try a linux distro one day. So I made a separate partition and installed it. Then I found out I chose the wrong partition. And I never looked back.

onetom13:08:11

@xifi: alandipert http://dev.modern.ie/tools/vms/ for testing (i havent tried them though)

micha13:08:40

@xifi: you chose the right partition simple_smile

xifi13:08:08

in that sense, yes simple_smile

alandipert13:08:24

btw i made an #C09N0H1RB channel where those of us on amazon can compare notes, if anyone is interested

martinklepsch15:08:17

looking at the changelog I don’t get it

martinklepsch15:08:32

app.out.cljs.core, could not locate app/out/cljs/core.cljs, app/out/cljs/core.cljc, or Closure namespace “app.out.cljs.core"

martinklepsch15:08:50

also fails with -2

martinklepsch15:08:42

also with -1but different error

juhoteperi19:08:14

@martinklepsch: Did you try with -3?

juhoteperi20:08:14

... had some beers and didn't read the first line