Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JHag6694 opened this issue Mar 10, 2021 · 17 comments
Open

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

JHag6694 opened this issue Mar 10, 2021 · 17 comments

Comments

@JHag6694
Copy link

JHag6694 commented Mar 10, 2021

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

<property environment="env" />
<import file="${basedir}/build-import.xml" />

<!-- 
<import file="${basedir}/build-import.xml" />
==> ATR: Error parsing build.xml!

<import file="build-import.xml" />
==> ATR: Targets loaded from build.xml!
-->
@NickHeap2
Copy link
Owner

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
Copy link

joellutz commented May 3, 2022

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

@NickHeap2
Copy link
Owner

@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
Copy link
Owner

@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
Copy link

@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:

<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:

<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
Copy link
Owner

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

@NickHeap2
Copy link
Owner

@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
Copy link

@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
Copy link
Owner

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

@unigeek
Copy link

unigeek commented May 31, 2022

I will take a look--thanks!

@unigeek
Copy link

unigeek commented May 31, 2022

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

@JHag6694
Copy link
Author

JHag6694 commented Jun 1, 2022

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
Copy link
Owner

@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
Copy link
Author

JHag6694 commented Jun 7, 2022

@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
Copy link

aulMasa commented Oct 4, 2022

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

@NickHeap2
Copy link
Owner

@aulMasa Upcoming release will have this included.

@NickHeap2
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants