MATLAB Answers

Relocating a Matlab Compiler project to a directory alongside source tree

10 views (last 30 days)
Andrew Janke
Andrew Janke on 19 Jun 2018
Commented: Andrew Janke on 3 Mar 2019
I have a large codebase that I compile using a few *.prj Matlab Compiler project files. I would like to relocate the *.prj files into their own subdirectory to keep my project's repo structure tidy. But when I do so, every time I run the compiler, it adds a big fileset.depfun section containing the absolute paths to all the *.m files in my source tree. And it changes the target output directory.
How can I keep it from doing this?
Here are the details:
I'm on Windows running Matlab R2016b.
We'll call my program the Foo application.
My current source tree layout is this:
  • C:\Foo - the main directory I do all my project stuff in
  • C:\Foo\*.prj - the current location of my project files (outside of source control)
  • C:\Foo\trunk - the Subversion-controlled working directory where I check out my source tree
  • C:\Foo\trunk\src - where all my M-files for the project live
I want to change it to be like this:
  • C:\Foo - the main directory I do all my project stuff in
  • C:\Foo\trunk - the Subversion-controlled working directory where I check out my source tree
  • C:\Foo\trunk\tools - where I keep my build & release tools (in source control now)
  • C:\Foo\trunk\tools\*.prj - new home for all those Matlab Compiler project files
  • C:\Foo\trunk\src - where all my M-files for the project live, same as before
When I moved the *.prj files over to this new structure, I opened them up in a text editor and manually edited the paths in them.
<deployment-project plugin="plugin.ezdeploy" plugin-version="1.0">
<configuration build-checksum="2118345216" file="C:\Foo\trunk\tools\FooSdk.prj" location="C:\Foo\trunk\tools" name="FooSdk" preferred-package-location="C:\Foo\FooSdk\for_redistribution" preferred-package-type="package.type.exe" target="target.ezdeploy.library" target-name="Library Compiler">
...
<fileset.exports>
<file>${PROJECT_ROOT}\..\compiled\sdk\net\Configuration.m</file>
<file>${PROJECT_ROOT}\..\compiled\sdk\net\EntryGateway.m</file>
</fileset.exports>
<fileset.classes>
<entity.package name="">
<entity.class name="FooSdk">
<file>${PROJECT_ROOT}\..\compiled\sdk\net\EntryGateway.m</file>
</entity.class>
</entity.package>
</fileset.classes>
<fileset.resources>
<file>${MATLAB_ROOT}\toolbox\local\pathdef.m</file>
<file>${MATLAB_ROOT}\toolbox\local\userpath.m</file>
<file>${PROJECT_ROOT}\..\lib</file>
<file>${PROJECT_ROOT}\..\src</file>
</fileset.resources>
...
<build-deliverables>
<file location="${PROJECT_ROOT}\..\..\RmaSdk\for_testing" name="RmaSdk.dll" optional="false">C:\RMAStudio\RmaSdk\for_testing\RmaSdk.dll</file>
<file location="${PROJECT_ROOT}\..\..\RmaSdk\for_testing" name="readme.txt" optional="true">C:\RMAStudio\RmaSdk\for_testing\readme.txt</file>
<file location="${PROJECT_ROOT}\..\..\RmaSdk\for_testing" name="RmaSdk_overview.html" optional="false">C:\RMAStudio\RmaSdk\for_testing\RmaSdk_overview.html</file>
<file location="${PROJECT_ROOT}\..\..\RmaSdk\for_testing" name="RmaSdkNative.dll" optional="false">C:\RMAStudio\RmaSdk\for_testing\RmaSdkNative.dll</file>
</build-deliverables>
When I opened up the project file in the App Compiler App, it succeeded in compiling the library without any settings changes. But then when the compilation was complete and I tried to close the dialog, it asked me if I wanted to save my changes. I chose Yes, and then when I looked at the project file afterwards, it had a new fileset.depfun element with 1400 files in it, all with absolute paths, like this:
<fileset.depfun>
<file>C:\Foo\trunk\src\+foo\+assetmodel\+outage\+whatever\constant.m</file>
<file>C:\Foo\trunk\src\+foo\+assetmodel\+outage\+whatever\derate.m</file>
<file>C:\Foo\trunk\src\+foo\+assetmodel\+outage\+whatever\emergency.m</file>
<file>C:\Foo\trunk\src\+foo\+assetmodel\+outage\+whatever\object.m</file>
<file>C:\Foo\trunk\src\+foo\+assetmodel\+outage\+whatever\outage.m</file>
<file>C:\Foo\trunk\src\+foo\+assetmodel\+outage\+model\constant.m</file>
...
and preferred-package-location had changed:
<configuration build-checksum="120092597" file="C:\Foo\trunk\tools\FooSdk.prj" location="C:\Foo\trunk\tools" name="FooSdk" preferred-package-location="C:\Foo\trunk\tools\FooSdk\for_redistribution" preferred-package-type="package.type.exe" target="target.ezdeploy.library" target-name="Library Compiler">
and the build-deliverables locations had changed.
<build-deliverables>
<file location="${PROJECT_ROOT}\FooSdk\for_testing" name="FooSdkNative.dll" optional="false">C:\Foo\trunk\tools\FooSdk\for_testing\FooSdkNative.dll</file>
<file location="${PROJECT_ROOT}\FooSdk\for_testing" name="readme.txt" optional="true">C:\Foo\trunk\tools\FooSdk\for_testing\readme.txt</file>
<file location="${PROJECT_ROOT}\FooSdk\for_testing" name="FooSdk.dll" optional="false">C:\Foo\trunk\tools\FooSdk\for_testing\FooSdk.dll</file>
<file location="${PROJECT_ROOT}\FooSdk\for_testing" name="FooSdk_overview.html" optional="false">C:\Foo\trunk\tools\FooSdk\for_testing\FooSdk_overview.html</file>
</build-deliverables>
Is there any way to get it to not do that?
  2 Comments
Andrew Janke
Andrew Janke on 3 Mar 2019
Nope. I ended up just sticking all my *.prj files in the root of my source tree, and apologizing to my coworkers for the clutter. Sorry.

Sign in to comment.

Answers (0)

Products


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!