mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-20 09:30:59 +00:00
the new bundle project type - probably not 100% correct but working
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@8027 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ca020b4dfb
commit
a0b2a3a561
11 changed files with 839 additions and 0 deletions
50
PCBundleProj/GNUmakefile
Normal file
50
PCBundleProj/GNUmakefile
Normal file
|
@ -0,0 +1,50 @@
|
|||
# GNUmakefile
|
||||
#
|
||||
# Copyright (C) 2000 Philippe C.D. Robert
|
||||
#
|
||||
# Author: Philippe C.D. Robert <phr@projectcenter.ch>
|
||||
# Date: 2000
|
||||
#
|
||||
# This file is part of ProjectCenter
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
BUNDLE_NAME = PCBundleProj
|
||||
BUNDLE_EXTENSION =.bundle
|
||||
BUNDLE_INSTALL_DIR =$(GNUSTEP_LOCAL_ROOT)/Library/ProjectCenter/
|
||||
|
||||
PCBundleProj_OBJC_FILES = \
|
||||
PCBundleProj.m \
|
||||
PCBundleMakefileFactory.m \
|
||||
PCBundleProject.m
|
||||
|
||||
PCBundleProj_HEADERS= \
|
||||
PCBundleMakefileFactory.h \
|
||||
PCBundleProj.h \
|
||||
PCBundleProject.h
|
||||
|
||||
PCBundleProj_PRINCIPAL_CLASS = PCBundleProj
|
||||
|
||||
PCBundleProj_RESOURCE_FILES = \
|
||||
PC.proj
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||
|
||||
-include GNUmakefile.postamble
|
||||
|
30
PCBundleProj/GNUmakefile.postamble
Normal file
30
PCBundleProj/GNUmakefile.postamble
Normal file
|
@ -0,0 +1,30 @@
|
|||
#
|
||||
# Makefile.postamble
|
||||
#
|
||||
# Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
#
|
||||
# Original Author: Scott Christley <scottc@net-community.com>
|
||||
#
|
||||
# This file is part of the GNUstep ProjectCenter.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# If you are interested in a warranty or support for this source code,
|
||||
# contact Scott Christley at scottc@net-community.com
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
|
||||
|
74
PCBundleProj/GNUmakefile.preamble
Normal file
74
PCBundleProj/GNUmakefile.preamble
Normal file
|
@ -0,0 +1,74 @@
|
|||
#
|
||||
# Makefile.preamble
|
||||
#
|
||||
# Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
#
|
||||
# Original Author: Scott Christley <scottc@net-community.com>
|
||||
#
|
||||
# This file is part of the GNUstep ProjectCenter.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# If you are interested in a warranty or support for this source code,
|
||||
# contact Scott Christley at scottc@net-community.com
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#
|
||||
# Makefile.preamble
|
||||
#
|
||||
# Project specific makefile variables, and additional
|
||||
#
|
||||
# Do not put any Makefile rules in this file, instead they should
|
||||
# be put into Makefile.postamble.
|
||||
#
|
||||
|
||||
#
|
||||
# Flags dealing with compiling and linking
|
||||
#
|
||||
|
||||
# Additional flags to pass to the preprocessor
|
||||
ADDITIONAL_CPPFLAGS +=
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
ADDITIONAL_OBJCFLAGS +=
|
||||
|
||||
# Additional flags to pass to the C compiler
|
||||
ADDITIONAL_CFLAGS +=
|
||||
#ADDITIONAL_CFLAGS +=
|
||||
|
||||
# Additional include directories the compiler should search
|
||||
ADDITIONAL_INCLUDE_DIRS +=
|
||||
|
||||
# Additional LDFLAGS to pass to the linker
|
||||
ADDITIONAL_LDFLAGS += -lProjectCenter
|
||||
|
||||
# Additional library directories the linker should search
|
||||
ADDITIONAL_LIB_DIRS +=
|
||||
|
||||
ADDITIONAL_TOOL_LIBS +=
|
||||
|
||||
#
|
||||
# Flags dealing with installing and uninstalling
|
||||
#
|
||||
|
||||
# Additional directories to be created during installation
|
||||
ADDITIONAL_INSTALL_DIRS +=
|
||||
|
||||
#
|
||||
# Local configuration
|
||||
#
|
||||
|
||||
|
||||
|
29
PCBundleProj/Info.table
Normal file
29
PCBundleProj/Info.table
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
AdditionalAttributes = {
|
||||
PrincipalClass = {ATTR_CLASS_NAME = "NSString";};
|
||||
};
|
||||
Allowable_SubprojectTypes = (Subproject, Bundle, Tool, Framework, Library, Palette);
|
||||
AttributesInspector = ApplicationInspector;
|
||||
DefaultExtension = "";
|
||||
Default_Localizable_Keys = (INTERFACES);
|
||||
GeneratedFiles = (Makefile, iconHeader);
|
||||
INSTALLFLAGS = "-c -s -m 755";
|
||||
InfoName = "";
|
||||
Localizable_Keys = (INTERFACES, IMAGES, OTHER_RESOURCES, HELP_RESOURCES);
|
||||
MAKEFILE = app.make;
|
||||
MAKEFILEDIR = "$(MAKEFILEPATH)/pb_makefiles";
|
||||
Other_Keys = (HELP_RESOURCES, OTHER_SOURCES, FRAMEWORKS, OTHER_LIBS);
|
||||
PBProjectTypeSubClass = "PBApplicationProjectType";
|
||||
ProvidesIcons = Yes;
|
||||
Public_Keys = (H_FILES);
|
||||
Resource_Keys = (INTERFACES, IMAGES, OTHER_RESOURCES);
|
||||
SOURCEMODE = 444;
|
||||
Source_Keys = (CLASSES, H_FILES, OTHER_LINKED);
|
||||
Subproj_Keys = (SUBPROJECTS);
|
||||
Targets = (app, debug, profile, install);
|
||||
ExecutableResults = (
|
||||
"$PROJECTNAME$.app/$PROJECTNAME$$EXECUTABLE_EXT$",
|
||||
"$PROJECTNAME$.debug/$PROJECTNAME$$EXECUTABLE_EXT$",
|
||||
"$PROJECTNAME$.profile/$PROJECTNAME$$EXECUTABLE_EXT$"
|
||||
);
|
||||
}
|
34
PCBundleProj/PC.proj
Normal file
34
PCBundleProj/PC.proj
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
APPCLASS = "NSApplication";
|
||||
APPKIT = "GNUSTEP-GUI";
|
||||
APPLICATIONICON = "";
|
||||
BUILDTOOL = "gnumake";
|
||||
CLASS_FILES = ();
|
||||
COMPILEROPTIONS = "";
|
||||
CREATION_DATE = "";
|
||||
DOCU_FILES = ();
|
||||
FOUNDATION = "GNUSTEP-BASE";
|
||||
FRAMEWORKS = ();
|
||||
HEADER_FILES = ();
|
||||
INTERFACES = ();
|
||||
IMAGES = ();
|
||||
LANGUAGE = "English";
|
||||
LAST_EDITING = "";
|
||||
LIBRARIES = ("gnustep-base");
|
||||
MAININTERFACE = "";
|
||||
MAKEFILEDIR = "/usr/GNUstep/System/Makefiles";
|
||||
INSTALLDIR = "$(HOME)/Apps";
|
||||
OTHER_FILES = ();
|
||||
OTHER_RESOURCES = ();
|
||||
OTHER_SOURCES = ();
|
||||
PRINCIPAL_CLASS = "";
|
||||
PROJECT_CREATOR = "";
|
||||
PROJECT_DESCRIPTION = "No description avaliable!";
|
||||
PROJECT_MAINTAINER = "";
|
||||
PROJECT_NAME = "";
|
||||
PROJECT_TYPE = "Bundle";
|
||||
PROJECT_BUILDER = "PCBundleProj";
|
||||
PROJECT_VERSION = 1.0;
|
||||
SUBPROJECTS = ();
|
||||
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
|
||||
}
|
38
PCBundleProj/PCBundleMakefileFactory.h
Normal file
38
PCBundleProj/PCBundleMakefileFactory.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.projectcenter.ch
|
||||
|
||||
Copyright (C) 2000 Philippe C.D. Robert
|
||||
|
||||
Author: Philippe C.D. Robert <phr@projectcenter.ch>
|
||||
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
|
||||
@interface PCBundleMakefileFactory : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
+ (PCBundleMakefileFactory *)sharedFactory;
|
||||
|
||||
- (NSData *)makefileForProject:(PCProject *)aProject;
|
||||
|
||||
@end
|
161
PCBundleProj/PCBundleMakefileFactory.m
Normal file
161
PCBundleProj/PCBundleMakefileFactory.m
Normal file
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.projectcenter.ch
|
||||
|
||||
Copyright (C) 2000 Philippe C.D. Robert
|
||||
|
||||
Author: Philippe C.D. Robert <phr@projectcenter.ch>
|
||||
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#import "PCBundleMakefileFactory.h"
|
||||
|
||||
@implementation PCBundleMakefileFactory
|
||||
|
||||
static PCBundleMakefileFactory *_factory = nil;
|
||||
|
||||
+ (PCBundleMakefileFactory *)sharedFactory
|
||||
{
|
||||
if (!_factory) {
|
||||
_factory = [[[self class] alloc] init];
|
||||
}
|
||||
return _factory;
|
||||
}
|
||||
|
||||
- (NSData *)makefileForProject:(PCProject *)aProject;
|
||||
{
|
||||
NSMutableString *string = [NSMutableString string];
|
||||
NSString *prName = [aProject projectName];
|
||||
NSDictionary *prDict = [aProject projectDict];
|
||||
NSString *tmp;
|
||||
NSEnumerator *enumerator;
|
||||
int i;
|
||||
NSString *installDir = [NSString stringWithString:@"$(GNUSTEP_LOCAL_ROOT)/Library/Bundles"];
|
||||
|
||||
// Header information
|
||||
[string appendString:@"#\n"];
|
||||
[string appendString:@"# GNUmakefile - Generated by the ProjectCenter\n"];
|
||||
[string appendString:@"# Written by Philippe C.D. Robert <phr@projectcenter.ch>\n"];
|
||||
[string appendString:@"#\n"];
|
||||
[string appendString:@"# NOTE: Do NOT change this file -- ProjectCenter maintains it!\n"];
|
||||
[string appendString:@"#\n"];
|
||||
[string appendString:@"# Put all of your customisations in GNUmakefile.preamble and\n"];
|
||||
[string appendString:@"# GNUmakefile.postamble\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
// The 'real' thing
|
||||
[string appendString:@"include $(GNUSTEP_MAKEFILES)/common.make\n"];
|
||||
|
||||
[string appendString:@"#\n\n"];
|
||||
[string appendString:@"# Subprojects\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
if ([[aProject subprojects] count]) {
|
||||
enumerator = [[prDict objectForKey:PCSubprojects] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
|
||||
[string appendString:@"#\n"];
|
||||
[string appendString:@"# Bundle\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"BUNDLE_NAME=%@\n",prName]];
|
||||
[string appendString:[NSString stringWithFormat:@"BUNDLE_EXTENSION=.bundle\n"]];
|
||||
[string appendString:[NSString stringWithFormat:@"BUNDLE_INSTALL_DIR=%@\n",installDir]];
|
||||
if ([prDict objectForKey:PCPrincipalClass]) {
|
||||
[string appendString:[NSString stringWithFormat:@"%@_PRINCIPAL_CLASS=%@\n",prName,[prDict objectForKey:PCPrincipalClass]]];
|
||||
}
|
||||
|
||||
[string appendString:@"#\n\n"];
|
||||
[string appendString:@"# Additional libraries\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_LIBRARIES_DEPEND_UPON += ",prName]];
|
||||
|
||||
if ([[prDict objectForKey:PCLibraries] count]) {
|
||||
enumerator = [[prDict objectForKey:PCLibraries] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
if (![tmp isEqualToString:@"gnustep-base"] &&
|
||||
![tmp isEqualToString:@"gnustep-gui"]) {
|
||||
[string appendString:[NSString stringWithFormat:@"-l%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n#\n\n"];
|
||||
[string appendString:@"# Resource files\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_RESOURCE_FILES= ",prName]];
|
||||
|
||||
for (i=0;i<[[aProject resourceFileKeys] count];i++) {
|
||||
NSString *k = [[aProject resourceFileKeys] objectAtIndex:i];
|
||||
|
||||
enumerator = [[prDict objectForKey:k] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n#\n\n"];
|
||||
[string appendString:@"# Header files\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_HEADERS= ",prName]];
|
||||
|
||||
enumerator = [[prDict objectForKey:PCHeaders] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n#\n\n"];
|
||||
[string appendString:@"# Class files\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_OBJC_FILES= ",prName]];
|
||||
|
||||
enumerator = [[prDict objectForKey:PCClasses] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n#\n\n"];
|
||||
[string appendString:@"# C files\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_C_FILES= ",prName]];
|
||||
|
||||
enumerator = [[prDict objectForKey:PCOtherSources] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n"];
|
||||
|
||||
[string appendString:@"-include GNUmakefile.preamble\n"];
|
||||
[string appendString:@"-include GNUmakefile.local\n"];
|
||||
[string appendString:@"include $(GNUSTEP_MAKEFILES)/bundle.make\n"];
|
||||
[string appendString:@"-include GNUmakefile.postamble\n"];
|
||||
|
||||
return [string dataUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
}
|
||||
|
||||
@end
|
49
PCBundleProj/PCBundleProj.h
Normal file
49
PCBundleProj/PCBundleProj.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.projectcenter.ch
|
||||
|
||||
Copyright (C) 2000 Philippe C.D. Robert
|
||||
|
||||
Author: Philippe C.D. Robert <phr@projectcenter.ch>
|
||||
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <ProjectCenter/ProjectCenter.h>
|
||||
|
||||
@interface PCBundleProj : NSObject <ProjectType>
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ProjectType
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+ (id)sharedCreator;
|
||||
|
||||
- (Class)projectClass;
|
||||
|
||||
- (NSString *)projectTypeName;
|
||||
- (NSDictionary *)typeTable;
|
||||
|
||||
- (PCProject *)createProjectAt:(NSString *)path;
|
||||
- (PCProject *)openProjectAt:(NSString *)path;
|
||||
|
||||
@end
|
||||
|
145
PCBundleProj/PCBundleProj.m
Normal file
145
PCBundleProj/PCBundleProj.m
Normal file
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.projectcenter.ch
|
||||
|
||||
Copyright (C) 2000 Philippe C.D. Robert
|
||||
|
||||
Author: Philippe C.D. Robert <phr@projectcenter.ch>
|
||||
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
Description:
|
||||
|
||||
PCBundleProj creates new project of the type Application!
|
||||
|
||||
*/
|
||||
|
||||
#import "PCBundleProj.h"
|
||||
#import "PCBundleProject.h"
|
||||
|
||||
@implementation PCBundleProj
|
||||
|
||||
static NSString *_projTypeName = @"Bundle";
|
||||
static PCBundleProj *_creator = nil;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ProjectType
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+ (id)sharedCreator
|
||||
{
|
||||
if (!_creator) {
|
||||
_creator = [[[self class] alloc] init];
|
||||
}
|
||||
return _creator;
|
||||
}
|
||||
|
||||
- (Class)projectClass
|
||||
{
|
||||
return [PCBundleProject class];
|
||||
}
|
||||
|
||||
- (NSString *)projectTypeName
|
||||
{
|
||||
return _projTypeName;
|
||||
}
|
||||
|
||||
- (NSDictionary *)typeTable
|
||||
{
|
||||
NSString *_path = [[NSBundle bundleForClass:[self class]]
|
||||
pathForResource:@"Info" ofType:@"table"];
|
||||
|
||||
return [NSDictionary dictionaryWithContentsOfFile:_path];
|
||||
}
|
||||
|
||||
- (PCProject *)createProjectAt:(NSString *)path
|
||||
{
|
||||
PCBundleProject *project = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
NSAssert(path,@"No valid project path provided!");
|
||||
|
||||
if ([fm createDirectoryAtPath:path attributes:nil]) {
|
||||
NSString *_file;
|
||||
NSString *_resourcePath;
|
||||
NSMutableDictionary *dict;
|
||||
|
||||
project = [[[PCBundleProject alloc] init] autorelease];
|
||||
|
||||
_file = [[NSBundle bundleForClass:[self class]]
|
||||
pathForResource:@"PC" ofType:@"proj"];
|
||||
dict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||
|
||||
// Customise the project
|
||||
[dict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||
[dict setObject:[project principalClass] forKey:PCProjType];
|
||||
|
||||
// Save the project to disc
|
||||
[dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"]
|
||||
atomically:YES];
|
||||
|
||||
/*
|
||||
* Copy the project files to the provided path
|
||||
*
|
||||
*/
|
||||
|
||||
_file = [[NSBundle bundleForClass:[self class]]
|
||||
pathForResource:@"GNUmakefile" ofType:@"postamble"];
|
||||
[fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.postamble"] handler:nil];
|
||||
|
||||
_file = [[NSBundle bundleForClass:[self class]]
|
||||
pathForResource:@"GNUmakefile" ofType:@"preamble"];
|
||||
[fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.preamble"] handler:nil];
|
||||
|
||||
// Resources
|
||||
_resourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
|
||||
[fm createDirectoryAtPath:_resourcePath attributes:nil];
|
||||
[fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Images"] attributes:nil];
|
||||
[fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Documentation"] attributes:nil];
|
||||
|
||||
// The path cannot be in the PC.project file!
|
||||
[project setProjectPath:path];
|
||||
|
||||
// Set the new dictionary - this causes the GNUmakefile to be written
|
||||
if(![project assignProjectDict:dict]) {
|
||||
NSRunAlertPanel(@"Attention!",@"Could not load %@!",@"OK",nil,nil,path);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
||||
- (PCProject *)openProjectAt:(NSString *)path
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
id obj;
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"<%@ %x>: opening project at %@",[self class],self,path);
|
||||
#endif DEBUG
|
||||
|
||||
obj = [dict objectForKey:PCProjectBuilderClass];
|
||||
if ([obj isEqualToString:@"PCBundleProj"]) {
|
||||
return [[[PCBundleProject alloc] initWithProjectDictionary:dict path:[path stringByDeletingLastPathComponent]] autorelease];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
66
PCBundleProj/PCBundleProject.h
Normal file
66
PCBundleProj/PCBundleProject.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.projectcenter.ch
|
||||
|
||||
Copyright (C) 2000 Philippe C.D. Robert
|
||||
|
||||
Author: Philippe C.D. Robert <phr@projectcenter.ch>
|
||||
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
Description:
|
||||
|
||||
This is the project type 'Application' for GNUstep. You never should create
|
||||
it yourself but use PCBundleProj for doing this. Otherwise needed files don't
|
||||
get copied to the right place.
|
||||
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
|
||||
@interface PCBundleProject : PCProject
|
||||
{
|
||||
NSTextField *principalClassField;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Init and free
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
- (id)init;
|
||||
- (void)dealloc;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Project
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
- (BOOL)writeMakefile;
|
||||
|
||||
- (BOOL)isValidDictionary:(NSDictionary *)aDict;
|
||||
|
||||
- (NSArray *)sourceFileKeys;
|
||||
- (NSArray *)resourceFileKeys;
|
||||
- (NSArray *)otherKeys;
|
||||
- (NSArray *)buildTargets;
|
||||
- (NSString *)projectDescription;
|
||||
|
||||
@end
|
||||
|
163
PCBundleProj/PCBundleProject.m
Normal file
163
PCBundleProj/PCBundleProject.m
Normal file
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.projectcenter.ch
|
||||
|
||||
Copyright (C) 2000 Philippe C.D. Robert
|
||||
|
||||
Author: Philippe C.D. Robert <phr@projectcenter.ch>
|
||||
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#import "PCBundleProject.h"
|
||||
#import "PCBundleMakefileFactory.h"
|
||||
|
||||
#import <ProjectCenter/ProjectCenter.h>
|
||||
|
||||
@interface PCBundleProject (CreateUI)
|
||||
|
||||
- (void)_initUI;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCBundleProject (CreateUI)
|
||||
|
||||
- (void)_initUI
|
||||
{
|
||||
NSTextField *textField;
|
||||
NSRect frame = {{84,120}, {80, 80}};
|
||||
NSBox *box;
|
||||
|
||||
[super _initUI];
|
||||
|
||||
textField =[[NSTextField alloc] initWithFrame:NSMakeRect(16,240,88,21)];
|
||||
[textField setAlignment: NSRightTextAlignment];
|
||||
[textField setBordered: NO];
|
||||
[textField setEditable: NO];
|
||||
[textField setBezeled: NO];
|
||||
[textField setDrawsBackground: NO];
|
||||
[textField setStringValue:@"Principal class:"];
|
||||
[projectProjectInspectorView addSubview:[textField autorelease]];
|
||||
|
||||
principalClassField =[[NSTextField alloc] initWithFrame:NSMakeRect(106,240,144,21)];
|
||||
[principalClassField setAlignment: NSLeftTextAlignment];
|
||||
[principalClassField setBordered: YES];
|
||||
[principalClassField setEditable: YES];
|
||||
[principalClassField setBezeled: YES];
|
||||
[principalClassField setDrawsBackground: YES];
|
||||
[principalClassField setStringValue:@""];
|
||||
[projectProjectInspectorView addSubview:principalClassField];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCBundleProject
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Init and free
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
rootCategories = [[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
PCGModels,@"Interfaces",
|
||||
PCImages,@"Images",
|
||||
PCOtherResources,@"Other Resources",
|
||||
PCSubprojects,@"Subprojects",
|
||||
PCLibraries,@"Libraries",
|
||||
PCDocuFiles,@"Documentation",
|
||||
PCOtherSources,@"Other Sources",
|
||||
PCHeaders,@"Headers",
|
||||
PCClasses,@"Classes",
|
||||
nil] retain];
|
||||
|
||||
[self _initUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[rootCategories release];
|
||||
[principalClassField release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Project
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
- (BOOL)writeMakefile
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSString *makefile = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
|
||||
NSData *content;
|
||||
|
||||
if (![super writeMakefile]) {
|
||||
NSLog(@"Couldn't update PC.project...");
|
||||
}
|
||||
|
||||
if (![fm movePath:makefile toPath:[projectPath stringByAppendingPathComponent:@"GNUmakefile~"] handler:nil]) {
|
||||
NSLog(@"Couldn't write a backup GNUmakefile...");
|
||||
}
|
||||
|
||||
if (!(content = [[PCBundleMakefileFactory sharedFactory] makefileForProject:self])) {
|
||||
NSLog([NSString stringWithFormat:@"Couldn't build the GNUmakefile %@!",makefile]);
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![content writeToFile:makefile atomically:YES]) {
|
||||
NSLog([NSString stringWithFormat:@"Couldn't write the GNUmakefile %@!",makefile]);
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)isValidDictionary:(NSDictionary *)aDict
|
||||
{
|
||||
#warning No project check implemented, yet!
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSArray *)sourceFileKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCClasses,PCOtherSources,nil];
|
||||
}
|
||||
|
||||
- (NSArray *)resourceFileKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCGModels,PCOtherResources,PCImages,nil];
|
||||
}
|
||||
|
||||
- (NSArray *)otherKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCDocuFiles,PCSupportingFiles,nil];
|
||||
}
|
||||
|
||||
- (NSArray *)buildTargets
|
||||
{
|
||||
}
|
||||
|
||||
- (NSString *)projectDescription
|
||||
{
|
||||
return @"GNUstep Objective-C bundle project";
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in a new issue