Dojo Build - basePath


#1

Hello,
I was using the basePath property but the result of the build is not what I expected.

This is my profile based on one of the basic examples

//To build just Dojo base, you just need an empty file.
dependencies= {
	basePath:"../..",
	releaseDir: "./TESTING"

};

I’m executing the build with the following command (shows the folder where the batch file is located and the full path to the profile)

C:\Users\me\Downloads\dojo-release-1.10.8-src\util\buildscripts>build.bat --profile "C:\Users\me\Downloads\dojo-release-1.10.8-src\util\buildscripts\profiles\test.profile.js" --release

According to the documentation
https://dojotoolkit.org/reference-guide/1.10/build/buildSystem.html#id1

“If the profile contains the property basePath and the value of that property is a relative path, then the build system will automatically resolve that path with respect to the directory in which the profile resources resides–not the current working directory”

“Relative destination paths are computed with respect to the profile property releaseDir, optionally with a concatenated path segment given by profile property releaseName. If releaseDir is relative, then it is taken to be relative to basePath”

So if I specify the basePath as I did, I would have expected it to place itself relative to the profile location that I specified, so that is

Profile location
C:\Users\me\Downloads\dojo-release-1.10.8-src\util\buildscripts\profiles\test.profile.js

basePath location relative to profile (go back two levels)
C:\Users\me\Downloads\dojo-release-1.10.8-src\util\

So going back two levels means placing myself in the ‘util’ folder
So I would expect the release dir to be written in the util folder as well. However it is being written to the
buildscripts folder inside util.

On a second test I made the profile like this

dependencies= {
	basePath:"../..",
	releaseDir: "../TESTING"

};

And my release directory was written to the util folder. Which means the basePath I specified is actually pointing to the buildscripts folder but there is no subfolder deep enough to get to it using …/… if …/… means going back two levels.

So either I misunderstand what …/… means or something else is going on.

Can someone please explain how paths work in the build system when you specify a basePath?

Thanks


#2

Path issues are always a challenge as there’s never one right solution.

Here’s the standard information I typically give, which you probably already know:

basePath

  • Used to resolve relative references to source files
  • Relative paths facilitate moving projects around in the file system
  • By default the base path of the profile file is used
  • If a relative value is specified it is calculated relative to the profile file
  • The build equivalent of baseUrl for the sake of resolving package locations

releaseDir

  • Used to resolve relative references to destination files
  • If this is a relative value, it is computed as relative to basePath
  • When using --check to debug profiles, the final calculated value for the base path of destination resources is in the destBasePath property

Keep in mind the loader has its own configuration, which may be throwing things off here. The loader calculates a value for a package based on:

  • baseUrl
  • packages: paths for each package
  • tlmSiblingOfDojo: whether to look in baseUrl or adjacent to the folder containing dojo.js for unregistered packages
  • map: optional configuration parameter for re-mapping paths