Developing an OS X Cocoa app to support plugins - cocoa

I am developing an OS X app in Cocoa that should support plugins (which are bundles of code, images, etc.) The application works, but with Lion things seem to be more complicated. I used to install a framework in ~/Library/Frameworks/ that the plugin could link against. Now it is more difficult to get permission to write to that directory.
Ideally, the framework that the plugin links to would just live within the main app's bundle. Then an installer wouldn't be necessary. I can't figure out how to do this though. In particular, I don't know where to put the framework during the plugin development. Are there any open source projects that support plugins that I can look to for guidance?

Related

How to add system api classes to your android project for non AOSP builds

I have an android system app that is currently being built with the android build system. The SDK in use is system_current as it uses some system apis.
For external dependency reasons, ease of development, debugging etc, it would be nice to move this app to Android Studio and use Gradle to build.
Converting the sources to build with Gradle is straight forward enough. However, at build time, the system APIs are not found as those are not available in the normal SDK. I thought that by generating the SDK from the AOSP sources I'd get an SDK I could use, but that target output seems to also not have the System APIs available.
How would I change my gradle build to be able to use the System SDK to compile against?
There are two ways depending if you are only trying to use current non-public APIs, or of you've added custom ones yourselves and are trying to access those.
If you're only trying to use current system-level APIs, you can use android.jar from this repository https://github.com/anggrayudi/android-hidden-api
If you have added some new method that isn't part of standard AOSP, then it's a but more work.
The reason that all methods don't show as part of Android SDK is that in AOSP code they are annotated with #hide. This means that when SDK is generated, they are exlcuded.
You'll need to remove that annotation for the methods that you want to use. Then you'l need
Run make update-api to update the public API of the project.
Make the Android SDK from code by following: https://android.googlesource.com/platform/sdk/+/master/docs/howto_build_SDK.txt
Change the Android SDK path in Android Studio to use the custom one you build.
There's also the possibility of accessing methods via reflection on runtime without SDK generation. It's slower and messier to code though.
Not sure I understand exactly what you mean by normal SDK etc.
From https://developer.android.com/studio/build
The key part is to have a
apply plugin: 'com.android.library'
...
android {
...
}
If on the other hand you wanted to build with a desktop JDK but compile against java APIs you could add a dependency on robolectric and you can get a jar you can import into another Android project.
implementation "org.robolectric:android-all:11-robolectric-6757853"
Android Studio isn't really designed to work with System APIs. Even if you make Gradle build your platform app, you will also need to sign it with the same certificate as your AOSP build (so that you could run it). As you noticed, if you decide to use Roboelectric you would also need to modify it yourself to match your current AOSP version (System APIs are not as stable as Public APIs and Roboelectric needs to constantly chase all the changes).
I would suggest to keep using the AOSP build system but optimize our workflow.
Ease of development
Doing a full build/flash for every change in your component must be a pain. But if you are just modifying a single app, you can get away with just building that single component:
~/aosp/ $ m -j -- do a full build first
flash a clean image (with your platform certificate)
~/aosp/path/to/your/app/ $ mma -j -- build your app with all dependencies after you made changes
$ adb root && adb remount && adb sync
Basically, adb sync works great if you don't touch any APIs or parts of Android Framework (which would cause a rebuild of thousands other objects). If you see adb sync updating more than handful of files, you'll likely end up with a bad system and need to do a full flash.
Debugging
While Android Studio is a to-go solution for regular apps, framework and the platform apps go with InteliJ (you can probably use Android Studio, but there won't be much of use of Android plugins on top InteliJ) plus some configuration (see idegen.sh - example).

iOS Unity3D game with Apple Watch companion

guys.
First goes the questions.
I need to combine different Xcode projects for iOS and watchOS. And I need automation for this.
Is it possible to set reference in iOS-Xcode project to watchOS-Xcode project, and setup outer project to build target iOS app with embedded watchOS app, by using targets of inner project? Is it possible to do such a thing with workspaces?
Are there exist some command line tools for managing Xcode project, like adding targets, changing build settings, setup build phases, add resources and so on?
Problem summary.
I'm currently developing video game with Unity3D for iOS and want to make a companion application for watchOS. The problem is that Unity doesn't have any built-in support for watchOS, thus I have to care about integration of watchOS part by myself.
I have Unity project for the game itself and different Xcode project for watchOS part of the game. Now I combine Unity-generated Xcode project with the necessary parts of watchOS project manually: I create WatchKit App target, then import necessary resources from the separate watchOS-project, setup build settings as required - and that do the thing, I get the game with Apple Watch support.
The thing is, that I need to do automation for this process. But I haven't found some useful information on this topic neither here (on stackoverflow), not did on official apple developers' site, not on unityanswers.com, nor in Xcode documentation.
Thanks in advance.

JavaFX Native Packaging EXE on a Mac

I am using Eclipse on Mac to develop my JavaFX application. I have packaged it as a dmg very nicely with the ant build and e(fx)clipse plugin.
However I now need to make this application an exe. Every tutorial and help I have found so far show that you need Inno Setup however this program is only available for Windows and I am on a Mac.
How should I go about this?
Any help is appreciated!
It is not possible, as documented at official oracle website:
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
Self-contained application packages have the following drawbacks:
Package per target platform: Self-contained application packages are platform-specific and can only be produced for the same system on
which you build. To deliver self-contained application packages on
Windows, Linux, and OS X, you must build your project on all three
platforms.
Creating native bundles/launchers is tied to internal tools calling local installed toolsets, so running any "EXE"-file would never work. An option would be to install a windows-system inside some virtual machine.
Some notes about "create 32bit on 64bit"-systems and vice-versa: it is tricky and not very possible, at least on windows-systems. I encountered this while debugging some issue of the javafx-maven-plugin (disclaimer: I am the maintainer of that maven-plugin)

Xcode: How to use separate Projects with cross-project references to embed a framework in your application?

I am using Xcode 4.3.
I have an existing Xcode Project (originally created in Xcode 3) for a embeddable Mac OS X Framework. This Project has a few Targets, but the primary Target in this project is for my Framework. This Framework is designed to be embedded in Mac Apps and has the appropriate Installation Directory properties set. (#executable_path/../Frameworks)
I have a new Xcode Project (created just now in Xcode 4) for a Mac OS X Application. There is only a single Mac App Target in this Project.
I would like to combine my old Framework Project and/or Target into the new App Project so that I can build both the App and Framework from source in a single, combined build process. (I have done this in Xcode 3 many times, but cannot figure it out in Xcode 4).
I do not (unless it's the only way) want to build my Framework separately and then just link to it from my App Project. I want to combine the Framework Target into my Mac App Project.
Here's Apple's outdated documentation describing how to do what I want in Xcode 3:
Embedding a Private Framework in Your Application Bundle > Using Separate Xcode Projects For Each Target
How do you do this in Xcode 4?
Note: I just need to know how to add my Framework Target to the new Project. From there, I know how to add the dependencies and do all the Build Phases of linking and copying the built Framework into the app bundle.
After working through a tricky issue in Xcode 4.3.1, I discovered how to do this. I've given a full/detailed example in my answer to another question about how to embed ParseKit in a Mac App.
I also found excellent information on the topic in Chapter 16 of Mastering Xcode 4 by Joshua Nozzi.
You actually have 2 separate Xcode project files here: Application and Framework. The answer is the section below the one you find: Using Separate Xcode Projects For Each Target
Edit:
OK. Now I remember. You need to create a workspace and add both projects to it. Then you can add target in one project to the other for dependency: Adding an Existing Project to a Workspace
I don't have all the details since I don't have a Mac now. But I think you can figure it out once you created the workspace.

Internal Linking of Cocoa Frameworks

In my open-source Cocoa project, I have two Xcode projects -- one framework and one application. I want to link the framework in the application, and whenever I build the framework, I want the linked framework in the application to be updated automatically as well.
What is the correct way to set this up, especially so that someone else who clones my project can easily build both the framework and the application?
Drag the Framework project into the App project's source list (on the left). I make a "Projects" folder in the source list for that exact purpose.
Then, you can simply select your App Target, Get Info, and add the Framework as a Direct Dependency.
Now, whenever you build your App, your Framework will be built as well.
It's recommended to use a common Build Folder as well (Xcode->Preferences->Building) to help with linking.

Resources