Re: Project templates
Re: Project templates
- Subject: Re: Project templates
- From: Philip Aker <email@hidden>
- Date: Sun, 29 Jun 2008 12:59:34 -0700
On 08-06-26, at 06:37, Karan, Cem (Civ, ARL/CISD) wrote:
[...]
I propose that we have the ability to get the following:
I'm just summarizing here Cem:
Attributes
VERSION
RELEASENOTESURI
Elements
DATE
FILE
PRODUCT
TARGET
TEMPLATE
USER
I know there is more stuff that can be added, but this is just the
start. Any thoughts from anyone out there? Should all key/values
be strings (makes parsing easy), or should they be a mix of strings,
integers, etc.?
I found your post very thought provoking. Especially the TEMPLATE part
where we supply definitions, delimiters, and encoding. I've tried to
merge your "This is what I need" outline above with a "This is one way
to do it" notion and present a sketch of what an Xcode Project
Template instance might look like below. The DATE and USER definitions
have been blended into the TEMPLATE idea using the macros" element to
contain named sets of them. These are referenced from the macro-
expansion-files and rename-files elements which indicate what is to be
expanded.
Discussion:
One problem that's bound to come up: given a new template mechanism --
what to do with the old? In order to create the least amount of
disruption, new style templates could be housed in a bundle with a
specific extension (let's call it .xptd (Xcode Project Template
Directory)). The template importer will recognize the new format and
delete the bundle extension in when presenting its name in the
template list. A bundle format, whether like an actual bundle
(.component, .plugin, etc.), a framework, or shallow bundle (.rtfd)
would provide lots of familiar and convenient organizational
possibilities. Not the least of which would be to use custom keys in
the Info.plist for setting up the environment.
Practical Goals:
1. Do away with the current practice of housing an .xcodeproj and then
have to munge it. Instead, proceed with the idea that the new XML
format will be processed by various means to insert entries in what is
essentially an empty project (always supplied by the processor).
2. Assume that all input files are UTF-8 unless they have have a
Unicode BOM. Otherwise the encoding must be specified as an attribute
in its file element.
3. There won't be much need for us to deal with UUID-type cross-
referencing in our specification. That's the kind of stuff best dealt
with in transformational code by the processor so we'll opt for the
human-readable form when it's necessary.
4. Make use of .xcconfig files for our project/target settings and set
up our Info.plist to make use of those setting definitions (like
$ARCHES, $CURRENT_PROJECT_VERSION, INSTALL_PATH, etc.). This would
seem to obviate the PRODUCT category above because all the details can
be covered in an xcconfig.
Format:
Like sdef, we won't be using mixed elements and will tend towards
attributes rather than sub-elements whenever possible. That's were the
similarity ends however. We'll avoid the DTD pitfall and opt for an
XML Schema in order to utilize the appinfo and documentation sub-
elements of the annotation element for processing and documentation. I
think you are working primarily on 10.4 -- one improvement that sdefs
have in 10.5 is the use of xinclude. It's not in this version but I
certainly see it could be put to good use in these templates.
Outline:
project-template
macros+
macro+
project+
info{1}
documentation{1}
group*
(group | file)+
target+
info{1}
phase+
macro-expansion-files+
file-ref+
rename-files+
file-ref +
An Instance:
A policy adopted here is that the processor is expected to assemble
the total file list from file elements declared in arbitrary
positions. If a file is to be referenced from another element, it must
be assigned a unique id and referenced by that id. This referencing
style extends to other elements such as configuration, and
documentation. Note also that a file declared outside a group attains
membership in that group by specifying a group id attribute.
<?xml version="0.1" encoding="utf-8"?>
<project-template
version="1.0"
xmlns="http://www.aker.ca/namespace/xcodeproj-template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://localhost/Library/DTDs/xcodeproj-template.xsd
"
>
<macros id="default" open="«" close="»" encoding="utf-8">
<macro name="PROJECTNAME" value="$PROJECTNAME"/>
<macro name="DATE" value="/bin/date +'%F %T'"/>
<macro name="AUTHOR" value="Foo Bar Jr."/>
</macros>
<project name="project">
<info default-configuration="project-release" archive-version="1"
object-version="42" compatibility-version="Xcode 2.4"/>
<documentation description="This project builds a ..." file-
ref="docs"/>
<configuration name="Release" file-ref="project-release"/>
<configuration name="Debug" file-ref="project-debug"/>
<group id="xcconfig" name="Config">
<file id="project-release" uri="ProjectRelease.xcconfig"/>
<file id="project-debug" uri="ProjectDebug.xcconfig"/>
<file id="target-release" uri="TargetRelease.xcconfig"/>
<file id="target-debug" uri="TargetDebug.xcconfig"/>
<file id="pch" uri="project.pch"/>
<file id="exp" uri="project.exp"/>
</group>
<group id="source" name="Source">
<file id="project-h" uri="Source/project.h"/>
</group>
<group id="utils" name="Utilities">
<group id="fs" name="FS">
<file uri="utils/fsutils.h"/>
</group>
<group id="net" name="Net">
<file uri="utils/netutils.h"/>
</group>
</group>
<group id="documentation" name="Documentation">
<file id="docs" uri="Documentation/project.xhtml" reference-
type="project"/>
</group>
<group id="frameworks" name="Frameworks"/>
<group id="resources" name="Resources">
<file id="project-r" uri="Resources/project.r"
encoding="macroman" reference-type="project"/>
<group id="scripts" name="Scripts">
<file id="distro" uri="Resources/Scripts/distribution.sh"/>
</group>
</group>
<target id="target.1">
<info default-configuration="target-release" dependencies="target.
2"/>
<phase type="copy-headers" name="CopyHeaders"/>
<phase type="compile-applescripts" name="Compile AppleScripts"/>
<phase type="compile-source" name="Compile Source">
<file id="main" group="source" uri="Source/main.c"/>
<file id="project-c" group="source" uri="Source/project.c"/>
<file group="fs" uri="utils/fsutils.c"/>
<file group="net" uri="utils/netutils.c"/>
</phase>
<phase type="copy-bundle-resources" name="Copy Bundle Resources">
<file-ref file="project-r"/>
<file group="resources" uri="Resources/target.1.plist"
name="target.1.plist"/>
<file group="resources" uri="Resources/target.icns" reference-
type="project"/>
<file group="resources" uri="Resources/en.lproj/Document.xib"
reference-type="enclosing-group"/>
<file group="resources" uri="Resources/en.lproj/MainMenu.xib"
reference-type="group"/>
<file group="resources" uri="Resources/en.lproj/
InfoPlist.strings" encoding="UTF-16LE"/>
<file group="resources" uri="Resources/Japanese.lproj"
reference-type="absolute" folder-reference="true"/>
</phase>
<phase type="link" name="Link Binary with Libraries">
<framework group="frameworks" name="CoreFoundation.framework"/>
<file group="frameworks" id="myframework" uri="Frameworks/
MyFramework.framework"/>
<file group="frameworks" uri="/usr/lib/libsqlite3.dylib"/>
</phase>
<phase type="build-resources" name="Rez Resources">
<file-ref file="project-r"/>
</phase>
<phase type="copy-files" name="Copy to Frameworks">
<file-ref name="myframework" dest="${TARGET_BUILD_DIR}/$
{FULL_PRODUCT_NAME}/Contents/Frameworks"/>
</phase>
<phase type="run-script" name="Distribution">
<file-ref name="distro"/>
</phase>
</target>
<!--
<target id="target.2">
<xi:include href="../OtherProject/project.xptemplate"
xpointer="xpointer(/project-template/project/target[id='target.1'])"/>
</target>
-->
<macro-expansion-files macros="default">
<file-ref file="main"/>
<file-ref file="project-c"/>
<file-ref file="project-h"/>
<file-ref file="project-r"/>
<file-ref file="pch"/>
</macro-expansion-files>
<rename-files macros="default">
<file-ref file="project-c" dest="${PROJECTNAME}.c"/>
<file-ref file="project-h" dest="${PROJECTNAME}.h"/>
<file-ref file="project-r" dest="${PROJECTNAME}.r"/>
<file-ref file="docs" dest="${PROJECTNAME}.xhtml"/>
<file-ref file="pch" dest="${PROJECTNAME}.pch"/>
<file-ref file="exp" dest="${PROJECTNAME}.exp"/>
</rename-files>
</project>
</project-template>
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden