openframeworks / projectGenerator

repo for centralizing work on a tool to generate OF projects
83 stars 74 forks source link

"update multiple targets" fails for ofxCv #121

Open kylemcdonald opened 8 years ago

kylemcdonald commented 8 years ago

i'm doing an computer vision + OF class at ITP this weekend and wanted to show them the "update multiple projects" tab. but when i try to run it on ofxCv i don't get any new project files. here is the verbose log:

[notice ] -----------------------------------------------
[notice ] updating an existing project
[notice ] target platform is: osx
[verbose]   addon_config.mk
[verbose]   bin
[verbose]   config.make
[verbose]   example-ar
[verbose]   example-background
[verbose]   example-bayer
[verbose]   example-blur
[verbose]   example-calibration
[verbose]   example-calibration-lcp
[verbose]   example-coherent-lines
[verbose]   example-contours-advanced
[verbose]   example-contours-basic
[verbose]   example-contours-color
[verbose]   example-contours-following
[verbose]   example-contours-quad
[verbose]   example-contours-tracking
[verbose]   example-difference
[verbose]   example-difference-columns
[verbose]   example-edge
[verbose]   example-empty
[verbose]   example-estimate-affine
[verbose]   example-face
[verbose]   example-face-follow
[verbose]   example-face-zoom
[verbose]   example-flow
[verbose]   example-flow-distort
[verbose]   example-flow-distort-shader
[verbose]   example-flow-keypoints
[verbose]   example-gesture
[verbose]   example-highpass
[verbose]   example-homography
[verbose]   example-kalman
[verbose]   example-kalman-euler
[verbose]   example-smile
[verbose]   example-threshold
[verbose]   example-undistortion
[verbose]   libs
[verbose]   license.md
[verbose]   Makefile
[verbose]   ofxaddons_thumbnail.png
[verbose]   ofxCv.xcodeproj
[verbose]   openFrameworks-Info.plist
[verbose]   Project.xcconfig
[verbose]   readme.md
[verbose]   src
[verbose]   update-projects.py
[verbose] listed 46 files in "/Users/kyle/Documents/openFrameworks-0.9.2/addons/ofxCv/"
[notice ] updating project /Users/kyle/Documents/openFrameworks-0.9.2/addons/ofxCv
[verbose] returning path ../../

[verbose]   ofxCv.h
[verbose] listed 1 files in "/Users/kyle/Documents/openFrameworks-0.9.2/addons/ofxCv/src/"
[notice ] parsing addons.make
[notice ] saving addons.make
[notice ] project updated! 
[notice ] -----------------------------------------------

1 project updated [notice ] in -4.96733 seconds

(command used:"/Users/kyle/Documents/openFrameworks-0.9.2/projectGenerator-osx/projectGenerator.app/Contents/Resources/app/app/projectGenerator" -r -v -o"/Users/kyle/Documents/openFrameworks-0.9.2" -p"osx" "/Users/kyle/Documents/openFrameworks-0.9.2/addons/ofxCv")

it offers me the option "open in IDE" and if i click it, it says:

Uncaught Exception:
Error: ENOENT: no such file or directory, stat '/Users/kyle/Documents/openFrameworks-0.9.2/apps/myApps/mySketch'
    at Error (native)
    at fs.statSync (fs.js:854:18)
    at Object.fs.statSync (ATOM_SHELL_ASAR.js:225:16)
    at EventEmitter.<anonymous> (/Users/kyle/Documents/openFrameworks-0.9.2/projectGenerator-osx/projectGenerator.app/Contents/Resources/app/index.js:800:16)
    at emitTwo (events.js:87:13)
    at EventEmitter.emit (events.js:172:7)
    at EventEmitter.<anonymous> (/Users/kyle/Documents/openFrameworks-0.9.2/projectGenerator-osx/projectGenerator.app/Contents/Resources/atom.asar/browser/api/lib/web-contents.js:54:23)
    at emitTwo (events.js:87:13)
    at EventEmitter.emit (events.js:172:7)

this is with 0.9.2 and the latest ofxCv.

is there something additional i should do to get the project generator to work?

ofZach commented 8 years ago

I pulled the examples out of ofxCv into a new folder and did update and it worked. (although when I did verbose it stalled out I think because of a seperate issue with maxbuffer I need to look into https://github.com/openframeworks/projectGenerator/issues/122).

I think here it's obviously getting confused about what is a project -- it sees the "src" folder in the root of ofxCv and it thinks that it is a project, rather than the examples.

[notice ] updating project /Users/kyle/Documents/openFrameworks-0.9.2/addons/ofxCv

I think it doesn't recursively look inside of projects for more projects, so here it finds src, tries to do something and doesn't seek deeper. (our "is this folder a project" check is quite simple it just lookss for src: https://github.com/openframeworks/projectGenerator/blob/master/commandLine/src/main.cpp#L191-L214)

I am not sure the best solution but this is the same w/ ofxCv in 0.9.0 as well -- I think the best bet is to pull examples out of the addon to update them or we need to think about a better check for if a folder is a project or not.

kylemcdonald commented 8 years ago

i see, so this is a general bug with all addons that come with examples, not specific to ofxCv. in that case, would it make sense to assume that any folder starting with "ofx" is not a project folder?

i copied the examples into a new folder like you suggested and it worked, taking 83 seconds. i'll tell students to do that for now. i feel like it will give them the wrong intuition for how to work with addon examples, but maybe it doesn't matter when you're just getting started.

ofZach commented 8 years ago

yes this is a general bug (which has existed since 0.9 and maybe longer) -- if a folder has src in it it will be assumed to be an project so most addons will fail for batch update.

I think it's a good solution to change how we assume a project folder is a project but I am not sure if using "ofx" to disambiguate is the best option either (just as using "src" might not be ideal) since there's a chance you might be work on a project that could turn into an addon, etc. Maybe we can search for "src/main.cpp" or something more specific to projects (such as having bin/data) ?

It's probably good to open a second issue about how long the updating takes -- this is specific to osx and the recursive parsing for opencv -- I think there might be a way to cache the results on batch updates (or after you've parsed the folder once) so we can likely shave down that time (since it's unlikely the addon changed from moment to moment while doing the batch updates).

kylemcdonald commented 8 years ago

i understand. using main.cpp sounds more reliable. but if main.cpp is called ofApp.cpp that could be a problem. the most reliable solution might be checking if there is a void main or int main in the one of the files in src/, since this is the only real difference between an app and a library.