spmeesseman / vscode-taskexplorer

Run and Manage Tasks for Visual Studio Code
Other
140 stars 30 forks source link

taskExplorer.includeAnt only detects files in subfolders after they have been opened and saved (and go missing again after refresh) #109

Closed thiscantbeserious closed 4 years ago

thiscantbeserious commented 4 years ago

... after I click refresh in Task Explorer View they go missing again.

I first suspected that it was my buildfiles (quite complex) but the same happens with the simple example Buildfile from the ANT-Documentation from here:

https://ant.apache.org/manual/using.html

I even went further and stripped down the above example Buildfile even more down:

<project name="MyProject" default="dist" basedir="../">
  <description>
    very very simple example build file 
  </description>
  <property name="build" location="build"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>
</project>

But the result is exactly the same.

I also suspected it has something to do with basedir, but that wasn't it either way. It only detecs the files after I opened and saved them once. Restart and nothing else helps. Its not glob either way I'm just using this here for now:

"taskExplorer.includeAnt":[
    "build/build-test.xml"
]

Also opening them to see the list of tasks I get:

Element with id c:\DEV\MyProject\build\build-test.xml:ant:[taskname]* is already registered

*[taskname] is a placeholder for this issue defined by me which is usually the last taskname e.g. "build" in the buildfile.

Interestingly if the file is moved to the root-folder this doesn't happen.

The OS this is happening on is Windows 10.


Edit:

It seems like you're parsing the buildfiles itself? The same goes for gulp.

Both ant and gulp provide a way to get all available tasks (which often get created dynamically trough imports) via the commandline:

ant -f .\build\build-test.xml -p

Buildfile: C:\DEV\MyProject\build\build-test.xml

    very very simple example build file

Main targets:

Other targets:

 init
Default target: dist

and

gulp --tasks

Tasks for C:\DEV\MyComplexProject\gulpfile.js
[12:28:59] ├─┬ lint
[12:28:59] │ └─┬ <series>
[12:28:59] │   └── lintSCSS
[12:28:59] ├─┬ watch
[12:28:59] │ └─┬ <parallel>
[12:28:59] │   ├── cssWatcher
[12:28:59] │   ├── jsWatcher
[12:28:59] │   └── staticWatcher
[12:28:59] ├── clean
[12:28:59] ├─┬ build
[12:28:59] │ └─┬ <series>
[12:28:59] │   ├── buildCSS
[12:28:59] │   ├── buildStatic
[12:28:59] │   └── buildJS
[12:28:59] ├── init
[12:28:59] ├─┬ dist:copy
[12:28:59] │ └─┬ <series>
[12:28:59] │   ├── cleanDistLibs
[12:28:59] │   └── copyLibs
[12:28:59] ├── dist:normalize
[12:28:59] ├─┬ dev
[12:28:59] │ └─┬ <parallel>
[12:28:59] │   ├─┬ watch
[12:28:59] │   │ └─┬ <parallel>
[12:28:59] │   │   ├── cssWatcher
[12:28:59] │   │   ├── jsWatcher
[12:28:59] │   │   └── staticWatcher
[12:28:59] │   └── devServer
[12:28:59] └─┬ default
[12:28:59]   └─┬ <series>
[12:28:59]     ├─┬ lint
[12:28:59]     │ └─┬ <series>
[12:28:59]     │   └── lintSCSS
[12:28:59]     ├── clean
[12:28:59]     └─┬ build
[12:28:59]       └─┬ <series>
[12:28:59]         ├── buildCSS
[12:28:59]         ├── buildStatic
[12:28:59]         └── buildJS

Currently Taskexplorer just lists 3 tasks for my complex project.

Maybe that will solve all issues related to both, so that you won't have to parse the buildfiles yourself.

spmeesseman commented 4 years ago

yes this one is affecting me too. going to try and fix this weekend

spmeesseman commented 4 years ago

@thiscantbeserious can u provide a copy of your build.xml for me to test with?

spmeesseman commented 4 years ago

i think you need to glob pattern your 'includeAnt' setting, e.g.:

"taskExplorer.includeAnt": [     "∗∗/install/∗.xml",     "∗∗/script/∗.xml" ] please try to see if that makes a difference on the files being picked up

spmeesseman commented 4 years ago

yeas, i think, you need to use the file glob patterns, thats why theyll show up after you open and save, because the applications file watcher is using the glob pattern "/[Bb]uild.xml". not sure how the custom file ones are getting picked up on save, didnt go digging to see, but in any case if you add / to the beginning of your settings entry, it should work. There's another elusive Ant bug Ive been looking for for a while, which I thought that was what you were referring to when i first saw the ticket today. DIfferent though. Closing this ticket, but, I did add the Ant detection using Ant itself instead of manual parse. wasnt aware that was there. did the same thing for gulp too. in the next release (azure pipelines is down at the moment for insiders tests)