fusion.git
11 years agoRemove redundant clean-up from dependency resoluton algorithm master
Wincent Colaiuta [Thu, 11 Nov 2010 18:50:39 +0000 (19:50 +0100)] 
Remove redundant clean-up from dependency resoluton algorithm

Being in the "unresolved" set is used to detect circular dependencies.
It really means "already seen but not yet resolved", so if you see the
same plug-in again it means that you're looping.

It is, however, not necessary to remove items from the "unresolved" set
upon resolution, because, by definition, the "unresolved" set will never
be checked for items that are in the "resolved" array. That is, in
pseudo-code:

  if (!resolved but seen)
    raise

So, if we've added something to "resolved" the "seen" array won't even
be checked, and if it won't be checked for such items then there's no
need to bother removing them.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoShort-circuit dependency resolution for already resolved plug-ins
Wincent Colaiuta [Thu, 11 Nov 2010 18:38:39 +0000 (19:38 +0100)] 
Short-circuit dependency resolution for already resolved plug-ins

Our simple algorithm was sometimes inserted already-resolved plug-ins
into the array, because we were applying the resolution algorithm to all
plug-ins.

The latter is a necessary evil, because we can't know beforehand which,
if any, plug-in we should start traversing the dependency graph from in
order to cover the entire graph.

Given that we will sometimes be re-walking the a portion of the graph,
add an explicit short-circuit check to avoid adding already-resolved
plug-ins to the list again.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoDrop plugInForClass:
Wincent Colaiuta [Tue, 9 Nov 2010 19:19:11 +0000 (20:19 +0100)] 
Drop plugInForClass:

For now I can't see this being useful, so drop it. Can always
add it back in later if a need for it arises.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd reference to fusion-plugin-target.xcconfig to project
Wincent Colaiuta [Sun, 7 Nov 2010 18:40:43 +0000 (19:40 +0100)] 
Add reference to fusion-plugin-target.xcconfig to project

Even though we'll never use this directly within the project, add a
reference anyway to keep everything visible.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd fusion-bundle-target.xcconfig
Wincent Colaiuta [Sun, 7 Nov 2010 18:31:35 +0000 (19:31 +0100)] 
Add fusion-bundle-target.xcconfig

Will use this to provide a consistent basis (in terms of build settings)
for all Fusion plug-ins.

At this stage the only setting passes "-undefined dynamic_lookup" to the
linker. This is a double-edged sword:

  - it allows us to refer to symbols in Fusion.framework without having
    to explicitly link to it at build time; so far, this is just
    laziness
  - more importantly, it allows us to refer to symbols in other plugins
    without having to link to them (and we're lucky to have this
    setting, because we couldn't link to another loadable bundle even if
    we wanted to)
  - this is less work than the alternatives of:
      - getting access to classes using NSStringFromClass()
      - defining protocols for all the "foreign" objects we wish to
        speak with and then doing all interaction by accessing instances
        with type "id <SomeProtocol>"
  - instead, we can just reference the header file of the plug-in we
    wish to speak with and proceed as though we had access to those
    classes inside our bundle
  - the down side of all this is that it can mask build errors, because
    if we make a mistake setting up the build, we won't find out about
    it until runtime; this isn't really an impediment though, because
    exactly the same kind of error-masking can occur with the
    alternative strategies using NSStringFromClass() and protocols

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoMake loadAllPlugIns method callable multiple times
Wincent Colaiuta [Sun, 7 Nov 2010 18:19:42 +0000 (19:19 +0100)] 
Make loadAllPlugIns method callable multiple times

We make this method safe to call multiple times by only loading a
plug-in if it is not already loaded, and only instantiating a plug-in if
it is not already instantiated.

It is useful to be able to call this method multiple times in a pure
plug-in context, to facilitate the following pattern:

  - "base" plug-in, which boots NSApplication and calls -[NSApplication
    run] (and therefore never returns!), and which then continues the
    plug-in loading process by calling loadAllPlugIns again (in response
    to an NSApplicationDidFinishLaunching notification or similar)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoFix missing newline at end of file
Wincent Colaiuta [Sun, 7 Nov 2010 12:57:35 +0000 (13:57 +0100)] 
Fix missing newline at end of file

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoFirst cut at basic dependency resolution
Wincent Colaiuta [Sun, 7 Nov 2010 12:53:00 +0000 (13:53 +0100)] 
First cut at basic dependency resolution

Based on an algorithm described in this blog post:

  http://www.electricmonk.nl/log/2008/08/07/dependency-resolving-algorithm/

Chosen for its simplicity, given that extreme efficiency is unlikely to
be needed with the anticipated working set sizes (and if it ever does
become an issue, a more efficient algorithm can be investigated).

Note: the blog post in question makes the issue seem more simple than it
really is as it says, "we'll start with node 'A'", which just happens to
be the only node in the graph which will result in the dependencies
being fully resolved. Starting from any other node will result in an
incomplete dependency graph. So, we need to iterate over all nodes,
applying the algorithm to each in turn, to ensure that we get a complete
graph.

Other algorithms are mentioned here:

  http://en.wikipedia.org/wiki/Topological_sorting

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoGet a very basic form of plug-in loading up and running
Wincent Colaiuta [Sat, 6 Nov 2010 18:51:07 +0000 (19:51 +0100)] 
Get a very basic form of plug-in loading up and running

This commit adds:

  - a -[WOFPlugInManager loadAllPlugIns] method to bootstrap the loading
    process
  - a -[WOFPlugIn instantiate] method to instantiate an instance of the
    plug-in's principal class after loading
  - an instance property that provides access to that object created by
    the instantiate method

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd WOFPlugInProtocol
Wincent Colaiuta [Sat, 6 Nov 2010 18:04:06 +0000 (19:04 +0100)] 
Add WOFPlugInProtocol

Doesn't do much interesting stuff yet, but it's a starting point. Note
that the possibility of repeated activation and deactivation is
mentioned in the code comments, but our initial implementation will just
perform once-off activation and we'll worry about implementing
deactivation later.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoFind all plug-ins during initialization
Wincent Colaiuta [Sat, 6 Nov 2010 16:43:01 +0000 (17:43 +0100)] 
Find all plug-ins during initialization

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoUpdate buildtools submodule 434be0a..10827cb
Wincent Colaiuta [Fri, 5 Nov 2010 21:32:30 +0000 (22:32 +0100)] 
Update buildtools submodule 434be0a..10827cb

68b492d Fix typo in comment
50174da Remove files made redundant by @rpath/-rpath
04d9662 Remove another file made irrelevant by @rpath/-rpath
b340c54 Update copyright year range
d01c90e Drop GCC_SYMBOLS_PRIVATE_EXTERN setting
608b69f Move common settings up into the base xcconfig file
cb9f04e Remove ZERO_LINK setting, as it is long since dead
f80be60 Another dead-in-the-water build setting
aa1acf9 Remove another legacy setting
10827cb Two more legacy settings bite the dust

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoUpate buildtools submodule 8e7d49d..434be0a
Wincent Colaiuta [Fri, 5 Nov 2010 18:42:20 +0000 (19:42 +0100)] 
Upate buildtools submodule 8e7d49d..434be0a

434be0a Use @rpath instead of @exectuable_path

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdjust documentation output path in Doxyfile
Wincent Colaiuta [Thu, 4 Nov 2010 22:59:28 +0000 (23:59 +0100)] 
Adjust documentation output path in Doxyfile

The "build" directory is one level closer to us now.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoMark headers as public so they get copied into framework bundle
Wincent Colaiuta [Thu, 4 Nov 2010 22:06:14 +0000 (23:06 +0100)] 
Mark headers as public so they get copied into framework bundle

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoUpdate buildtools (@executable_path fix)
Wincent Colaiuta [Thu, 4 Nov 2010 21:44:19 +0000 (22:44 +0100)] 
Update buildtools (@executable_path fix)

8e7d49d Set LD_DYLIB_INSTALL_NAME using @executable_path

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd LICENSE.txt reference to project
Wincent Colaiuta [Thu, 4 Nov 2010 20:57:29 +0000 (21:57 +0100)] 
Add LICENSE.txt reference to project

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd LICENSE.txt
Wincent Colaiuta [Thu, 4 Nov 2010 20:56:05 +0000 (21:56 +0100)] 
Add LICENSE.txt

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoChange CFBundleDevelopmentRegion from "English" to "en"
Wincent Colaiuta [Thu, 4 Nov 2010 20:54:29 +0000 (21:54 +0100)] 
Change CFBundleDevelopmentRegion from "English" to "en"

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoUpdate buildtools submodule e336031..cf212ec
Wincent Colaiuta [Thu, 4 Nov 2010 18:29:12 +0000 (19:29 +0100)] 
Update buildtools submodule e336031..cf212ec

cf212ec Fix a comment typo

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoUpdate buildtools ef522c6..e336031
Wincent Colaiuta [Thu, 4 Nov 2010 18:25:02 +0000 (19:25 +0100)] 
Update buildtools ef522c6..e336031

087faa9 Lay separate build-intermediates folder to rest
40213a8 Add note on why BUILDTOOLS_DIR is set the way it is
e9f4081 Drop SHARED_PROJECTS_DIR setting
6f0c519 Annotate some more cryptic build settings
0834296 Remove unnecessary DSTROOT setting
e336031 SYMROOT is now ../build rather than ../../build

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoUpdate buildtools 640bd96..ef522c6
Wincent Colaiuta [Wed, 3 Nov 2010 22:10:41 +0000 (23:10 +0100)] 
Update buildtools 640bd96..ef522c6

ef522c6 Move 64-bit ARCHS setting up into base configuration

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd initial documentation stub to Fusion.h
Wincent Colaiuta [Wed, 3 Nov 2010 20:37:36 +0000 (21:37 +0100)] 
Add initial documentation stub to Fusion.h

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd Fusion.h (top-level framework header)
Wincent Colaiuta [Wed, 3 Nov 2010 20:16:17 +0000 (21:16 +0100)] 
Add Fusion.h (top-level framework header)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoStore dependencies array on initializing a plug-in
Wincent Colaiuta [Wed, 3 Nov 2010 20:07:31 +0000 (21:07 +0100)] 
Store dependencies array on initializing a plug-in

For now we just blindly store the returned object in a property without
checking its type or content; later on this will probably evolve into an
array of WOFDependency objects.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd folder reference to WOPublic submodule
Wincent Colaiuta [Wed, 3 Nov 2010 20:00:20 +0000 (21:00 +0100)] 
Add folder reference to WOPublic submodule

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd WOFPlugInDependencies Info.plist key
Wincent Colaiuta [Tue, 2 Nov 2010 22:33:41 +0000 (23:33 +0100)] 
Add WOFPlugInDependencies Info.plist key

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd WOPublic as a submodule
Wincent Colaiuta [Tue, 2 Nov 2010 22:25:42 +0000 (23:25 +0100)] 
Add WOPublic as a submodule

Fusion itself won't incorporate any code or symbols from WOPublic, so as
to allow other projects to be able to use both Fusion and WOPublic
without having to worry about clashes, but it can still make use of
non-symbol content such as macros (in particular, I will shortly be
making a commit that makes use of the WO_EXPORT macro).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoUpdate buildtools (target 64-bit architecture only)
Wincent Colaiuta [Mon, 1 Nov 2010 22:29:54 +0000 (23:29 +0100)] 
Update buildtools (target 64-bit architecture only)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoMake WOFPlugIn a subclass of NSBundle
Wincent Colaiuta [Mon, 1 Nov 2010 22:28:42 +0000 (23:28 +0100)] 
Make WOFPlugIn a subclass of NSBundle

Subclassing NSBundle looks cleaner than making a composite object that
just wraps an NSBundle instance.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoDon't search for plug-ins in "system" domain
Wincent Colaiuta [Mon, 1 Nov 2010 18:05:11 +0000 (19:05 +0100)] 
Don't search for plug-ins in "system" domain

The sample code in the Apple documentation specifically excludes the
"system" domain, presumably because it is supposed to be
Apple-controlled and never written to by anyone else.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd bundles property and populate it with findAllBundles
Wincent Colaiuta [Mon, 1 Nov 2010 17:07:04 +0000 (18:07 +0100)] 
Add bundles property and populate it with findAllBundles

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoMove a method call outside a loop
Wincent Colaiuta [Mon, 1 Nov 2010 16:55:42 +0000 (17:55 +0100)] 
Move a method call outside a loop

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoFix case on WOFPlugIn and WOFPlugInManager files
Wincent Colaiuta [Mon, 1 Nov 2010 16:53:38 +0000 (17:53 +0100)] 
Fix case on WOFPlugIn and WOFPlugInManager files

A real pain, incidentally, when running Git on a case-insensitive file
system like HFS+.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd initial search methods and some docs to WOPlugInManager
Wincent Colaiuta [Mon, 1 Nov 2010 16:50:21 +0000 (17:50 +0100)] 
Add initial search methods and some docs to WOPlugInManager

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoRemove project reference to deleted prefix file
Wincent Colaiuta [Mon, 1 Nov 2010 14:56:10 +0000 (15:56 +0100)] 
Remove project reference to deleted prefix file

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd WOFPlugin and WOFPluginManager classes
Wincent Colaiuta [Mon, 1 Nov 2010 13:04:55 +0000 (14:04 +0100)] 
Add WOFPlugin and WOFPluginManager classes

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoRemove default prefix header file
Wincent Colaiuta [Mon, 1 Nov 2010 11:56:09 +0000 (12:56 +0100)] 
Remove default prefix header file

The last commit switched us to Foundation as our prefix header, so the
one defined in the standard project template is no longer needed.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoImport and use buildtools configuration files
Wincent Colaiuta [Sun, 31 Oct 2010 21:20:45 +0000 (22:20 +0100)] 
Import and use buildtools configuration files

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAdd buildtools as a submodule
Wincent Colaiuta [Sun, 31 Oct 2010 20:38:18 +0000 (21:38 +0100)] 
Add buildtools as a submodule

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoGit: set up ignores for per-user files inside project bundle
Wincent Colaiuta [Sun, 31 Oct 2010 20:21:45 +0000 (21:21 +0100)] 
Git: set up ignores for per-user files inside project bundle

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoGit: ignore "build" directory created by Xcode
Wincent Colaiuta [Sun, 31 Oct 2010 20:18:08 +0000 (21:18 +0100)] 
Git: ignore "build" directory created by Xcode

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoNew framework based on standard Xcode project template
Wincent Colaiuta [Sun, 31 Oct 2010 20:15:57 +0000 (21:15 +0100)] 
New framework based on standard Xcode project template

Signed-off-by: Wincent Colaiuta <win@wincent.com>