NickHeap2 / vscode-ant

Visual Studio Code Ant Task Runner Extension published on the marketplace
MIT License
6 stars 4 forks source link

Error parsing build.xml if import use a property !? #22

Open JHag6694 opened 3 years ago

JHag6694 commented 3 years ago

When trying this extension, we face a problem with an already existing project. In our build file, there is an import task in which the file path is set with a property. It seems that it triggers an error when parsing the XML

See below a Minal non-Working Example

My conf : Windows 10, VS Code 1.54.1, Ant Target Runner 0.3.0

<?xml version="1.0" encoding="UTF-8"?>

NickHeap2 commented 3 years ago

Currently this isn't supported but I am going to look into using the ant libraries to do the parsing when I get a chance.

joellutz commented 2 years ago

That would be awesome! Any updates on this? ant is currently the only reason I still have to use eclipse instead of vscode.

NickHeap2 commented 2 years ago

@joellutz I finally got time to look into this and have the parsing of the ant -p output sorted on a branch just need a little more time to finish it off.

NickHeap2 commented 2 years ago

@joellutz If you can test this pre-release I'd be grateful. There is a new setting you can turn on to use ant command line for build file parsing image Build file parsing should be working in this. Reveal definition isn't working yet though.

vscode-ant-0.4.0-test.zip

joellutz commented 2 years ago

@NickHeap2 Thank you for looking into this! With your pre-release version, I don't get any ATR: Error parsing build.xml! message anymore with my test build.xml, so parsing should be fine now. Although the targets from the imported file don't yet appear in the target tree, as you pointed out.

My setup: build.xml: <?xml version="1.0" encoding="UTF-8" ?>

<project  name="importAnotherFile" default="" basedir="." >

    <property name="subfolder" value="./subfolder" />
    <import file="${subfolder}/anotherFile.xml" />

    <target name="test" >
        <echo message="Hello from main file!" />
    </target>

</project>

subfolder/anotherFile.xml: <?xml version="1.0" encoding="UTF-8"?>

<project name="" default="" basedir=".">

    <target name="test2" >
        <echo message="Hello from another file!" />
    </target>

</project>

Resulting target tree: grafik

I can run the test target without any problems. I can also <antcall target="test2" /> from within my build.xml, so it should work in principle. If the targets from the imported file(s) also get displayed in the ant target tree, that would be awesome. But that may be another issue.

NickHeap2 commented 2 years ago

@joellutz great thanks for your setup I'll give that a try

NickHeap2 commented 2 years ago

@joellutz second test for you. This should resolve targets correctly and also Reveal definition should be working now as well. vscode-ant-0.4.0-test2.zip

joellutz commented 2 years ago

@NickHeap2 Nice work, now also the imported targets are shown: grafik It even works when I include a third file within the subfolder/anotherFile.xml! Thank you!

NickHeap2 commented 2 years ago

Good to hear @joellutz! @JHag6694 , @unigeek if this is still relevant to you can you give this a try please.

unigeek commented 2 years ago

I will take a look--thanks!

unigeek commented 2 years ago

Ooooh! Looking very good so far! I will have to play with this some! Many thanks.

JHag6694 commented 2 years ago

Good to hear @joellutz! @JHag6694 , @unigeek if this is still relevant to you can you give this a try please.

Looking good too ! Thanks.

Just one remark: We have a lot of internal targets, starting with "-". When "Sort Targets Alphabetically" is enabled, they are displayed in the first positions. I think it would be good to have an option to hide them, or to make them displayed in the last positions. If you agree, and prefer me creating a new issue, just tell me.

Thanks again for your work.

NickHeap2 commented 2 years ago

@JHag6694 I think private targets are those without a description if I remember correctly. I can certainly add in the option to hide targets without descriptions if that works for you?

JHag6694 commented 2 years ago

@JHag6694 I think private targets are those without a description if I remember correctly. I can certainly add in the option to hide targets without descriptions if that works for you?

Hi @NickHeap2 To avoid confusion, I think it is better to create a new issue for this topic.

aulMasa commented 2 years ago

is it possible to have a more detailed info when the extension returns ATR: Error parsing build.xml! ?

NickHeap2 commented 2 years ago

@aulMasa Upcoming release will have this included.

NickHeap2 commented 2 years ago

@aulMasa @joellutz @JHag6694 @unigeek Ant parsing and error messages are now in the latest 0.4.0 release.