Opened 10 years ago

Closed 8 years ago

#9395 closed defect (fixed)

layer file in nonexistent directory breaks build

Reported by: floatingworld Owned by: Rawld Gill
Priority: low Milestone: 1.7
Component: BuildSystem Version: 1.3.1
Keywords: layer profile needsreview Cc:
Blocked By: Blocking:

Description

I'm building dojo 1.3.1 from source on Windows XP. My profile.js includes this:

layers: [
...
	{
		name: "../../site/dojocustom.js",
		dependencies: [
			"dojo.fx",
			"dojo.fx.easing",
			"dojox.analytics.Urchin",
			"dojox.gfx",
			"dojox.fx",
		]
	}
...
],

And because the folder "site" doesn't already exist within releaseDir the build breaks. Creating that empty folder ahead of time resolves the problem. Here's the end of the build script's output:

...

release:  Optimizing (shrinksafe) file: C:/parentfolder/folder/../dijit/dijit-all.js
release:  Interning strings for file: C:/parentfolder/folder/../dojox/off/offline.js
release:  Optimizing (shrinksafe) file: C:/parentfolder/folder/../dojox/off/offline.js
org.mozilla.javascript.WrappedException: Wrapped java.io.FileNotFoundException: C:\parentfolder\folder\..\..\site\dojocustom.js.uncompressed.js (The system cannot find the path specified)
 at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1654)
 at org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:192)
 at org.mozilla.javascript.NativeJavaClass.constructSpecific(NativeJavaClass.java:274)
 at org.mozilla.javascript.NativeJavaClass.construct(NativeJavaClass.java:193)
 at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2266)
 at org.mozilla.javascript.gen.c3._c7(Unknown Source)
 at org.mozilla.javascript.gen.c3.call(Unknown Source)
 at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
 at org.mozilla.javascript.gen.c3._c6(Unknown Source)
 at org.mozilla.javascript.gen.c3.call(Unknown Source)
 at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
 at org.mozilla.javascript.gen.c1._c3(Unknown Source)
 at org.mozilla.javascript.gen.c1.call(Unknown Source)
 at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:57)
 at org.mozilla.javascript.gen.c1._c0(Unknown Source)
 at org.mozilla.javascript.gen.c1.call(Unknown Source)
 at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
 at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
 at org.mozilla.javascript.gen.c1.call(Unknown Source)
 at org.mozilla.javascript.gen.c1.exec(Unknown Source)
 at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:526)
 at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:448)
 at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:414)
 at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:405)
 at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179)
 at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)
 at org.mozilla.javascript.Context.call(Context.java:499)
 at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
 at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162)
 at org.mozilla.javascript.tools.shell.Main.main(Main.java:140)
Caused by: java.io.FileNotFoundException: C:\parentfolder\folder\..\..\site\dojocustom.js.uncompressed.js (The system cannot find the path specified)
 at java.io.FileOutputStream.open(Native Method)
 at java.io.FileOutputStream.<init>(Unknown Source)
 at java.io.FileOutputStream.<init>(Unknown Source)
 at sun.reflect.GeneratedConstructorAccessor9.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
 at java.lang.reflect.Constructor.newInstance(Unknown Source)
 at org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:184)
 ... 28 more

Change History (6)

comment:1 Changed 10 years ago by James Burke

This is problematic to support. What should happen is that you have a site directory before the build and you put in a prefixes entry in your build profile for site. Then things should work as expected.

The directories really match to module prefixes, and it is important for things like i18n bundles that also get flattened/optimized for a build layer. But in order to load the layer correctly, the layer code will try to do a dojo.require("site...") call to load the i18n bundle. However, if you have not set up the site directory/module prefix mapping things will fail.

i18n may not be a specific concern for the modules you have in your build, but for the generic build case, we need to support them.

So I believe this is working as designed, but I can appreciate that it can cause some confusion. I can see about putting in a message in the build about this expected behavior when this error is hit. Would that help?

comment:2 Changed 10 years ago by floatingworld

Yeah, that would be a good idea - to catch the exception and output an explanatory message. And actually I've thought about it more and even beyond i18n stuff it makes sense for this to be expected behavior, because otherwise if you've entered the wrong path for your application in profile.js, for example including too many "../", if the build didn't crash it wouldn't be until runtime of your application that you'd discover the problem.

comment:3 Changed 10 years ago by James Burke

Milestone: tbdfuture

comment:4 Changed 8 years ago by bill

Owner: changed from James Burke to Rawld Gill

Bulk update to assign BuildSystem? tickets to Rawld. Many of these are probably already fixed in 1.7.

comment:5 Changed 8 years ago by ben hockey

Keywords: needsreview added
Priority: highlow

comment:6 Changed 8 years ago by Rawld Gill

Milestone: future1.7
Resolution: fixed
Status: newclosed

Fixed as side-effect of new builder in 1.7.

Note: See TracTickets for help on using tickets.