Nant Zip task zips 0 files when basedir is a variable? - deployment

I have the following Nant Script snippet.
<zip zipfile="${devEnvironment}..\dev-${datetime::get-year(datetime::now())}${datetime::get-month(datetime::now())}${datetime::get-day(datetime::now())}.zip">
<fileset basedir="${devEnvironment}">
<include name="**/*"/>
</fileset>
</zip>
The devEnvironment property is set to a valid UNC path used in copy tasks in other places of the script. When I run the above zip task, it tells me that there are 0 files to archive (in essence, it makes an empty zip file). If I replace the devEnvironment variable in the basedir attribute with the UNC path, it works without any issues.
I've looked at examples online and most show a variable being used for the basedir; however, my attempts do not seem to work.
Am I doing something wrong?
EDIT:
For completion sake, here's the UCN path contained in the devEnvironment variable with specific info left out.
\\serverName\wwwroot\appName\site\

Run it verbose. I'll bet a dollar the macro expansion is evaluating to something you don't expect.

After running the script in verbose mode without making any changes to the script itself (not even hitting save again), it worked fine. I'll try it again without verbose mode. Weird but at least it's working now.
Thanks

What does Nant do with backslashes in strings? My first guess would be that the string really expands to
\serverNamewwwroot[BEL]ppNamesite

Related

Xcode New "Run Script Phase" - How to handle output files?

I want to add a Run Script Phase to my Build Phases to call a swift executable that takes a plist file from my project and uses it to generate a swift file with some boilerplate code.
I figured out how to specify the input file for the Run Script Phase like this:
$(SRCROOT)/MyProject/MyData.plist
But for output files, Xcode gives me this $(DERIVED_FILE_DIR)/newOutputFile default value which, if I echo it via echo "$SCRIPT_OUTPUT_FILE_0", prints some strange path to the ....MyProject.build/DerivedSources folder. What is that? What do I do with this and how can I generate my output swift file and place it inside my project?
I don't really find much information about this $(DERIVED_FILE_DIR) (at least nothing that I understand, I've never worked with these things before).
Thanks!
Presumably the derived file directory is just a safe place to write output results to. It isn't in the project directory, but it is unique to the project.
However, you do want to write directly into the project directory (I presume), so just go ahead and do so, using the environmental variable PROJECT_DIR.

Change simulink rtwbuild output folder

I'm automating my build process, but I wasn't able to change the model_target_rtw folder to something different.
I'm not talking about CodegenFolder, but about the folder that's created inside it during compilation.
I'm currently working this around by renaming the folder after compilation, but it would be grate to remove that step.
The folder you are referring to is the RTW (Real Time Workshop) BuildDirectory.
You can get the value of BuildDirectory by running the command:
RTW.getBuildDir('MyModel')
See:
https://se.mathworks.com/matlabcentral/answers/274082-how-can-i-change-the-build-folder-of-a-model
Also look at this question:
Save generated code in a special folder in "rtwbuild"
If you run this command in MATLAB:
set_param(0, 'CodeGenFolder', 'C:\MyBuildDir')
and then run the RTW.getBuildDir command again you will see that the BuildDirectory has changed.

Intellij 10.5.4 replaces iml files' libary root url localvariable with $USER_HOME$

for some reason when I reopen my intellij projects, the iml files’ root tags’ url parameter is automatically replacing my user-defined local variable with $USER_HOME$.
Furthermore, when I go in and manually replace (with CTRL+R) the $USER_HOME$ with the $LOCAL_VAR$, Intellij replaces this change with $LOCAL_VAR$/.m2/repository. Have you ever run into this issue?
code from one of the directory .iml files:
<library>
<classes>
<root url="jar://$LOCAL_VAR$/.m2/repository/.m2/repository/bar/foo.jar!/" />
</classes>
<JAVADOC/>
</libarary>
When I go and replace the $LOCAL_VAR$/.m2/repository with $LOCAL_VAR$ for the second time, no further autoreplacements occur. The reason why I need to replace $USER_HOME$ with $LOCAL_VAR$ is because $USER_HOME$ is system-defined, and I need to point my code to a SAMBA drive that I've mounted onto my Windows7 pc.
If you can please suggest either a way to override my $USER_HOME$ or a possible cause of this odd behavior, I would be grateful for your wisdom. Please note that when I originally imported this project, I had generated the .iml files from a .ipr file. Not sure if that's relevant.
Try to define /.m2/repository/ as a separate path variable, this one should not be overridden.

NetBeans ANT: <zip> is not including hidden files?

At the end of my Clean/Build, I wanted to always automatically copy the project folder into a zip for easy transfer. So I added this to my post build <target> in build.xml:
<zip zipfile="../project-xyz.zip" basedir=".." includes="project-xyz/**" excludes="*/dir/lib/**"/>
This works great on Windows, but on Linux, it removes any .hidden folders and all their children. I even tried
<zip zipfile="../project-xyz.zip" basedir=".." includes="project-xyz/**,project-xyz/.hidden/**" excludes="*/dir/lib/**"/>
and it still doesn't work.
What can I do to bring those files into the zip?
I am not opposed to detecting non-Windows environments and using <exec> on the zip command, though I am not sure how I would do that, and I am not sure I really want to, especially if there is a better way!
You can see what gets excluded by default from the zip by adding the following line in ant
<defaultexcludes echo="true"/>
And then use
<defaultexcludes add=.../>
and
<defaultexcludes remove=.../>
to customize what gets excluded by default.
Reference: Ant docs for DefaultExcludes
EDIT
You can also do
<zip defaultexcludes="no" .../>
Reference: Ant docs for Zip

Environment.CurrentDirectory with NUnit GUI differs to the TeamCity value, how can I sync them?

As above really, I have some integration tests that use files from a relative file path. To help picture it here is the file structure:
/Dependencies
/VideoTests/bin/release/video.dll
/SearchTests/bin/release/search.dll
/OtherProjects
The GUI is running the tests from the root, however when TeamCity runs the tests it is running the tests from each test dlls bin directory. Now I don't mind which one I can get to follow the other but I do need them to be the same otherwise my relative paths just won't work!
Any ideas?
P.S. Using TeamCity 5.0 and NUnit 2.5.
You probably don't want to rely on CurrentDirectory. I'd suggest reading the doc, but the main point you'll want to take away is that the CurrentDirectory is where the .exe was started from: it could be any path in the system. For example, let's assume your users add your .exe (or whatever .exe uses your DLLs) to their path. They could then navigate to c:\foo\bar and start the .exe from there, which would set the CurrentDirectory to "C:\foo\bar" and you may not be able to deal with that.
I think it would be preferable for you to rework whatever you're doing so you don't rely on CurrentDirectory. What problems are you encountering by relying on CurrentDirectory right now?
Have you made sure that both TeamCity and NUnit are using the same working directory when starting the application?
And if they aren't, you could adjust the current directory in the test code.