We're using KM V9.0.4 to automate Xcode builds. We are finding that Xcode 11 is a complete PITA for automation (and that's being polite).You have to click too many things and too many elements are binary switches with no way of determining what the state is. It's a complete mess.
Anyway, one of the things we have found is that we need to add a framework to Xcode. To do this you have to navigate down a directory system to find the framework by clicking on a dialogue box, which opens a finder like open file window.
We would have hoped that we could navigate the open file window by entering the directory/folder name and clicking on the Open button, this would allow us to specify the path clearly in case new directories are in the system. See below
However entering the name of the directory and pressing the Open button doesn't open the directory but inserts the directory into the Xcode framework. It does look like the Xcode developers have screwed around here.
To open the directory you have to double click the folder name with the mouse, we cannot find a key combination that opens the folder. Enter inserts the folder, Apple-O inserts the folder.
Our problem is that the directories listed may not be the same order each time or there may be other folders/directories in place, so doing a absolute mouse click may not work in future. What we want to do is to select the folder by typing the name (which works), and then move the mouse to the selection and then double click.
If your above image shows the target folder selected, then using a Move or Click Mouse action with an image like this (do your own screenshot) should work.
You should be able to restrict the Found Image search to a specific window (frontmost window).
Thanks for this, yes it works, wasn't aware of this functionality and think it's cool. Still working out how KM does it so quickly
I have screen grabbed all the folders and updated the code to use this technique. It seems to work well, I get a green bar with a percentage sign where it finds it, I assume (and will check) it's some sort of matching result.
My next problem is an osascript timeout. I have updated according to another post on this forum
osascript -e 'with timeout of 86400 seconds' -e 'tell application "Keyboard Maestro Engine" to do script "JambusterXCodeUpdates" with parameter "/Users/rwillett/Documents/src/Jambuster_Suite/BlackwallTunnel/platforms/ios/Blackwall Tn.xcworkspace"' -e 'end timeout'
but that doesn't seem to work. I'll keep digging though, two steps forward, one step back.
The aim of the 'system' we use is to create an Ionic/Cordova application. Our application is basically the same application but due to a runtime configuration parameters presents itself very differently to users. We are working on 10 different 'versions' of the app. Its more than rebranding
As each Ionic application needs it's own Apple/Android identifiers, Xcode provisioning profile etc etc, the easiest (and we believe only) way to manage this is to have separate development directories that are automatically created and managed. Currently we have two separate applications, Jambuster and Jambuster Blackwall Tunnel. Each of these applications is both IOS and Android. We are planning another eight applications, each having Android and IOS versions. So thats 20 different apps.
The creation method is complex as we need to
manage all the differences that need to arise, e.g. different config.xml files, different configuration files. Different Xcode config files.
Keep the differences to a minimum so that we can avoid version skew. We want to make one change only to a source file and that is automatically picked up by every version of the application.
We could use git to do some of this (and indeed we do), but the easiest way is to create a series of hard links to a master directory and manage the issues the issues that arise from this. We have tried having separate files and it's a nightmare to sync. We've been doing this for three years now and we have tried most methods.
So we have a master Perl script that creates each application. This Perl script does
Iniitiates the Ionic applicartion
Adds the right NPM modules
Updates the Ionic application
Adds the right Cordova plugins. Some of the plugins have different configurations for different apps, e.g. Apple insists on different wordage for background geolocation usage for different apps.
Adds in a push notification provider, OneSignal. This is actually a major hassle as it needs to be edited, targets created in Xcode and libraries added to Xcode.
Adds the right platforms to Cordova.
Prepares the platforms and adds in the missing icons, e.g. cordova missed out the 216x216 icons needed for Xcode
Update Xcode with the right provisioning profiles.
Modifies the Pbxproj files as the default settings are wrong.
Creates the right .git files.
Adds US Encryption Exempt status
Our problem is now down to adding and creating the right libraries in Xcode. To do this we call KM, but as far as we can see, the only way to call KM is via osascript from Perl. If there is another way we'd love to know. Basically we have to call KM from Perl as there is simply too much code needed in Perl.
We have already broken down the KM script into two parts to get around the problem. We realised that 86400 seconds is a day, but adding the timeout still didn't work.
I can post the script, is there a recommened approach?
We'll keep looking and persevering. We are looking at the npm module xcode to see if that helps us as well.
If you are open to alternative designs and methods, let me suggest that you post a brief summary, with perhaps the above list of Perl tasks, to the Script Debugger Forum. They welcome general questions about AppleScript and ASObjC, and it is owned by two very knowledgable people who use Xcode extensively and are experts at AppleScript and Objective-C: @ShaneStanley and Mark @Alldritt
I'm thinking it is likely that they might have some ASObjC suggestions that you could use for all or part of your process. They would also know how to address the AppleScript timeout issue.
Apologies for taking so long to come back. We were experimenting with a NPM module xcode that had promise of directly manipulating Xcode. Sadly whilst it could probably do what we wanted, the documentation on it was zero so we spent a few days trying to work out what we needed to do. It turns out that we simply couldn't decode the pbxproj files to get it working. I have to say Apple does some serious weird stuff with it's compilers and build systems. I used to build compilers and build systems and it's so odd...
Anyway, we have come back to KM to see if it can work. We've spent the day getting back up to speed and then we find one Xcode issue after another. We cannot guarantee or rather Xcode cannot guarantee that Xcode will be in a consistent state for what we want to do.
As an example, we generate a new Notification Service Extension from the File->New->Target. This will generate the right files and we can see them in the file menu on the left of Xcode. Sometimes when we click on the file that has just been generated, it opens as a blank file. If you close Xcode down, and restart it and then click on the file, you can see the contents. This is nothing to do with KM but rather Xcode as this happens manually.
Xcode is a pile of utter junk as far as we are concerned, sentiments shared by many people we know in the business. We know some people love it, but it's just got bigger and more bloated and slower and ...
Anyway as we cannot guarantee Xcode is going to be in a consistent state, we are cutting our losses and accepting we will have to do our changes manually. There's just too many issues for us to try and work around them.
This is no reflection on KM, but a simple acceptance that we are spending too much time trying to solve a problem that Apple makes difficult for no real reason. It's costs too much of our time to try and resolve so far and we'll cut our losses.