cocoa no longer depends on xml
parent
2c76171c8a
commit
6f1d3d9174
|
@ -42,11 +42,13 @@ SYMBOL: super-sent-messages
|
|||
"NSArray"
|
||||
"NSAutoreleasePool"
|
||||
"NSBundle"
|
||||
"NSDictionary"
|
||||
"NSError"
|
||||
"NSEvent"
|
||||
"NSException"
|
||||
"NSMenu"
|
||||
"NSMenuItem"
|
||||
"NSMutableDictionary"
|
||||
"NSNib"
|
||||
"NSNotification"
|
||||
"NSNotificationCenter"
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
! Copyright (C) 2007 Slava Pestov.
|
||||
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: strings arrays hashtables assocs sequences
|
||||
xml.writer xml.utilities kernel namespaces ;
|
||||
cocoa.messages cocoa.classes cocoa.application cocoa kernel
|
||||
namespaces io.backend ;
|
||||
IN: cocoa.plists
|
||||
|
||||
GENERIC: >plist ( obj -- tag )
|
||||
: assoc>NSDictionary ( assoc -- alien )
|
||||
NSMutableDictionary over assoc-size -> dictionaryWithCapacity:
|
||||
[
|
||||
[
|
||||
spin [ <NSString> ] bi@ -> setObject:forKey:
|
||||
] curry assoc-each
|
||||
] keep ;
|
||||
|
||||
M: string >plist "string" build-tag ;
|
||||
|
||||
M: array >plist
|
||||
[ >plist ] map "array" build-tag* ;
|
||||
|
||||
M: hashtable >plist
|
||||
>alist [ >r "key" build-tag r> >plist ] assoc-map concat
|
||||
"dict" build-tag* ;
|
||||
|
||||
: build-plist ( obj -- tag )
|
||||
>plist 1array "plist" build-tag*
|
||||
dup { { "version" "1.0" } } update ;
|
||||
|
||||
: plist>string ( obj -- string )
|
||||
build-plist build-xml xml>string ;
|
||||
: write-plist ( assoc path -- )
|
||||
>r assoc>NSDictionary
|
||||
r> normalize-path <NSString> 0 -> writeToFile:atomically:
|
||||
[ "write-plist failed" throw ] unless ;
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
USING: io io.files kernel namespaces sequences
|
||||
system tools.deploy.backend tools.deploy.config assocs
|
||||
hashtables prettyprint io.unix.backend cocoa io.encodings.utf8
|
||||
cocoa.application cocoa.classes cocoa.plists qualified ;
|
||||
io.backend cocoa.application cocoa.classes cocoa.plists
|
||||
qualified ;
|
||||
IN: tools.deploy.macosx
|
||||
|
||||
: bundle-dir ( -- dir )
|
||||
|
@ -20,23 +21,21 @@ IN: tools.deploy.macosx
|
|||
"fonts/" resource-path
|
||||
swap "Contents/Resources/" append-path copy-tree-into ;
|
||||
|
||||
: app-plist ( executable bundle-name -- string )
|
||||
: app-plist ( executable bundle-name -- assoc )
|
||||
[
|
||||
namespace {
|
||||
{ "CFBundleInfoDictionaryVersion" "6.0" }
|
||||
{ "CFBundlePackageType" "APPL" }
|
||||
} update
|
||||
"6.0" "CFBundleInfoDictionaryVersion" set
|
||||
"APPL" "CFBundlePackageType" set
|
||||
|
||||
file-name "CFBundleName" set
|
||||
|
||||
dup "CFBundleExecutable" set
|
||||
"org.factor." prepend "CFBundleIdentifier" set
|
||||
] H{ } make-assoc plist>string ;
|
||||
[ "CFBundleExecutable" set ]
|
||||
[ "org.factor." prepend "CFBundleIdentifier" set ] bi
|
||||
] H{ } make-assoc ;
|
||||
|
||||
: create-app-plist ( vocab bundle-name -- )
|
||||
: create-app-plist ( executable bundle-name -- )
|
||||
[ app-plist ] keep
|
||||
"Contents/Info.plist" append-path
|
||||
utf8 set-file-contents ;
|
||||
write-plist ;
|
||||
|
||||
: create-app-dir ( vocab bundle-name -- vm )
|
||||
dup "Frameworks" copy-bundle-dir
|
||||
|
@ -64,6 +63,6 @@ M: macosx deploy* ( vocab -- )
|
|||
[ bundle-name create-app-dir ] keep
|
||||
[ bundle-name deploy.app-image ] keep
|
||||
namespace make-deploy-image
|
||||
bundle-name show-in-finder
|
||||
bundle-name normalize-path show-in-finder
|
||||
] bind
|
||||
] with-directory ;
|
||||
|
|
Loading…
Reference in New Issue