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

Schemes not detected when owned by workspace #144

Closed
valeriomazzeo opened this issue Sep 30, 2015 · 38 comments
Closed

Schemes not detected when owned by workspace #144

valeriomazzeo opened this issue Sep 30, 2015 · 38 comments
Assignees

Comments

@valeriomazzeo
Copy link

This happens both with an existing template or when creating a new template.

I don't really know what more information I can include.

Screenshot attached below:

screen shot 2015-09-30 at 17 20 15

@czechboy0
Copy link
Member

Yeah, can you please check whether you already filled-in your Xcode Server config first? I hacked it terribly, but there's an implicit dependency (first config Xcode Server, then config the Project) - because we need to fetch the list of devices from Xcode Server to show the list.

@czechboy0 czechboy0 added the bug label Sep 30, 2015
@valeriomazzeo
Copy link
Author

the created both runs on all the simulators available at the moment.

I am not sure what you mean with:

can you please check whether you already filled-in your Xcode Server config first?

What would be the steps to have it working again?

@czechboy0
Copy link
Member

screenshot 2015-09-30 17 31 15

As in before you go into setting up your project/build template, first finish setting up Xcode Server credentials on the right side of the Buildasaur window (above). Please make sure you hit Done to validate that it is accessible. Once done, try again to edit/create your build template, hopefully this should help. (Also, make sure you have your scheme already selected at the top).

@czechboy0 czechboy0 changed the title Device list is not populated [0.5.0] Build Template Device list is not populated [0.5.0] Sep 30, 2015
@valeriomazzeo
Copy link
Author

I was already doing that, unfortunately still doesn't work :(

@czechboy0
Copy link
Member

In that case, can you just run curl -k https://localhost:20343/api/devices for me and see if any devices are returned?

@czechboy0
Copy link
Member

Sorry @valeriomazzeo, I deleted the comment, that information also has UUID of your devices, which you don't want public :)

@valeriomazzeo
Copy link
Author

Fair enough, didn't look for it to be honest.

By the way, it's not empty as you could see :D

@czechboy0
Copy link
Member

But I see that the devices were there. Very strange. I wonder if the issue is in XcodeServerSDK or in Buildasaur. Could you please clone https://github.com/czechboy0/XcodeServerSDK and in there's a playground inside. In there, try to call on server server.getDevices... (see here) and print the result. I wonder if parsing hasn't been broken with a new version or something.

Thanks so much!

@valeriomazzeo
Copy link
Author

It looks like it doesn't get executed at all? I don't get anything in the completion block, not even errors.

@czechboy0
Copy link
Member

Is your Xcode Server running on localhost? If you open XcodeServerSDK.xcworkspace and on the left go to Playgrounds/XcodeServerSDK.playground, it should work. If your XCS is running on a different IP address, change that on line 7. This is the playground contents with the call changed to getDevices:

import Foundation
import XcodeServerSDK
import XCPlayground

let serverConfig = try! XcodeServerConfig(host: "https://127.0.0.1", user: "MacUser", password: "Secr3t")

let server = XcodeServerFactory.server(serverConfig)

server.getDevices { (devices, error) -> () in

    print(error)
    print(devices)
}

XCPSetExecutionShouldContinueIndefinitely(true)

This yields results on my machine (if you open the console at the bottom).

@valeriomazzeo
Copy link
Author

That's exactly what I did.

I managed to get the list of bots (so the playground was definitely working) but not the list of devices.

@czechboy0
Copy link
Member

Hmm that is weird indeed :( The API works, because curl returned the right data... I suggest you clone the source and try to debug the call, whether it returns. Unfortunately there's not much more I can do from here :(

@valeriomazzeo
Copy link
Author

I tried with a project importing XcodeServerSDK (without playground) and server.getDevices works perfectly fine.

@czechboy0
Copy link
Member

Ok then it must be somewhere in Buildasaur. Can you try to start over,
delete the project and configure it again in Buildasaur? Not sure what's
going on. Or clone the source and debug it :)
On Thu, Oct 1, 2015 at 10:20 AM Valerio Mazzeo notifications@github.com
wrote:

I tried with a project importing XcodeServerSDK (without playground) and
server.getDevices works perfectly fine.


Reply to this email directly or view it on GitHub
#144 (comment)
.

@valeriomazzeo
Copy link
Author

I can give it a try, where does Buildasaur store the configuration files?

@czechboy0
Copy link
Member

~/Library/Application Support/Buildasaur
On Thu, Oct 1, 2015 at 11:02 AM Valerio Mazzeo notifications@github.com
wrote:

I can give it a try, where does Buildasaur store the configuration files?


Reply to this email directly or view it on GitHub
#144 (comment)
.

@valeriomazzeo
Copy link
Author

it's exiting here:

    func processReceivedDevices(devices: [Device]) -> [Device] {

        //pull filter from platform type
        guard let platform = self.buildTemplate.platformType else {
            return []
        }

Probably because inside the following function it enters into the catch

func pullSchemeFromUI(interactive: Bool) -> Bool

Error Domain=com.honzadvorsky.Buildasaur Code=0 "Unrecognized type: " UserInfo={NSLocalizedDescription=Unrecognized type: }

and that's because in public class func parseDeviceTypeFromProjectUrlAndScheme(projectUrl: NSURL, scheme: String) throws -> DeviceType

typeString is empty

now I see why you meant with "it's hacky" :D

let script = "cd \"\(folder)\"; xcodebuild -scheme \"\(schemeName)\" -showBuildSettings 2>/dev/null | egrep '^\\s*PLATFORM_NAME' | cut -d = -f 2 | uniq | xargs echo"

I think the whole problem is that running xcodebuild -list on my project returns: This project contains no schemes.

@valeriomazzeo
Copy link
Author

So in the end, my project was setup like this:
screen shot 2015-10-01 at 11 55 08

Instead than like this:
screen shot 2015-10-01 at 11 54 58

With the first configuration, xcodebuild is not able to access the schemes (don't ask me why, they must have changed something in Xcode 7), and that triggers a whole chain reaction of not being able to load the devices list.

@czechboy0
Copy link
Member

Oh, amazing work, @valeriomazzeo, thanks so much for taking the time and actually debugging this onsite. I would not have been able to help you from where I'm sitting :)

This is interesting, because I remember adding support for schemes contained in either the project or workspace. Maybe they did change something in Xcode 7. Let me try to reproduce this.

Thanks again!

@czechboy0
Copy link
Member

Damn, I can't reproduce this locally. Even when I change the ownership of the schemes to the workspace, Buildasaur picks them up just fine.

I'm sorry - but could you try to change them back to be owned by the workspace and try Buildasaur again? If that doesn't work again that would be a bug in Buildasaur I would be very much interested in fixing. Thanks again 👍

@czechboy0 czechboy0 changed the title Build Template Device list is not populated [0.5.0] Schemes not detected when owned by workspace Oct 1, 2015
@valeriomazzeo
Copy link
Author

It's not a bug in buildasaur.

It's 'xcodebuild -list' that can't find the schemes with that kind of setup. As result, your script has nothing to parse.

@czechboy0
Copy link
Member

Are you able to isolate the cases when it doesn't work? Did you say it didn't find the schemes when they were under the workspace but did when under the project? What Xcode are you on? OS X?

@valeriomazzeo
Copy link
Author

OS X Yosemite, El Capitan (wasn't working on both)

Xcode 7 (I think they changed something in xcodebuild)

Under the workspace can't find them, under the project it can.

I was using -list for debugging, your script uses -scheme. Both said scheme not found.

I can try and see if I can reproduce it with a new project.

@czechboy0
Copy link
Member

That would be great, thanks so much. If they changed something, I'd like to make sure to support it in Builda :)

@czechboy0
Copy link
Member

You're right, I reproduced it. It seems that previously when you ran xcodebuild -list, it implicitly picked up the workspace, which contains both schemes from the workspace and the projects inside of it. Now, however, the .xcodeproj seems to get picked up.

Fix will be easy - we'll look at the file extension and if .xcworkspace, we run xcodebuild -workspace WORKSPACE_NAME -scheme SCHEME_NAME ... and if .xcodeproj, we run xcodebuild -project PROJECT_NAME -scheme SCHEME_NAME ...

Thanks so much for finding this, I'll try to push a fix ASAP. 🎉 👍

@czechboy0 czechboy0 self-assigned this Oct 2, 2015
@valeriomazzeo
Copy link
Author

no problem at all, it's the beauty of open source :)

@joelekstrom
Copy link
Contributor

I also have this problem, tests take about 30 min since it runs on ALL simulators/devices 😄

@czechboy0
Copy link
Member

@accatyyc Do you really mean this ticket or did you mean #147?

@joelekstrom
Copy link
Contributor

I think I mean this. I can't select to run only on devices/certain simulators since nothing shows up during config. Which means it runs on everything

@czechboy0
Copy link
Member

Ha, okay, sorry. Yes, I'm fixing this as we speak, hopefully will have a fixed version released in about half an hour.

@joelekstrom
Copy link
Contributor

Nice 😄 talk about quick support

@czechboy0
Copy link
Member

Ok, it might actually take a bit longer 😆

@czechboy0
Copy link
Member

@valeriomazzeo I just merged the fix into master. Could you please try to pull and build from source and make sure that it's now working for you? @accatyyc feel free to do the same. I want to make sure it really works before I make the release. Thanks!

@joelekstrom
Copy link
Contributor

Great, will try!

@valeriomazzeo
Copy link
Author

I confirm that now it works in both configurations 👍

well done!

PS: If you are about to make a new release, could you please have a look at #147 first? It's really really really annoying :S

@joelekstrom
Copy link
Contributor

I have tested now, and it works with a quirk.

First when opening Buildasaur, I verified the Xcode server settings first. Then started editing the scheme settings. No devices or options showed up, so I thought the bug was still there. But then I switched to a different scheme and back and all devices showed up!

@valeriomazzeo
Copy link
Author

devices are pulled the moment you select a scheme from the dropdown menu I guess

@czechboy0
Copy link
Member

Yes. It should also re-pull on show of the whole screen, so that should be considered a bug I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants