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

Shortcut only works from class to test file #9

Closed
c3farrell opened this issue Jul 29, 2015 · 4 comments
Closed

Shortcut only works from class to test file #9

c3farrell opened this issue Jul 29, 2015 · 4 comments

Comments

@c3farrell
Copy link

Hi, Thank you for the plugin!
After install to Xcode 6.4, via Alcatraz, the shortcut works from class file to test file.
When I am in the test file, the shortcut does not return me to the class, nothing happens.
My test files are suffixed with 'Spec' rather than 'Test,' not sure if that matters.
Thank you!

@marksands
Copy link
Owner

Thank you for reporting this! I've been wondering how long my hack would hold up before it crumbled beneath itself. I will find time to monkey patch 'Spec' as an alternative naming scheme, but ideally I need some sort of engine that does a way better job of guessing than assuming a file suffix.

@kenji21
Copy link
Contributor

kenji21 commented Jul 30, 2015

Maybe looking at target membership ?

$ /usr/libexec/PlistBuddy Test7.xcodeproj/project.pbxproj -c "print rootObject"
BA96075A1B26F7E50001E907
$ /usr/libexec/PlistBuddy Test7.xcodeproj/project.pbxproj -c "print objects:BA96075A1B26F7E50001E907:targets"
Array {
    BA9607611B26F7E50001E907
    BA9607751B26F7E50001E907
    BA9607801B26F7E50001E907
}

Then choose the second targets (as I know that is a test one, but we can iterate within plugin) :

$ /usr/libexec/PlistBuddy Test7.xcodeproj/project.pbxproj -c "print objects:BA9607751B26F7E50001E907"
Dict {
    buildConfigurationList = BA96078D1B26F7E50001E907
    productReference = BA9607761B26F7E50001E907
    productType = com.apple.product-type.bundle.unit-test
    productName = Test7Tests
    isa = PBXNativeTarget
    buildPhases = Array {
        BA9607721B26F7E50001E907
        BA9607731B26F7E50001E907
        BA9607741B26F7E50001E907
    }
    dependencies = Array {
        BA9607781B26F7E50001E907
    }
    name = Test7Tests
    buildRules = Array {
    }
}

And the first build phase ( the one of type PBXSourcesBuildPhase ) :

$ /usr/libexec/PlistBuddy Test7.xcodeproj/project.pbxproj -c "print objects:BA9607751B26F7E50001E907"
Dict {
    isa = PBXSourcesBuildPhase
    buildActionMask = 2147483647
    files = Array {
        BA96077B1B26F7E50001E907
        BA9607951B26F7F50001E907
        BA9607971B26F7FC0001E907
    }
    runOnlyForDeploymentPostprocessing = 0
}

And now the files are nearly there :

$ /usr/libexec/PlistBuddy Test7.xcodeproj/project.pbxproj -c "print objects:BA96077B1B26F7E50001E907"
Dict {
    isa = PBXBuildFile
    fileRef = BA96077A1B26F7E50001E907
}
$ /usr/libexec/PlistBuddy Test7.xcodeproj/project.pbxproj -c "print objects:BA9607931B26F7F50001E907"
Dict {
    path = TestSwift.swift
    isa = PBXFileReference
    sourceTree = <group>
    fileEncoding = 4
    lastKnownFileType = sourcecode.swift
}

Maybe it would be more easy to have test files using objc within the plugin :-)

@marksands
Copy link
Owner

@kenji21 I'm not sure what you're saying. I do look at target membership.

@marksands
Copy link
Owner

@chrisfarrell 8da4910 should fix your issue. Let me know if it's not solved. 👍

I'm now working on Aviator 2.0 on a local branch, since I just found out that Xcode automatically parses the information I need. I just need to rewrite this plugin to use that framework, so there shouldn't be any more issues like this cropping up in the future!

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

3 participants