developertown / integratej2objc

MIT License
3 stars 4 forks source link

Seems to be removing files it shouldn't? #16

Closed mungler closed 9 years ago

mungler commented 9 years ago

Hi,

I'm trying to build a static library using mostly generated j2objc-derived code, along with some utility classes. Lets call it libfoo - I have added a group inside the libfoo xcode project called libfoo_generated, and am invoking integratej2objc as follows:

bundle exec integratej2objc integrate_source  -x libfoo/libfoo.xcodeproj -s generated -g libfoo_generated -t libfoo

However, this appears to remove some non-j2objc files from the project too - Git shows the generated files being added, but also the following lines removed:

-                               9869D3B71AE67A4100528768 /* FooBarBaz.m in Sources */,
-                               9869D3A11AE67A2700528768 /* libfoo.m in Sources */,

Is this expected behaviour? I expected these files to be left alone, since they're outwith the libfoo_generated group.

Thanks!

mungler commented 9 years ago

After opening the xcode project up after the integratej2objc step has run, I can see the library's main file no longer has target membership: http://screencloud.net/v/bfck

mungler commented 9 years ago

So, this is my problem: https://github.com/developertown/integratej2objc/blob/master/lib/j2objc_shared_lib_smanger.rb#L30

That line removes my files from the target build phase. The question is: why? Doesn't this rather assume that the target has no other source files, other than the ones from j2objc?

mungler commented 9 years ago

As far as I can tell, from reading the xcodeproj source, the call to remove_from_project here: https://github.com/developertown/integratej2objc/blob/master/lib/j2objc_shared_lib_smanger.rb#L45 will take care of removing the file from the source_build_phase (see https://github.com/CocoaPods/Xcodeproj/blob/master/lib/xcodeproj/project/object.rb#L100), so this .clear call may well be unnecessary. Certainly, it prevents me from using integratej2objc to achieve my aims, currently :)

Tomorrow I will try to look into forking the project and adding spec coverage to test whether my assumption is correct. If so, I think this line should be removed to allow non-derived sources to be included in the target without being unceremoniously removed.

mungler commented 9 years ago

In fact, I did fork the project, and commented out that line. This fork now works perfectly for my purposes. https://github.com/asmallworldsite/integratej2objc in case its useful to anyone.

brunobowden commented 9 years ago

@developertown - If you're not actively working on this, would you be open to handing over the management to someone else who's interested? If you'd like to actively manage it, then we'd all be happy to hear from you.

mungler commented 9 years ago

:+1:

jonnolen commented 9 years ago

Sorry for not being more responsive, but yeah we gave up on j2objc. I'll pull down this repo so it's not confusing the issue anymore.

As to why we would remove all of the files, our intended use case was to pull in the j2objc generated files as effectively a sub project. I believe there was a way to specify a sub group of the project so that you could isolate all generated code to one group. Again, this was about three weeks into an experiment that we later abandoned. I'll just close this pull request, and link to asmallworldsite/integratej2objc in the readme.