-
Notifications
You must be signed in to change notification settings - Fork 43
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
Config to only add j2objc_shared method to Podfile #565
Conversation
@@ -664,6 +664,8 @@ class J2objcConfig { | |||
*/ | |||
String xcodeProjectDir = null | |||
|
|||
boolean onlyAddJ2ObjcToPodfile = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Rename so that it's more clearly associated with the xcodeTargetsIos config:
xcodeTargetsManualConfig
- Add the javadoc to it indicating what it does:
/**
* Allows manual config of the Podfile (default is false).
*
* When set to true, this allows manual configuring of the Podfile targets.
* This is necessary when your Podfile is too complex to be automatically
* updated. When used, you must also set xcodeTargets{Ios|Osx|Watchos)
* to empty.
*/
- move this after the xcodeTargetsWatchos setting, so it's the last one listed.
Hi @saruye, thanks for your work on this. I think that generally this is on the right track. I came across this when looking at some complex Podfiles, so I thought that eventually people would need it. To answer your questions: My questions:
in the task I used updateTargets now as a boolean since that seemed more straight forward. Is that ok?
So far the method is always added before the target instructions. Where should it go if this cannot be found?
Two thoughts:
Is it possible to just add it at the beginning of the file? Maybe before the 'source ...' ?
So I think that line 3 being the first line that isn't a comment could work. As above though, if the code has been moved elsewhere in the file, then it should be updated in place. |
I tried to implement all your feedback. I didn't get to implement the actual updating logic though. My idea is to replace the regexStripLines with somethingLike regexReplaceLines and then update the insert logic only to run if nothing was replaced and to insert it at the beginning if no targetStartRegex is found. Try to get to it sometime this week. |
"Can be optionally configured for xcodeTargetsOsx and xcodeTargetsWatchos\n") | ||
boolean xcodeTargetsAllEmpty = | ||
xcodeTargetDetails.xcodeTargetsIos.isEmpty() && | ||
xcodeTargetDetails.xcodeTargetsOsx.isEmpty() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've generally avoided the style of extra indentation for multiple lines. So lines 408 and 409 should start at the same place as line 407.
This applies several times below as well.
@superarne, @saruye - are you the same user? It's just a little more confusing when you're using different accounts. This is definitely coming along. Definitely make sure that all the unit tests pass. When it's ready, ping me again all I'll go do a final review. |
implement insert at correct line without target
…c-gradle into only-update-podfile
hi. yeah that was me. I was logged in with a wrong account. sry :/ |
*/ | ||
@VisibleForTesting | ||
static List<String> regexReplaceLines(List<String> podfileLines, | ||
String startRegex, String endRegex, List<String> newPodFileLines) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a variation of the regexInsertLines method. Just extend regexInsertLines, to add a boolean replace
parameter. If true, it should skip copying the old lines. It avoid having duplication of similar code.
@brunobowden
I started working on issue #561. This is not finished. I just opened this PR already to get some feedback if I am on the right track.
My idea was: Add an extra property that can disable updating the targets. Default will be as it is. If the property is set, it will disable all checks for targets and only add/update the j2objc method to the Podfile. Is that the intention?
My questions:
naming: since you renamed the ticket I guess you prefer the naming to be something about "only to add the method" instead of "disabling updating of the target"? in the task I used updateTargets now as a boolean since that seemed more straight forward. Is that ok?
So far the method is always added before the target instructions. Where should it go if this cannot be found? Is it possible to just add it at the beginning of the file? Maybe before the 'source ...' ?