Extract App Intents Metadata - very slow build step - swift

The app intents extraction from the new AppIntents framework takes a lot of time, even when changes in code don't touch the intents directly.
In the build log reasons for this step to happen differ, but mostly it's that "file X changed" and I wonder if I can somehow cache that intent or at least extract this metadata only in Production builds? Simple #if debug doesn't prevent this step from being executed.

So far the only idea I came with is to switch the executable run by xcode.
It's inside /Applications/Xcode.app/Contents/Developer/usr/bin named appintentsmetadataprocessor make sure to backup it!. I replaced it with simple
#!/bin/sh
exit 0
Of course you need to add chmod +x to it.
Then your widgets won't work, but if you're building releases through CI you should be safe + you can always put the previous appintentsmetadataprocessor back.
Now the step takes 0.1 sec.

Related

Simulink Real-Time Desktop model: why does it rebuild on every run?

I have a Simulink Real-Time Desktop model that launches from a GUIDE application in External mode. My problem is how to run the model without Matlab rebuilding it every single time.
In the _OpeningFcn I included a 'rtwrebuild' command with the expectation that this would rebuild the code only if the model had been changed since the last run. However, when I start the real-time simulation using set_param(MODEL, 'SimulationCommand', 'start', ...), it invariably rebuilds the code regardless of what 'rtwrebuild' did. How can I keep the start command from causing all these unnecessary builds?
Since I don't have reputation enough for posting a comment request for clarification, I'll ask it here; did you check the rebuild option setting in the configuration set?
From my own experience it take a long time even if set to only rebuild if changes detected because it still opens every single file in the model tree to check that nothing was changed. Also I think some parameter changes counts as cause for rebuild. If you don't want that you need to set "Never" rebuild and control this yourself.

Uses of .devmode.js file in production mode

I have a simple GWT app.
Whenever I run gwt compilation for production, I also see a file with the extension .devmode.js being generated.
Questions:
This looks like a devmode-related file; do I actually need it while running in production? Do I need to delete it?
What does it do?
If useless, is there any way to stop it from being generated while in production?
I'm using GWT 2.8.
Kind regards,
Andrei
It is specific to legacy Dev Mode, and not used in Super Dev Mode. If you don't ever use legacy Dev Mode, you don't need it.
You don't need it in production... unless you ever need to debug your app in production. If you ever want to debug your app in production (with legacy dev mode), you should leave it.
You do not need to delete it - it will not be used unless you attempt to enter dev mode, and it is a static file, and cannot be used to maliciously debug your app, unless the attacker also has all of your original Java source code already.
The Linker system does not currently have a way to prevent it from being emitted. The "generation" of it is very simple, only the __MODULE_NAME__ tokens are replaced with the name of your app, so there is essentially no penalty paid in creating it.
Unless you need the extra 1k of disk space in your generated app, I wouldn't worry about it at all as there is no risk in having it. If you do need that extra 1k, either modify your current linker to avoid emitting it, or add a later build step to delete it.

how to suppress the enoying dialog boxes when developing xPages?

Anyone know how to remove or supress the enoying dialog boxes when developing xPages
If you are just making small xpages application you might not see these very often, but the more complex your xPages get you see these all the time. specially when you navigate your xpage using the outline view or during build
I click the x several times every day to get rid of it, Not sure if the operation quits when I click the x or if it continues in the background.
I would like a setting to get rid of it once and for all
Well, in your designer, you should disable Build automatically in the Project menu. This will remove the constant build, but also means that you have to build manually, when needed.
You could also take a look at Nathan T. Freeman's post on the matter # Making Domino Designer work like you want
Are you using any java libraries added to the webinf/lib dir in your nsf? I noticed that when adding any jar files to the lib dir rebuilding your application can take ages..
I had 2 external jar files used in my project (contained within the database). It used to take around 5-10 minutes to compile the project. Any changes to the XPages/Custom Control/Java files needs a recompile. And you can imagine the frustration I had with the compilation time. Later I detached the jar files and put under the jvm\lib\ext folder. The compilation time drastically reduced to 1 minute. Still not happy.
As a next step, took a local replica of the database and started making the changes and recompilation on the local replica. Once done, replicated the databases and always previewed the changes on the server version. The compilation time is hardly 10 seconds. So 10 minutes to 10 seconds :)
Switch off build automatically, it will solve most of these.
There is also a known issue SPR SODY8Q9KNA where Java Design elements (new feature in 8.5.3) keep getting rebuilt on designer start up. That brings up the same pop-up.
There should be a fix for that in 8.5.3FP1 but I am not in an official position to say it will be in FP1 until it actually ships. You can check in the release notes as they are updated.
http://www-10.lotus.com/ldd/r5fixlist.nsf/(Progress)/853%20FP1

How to run and debug unit tests for an iPhone application

NOTE: Unit testing is a lot easier to setup nowadays. This tutorial is not really relevant for Xcode version 5 and above.
It took me quite some time but I finally managed to make it work for my project.
To create the "logic" tests I followed Apple guidelines on creating logic tests.
This works fine once you understand that the logic tests are run during build.
To be able to debug those tests it is required to create a custom executable that will call those tests. The article by Sean Miceli on the Grokking Cocoa blog provides all the information to do this. Following it however did not yield immediate success and needed some tweaking.
I will go over the main steps presented in Sean's tutorial providing some "for dummies" outline which took me some time to figure out:
Setup a target that contains the unit tests but DOES NOT run them
Setup the otest executable to run the tests
Setup the otest environment variables so that otest can find your unit tests
The following was performed with XCode 3.2.5
Note for XCode 4
In XCode 4 it is possible to debug your unit tests DIRECTLY. Just write your test, add it to your target as one of the tests and set a breakpoint in it. That's all. More will come.
Step 1 - Setting up the target
Duplicate your unit tests target located under your project Targets. This will also create a duplicate of your unit tests product (.octest file). In the figure below "LogicTest" is the original target.
Rename both the unit tests target and the unit tests product (.octest file) to the same name. In the figure below "LogicTestsDebug" is the duplicate target.
Delete the RunScript phase of the new target
The name of both can be anything but I would avoid spaces.
Step 2 - Setting up otest
The most important point here is to get the correct otest, i.e. the one for your current iOS and not the default Mac version. This is well described in Sean's tutorial. Here are a few more details which helped me setting things right:
Go Project->New Custom Executable. This will pop open a window prompting you to enter an Executable Name and an Executable Path.
Type anything you wish for the name.
Copy paste the path to your iOS otest executable. In my case this was /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/Developer/usr/bin/otest
Press enter. This will bring you to the configuration page of your executable.
The only thing to change at this point is to select "Path Type: Relative to current SDK". Do not type in the path, this was done at step 3.
Step 3 - Setting up the otest arguments and environment variables
The otest arguments are straightforward to setup... But this proved to be my biggest problem. I initially had named my logic test target "LogicTests Debug". With this name and "LogicTests Debug.octest" (with quotes) as argument to otest I kept having otest terminating with exit code 1 and NEVER stopping into my code...
The solution: no space in your target name!
The arguments to otest are:
-SenTest Self (or All or a test name - type man otest in terminal to get the list)
{LogicTestsDebug}.octest - Where {LogicTestsDebug} needs to be replaced by your logic test bundle name.
Here is the list of environment variables for copy/pasting:
DYLD_ROOT_PATH: $SDKROOT
DYLD_FRAMEWORK_PATH: "${BUILD_PRODUCTS_DIR}: ${SDK_ROOT}:${DYLD_FRAMEWORK_PATH}"
IPHONE_SIMULATOR_ROOT: $SDKROOT
CFFIXED_USER_HOME: "${HOME}/Library/Application Support/iPhone Simulator/User"
DYLD_LIBRARY_PATH: ${BUILD_PRODUCTS_DIR}:${DYLD_LIBRARY_PATH}
DYLD_NEW_LOCAL_SHARED_REGIONS: YES
DYLD_NO_FIX_PREBINDING: YES
Note that I also tried the DYLD_FORCE_FLAT_NAMESPACE but this simply made otest crash.
Step 4 - Running your otest executable
To run your otest executable and start debugging your tests you need to:
Set your active target to your unit test target (LogicTestsDebug in my case)
Set your active executable to your otest executable
You can build and run your executable and debug your tests with breakpoints.
As a side note if you are having problems running your otest executable it can be related to:
Faulty path. I had lots of problem initially because I was pointing to the mac otest. I kept crashing on launch with termination code 6.
Faulty arguments. Until I removed the space from bundle (.octest) name I kept having otest crash with exit code 1.
Wrong path in environment variables. Sean tutorial has lots of follow-up questions giving some insight on what other people tried. The set I have now seems to work so I suggest you start with this.
You may get some message in the console which might lead you to think something is wrong with your environment variables. You may notice a message regarding CFPreferences. This message is not preventing the tests from running properly so don't focus on it f you have problems running otest.
Last once everything is working you will be able to stop at breakpoints in your tests.
One last thing...
I've read on many blogs that the main limitation of the integrated XCode SenTestKit is that tests cannot be run while building the application. Well as it turns out this is in fact quite easy to manage. You simply need to add your Logic tests bundle as a dependency to your application project. This will make sure your logic tests bundle is built, i.e. all tests are run, before your application is built.
To do this you can drag and drop your logic test bundle onto your application target.
This post is intended as a "How-to" more than a real question. Therefore this answer is just meant to allow me to mark the "How-to" as "answered". This will probably be flagged by the community as irregular. I'm up for suggestions on where to post future "How-to" articles.
One final note though on this topic.
For those who still wonder whether writing unit tests is worth it I would definitely say Yes!
I am currently writing an application with CoreData and retrieval of data from a web service (xml parsing). The complete model can be tested and debugged without having to:
run the actual application on the simulator or device. Not having to use the device to run the tests is a huge gain of time. It's the difference between 2 minutes and 5 seconds per run.
without the need to create views or controllers when testing the model. The complete development and testing can focus on the model only in the first iteration. Once the model is cleared for integration the rest of the development can follow.
To debug the xml parsing I can simply use "hard-coded" files which I completely control.
The crux is of course to write the tests as you implement features in the code. It really is a time saver down the line in terms of debugging of the complete application.
VoilĂ , I'll leave it at that.
I was able to run the test case in debugger in the following simple steps:
Product > Build For > Testing
Put a break point in part of the test you want to debug
Product > Test
This is on Xcode 6.0.1 and seems much more convenient than the long procedure described above.

Unit testing in XCode 4

I've managed to set up unit tests for my library in Xcode 4. I've performed builds with tests that I know will pass and fail (i.e. STAssertTrue(YES) and STAssertTrue(NO) ) just to make sure it's working. I'm using the default apple SenTest libraries following this document.
However, when my tests are running I'm getting this error in the build log :
An internal error occurred when handling command output: -[IDEActivityLogSectionRecorder endMarker]: unrecognized selector sent to instance 0x20310b580
To be clear, it's not affecting the running of the tests at all, just the output into the build window. All the tests run each time so I can tell a pass / fail by looking to see if the build succeeds or fails.
However, when my tests fail I can't find out which one fails because the output seems to stop when it gets to that error.
Does anyone have experience with unit testing / Xcode 4 / this error?
I just posted this on another thread, but I'm going the opposite direction for Xcode 4.
Please see my blog post exploring the topic, leave a comment if you think I'm wrong.
I realise it doesn't directly answer your question, but forget SenTestingKit and use GHUnit. It'll take you about 10 minutes to figure out (much more straightforward than OCUnit) and will save you a lot of headaches. IMHO, Apple should be shipping it with Xcode instead of OCUnit.
GHUnit can run your tests in a true application environment (with a GUI), or on the command line. It literally just drops into your existing project as a separate target.
https://github.com/gabriel/gh-unit