The manual states: -i import_file.xml Creates a new project or updates an existing project using the data provided by an XML file, which has to be compliant to the schema project_import.xsd available in the directory ..\UV4. The target name can be specified with the option -t. By default, the target name is set to the device name. The GUI is suppressed automatically when using this option.
Examples: UV4 MyProject.uvprojx –i MyImport.xml
But it doesn't provide any example of what might be in the MyImport.xml. Can anyone elaborate? I'm most interested in the "updates an existing project" aspect of it, as I'd like to enable and disable a pre-build step based on command line input instead of having a separate target to maintain.
Thanks, -J
Hello Jeff, as the manual tells, "the schema project_import.xsd available in the directory ..\UV4" should telly you, how MyImport.xml shall look like. But here also an example, that I used for testing:
<?xml version="1.0" encoding="utf-8"?> <Project> <Groups> <Group> <GroupName>GroupName1</GroupName> <Files> <File> <FileName>FileName1</FileName> <FileType>1</FileType> <FilePath>FilePath1</FilePath> </File> <File> <FileName>FileName2</FileName> <FileType>1</FileType> <FilePath>FilePath2</FilePath> </File> <File> <FileName>FileName3</FileName> <FileType>1</FileType> <FilePath>FilePath3</FilePath> </File> </Files> </Group> <Group> <GroupName>GroupName2</GroupName> <Files> <File> <FileName>FileName4</FileName> <FileType>1</FileType> <FilePath>FilePath4</FilePath> </File> <File> <FileName>FileName5</FileName> <FileType>1</FileType> <FilePath>FilePath5</FilePath> </File> <File> <FileName>FileName6</FileName> <FileType>1</FileType> <FilePath>FilePath6</FilePath> </File> </Files> </Group> <Group> <GroupName>GroupName3</GroupName> <Files> <File> <FileName>FileName7</FileName> <FileType>1</FileType> <FilePath>FilePath7</FilePath> </File> <File> <FileName>FileName8</FileName> <FileType>1</FileType> <FilePath>FilePath8</FilePath> </File> <File> <FileName>FileName9</FileName> <FileType>1</FileType> <FilePath>FilePath9</FilePath> </File> </Files> </Group> </Groups> <useUlib>1</useUlib> <LinkOptions>LinkOptions1</LinkOptions> <AsmOptions>AsmOptions1</AsmOptions> <COptions>COptions1</COptions> <AsmDefines>AsmDefines1</AsmDefines> <CDefines>CDefines1</CDefines> <MiscControls>MiscControls1</MiscControls> <ScatterFile>ScatterFile1</ScatterFile> <!----> <IncludePath>IncludePath1</IncludePath> <Device>ARMCM3</Device> <ToolsetName>ARM</ToolsetName> </Project>
These are replacement updates. So, for example, you wouldn't want to even use
<ScatterFile>...</ScatterFile> //OR <ScatterFile/>
unless you had a replacement scatterfile ready.
As of this writing, the source groups and all files inside are entirely replaced with whatever Gourp/Files/File tags are in the xml. Here's another example with User commands:
<?xml version="1.0" encoding="UTF-8" ?> <Project xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_import.xsd"> <ToolsetName>ARM</ToolsetName> <Device>LPC1768</Device> <User> <BeforeCompile1 StopOnExitCode="2" Dos16Mode="0">someCMDS1.bat</BeforeCompile1> <AfterBuild1 StopOnExitCode="2" Dos16Mode="0">someBat1.bat</AfterBuild1> </User> <MiscControls>REPLACEMENT_MiscCtrl_Update</MiscControls> <CDefines>REPLACEMENT_MACRO_1</CDefines> <Groups> <Group> <GroupName>SourceFiles</GroupName> <Files> <File> <FileName>new_main.c</FileName> <FileType>1</FileType> <FilePath>.\new_main.c</FilePath> </File> <File> <FileName>test2.c</FileName> <FileType>1</FileType> <FilePath>.\test2.c</FilePath> </File> </Files> </Group> </Groups> </Project>
User commands are the only exception I see. Updating one User command (Ex. "AfterBuild2") won't affect the other User commands.
For reference
http://www.keil.com/support/man/docs/uv4/uv4_commandline.htm
Thanks for the example.
I am having some trouble generating a uvprojx file with the following import.xml file -> no output file is created.Note that generating a uvproj file works as expected. Please not that the configured exists in my device database. Otherwise, the generation of the uvproj file would fail as well.
Is there a way to get any feedback in case of an error during import? Currently the program exists and doesn't to anything. It doesn't even set the error level.
Here is the code I use:
<Project> <ToolsetName>ARM</ToolsetName> <Device>MyDeviceName</Device> <Groups> <Group> <GroupName>Group1</GroupName> <Files> <File> <FileName>Test.c</FileName> <FileType>1</FileType> <FilePath>./</FilePath> </File> </Files> </Group> </Groups> </Project>