How to change references by command line?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to change references by command line?

ソリューションへジャンプ
3,350件の閲覧回数
rossrhone
Contributor III

I have downloaded a project from a repository that refers to another project. I'd really like to build this project with Codewarrior 10.4's command line tools. However, the reference path in my .project file doesn't correspond to the location of the project it references, on my computer. I needed a command-line, programmatic way of changing the reference path to the correct location on my machine. So I tried

 

ecd -references -project project_pathName -allConfigs -remove wrongReferencePathName

with the intent of then running

ecd -references -project project_pathName -allConfigs -add correctReferencePathName

 

But the first command gave me a file not found error. So, it looks like I can only remove references to projects that actually exist on my system, and can't get rid of bogus references to projects that aren't even valid locations on my filesystem.

 

Is there any way to remove a bad reference, one that doesn't correspond to a valid project location, from the command line? If not, can you think of any other way I might approach this issue?

 

Just for context, the way our company avoids this issue normally is via representing our projects and their references in a .wsd file. We drag-drop the file into the CodeWarrior GUI, and this automatically fixes all the references in all our .project files. The issue is that we can't figure out how to invoke the wsd file from the command line. If you know of any way of doing this, it would actually be much more helpful than an answer to my other question!

 

Thanks so much! I really appreciate your effort on this one!

 

-Ross

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
2,899件の閲覧回数
rossrhone
Contributor III

I am a bit embarrassed. “Projects specified by the -project flag that are not present in the workspace (either the default one or the one specified by the -data flag) are automatically imported in the workspace as existing project in the file system, and recorded in the workspace metadata.” I should have looked closer at this sentence in the documentation. I was able to solve our issue by manually adding each project with its correct file path by from the -data flag. This would then not use the default file path I was getting before because I had not added all my projects in.

 

example:

ecd -build -data c:\test_workspace –project "C:\correct\file\path\p1" -project "C:\correct\file\path\p2" -project "C:\correct\file\path\p3" -project “C:\correct\file\path\p4

Thank you so much for helping me figure out something so simple :smileyhappy:

元の投稿で解決策を見る

0 件の賞賛
返信
8 返答(返信)
2,897件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi,

can you please post your exact command of

ecd -references -project project_pathName -allConfigs -remove wrongReferencePathName

for your project?

what error message do you get? can you also post all the error message screenshot here? thanks!


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,897件の閲覧回数
rossrhone
Contributor III

errors4.jpg

I tried multiple options for wrongReferencePathName. Above I tested "file:/C:/Development/DSM33/DSM33_India/DSM33_FS_v02.02/AlphaBoot", but I also tried "C:/Development/DSM33/DSM33_India/DSM33_FS_v02.02/AlphaBoot" and "C:\Users\Ross\Desktop\Round2\DM3\Freescale\DSM33_FS_v02.02\Firmware\.project".

They all produced the same error. The paths I'm trying don't exist in my filesystem--I have different paths to the referenced projects in my filesystem--so it kinda makes sense that I'm getting a fileNotFoundException. Maybe it's that the references tool is looking for a .project or .cproject file at the provided reference path and crashes out if none is found.

If this is true, I might try spoofing the bogus filepath in my system and copying over a .project file, but this is a real pain.

It's also possible that I'm just not using the referencedProjectLocation argument correctly--for reference command syntax is

ecd -references -project path [-config name | -allConfigs] ( -list | -add | -remove) referencedProjectLocation [buildConfigurationName]. I'm assuming this argument can only take a project filepath, but if I'm wrong or if there's a different way to identify a project with this argument, I'd love to know!

Here is the error output--not sure the full backtrace will be helpful :smileyhappy:

errors1.jpg

errors2.jpg

errors3.jpg

Thank you so much on your help for this one!

-Ross

0 件の賞賛
返信
2,897件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi,

you are trying to remove ‘Project_Headers’ which is a *folder* and not a reference.

References are these kind of references:

pastedImage_0.png

are you sure you need remove "reference" or "folder"?


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,897件の閲覧回数
rossrhone
Contributor III

Hello,

To my knowledge the command below means (Lists, adds or removes all the referenced project and build configurations in a project.)

ecd.exe -references -project path [-config name | -allConfigs] ( - list | -add | -remove) referencedProjectLocation [buildConfigurationName]

(information provided from the link below page 24)

http://www.nxp.com/files/soft_dev_tools/doc/user_guide/CWCFUG.pdf?fasp=1&WT_TYPE=Users%20Guides&WT_V...

The current properties setting window you currently have open, did you open that window before building your project or after? Remember that I am making an automated build and will not have the option to drag over my project file into the codeWarrior GUI.

There have been clues to say that I need to remove references, but I am not sure as I am very new to codewarrior. What is the differences between references and "Project_Headers"? I have provided some non-automated builds for you so it can be more clear. Just remember that I will not be able to drag and drop the project in as I have done here.

Freescale1.jpg

This photo was taken right after I have drag my Project Firmware into the code warrior GUI.

"Should referenced projects also be imported and opened where applicable?"

Freescale2.jpg

I clicked the yes button and received "Referenced project not found" this is the bogus file path I have mentioned above. I would like to be able to change this file path ... "remove reference/add reference". Do you know a way to do this in automated manner?

Freescale3.jpg

Another view of the unbuilt project with the blank non-existing referenced Projects, which should be existing and not transparent.

Thanks so much for providing me with this help!

0 件の賞賛
返信
2,898件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ross.

"-references " is for *Referenced Projects*.

Referenced projects allow you to create build dependencies between projects. If project A is set up as a referenced project for project B, then project A will be built before each project B build. Referenced projects are automatically imported and opened when a project is imported in the workspace, so referenced projects can be used to automatically populate the workspace with a set of projects.

for example

ecd.exe -references -project c:\my_first_project

here " c:\my_first_project" is a project path.

"Project_Headers" is a folder inside the project. normally there are some .h files inside. that's the reason I ask you "need remove "reference" or "folder""? 


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,898件の閲覧回数
rossrhone
Contributor III

Hey Jennie! 

In that case now fully understanding what a "reference" means I would like to have all the referenced projects imported in automatically. I would like to remove the "reference's" file path location that was set before I downloaded it from a repo and change it to the correct file path. This will hopefully solve our current problem of not being to pull down source files and do a complete build on them. 

Really, all we want to do is pull down our source files and do a complete build on them from the command line. This involves importing the projects from the command line. We thought the best way to do this was to set up the referenced projects correctly, so that calling ecd -build on our main project imports the rest of the projects.

But if that doesn't explain exactly what we're trying to do:

Can you explain more how you got the impression we're trying to remove the "Project_Headers" folder? We do want to remove "reference's" file path location, not some random folder with .h files in it :smileyhappy: Maybe we're using the project path argument wrong. If so, could you send us an example project path? Or are you saying we ought to be removing this folder (which by the way is not even in our project directory)? Does the "Project_Headers" folder contain the "references" file path location inside?

0 件の賞賛
返信
2,898件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ross,

Sorry I didn't mention the background in my previous answer.

In order to reproduce the exact error as shown in your screenshot, I performed test from my side. if parameter  "-remove" is followed with a project path, there is no error; if it followed a source files folder for example "Project_Headers", I can reproduce the same error as you have.

I attach a video as my test example, in the video:

1. project "Firmware" is set up as a referenced project for project "test_kinetis" in CW IDE

2. in commandline, with this command

ecd.exe -references -project "C:\Users\b08277\workspace1064\test_kinetis" -allConfigs -remove "C:\Users\b08277\workspace1064\Firmware"

referenced project "Firmware" is removed

3. reopen project "test_kinetis", we can see project "Firmware" is removed from Project reference.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,900件の閲覧回数
rossrhone
Contributor III

I am a bit embarrassed. “Projects specified by the -project flag that are not present in the workspace (either the default one or the one specified by the -data flag) are automatically imported in the workspace as existing project in the file system, and recorded in the workspace metadata.” I should have looked closer at this sentence in the documentation. I was able to solve our issue by manually adding each project with its correct file path by from the -data flag. This would then not use the default file path I was getting before because I had not added all my projects in.

 

example:

ecd -build -data c:\test_workspace –project "C:\correct\file\path\p1" -project "C:\correct\file\path\p2" -project "C:\correct\file\path\p3" -project “C:\correct\file\path\p4

Thank you so much for helping me figure out something so simple :smileyhappy:

0 件の賞賛
返信