Add prebuild source files

This commit is contained in:
Zontreck 2023-08-10 01:19:24 -07:00
parent cbcd8b2bd3
commit 4f5e7942e1
86 changed files with 18185 additions and 0 deletions

11
AUTHORS Normal file
View file

@ -0,0 +1,11 @@
Dave Hudson (jendave@yahoo.com),
Matthew Holmes (matthew@wildfiregames.com)
Dan Moorehead (dan05a@gmail.com)
Rob Loach (http://www.robloach.net)
C.J. Adams-Collier (cjac@colliertech.org)
Tara Piccari (tarapiccari@gmail.com)
Patch Contributers
lbsa71
chi11ken
sdague

484
ChangeLog Normal file
View file

@ -0,0 +1,484 @@
2023, Tara Piccari
* Prebuild updated fully to net7
* Added VS Solution flag to include dep files
2017, August Ubit Umarov
* add Freak Tech patch for prefer32bit default to false
* fix comand line target override
* fix CSharp target assembly name
2015, June Fly-Man- <fly.man.opensim@gmail.com>
* V2.0.7 (WhiteCore Build)
* Added the VS2012/VS2013 targets so .Net 4.5 can be used for WhiteCore
* Cleaned up the SharpDevelop2 code part
2015, April rowan Deppeler <greythane@gmail.com>
* V2.0.6w (WhiteCore build
* No changes to the code as it appears development has now stalled at 1.10
- Incorporated (Rev's, I think) patches from Aurora to provide for passing the framework
and additional conditionals in the Prebuild.xml spec
- Re-built using Net 4.0 framework to provide for use on unmodified Windows 8 systems (No Net 3.5)
- Included Solution and project files to assist building if required
2008-12-09T02:15 D. Moonfire <d.moonfire@mfgames.com>
* src/Core/Kernel.cs
- Added a /ppi target to get the results of processing but before
processing the actual results.
* src/Core/Preprocessor.cs
- Applied the patch from kanato with formatting changes.
- Uses the <?include file="" ?> format.
* tests/
- Added some lightweight tests to test the functionality of the
include patch.
2008-06-19T09:37 John Anderson <sontek@gmail.com>
* src/Core/Kernel.cs
- Only Loop through targets that are not abstract.
* src/Core/Targets/VSGenericTarget.cs
- Marked abstract and removed the Target attribute.
2008-06-16T17:37 John Anderson <sontek@gmail.com>
* src/Core/Nodes/ProjectNode.cs,data/prebuild-1.7.xsd
- Added the ability to hardcode guid's in the projects
2008-05-21T0737 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- catch exception when unable to compile AssemblyInfo.cs
2008-05-07T17:29 John Anderson <sontek@gmail.com>
* src/Core/Targets/VSGenericTarget.cs
- Generate asp.net output in bin\ folder (asp.net requires it there)
2008-04-30T17:29 John Anderson <sontek@gmail.com>
* src/Core/Nodes/DatabaseReferenceNode.cs,
src/Core/Nodes/Datanode.cs,
src/Core/Nodes/FileNode.cs,
src/Core/Nodes/FileNodes.cs,
src/Core/Nodes/MatchNode.cs,
src/Core/Targets/VS2008Target.cs,
src/data/prebuild-1.7.xsd
- Refactored the project generation code to handle web projects and more
logically handle embedded resources and designer files.
2008-04-30T17:29 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Nodes/SolutionNode.cs
- Had solutions inherit Configurations in the same way that Projects do.
2008-04-29T06:35 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Targets/VS2008Target.cs,
src/Core/Nodes/DatabaseProjectNode.cs,
src/Core/Nodes/DatabaseReferenceNode.cs,
src/data/prebuild-1.7.xsd
- Added database references to database projects.
- Prevented nested solutions from being written to disk.
2008-04-29T05:43 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Targets/VS2008Target.cs
- Enabled embedded solutions to contain Files.
2008-04-29T04:13 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/VSVersion.cs
- Fixed spelling mistake in enum comment.
* src/Core/Attributes/DataNodeAttribute.cs
- Allowed the DataNodeAttribute to be attached to a single class
more than once, allowing one class to be used to parse more than
one node at a time.
* src/Core/Kernel.cs
- Changed CacheNodeTypes() to allow for multiple DataNodeAttribute
instances in one class. Refactored ProcessFile(...) to return Solutions,
rather than adding them to the Kernel.
* src/Core/Nodes/SolutionNode.cs
- Added Guid (for embedded folders)
- Added DatabaseProjects, Solutions and Processes to the SolutionNode
when parsing.
* src/Core/Nodes/ProjectNode.cs
- Added FrameworkVersion property to allow for 2.0/3.0/3.5 differentiation.
* src/Core/Targets/VS2008Target.cs, src/data/prebuild-1.7.xsd
- Added ability to have embedded solutions, and externally referenced
prebuild scripts.
2008-04-24T04:33 John M. Anderson <sontek@gmail.com>
* src/Core/Targets/VS2003Target.cs, src/Core/Targets/VSVersion.cs
- Moved the VSVersion enum into its own file.
* src/Core/Targets/VS2008Target.cs
- added support for VS2008
* src/Core/Nodes/ProjectNode.cs
- Added initial support for ASP.NET projects
* src/Core/Nodes/DatabaseProjectNode.cs
- Added support for Visual Studio database projects
2008-02-19T07:08 C.J. Adams-Collier <cjac@colliertech.org>
* TODO
- added some tasks from Sam Hocevar
* src/Core/Targets/AutotoolsTarget.cs
- added a missing end paren
* COPYING
- Removed Randy Ridge's name from the copyright. Looks to me like
his name was present only because the file was nabbed from Tao
2008-02-09T20:29 C.J. Adams-Collier <cjac@colliertech.org>
* COPYING
- added MIT/X11 license due to inclusion of code from Monodevelop
* THANKS
- added Lluis Sanchez Gual and Todd Berman - I yoinked code from
their pkg-config .pc file parser to build AutotoolsTarget.cs.
Sorry it took me so long to remember to add mention of you guys!
* src/Core/Targets/AutotoolsTarget.cs
- added MIT/X11 license. see above.
2008-02-07T08:27 C.J. Adams-Collier <cjac@colliertech.org>
* AUTHORS
- consolidated names and contact info found laying around the
source
* src/Core/Kernel.cs
- updated copyright date
- re-formatted license for 80-column editor
- updated log banner to indicate new date, new authors
* src/Core/Targets/AutotoolsTarget.cs
- clarified reasoning behind use of constants in
AutotoolsTarget.ParsePCFile
- reduced length of some long lines using newline/indent
- added log messages for parsing .pc files, emitting solutions,
projects
- robustified the inter-package dependency resolution target
- log warning when we can't find assembly for <Reference />
- clarified code for case of inability to find embedded
autotools.xml
* src/data/autotools.xml
- adding system lookup of resgen2 to configure.ac
- fixed .resource -> .resources typo
- added a rule to create <foo>.response file containing all sources
- using @<foo>.response on $(CSC) command line instead of listing
all source files
* src/Properties/AssemblyInfo.cs
- re-formatted license for an 80-column editor
- added more authors to the AssemblyCopyright attribute
- bumped version to 2.0.3
* prebuild.xml
- bumped version to 2.0.3
* scripts/autotools.sh
- if 'mono' is in the path, run Prebuild.exe with it
- using dirname to capture correct path to prebuild.xml &c
2008-02-06T17:18 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/NAntTarget.cs
- re-formatted the license for an 80-column editor
- added myself to the copyright
- added a fix submitted by Gryc Ueusp <gryc.ueusp@gmail.com>
* src/Core/Targets/AutotoolsTarget.cs
- updated copyright to include 2008
* THANKS
- created file, added Gryc Ueusp <gryc.ueusp@gmail.com>
2008-01-01T14:50 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
- fixed .resx -> .resource compilation
- fixed failing edge case where Project is an unsigned Library
- added $(RESOURCE_SRC) to list of extra dist files
* src/Core/Targets/AutotoolsTarget.cs
- removed embeddedResources from extraDistFiles list
2007-04-18T07:49 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/prebuild-1.7.xsd
- removed default version from references
2007-04-06T12:42 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
- added support for /doc: output when XmlDocFile is not empty
- not printing \t \\n on lines that have no content
- gacutil now installs the root assembly instead of the one under
bin/Debug or whatever
2007-04-04T22:12 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- removed debugging Console.WriteLine()
* src/data/autotools.xml
- ensuring that install-sh and missing get distributed
- explicitly stating that the sources, snk, resources and binary
references live under $(srcdir)
- corrected uninstall target
- verified distcheck completes successfully
2007-04-03T21:56 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- added a using for System.Diagnostics
- added enum ClrVersion for use with the pkg-config parser
- added class SystemPackage for use with the pkg-config parser
- removed explicit "private" property of members since it is implied
- flushing the stream-writer before it's closed
- removed excess braces around an if statement
! NormalizeAsmName(), AddAssembly(), GetAssembliesWithLibInfo(),
GetAssembliesWithoutLibInfo(), ProcessPiece(),
GetVariableFromPkgConfig(), ParsePCFile(),
RegisterSystemAssemblies(), RunInitialization()
- pulled the above from MonoDevelop to parse the system pkgconfig
files and determine /pkg: arguments. Original sources are here:
http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs
http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/ClrVersion.cs
! WriteProject()
- now gathering project version from AssemblyInfo.cs if it is part
of the project
- changed the declaration of the ArrayList's in the method
- now copying assembly .config files to the project, distributing,
installing
- making sure all needed files live under the Project directory
- copying strongname keys to project directory
- parsing AssemblyInfo.cs to determine assembly version
- removing all references to ".."
- removed superfluous if(project.References.Count > 0) around
for(int refNum = 0; refNum < project.References.Count; refNum++)
- removed use of runtimeLibs
- adding hook to copy sibling project's generated assemblies to
this project during Make time
- added extra dist target to ensure all files required to build
get distributed during "make dist"
- added new xslt processing args:
-- assemblyName
-- extraDistFiles
-- pkgLibs (/pkg:foo)
-- localCopyTargets (to copy sibling assemblies at Make time)
-- projectVersion (if determined from AssemblyInfo.cs)
-- hasAssemblyConfig (if there's a assembly.exe.config present)
! Write()
- calling RunInitialization() to gather pkg-config data
* src/data/autotools.xml
- accepting new args passed from AutotoolsTarget.cs
- modernized configure.ac a bit
- using a version of tar that allows >99-char filenames
- added ASSEMBLY_NAME variable
- using assembly name rather than project name for gac installation
- generated assembly is now assembly name and not project name
- accepting /pkg: flags gathered from AutotoolsTarget.cs
- adding Makefile targets to copy sibling project assemblies to .
- fixed Debug, Release targets
- adding support for strongname key signing
- adding /unsafe support
- adding a clean make target
- only running gacutil /u if the assembly being uninstalled is in gac
- added some templates to determine each Configuration's .snk
- added explanation as to why .exe assemblies live in $prefix/lib
* src/Properties/AssemblyInfo.cs
- bumped assembly version
* prebuild.xml
- bumped assembly version
2007-03-29T18:03 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
! WriteProject()
- re-named incorrectly-named variable gacLibs to systemLibs
- added another reference list, runtimeLibs which contains the
libs we will need at runtime. we use this to build a MONO_PATH
- added monoPath to the xslt args list
* src/data/autotools.xml
! <ProjectMakefileAm />
- renamed gacLibs to systemLibs
- added the sources to the dist list
- added logic to install libs that aren't strongnamed
! <ProjectWrapperScriptIn />
- accepting a param to update the MONO_PATH
2007-03-28T19:46 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/MonoDevelopTarget.cs
! CleanProject()
- using Assembly.LoadWithPartialName to locate the assembly
* src/Core/Targets/AutotoolsTarget.cs
! WriteCombine()
- no longer using $PWD to determine a project's source dir; this
doesn't work with <Process /> elements
- passing the solution name to all templates - fixes
multi-solution prebuild systems
! WriteProject()
- no longer using $PWD to determine a project's source dir; this
doesn't work with <Process /> elements
- passing the solution name to all templates - fixes
multi-solution prebuild systems
- copying strongname key to the autotools directory
- using Assembly.LoadWithPartialName to locate assemblies
* src/data/autotools.xml
! <ProjectConfigureAc />
- fixed the .pc AC_CONFIG_FILES macro
! <ProjectMakefileAm />
- added solution name param
- wrapping if type=exe check around script install macro
- added type=lib check and .pc file install macro
- added support for Configuration-specific builds (Debug, Release, etc)
- added strongname keyfile code
- TODO: support non-strongnamed library installation
! <ProjectWrapperScriptIn />
- added space preservation attribute to stylesheet element
- added a lower-case project name variable
- added solution name param
- made for-each template more specific
! <SolutionAutogenSh />
- added solution name param
! <SolutionConfigureAc />
- added solution name param
! <SolutionMakefileAm />
- added solution name param
! <ProjectPcIn />
- added solution name param
2007-03-27T09:33 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- now processing the wrapper script if type is "Exe" or "WinExe"
* src/data/autotools.xml
! <ProjectConfigureAc />
- being more exact about where text escaping is used
- using the correct variable name for the GACUTIL_FLAGS template
- using correct test="" for the AC_CONFIG_FILES macros
! <ProjectMakefileAm />
- uncommented the bin_SCRIPTS section now that the script is being
generated correctly
! <ProjectWrapperScriptIn />
- fixed whitespace at beginning of file, before #!
- using lower-case packageName to indicate installation location
2007-03-27T09:33 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectConfigureAc />
* added a lcProjectName which is $projectName lower-cased
* moved autoconf template specifier near AC_OUTPUT
* AC_OUTPUT with args is deprecated. now using AC_CONFIG_FILES
* placed AC_CONFIG_FILES() calls for wrapper script or pkg-config
file in xslt project type checks
! <ProjectMakefileAm />
* commented out bin_SCRIPTS
* added a lcProjectName which is $projectName lower-cased
* using $lcProjectName instead of the longer version
2007-03-27T08:39 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectMakefileAm />
- added whitespace-preservation
- added the missing projectName param
- replaced bin_SCRIPTS with something that worked
2007-03-27T07:56 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectConfigureAc />
- cleaned up duplicate checks
- placed initialization macros above system check macros
- added some more messages about what's going on
- added GACUTIL_FLAGS variable including /package option
! <ProjectMakefileAm />
- added an incomplete bin_SCRIPTS
- RCS check says "building" instead of "compiling"
! <SolutionConfigureAc />
- removed macros that are useful only for projects
! <ProjectWrapperScriptIn />
- created this element on this revision
- this is a wrapper shell script that lives in the $PATH and runs
the CIL assembly
2007-03-26T20:18 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- creating new template arguments to contain the list of libs to
reference: source, binary & GAC
- source libs are included as part of this solution (untested)
- binary libs are distributed with the source (untested)
- GAC libs are assumed to be in the GAC or other lib path (tested)
* src/data/autotools.xml
- created new params through which to accept reference info
- created a working $(CSC) line
- added a TODO item for ordering project dependency for
AC_CONFIG_SUBDIRS code
2007-03-26T08:41 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- now creating list of source files in managed code and passing
them to the template via <xsl:param>s
* src/data/prebuild-1.7.xsd
- updated the header comment to 2007
* src/data/autotools.xml
! <ProjectConfigureAc>
- copied checks from Solution-level configure.ac
- copied solution-level config status
! <ProjectMakefileAm>
- added <xsl:param> elements for file list to be passed through
- made a temporary target for the assembly we're building
- added this target to the deps of "all:"
! <SolutionConfigureAc>
- changed status header/footer from "- - -" to "==="
2007-03-23T08:33 C.J. Adams-Collier <cjac@colliertech.org>
Added version attribute handling code for Property element
Added description element handling code
* prebuild.xml
- added /Prebuild/Solution/Property/@version attribute
- added /Prebuild/Solution/Property/Description element
* src/Core/Nodes/ProjectNode.cs
- added some docs where they were missing and obvious
- added code to handle @version
* src/Core/Nodes/DescriptionNode.cs
- new file. Used to handle /Prebuild/Solution/Property/Description
* src/Core/Targets/AutotoolsTarget.cs
- added mkdirDashP(), a recursive directory creation method
- WriteProject() now copies the files to autotools/
* src/data/prebuild-1.7.xsd
- added /Prebuild/Solution/Property/Description element
- added /Prebuild/Solution/Property/@version attribute
* src/data/autotools.xml
- removed excess <xsl:value-of select="$projectName"/>
- explicitly using dnpb: prefix
2007-03-23T04:31 C.J. Adams-Collier <cjac@colliertech.org>
Merged code from my stripped-down test
Adding support for the /Prebuild/Solution/Project/Author element
* prebuild.xml
- added Author elements
- cleaned up the really long Project element
* src/Core/Nodes/ProjectNode.cs
- added Author tag processing code
* src/Core/Nodes/AuthorNode.cs
- Created to process Author elements
- based off of ReferencePathNode.cs
* src/Core/Targets/AutotoolsTarget.cs
- merged code from https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/test.cs
- renamed old WriteCombine to WriteCombineOld
- renamed old WriteProject to WriteProjectOld
* src/data/prebuild-1.7.xsd
- added Author element to Project
* src/data/autotools.xml
- lower-cased utf
2007-03-22T13:58 C.J. Adams-Collier <cjac@colliertech.org>
Exposing an XmlDocument that represents the prebuild.xml file
passed to the program
* src/Core/Kernel.cs
- created an object member called XmlDocument m_CurrentDoc
- created a property to access its value
- using m_CurrentDoc to load up the prebuild.xml file rather than
a local variable called "doc"
2007-03-22 C.J. Adams-Collier <cjac@colliertech.org>
* prebuild.xml
- added autotools.xml created at https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/autotools.xml
* src/data/autotools.xml
- the same
* src/Core/Targets/MonoDevelopTarget.cs
- fixed bug introduced in r206
2007-03-07 C.J. Adams-Collier <cjcollier@colliertech.org>
* src/data/prebuild-1.7.xsd
- added version attribute to Solution and Project elements
2006-11-04T00:38 C.J. Adams-Collier <cjcollier@colliertech.org>
* placing AssemblyInfo.cs into Properties/
* Fixed double-mention of the package name
2006-11-03T15:23 C.J. Adams-Collier <cjcollier@colliertech.org>
* corrected a problem in the Include.am generation code
* created the new .exe
* copied it to the root of the build
2006-11-03T14:57 C.J. Adams-Collier <cjcollier@colliertech.org>
* Updated the .exe file
2006-11-03 C.J. Adams-Collier <cjcollier@colliertech.org>
* Added a TODO file
* Added a ChangeLog file
* applied some fixes for autotools gac and pkg-config installation
problems

236
INSTALL.md Normal file
View file

@ -0,0 +1,236 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

65
LICENSE Normal file
View file

@ -0,0 +1,65 @@
BSD License
Copyright (c)2004-2008
See AUTHORS file for list of copyright holders
Dave Hudson (jendave@yahoo.com),
Matthew Holmes (matthew@wildfiregames.com)
Dan Moorehead (dan05a@gmail.com)
Rob Loach (http://www.robloach.net)
C.J. Adams-Collier (cjac@colliertech.org)
http://dnpb.sourceforge.net
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---
Portions of src/Core/Targets/AutotoolsTarget.cs
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

200
NEWS Normal file
View file

@ -0,0 +1,200 @@
Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt.
Documentation and downloads are available at http://dnpb.sourceforge.net.
Prebuild is licensed under the BSD license.
[ XXXXXXX XX, XXX - 1.3.2 ]
+ Added Keyfile signing to NAnt target and VS2005 target
+ Updated XSD file to 1.7
+ Boo and VisualBasic Language support in VS2005 target
+ Added basic Autotools target. It creates a non-recursive Autotools system.
! Multiple files can be excluded from the Match node
! VS2005 now handles .resx files correctly.
! NAnt and Autotools now handle defines
! NAnt and Autotools now handle resources
+ Conditional XML variables can be passed through the command line.
+ Added /install and /remove command line flags to install and remove assemblies from the GAC
+ Many fixes to VS2005 target
[ July 21, 2006 - 1.3.1 ]
! VS2005 fixes from Rob Loach
! NAnt fixes from Rob Loach and David Hudson
! XML doc fixes from Rob Loach
+ Added SharpDevelop2 target (really just uses VS2005 target)
! Fixed bug with BuildEvents in Monodevelop target
+ Passing /yes will default to answering yes to any warnings
[ February 28, 2006 - 1.3 ]
+ Added MonoDevelop target.
+ Added NAnt target.
+ Lots of fixes to all targets.
* Cleaned up the code using FXCop.
* Updated schema to 1.6 to fix a typo and add a new parameter.
* jendave is now the maintainer of the project. RobLoach has been added as a developer.
* Removed references to 'dnpb'.
+ Added rudimentary support for pre- and post- build scripts
* Updated examples.
[ August 5, 2004 - 1.2 ]
+ Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages
+ Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags
+ Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs
* Modified the removedir command line option to allow for a pipe-delimited list of directory names
! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well
+ Added the GenerateXmlDocFile boolean option to the Options XML element
* Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this
[ January 3, 2004 - 1.1 ]
! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems
+ Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake
* Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version
[ December 30, 2004 - 1.1 ]
! Applied Leed's fix for SharpDevelop references
+ Rewrote much of the processing for better validation and without the use of a temp file
+ Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs
* Changed all spaces into tabs
+ Added support for the None build action
* Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument
[ December 25, 2004 - 1.0 ]
+ Added the /removedir option for cleaning directories like obj before file releases
+ Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds
* Made path optional for Match elements (defaults to current directory) and updates schema for it
! Fixed XML example in the readme.txt
+ Added example xml files to docs directory
* Updated license.txt to add Dan Moorehead and update copyright years
+ Updated prebuild.xml to take advantage of the default path attribute for match elements
+ Updated Clean to delete the obj directories
[ December 25, 2004 - 0.13 ]
+ Added dnpb.exe so that it can be used to generate the project files
+ Added dnpb.ico
* Added parameterless Write statement to Log for writing a single line
* Changed scehema to version 1.3 for support of icon attribute
* Added support for All configuration name under a Project node signifying common settings for all configurations
! Fixed the SupressWarnings by adding the corresponding field to OptionsNode
* Wrote documentation in docs/readme.txt
* Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005
* Updated prebuild.xml
* Optimized Log class
* Updated OutputUsage()
* /clean targets all by default
* No log file is used by default, /log without value specified uses default file name
+ Added support for the /pause which pauses the utility after execution to observe output
[ September 27, 2004 - 0.12.2a ]
! Fixed a nasty bug when trying to delete our temp file for pre-processing.
[ September 15, 2004 - 0.12.2 ]
+ Expanded platform identification, thanks to the NAnt guys for shedding some
light on how to properly check for UNIX platforms! Thanks guys!
* POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX",
and "Unknown".
! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of
the Project tag.
+ New command-line switch, /ppo, forces DNPB to pre-process the file and write
the pre-processed file. This allows you to test/debug your pre-processor
macros. No other processing will be done. You can specify a target file as
a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml'
if you do not specify a file.
+ The Match tag now has a 'buildAction' attribute which functions exactly like
the attribute of the same name for the File tag.
[ August 5, 2004 - 0.12.1 ]
+ Added environment variable expansion for all values. Environment variables
should be listed in the form ${VAR}.
[ July 30, 2004 - 0.12.0 ]
+ Added preprocessing via XML processing information tags. Available tags
are: <?if <exp> ?>, <?elseif <exp> ?>, <?else ?> and <?endif ?>. The
current expression parser is very basic, but will be replaced with a more
capable parser over time. Current operators available are: =, !=, <, >,
<=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor,
RuntimeMinor, RuntimeRevision.
[ July 27, 2004 - 0.11.4 ]
+ Added 'useRegex' attribute to the Match tag. Matches can now use regular
expressions to match filenames.
+ Added the 'assemblyName' attribute to the Project tag. Projects can now
set their output assembly name.
! Fixed several bugs in the way that Project tags inheirt their parent
Solutions configuration options. This operation should now work fully as
intended.
! Due to some wierdness, Project Guid's are now stored as part of the Project
node and created at parse time.
[ May 11, 2004 - 0.11.3 ]
! Fixed a bug where I was writing the wrong property name for a projects root
namespace.
! Removed a DEBUG statement I had left in the code in 0.11.2.
! Fixed a bug in the VS2002 writer which caused the version variables to not
be overriden correctly.
+ Added the rootNamespace property to the <Project> element, allowing you to
specify the root namespace.
* /target and /clean are now mutually exclusive command line switches, and
they both now take the all option. In the case of /target all, all build
file for all targets will be created. In the case of /clean all, the user
will be prompted to make sure they want to do it, and if so, will clean
all build files for all targets.
[ April 22, 2004 - 0.11.2 ]
! Fixed a bug with the /file command-line operator. Was using the unresolved
file path rather then the resolved one, was making the attempt to open the
dnpb file fail.
! Fixed a bug in the schema that required at least 1 solution and 1 reference
path. We can do just fine with 0 of either of these. Some files may be all
<Process> statements and not have any <Solution> tags.
! Fixed a bug that caused the project references not to be written with the
SharpDevelop target.
* Changed the schema to version 1.2, allowing for Configuration nodes to exist
under project nodes. The inheritance of values is hierarchical. Meaning, if
you define a configuration named Debug at the Soltion level, and one by the
same name at the Project level, the one at the Project level will first
inherit the options of the Solution level configuration, then set it's own
options. If you define a configuration at the Project level and it does not
exist at the Solution level, it will be created at the Solution level.
* Project references should now work correctly across the board. Note that due
to a restriction in Visual Studio, you can only reference projects in the same
solution.
[ April 21, 2004 - 0.11.1 ]
! Fixed a problem with resolving paths in various targets. Was not properly
setting the CWD.
* Schema updated to 1.1, moving the ReferencePath element from the Options
element to the Project element. This makes more logical sense, given that
reference paths are resolved relative to the project path. Any prebuild.xml
file referecning verison 1.0 will fail! Please update to the 1.1 schema.
[ April 19, 2004 - 0.11.0 ]
* Added several attributes across the code to make FxCop happy
! Fixed bugs in reference paths being written in the VS targets.
! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of
a Push/Pop pair. Was wreaking havoc with <Process> tags.
! Fixed some bugs in the path tracking, both the Project and Solution nodes now
have a FullPath property, which is the full path to the file resolved at load
time. This should fix all path relativity problems.
+ Added new /clean switch, allowing the target to clean up any files it generated.
in accordance, the ITarget interface has been updated to support a new Clean()
method.
+ Completed addition of the <Process> tag, to allow the referencing of external
prebuild.xml files.
+ Added the runtime attribute to the Project element. This allows the developer
to specify which runtime a project should target (Mono or Microsoft). This is
of course ignored in certain targets like the Visual Studio targets.
+ Added the SharpDevelop target.
[ April 13, 2004 - 0.10.1a ]
+ Added the buildAction attribute to the File node. This is needed for dnpb
to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource)
[ April 13, 2004 - 0.10.1 ]
* First Release
[ Key ]
* = Change or information
+ = Addition
! = Bug Fix

18
THANKS Normal file
View file

@ -0,0 +1,18 @@
Gryc Ueusp <gryc.ueusp@gmail.com>
caught a problem with the NAnt target's .build output which caused
the Ubuntu build servers to choke on prebuild-generated packages
Todd Berman <tberman@sevenl.net>
Lluis Sanchez Gual <lluis@novell.com>
pkg-config .pc file parser used in AutotoolsTarget.cs was ripped off
from work contributed to MonoDevelop by Lluis and Todd. It came
from
src/core/MonoDevelop.Core/MonoDevelop.Core/SystemPackage.cs (Lluis)
and
src/core/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs
(Lluis && Todd)

43
TODO Normal file
View file

@ -0,0 +1,43 @@
* monodev target should be able to detect whether the project is 1.x
or 2.x runtime
* remove target which links ../project/foo.dll to each project's build
root
* generate .config files
* Fix the autotools target so that
sub generate_project_files { ... }
sub generate_solution_files { ... }
sub generate_multi_solution_files { ... }
sub generate_project {
...
generate_project_files();
}
sub generate_solution {
foreach $project ( @projects ){
mkdir "$project/";
pushd "$project/";
generate_project();
popd;
}
generate_solution_files();
}
sub generate_multi_solution {
foreach $solution ( @solutions ){
mkdir "$solution/";
pushd "$solution/";
generate_solution();
popd;
}
generate_multi_solution_files();
}
if(numProjects == 1){
generate_project();
}elsif(numSolutions == 1){
generate_solution();
}else{
generate_multi_solution();
}

BIN
bootstrap/prebuild.dll Normal file

Binary file not shown.

View file

@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
"configProperties": {
"System.Runtime.TieredCompilation": false
}
}
}

76
prebuild.xml Normal file
View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8" ?>
<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.10.xsd" version="1.10">
<Solution name="Prebuild" version="2.0.8">
<Configuration name="Debug">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
<SuppressWarnings>1595</SuppressWarnings>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<CompilerDefines>TRACE</CompilerDefines>
<OutputPath>bin/Release</OutputPath>
<OptimizeCode>true</OptimizeCode>
<DebugInformation>false</DebugInformation>
<SuppressWarnings>1595</SuppressWarnings>
</Options>
</Configuration>
<Files>
<File>prebuild.xml</File>
</Files>
<Project name="Prebuild"
path="src"
language="C#"
assemblyName="prebuild"
icon="App.ico"
type="Exe"
rootNamespace="Prebuild"
startupObject="Prebuild.Prebuild"
version="2.0.7"
frameworkVersion="v6_0"
>
<Author>Matthew Holmes (matthew@wildfiregames.com)</Author>
<Author>Dan Moorehead (dan05a@gmail.com)</Author>
<Author>Dave Hudson (jendave@yahoo.com)</Author>
<Author>Rob Loach (http://robloach.net)</Author>
<Author>C.J. Adams-Collier (cjac@colliertech.org)</Author>
<Author>John Hurliman (john.hurliman@intel.com)</Author>
<Author>WhiteCore build (2015) Rowan Deppeler (greythan@gmail.com)</Author>
<Author>OpenSimulator build (2017) AJLDuarte</Author>
<Description>The Prebuild project generator</Description>
<Configuration name="Debug">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
<KeyFile>Prebuild.snk</KeyFile>
<SuppressWarnings>1595</SuppressWarnings>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<CompilerDefines>TRACE</CompilerDefines>
<OutputPath>bin/Release</OutputPath>
<OptimizeCode>true</OptimizeCode>
<DebugInformation>false</DebugInformation>
<KeyFile>Prebuild.snk</KeyFile>
<SuppressWarnings>1595</SuppressWarnings>
</Options>
</Configuration>
<Reference name="System.EnterpriseServices" />
<Files>
<Match pattern="App.ico" buildAction="EmbeddedResource"/>
<Match path="data" pattern="prebuild-1.10.xsd" buildAction="EmbeddedResource"/>
<Match path="data" pattern="autotools.xml" buildAction="EmbeddedResource"/>
<Match pattern="*.cs" recurse="true">
<Exclude name="obj" pattern="obj"/>
</Match>
</Files>
</Project>
</Solution>
</Prebuild>

1
runprebuild.bat Normal file
View file

@ -0,0 +1 @@
dotnet bootstrap/prebuild.dll /target vs2022 /targetframework net6_0 /excludedir = "obj | bin" /file prebuild.xml

2
runprebuild.sh Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
dotnet bootstrap/prebuild.dll /target vs2022 /targetframework net6_0 /excludedir = "obj | bin" /file prebuild.xml

BIN
src/App.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -0,0 +1,63 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
namespace Prebuild.Core.Attributes;
/// <summary>
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true)]
public sealed class DataNodeAttribute : Attribute
{
#region Fields
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="DataNodeAttribute" /> class.
/// </summary>
/// <param name="name">The name.</param>
public DataNodeAttribute(string name)
{
Name = name;
}
#endregion
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; } = "unknown";
#endregion
}

View file

@ -0,0 +1,63 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
namespace Prebuild.Core.Attributes;
/// <summary>
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public sealed class OptionNodeAttribute : Attribute
{
#region Fields
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="OptionNodeAttribute" /> class.
/// </summary>
/// <param name="nodeName">Name of the node.</param>
public OptionNodeAttribute(string nodeName)
{
NodeName = nodeName;
}
#endregion
#region Properties
/// <summary>
/// Gets the name of the node.
/// </summary>
/// <value>The name of the node.</value>
public string NodeName { get; }
#endregion
}

View file

@ -0,0 +1,63 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
namespace Prebuild.Core.Attributes;
/// <summary>
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public sealed class TargetAttribute : Attribute
{
#region Fields
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="TargetAttribute" /> class.
/// </summary>
/// <param name="name">The name.</param>
public TargetAttribute(string name)
{
Name = name;
}
#endregion
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; }
#endregion
}

View file

@ -0,0 +1,82 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Runtime.Serialization;
namespace Prebuild.Core;
/// <summary>
/// </summary>
[Serializable]
public class FatalException : Exception
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="FatalException" /> class.
/// </summary>
public FatalException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FatalException" /> class.
/// </summary>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public FatalException(string format, params object[] args)
: base(string.Format(format, args))
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public FatalException(string message) : base(message)
{
}
/// <summary>
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public FatalException(string message, Exception exception) : base(message, exception)
{
}
/// <summary>
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected FatalException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endregion
}

View file

@ -0,0 +1,47 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System.Xml;
namespace Prebuild.Core.Interfaces;
/// <summary>
/// </summary>
public interface IDataNode
{
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
IDataNode Parent { get; set; }
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
void Parse(XmlNode node);
}

View file

@ -0,0 +1,51 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
namespace Prebuild.Core.Interfaces;
/// <summary>
/// </summary>
public interface ITarget
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
void Write(Kernel kern);
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
void Clean(Kernel kern);
}

745
src/Core/Kernel.cs Normal file
View file

@ -0,0 +1,745 @@
#region BSD License
/*
Copyright (c) 2004-2008
Matthew Holmes (matthew@wildfiregames.com),
Dan Moorehead (dan05a@gmail.com),
Rob Loach (http://www.robloach.net),
C.J. Adams-Collier (cjac@colliertech.org)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
#define NO_VALIDATE
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Schema;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Parse;
using Prebuild.Core.Utilities;
namespace Prebuild.Core;
/// <summary>
/// </summary>
public class Kernel : IDisposable
{
#region Constructors
private Kernel()
{
}
#endregion
#region Inner Classes
private struct NodeEntry
{
public Type Type;
public DataNodeAttribute Attribute;
}
#endregion
#region Fields
/// <summary>
/// This must match the version of the schema that is embeeded
/// </summary>
private const string m_SchemaVersion = "1.10";
private const string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd";
private const string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema;
private bool disposed;
private Version m_Version;
private const string m_Revision = "w";
//[Obsolete]
//private XmlSchemaCollection m_Schemas;
private readonly Dictionary<string, NodeEntry> m_Nodes = new();
private string m_Target;
private bool cmdlineTargetFramework;
private FrameworkVersion m_TargetFramework; //Overrides all project settings
public string ForcedConditionals { get; private set; }
private string m_Clean;
private string[] m_RemoveDirectories;
private string[] m_ProjectGroups;
public HashSet<string> excludeFolders = new(StringComparer.InvariantCultureIgnoreCase);
#endregion
#region Properties
/// <summary>
/// Gets a value indicating whether [pause after finish].
/// </summary>
/// <value><c>true</c> if [pause after finish]; otherwise, <c>false</c>.</value>
public bool PauseAfterFinish { get; private set; }
/// <summary>
/// Gets the instance.
/// </summary>
/// <value>The instance.</value>
public static Kernel Instance { get; } = new();
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version =>
string.Format("{0}.{1}.{2}{3}", m_Version.Major, m_Version.Minor, m_Version.Build, m_Revision);
/// <summary>
/// Gets the command line.
/// </summary>
/// <value>The command line.</value>
public CommandLineCollection CommandLine { get; private set; }
/// <summary>
/// Gets the targets.
/// </summary>
/// <value>The targets.</value>
public Dictionary<string, ITarget> Targets { get; } = new();
/// <summary>
/// Gets the log.
/// </summary>
/// <value>The log.</value>
public Log Log { get; private set; }
/// <summary>
/// Gets the current working directory.
/// </summary>
/// <value>The current working directory.</value>
public CurrentDirectory CurrentWorkingDirectory { get; private set; }
/// <summary>
/// Gets the solutions.
/// </summary>
/// <value>The solutions.</value>
public List<SolutionNode> Solutions { get; } = new();
/// <summary>
/// Gets the XmlDocument object representing the prebuild.xml
/// being processed
/// </summary>
/// <value>The XmlDocument object</value>
public XmlDocument CurrentDoc { get; private set; }
#endregion
#region Private Methods
private static void RemoveDirectories(string rootDir, string[] dirNames)
{
foreach (var dir in Directory.GetDirectories(rootDir))
{
var simpleName = Path.GetFileName(dir);
if (Array.IndexOf(dirNames, simpleName) != -1)
{
//delete if the name matches one of the directory names to delete
var fullDirPath = Path.GetFullPath(dir);
Directory.Delete(fullDirPath, true);
}
else //not a match, so check children
{
RemoveDirectories(dir, dirNames);
//recurse, checking children for them
}
}
}
// private void RemoveDirectoryMatches(string rootDir, string dirPattern)
// {
// foreach(string dir in Directory.GetDirectories(rootDir))
// {
// foreach(string match in Directory.GetDirectories(dir))
// {//delete all child directories that match
// Directory.Delete(Path.GetFullPath(match),true);
// }
// //recure through the rest checking for nested matches to delete
// RemoveDirectoryMatches(dir,dirPattern);
// }
// }
/*
private void LoadSchema()
{
Assembly assembly = GetType().Assembly;
Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema);
if (stream == null)
{
//try without the default namespace prepending to it in case was compiled with SharpDevelop or MonoDevelop instead of Visual Studio .NET
stream = assembly.GetManifestResourceStream(m_Schema);
if (stream == null)
{
throw new System.Reflection.TargetException(string.Format("Could not find the scheme embedded resource file '{0}'.", m_Schema));
}
}
XmlReader schema = new XmlTextReader(stream);
m_Schemas = new XmlSchemaCollection();
m_Schemas.Add(m_SchemaURI, schema);
}
*/
private void CacheVersion()
{
m_Version = Assembly.GetEntryAssembly().GetName().Version;
}
private void CacheTargets(Assembly assm)
{
foreach (var t in assm.GetTypes())
{
var ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget));
if (ta == null)
continue;
if (t.IsAbstract)
continue;
var target = (ITarget)assm.CreateInstance(t.FullName);
if (target == null) throw new MissingMethodException("Could not create ITarget instance");
Targets[ta.Name] = target;
}
}
private void CacheNodeTypes(Assembly assm)
{
foreach (var t in assm.GetTypes())
foreach (DataNodeAttribute dna in t.GetCustomAttributes(typeof(DataNodeAttribute), true))
{
var ne = new NodeEntry();
ne.Type = t;
ne.Attribute = dna;
m_Nodes[dna.Name] = ne;
}
}
private void LogBanner()
{
Log.Write("Prebuild v" + Version);
Log.Write("Copyright (c) 2004-2010");
Log.Write("Matthew Holmes (matthew@wildfiregames.com),");
Log.Write("Dan Moorehead (dan05a@gmail.com),");
Log.Write("David Hudson (jendave@yahoo.com),");
Log.Write("Rob Loach (http://www.robloach.net),");
Log.Write("C.J. Adams-Collier (cjac@colliertech.org),");
Log.Write("John Hurliman (john.hurliman@intel.com),");
Log.Write("WhiteCore build 2015 (greythane@gmail.com),");
Log.Write("OpenSimulator build 2017 Ubit Umarov,");
Log.Write("");
Log.Write("See 'prebuild /usage' for help");
Log.Write();
}
private void ProcessFile(string file)
{
ProcessFile(file, Solutions);
}
public void ProcessFile(ProcessNode node, SolutionNode parent)
{
if (node.IsValid)
{
var list = new List<SolutionNode>();
ProcessFile(node.Path, list);
foreach (var solution in list)
parent.SolutionsTable[solution.Name] = solution;
}
}
/// <summary>
/// </summary>
/// <param name="file"></param>
/// <param name="solutions"></param>
/// <returns></returns>
public void ProcessFile(string file, IList<SolutionNode> solutions)
{
CurrentWorkingDirectory.Push();
var path = file;
try
{
try
{
path = Helper.ResolvePath(path);
}
catch (ArgumentException)
{
Log.Write("Could not open Prebuild file: " + path);
CurrentWorkingDirectory.Pop();
return;
}
Helper.SetCurrentDir(Path.GetDirectoryName(path));
var reader = new XmlTextReader(path);
var pre = new Preprocessor();
//register command line arguments as XML variables
var dict = CommandLine.GetEnumerator();
while (dict.MoveNext())
{
var name = dict.Current.Key.Trim();
if (name.Length > 0)
pre.RegisterVariable(name, dict.Current.Value);
}
var xml = pre.Process(reader); //remove script and evaulate pre-proccessing to get schema-conforming XML
// See if the user put into a pseudo target of "prebuild:preprocessed-input" to indicate they want to see the
// output before the system processes it.
if (CommandLine.WasPassed("ppi"))
{
// Get the filename if there is one, otherwise use a default.
var ppiFile = CommandLine["ppi"];
if (ppiFile == null || ppiFile.Trim().Length == 0) ppiFile = "preprocessed-input.xml";
// Write out the string to the given stream.
try
{
using (var ppiWriter = new StreamWriter(ppiFile))
{
ppiWriter.WriteLine(xml);
}
}
catch (IOException ex)
{
Console.WriteLine("Could not write PPI file '{0}': {1}", ppiFile, ex.Message);
}
// Finish processing this special tag.
return;
}
CurrentDoc = new XmlDocument();
try
{
#if NO_VALIDATE
var validator = XmlReader.Create(new StringReader(xml));
CurrentDoc.Load(validator);
#else
XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml)));
//validate while reading from string into XmlDocument DOM structure in memory
foreach(XmlSchema schema in m_Schemas)
{
validator.Schemas.Add(schema);
}
m_CurrentDoc.Load(validator);
#endif
}
catch (XmlException e)
{
throw new XmlException(e.ToString());
}
//is there a purpose to writing it? An syntax/schema problem would have been found during pre.Process() and reported with details
if (CommandLine.WasPassed("ppo"))
{
var ppoFile = CommandLine["ppo"];
if (ppoFile == null || ppoFile.Trim().Length < 1) ppoFile = "preprocessed.xml";
StreamWriter writer = null;
try
{
writer = new StreamWriter(ppoFile);
writer.Write(xml);
}
catch (IOException ex)
{
Console.WriteLine("Could not write PPO file '{0}': {1}", ppoFile, ex.Message);
}
finally
{
if (writer != null) writer.Close();
}
return;
}
//start reading the xml config file
var rootNode = CurrentDoc.DocumentElement;
//string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0");
Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode, "checkOsVars", false);
foreach (XmlNode node in rootNode.ChildNodes) //solutions or if pre-proc instructions
{
var dataNode = ParseNode(node, null);
if (dataNode is ProcessNode)
{
var proc = (ProcessNode)dataNode;
if (proc.IsValid) ProcessFile(proc.Path);
}
else if (dataNode is SolutionNode)
{
solutions.Add((SolutionNode)dataNode);
}
}
}
catch (XmlSchemaException xse)
{
Log.Write("XML validation error at line {0} in {1}:\n\n{2}",
xse.LineNumber, path, xse.Message);
}
finally
{
CurrentWorkingDirectory.Pop();
}
}
#endregion
#region Public Methods
/// <summary>
/// Allows the project.
/// </summary>
/// <param name="projectGroupsFlags">The project groups flags.</param>
/// <returns></returns>
public bool AllowProject(string projectGroupsFlags)
{
if (m_ProjectGroups != null && m_ProjectGroups.Length > 0)
{
if (projectGroupsFlags != null && projectGroupsFlags.Length == 0)
foreach (var group in projectGroupsFlags.Split('|'))
if (Array.IndexOf(m_ProjectGroups, group) != -1) //if included in the filter list
return true;
return false; //not included in the list or no groups specified for the project
}
return true; //no filter specified in the command line args
}
/// <summary>
/// Gets the type of the node.
/// </summary>
/// <param name="node">The node.</param>
/// <returns></returns>
public Type GetNodeType(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
if (!m_Nodes.ContainsKey(node.Name)) return null;
var ne = m_Nodes[node.Name];
return ne.Type;
}
/// <summary>
/// </summary>
/// <param name="node"></param>
/// <param name="parent"></param>
/// <returns></returns>
public IDataNode ParseNode(XmlNode node, IDataNode parent)
{
return ParseNode(node, parent, null);
}
//Create an instance of the data node type that is mapped to the name of the xml DOM node
/// <summary>
/// Parses the node.
/// </summary>
/// <param name="node">The node.</param>
/// <param name="parent">The parent.</param>
/// <param name="preNode">The pre node.</param>
/// <returns></returns>
public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode)
{
IDataNode dataNode;
try
{
if (node == null) throw new ArgumentNullException("node");
if (preNode == null)
{
if (!m_Nodes.ContainsKey(node.Name))
{
Console.WriteLine("WARNING: Unknown XML node: " + node.Name);
return null;
}
var ne = m_Nodes[node.Name];
var type = ne.Type;
//DataNodeAttribute dna = ne.Attribute;
dataNode = (IDataNode)type.Assembly.CreateInstance(type.FullName);
if (dataNode == null)
throw new TargetException("Could not create new parser instance: " + type.FullName);
}
else
{
dataNode = preNode;
}
dataNode.Parent = parent;
if (cmdlineTargetFramework && dataNode is ProjectNode)
((ProjectNode)dataNode).FrameworkVersion = m_TargetFramework;
dataNode.Parse(node);
}
catch (WarningException wex)
{
Log.Write(LogType.Warning, wex.Message);
return null;
}
catch (FatalException fex)
{
Log.WriteException(LogType.Error, fex);
throw;
}
catch (Exception ex)
{
Log.WriteException(LogType.Error, ex);
throw;
}
return dataNode;
}
/// <summary>
/// Initializes the specified target.
/// </summary>
/// <param name="target">The target.</param>
/// <param name="args">The args.</param>
public void Initialize(LogTargets target, string[] args)
{
CacheTargets(GetType().Assembly);
CacheNodeTypes(GetType().Assembly);
CacheVersion();
CommandLine = new CommandLineCollection(args);
string logFile = null;
if (CommandLine.WasPassed("log"))
{
logFile = CommandLine["log"];
if (logFile != null && logFile.Length == 0) logFile = "Prebuild.log";
}
else
{
target = target & ~LogTargets.File; //dont output to a file
}
Log = new Log(target, logFile);
LogBanner();
CurrentWorkingDirectory = new CurrentDirectory();
m_Target = CommandLine["target"];
ForcedConditionals = CommandLine["conditionals"];
if (CommandLine["targetframework"] != null)
{
m_TargetFramework = (FrameworkVersion)Enum.Parse(typeof(FrameworkVersion), CommandLine["targetframework"]);
cmdlineTargetFramework = true;
}
m_Clean = CommandLine["clean"];
var removeDirs = CommandLine["removedir"];
if (!string.IsNullOrEmpty(removeDirs)) m_RemoveDirectories = removeDirs.Split('|');
var flags = CommandLine[
"allowedgroups"]; //allows filtering by specifying a pipe-delimited list of groups to include
if (flags != null && flags.Length == 0) m_ProjectGroups = flags.Split('|');
PauseAfterFinish = CommandLine.WasPassed("pause");
var excludeDirstr = CommandLine["excludedir"];
if (!string.IsNullOrEmpty(excludeDirstr))
{
var ex = excludeDirstr.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
if (ex.Length > 0)
foreach (var s in ex)
{
var st = s.Trim();
if (st.Length > 0)
excludeFolders.Add(st);
}
}
//LoadSchema();
}
/// <summary>
/// Processes this instance.
/// </summary>
public void Process()
{
var perfomedOtherTask = false;
if (m_RemoveDirectories != null && m_RemoveDirectories.Length > 0)
{
try
{
RemoveDirectories(".", m_RemoveDirectories);
}
catch (IOException e)
{
Log.Write("Failed to remove directories named {0}", m_RemoveDirectories);
Log.WriteException(LogType.Error, e);
}
catch (UnauthorizedAccessException e)
{
Log.Write("Failed to remove directories named {0}", m_RemoveDirectories);
Log.WriteException(LogType.Error, e);
}
perfomedOtherTask = true;
}
if (m_Target != null && m_Clean != null)
{
Log.Write(LogType.Error, "The options /target and /clean cannot be passed together");
return;
}
if (m_Target == null && m_Clean == null)
{
if (perfomedOtherTask) //finished
return;
Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file");
return;
}
var file = "./prebuild.xml";
if (CommandLine.WasPassed("file")) file = CommandLine["file"];
ProcessFile(file);
var target = m_Target != null ? m_Target.ToLower() : m_Clean.ToLower();
var clean = m_Target == null;
if (clean && target != null && target.Length == 0) target = "all";
if (clean && target == "all") //default to all if no target was specified for clean
{
//check if they passed yes
if (!CommandLine.WasPassed("yes"))
{
Console.WriteLine(
"WARNING: This operation will clean ALL project files for all targets, are you sure? (y/n):");
var ret = Console.ReadLine();
if (ret == null) return;
ret = ret.Trim().ToLower();
if (ret.ToLower() != "y" && ret.ToLower() != "yes") return;
}
//clean all targets (just cleaning vs2002 target didn't clean nant)
foreach (var targ in Targets.Values) targ.Clean(this);
}
else
{
if (!Targets.ContainsKey(target))
{
Log.Write(LogType.Error, "Unknown Target \"{0}\"", target);
return;
}
var targ = Targets[target];
if (clean)
targ.Clean(this);
else
targ.Write(this);
}
Log.Flush();
}
#endregion
#region IDisposable Members
/// <summary>
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose objects
/// </summary>
/// <param name="disposing">
/// If true, it will dispose close the handle
/// </param>
/// <remarks>
/// Will dispose managed and unmanaged resources.
/// </remarks>
protected virtual void Dispose(bool disposing)
{
if (!disposed)
if (disposing)
{
GC.SuppressFinalize(this);
if (Log != null)
{
Log.Close();
Log = null;
}
}
disposed = true;
}
/// <summary>
/// </summary>
~Kernel()
{
Dispose(false);
}
/// <summary>
/// Closes and destroys this object
/// </summary>
/// <remarks>
/// Same as Dispose(true)
/// </remarks>
public void Close()
{
Dispose();
}
#endregion
}

View file

@ -0,0 +1,71 @@
#region BSD License
/*
Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Author")]
public class AuthorNode : DataNode
{
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets the signature.
/// </summary>
/// <value>The signature.</value>
public string Signature { get; private set; }
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (Signature == null) Signature = "";
Signature = Signature.Trim();
}
#endregion
}

View file

@ -0,0 +1,68 @@
#region BSD License
/*
Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
[DataNode("CleanFiles")]
public class CleanFilesNode : DataNode
{
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets the signature.
/// </summary>
/// <value>The signature.</value>
public string Pattern { get; private set; }
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
Pattern = Helper.AttributeValue(node, "pattern", string.Empty);
;
Pattern = Pattern.Trim();
}
#endregion
}

View file

@ -0,0 +1,70 @@
#region BSD License
/*
Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Xml;
using Prebuild.Core.Attributes;
namespace Prebuild.Core.Nodes;
[DataNode("Cleanup")]
public class CleanupNode : DataNode
{
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets the signature.
/// </summary>
/// <value>The signature.</value>
public List<CleanFilesNode> CleanFiles { get; } = new();
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
foreach (XmlNode child in node.ChildNodes)
{
var dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is CleanFilesNode) CleanFiles.Add((CleanFilesNode)dataNode);
}
}
#endregion
}

View file

@ -0,0 +1,191 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Configuration")]
public class ConfigurationNode : DataNode, ICloneable, IComparable
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationNode" /> class.
/// </summary>
public ConfigurationNode()
{
Options = new OptionsNode();
}
#endregion
#region ICloneable Members
/// <summary>
/// Creates a new object that is a copy of the current instance.
/// </summary>
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
public object Clone()
{
var ret = new ConfigurationNode();
ret.Name = Name;
ret.m_Platform = m_Platform;
Options.CopyTo(ret.Options);
return ret;
}
#endregion
#region IComparable Members
public int CompareTo(object obj)
{
var that = (ConfigurationNode)obj;
return Name.CompareTo(that.Name);
}
#endregion
#region Fields
private string m_Platform = "AnyCPU";
#endregion
#region Properties
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
public override IDataNode Parent
{
get => base.Parent;
set
{
base.Parent = value;
if (base.Parent is SolutionNode)
{
var node = (SolutionNode)base.Parent;
if (node != null && node.Options != null) node.Options.CopyTo(Options);
}
}
}
/// <summary>
/// Identifies the platform for this specific configuration.
/// </summary>
public string Platform
{
get => m_Platform;
set
{
switch ((value + "").ToLower())
{
case "x86":
case "x64":
m_Platform = value;
break;
case "itanium":
m_Platform = "Itanium";
break;
default:
m_Platform = "AnyCPU";
break;
}
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; private set; } = "unknown";
/// <summary>
/// Gets the name and platform for the configuration.
/// </summary>
/// <value>The name and platform.</value>
public string NameAndPlatform
{
get
{
var platform = m_Platform;
if (platform == "AnyCPU")
platform = "Any CPU";
return string.Format("{0}|{1}", Name, platform);
}
}
/// <summary>
/// Gets or sets the options.
/// </summary>
/// <value>The options.</value>
public OptionsNode Options { get; set; }
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
Platform = Helper.AttributeValue(node, "platform", m_Platform);
if (node == null) throw new ArgumentNullException("node");
foreach (XmlNode child in node.ChildNodes)
{
var dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is OptionsNode) ((OptionsNode)dataNode).CopyTo(Options);
}
}
/// <summary>
/// Copies to.
/// </summary>
/// <param name="conf">The conf.</param>
public void CopyTo(ConfigurationNode conf)
{
Options.CopyTo(conf.Options);
}
#endregion
}

View file

@ -0,0 +1,64 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System.Collections.Generic;
namespace Prebuild.Core.Nodes;
/// <summary>
/// Implements a specialized list of configuration nodes which allows for lookup via
/// configuration name and platform.
/// </summary>
public class ConfigurationNodeCollection : List<ConfigurationNode>
{
#region Properties
public ConfigurationNode this[string nameAndPlatform]
{
get
{
foreach (var configurationNode in this)
if (configurationNode.NameAndPlatform == nameAndPlatform)
return configurationNode;
return null;
}
set
{
// See if the node
var configurationNode = this[nameAndPlatform];
if (configurationNode != null)
this[IndexOf(configurationNode)] = value;
else
Add(value);
}
}
#endregion
}

View file

@ -0,0 +1,89 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System.IO;
using System.Xml;
using Prebuild.Core.Interfaces;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
public abstract class DataNode : IDataNode
{
#region Fields
#endregion
#region IDataNode Members
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
public virtual IDataNode Parent { get; set; }
public string[] WebTypes { get; } = { "aspx", "ascx", "master", "ashx", "asmx" };
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public virtual void Parse(XmlNode node)
{
}
public BuildAction GetBuildActionByFileName(string fileName)
{
var extension = Path.GetExtension(fileName).ToLower();
foreach (var type in WebTypes)
if (extension == type)
return BuildAction.Content;
return BuildAction.Compile;
}
/// <summary>
/// Parses the file type to figure out what type it is
/// </summary>
/// <returns></returns>
public SubType GetSubTypeByFileName(string fileName)
{
var extension = Path.GetExtension(fileName).ToLower();
var designer = string.Format(".designer{0}", extension);
var path = fileName.ToLower();
if (extension == ".resx")
return SubType.Designer;
if (path.EndsWith(".settings"))
return SubType.Settings;
foreach (var type in WebTypes)
if (path.EndsWith(type))
return SubType.CodeBehind;
return SubType.Code;
}
#endregion
}

View file

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
[DataNode("DatabaseProject")]
public class DatabaseProjectNode : DataNode
{
private readonly List<AuthorNode> authors = new();
private readonly List<DatabaseReferenceNode> references = new();
public Guid Guid { get; } = Guid.NewGuid();
public string Name { get; private set; }
public string Path { get; private set; }
public string FullPath { get; private set; }
public IEnumerable<DatabaseReferenceNode> References => references;
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
Path = Helper.AttributeValue(node, "path", Name);
try
{
FullPath = Helper.ResolvePath(Path);
}
catch
{
throw new WarningException("Could not resolve Solution path: {0}", Path);
}
Kernel.Instance.CurrentWorkingDirectory.Push();
try
{
Helper.SetCurrentDir(FullPath);
if (node == null) throw new ArgumentNullException("node");
foreach (XmlNode child in node.ChildNodes)
{
var dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode == null)
continue;
if (dataNode is AuthorNode)
authors.Add((AuthorNode)dataNode);
else if (dataNode is DatabaseReferenceNode)
references.Add((DatabaseReferenceNode)dataNode);
}
}
finally
{
Kernel.Instance.CurrentWorkingDirectory.Pop();
}
base.Parse(node);
}
}

View file

@ -0,0 +1,54 @@
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
[DataNode("DatabaseReference")]
public class DatabaseReferenceNode : DataNode
{
public string Name { get; private set; }
public Guid ProviderId { get; private set; }
public string ConnectionString { get; private set; }
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
var providerName = Helper.AttributeValue(node, "providerName", string.Empty);
if (providerName != null)
switch (providerName)
{
// digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
// Not sure if these will help other operating systems, or if there's a better way.
case "Microsoft.SqlServerCe.Client.3.5":
ProviderId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533");
break;
case "System.Data.OleDb":
ProviderId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80");
break;
case "System.Data.OracleClient":
ProviderId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB");
break;
case "System.Data.SqlClient":
ProviderId = new Guid("91510608-8809-4020-8897-FBA057E22D54");
break;
case "System.Data.Odbc":
ProviderId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86");
break;
default:
throw new ArgumentOutOfRangeException("providerName", providerName,
"Could not provider name to an id.");
}
else
ProviderId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
ConnectionString = Helper.AttributeValue(node, "connectionString", ConnectionString);
base.Parse(node);
}
}

View file

@ -0,0 +1,72 @@
#region BSD License
/*
Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// The object representing the /Prebuild/Solution/Project/Description element
/// </summary>
[DataNode("Description")]
public class DescriptionNode : DataNode
{
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets the description Value.
/// </summary>
/// <value>The description Value.</value>
public string Value { get; private set; }
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
Value = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (Value == null) Value = "";
Value = Value.Trim();
}
#endregion
}

View file

@ -0,0 +1,72 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Exclude")]
public class ExcludeNode : DataNode
{
#region Fields
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
Name = Helper.AttributeValue(node, "pattern", Name);
}
#endregion
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; private set; } = "";
/// <summary>
/// Gets the pattern.
/// </summary>
/// <value>The pattern.</value>
public string Pattern => Name;
#endregion
}

218
src/Core/Nodes/FileNode.cs Normal file
View file

@ -0,0 +1,218 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.IO;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
public enum BuildAction
{
/// <summary>
/// </summary>
None,
/// <summary>
/// </summary>
Compile,
/// <summary>
/// </summary>
Content,
/// <summary>
/// </summary>
EmbeddedResource,
/// <summary>
/// </summary>
ApplicationDefinition,
/// <summary>
/// </summary>
Page,
/// <summary>
/// </summary>
Copy
}
/// <summary>
/// </summary>
public enum SubType
{
/// <summary>
/// </summary>
Code,
/// <summary>
/// </summary>
Component,
/// <summary>
/// </summary>
Designer,
/// <summary>
/// </summary>
Form,
/// <summary>
/// </summary>
Settings,
/// <summary>
/// </summary>
UserControl,
/// <summary>
/// </summary>
CodeBehind
}
public enum CopyToOutput
{
Never,
Always,
PreserveNewest
}
/// <summary>
/// </summary>
[DataNode("File")]
public class FileNode : DataNode
{
#region Public Methods
/// <summary>
/// </summary>
/// <param name="node"></param>
public override void Parse(XmlNode node)
{
var buildAction = Helper.AttributeValue(node, "buildAction", string.Empty);
if (buildAction != string.Empty)
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
var subType = Helper.AttributeValue(node, "subType", string.Empty);
if (subType != string.Empty)
m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
Console.WriteLine("[FileNode]:BuildAction is {0}", buildAction);
ResourceName = Helper.AttributeValue(node, "resourceName", ResourceName);
IsLink = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
if (IsLink) LinkPath = Helper.AttributeValue(node, "linkPath", string.Empty);
CopyToOutput = (CopyToOutput)Enum.Parse(typeof(CopyToOutput),
Helper.AttributeValue(node, "copyToOutput", CopyToOutput.ToString()));
PreservePath = bool.Parse(Helper.AttributeValue(node, "preservePath", bool.FalseString));
if (node == null) throw new ArgumentNullException("node");
Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (Path == null) Path = "";
Path = Path.Trim();
IsValid = true;
if (!File.Exists(Path))
{
IsValid = false;
Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", Path);
}
if (System.IO.Path.GetExtension(Path) == ".settings")
{
m_SubType = SubType.Settings;
m_BuildAction = BuildAction.None;
}
}
#endregion
#region Fields
private BuildAction? m_BuildAction;
private SubType? m_SubType;
#endregion
#region Properties
/// <summary>
/// </summary>
public string Path { get; private set; }
/// <summary>
/// </summary>
public string ResourceName { get; private set; } = "";
/// <summary>
/// </summary>
public BuildAction BuildAction
{
get
{
if (m_BuildAction != null)
return m_BuildAction.Value;
return GetBuildActionByFileName(Path);
}
}
public CopyToOutput CopyToOutput { get; private set; } = CopyToOutput.Never;
public bool IsLink { get; private set; }
public string LinkPath { get; private set; } = string.Empty;
/// <summary>
/// </summary>
public SubType SubType
{
get
{
if (m_SubType != null)
return m_SubType.Value;
return GetSubTypeByFileName(Path);
}
}
/// <summary>
/// </summary>
public bool IsValid { get; private set; }
/// <summary>
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
public bool PreservePath { get; private set; }
#endregion
}

193
src/Core/Nodes/FilesNode.cs Normal file
View file

@ -0,0 +1,193 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Xml;
using Prebuild.Core.Attributes;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Files")]
public class FilesNode : DataNode
{
#region Fields
private readonly List<string> m_Files = new();
private readonly Dictionary<string, BuildAction> m_BuildActions = new();
private readonly Dictionary<string, SubType> m_SubTypes = new();
private readonly Dictionary<string, string> m_ResourceNames = new();
private readonly Dictionary<string, CopyToOutput> m_CopyToOutputs = new();
private readonly Dictionary<string, bool> m_Links = new();
private readonly Dictionary<string, string> m_LinkPaths = new();
private readonly Dictionary<string, bool> m_PreservePaths = new();
private readonly Dictionary<string, string> m_DestinationPath = new();
private readonly NameValueCollection m_CopyFiles = new();
#endregion
#region Properties
public int Count => m_Files.Count;
public string[] Destinations => m_CopyFiles.AllKeys;
public int CopyFiles => m_CopyFiles.Count;
#endregion
#region Public Methods
public BuildAction GetBuildAction(string file)
{
if (!m_BuildActions.ContainsKey(file)) return BuildAction.Compile;
return m_BuildActions[file];
}
public string GetDestinationPath(string file)
{
if (!m_DestinationPath.ContainsKey(file)) return null;
return m_DestinationPath[file];
}
public string[] SourceFiles(string dest)
{
return m_CopyFiles.GetValues(dest);
}
public CopyToOutput GetCopyToOutput(string file)
{
if (!m_CopyToOutputs.ContainsKey(file)) return CopyToOutput.Never;
return m_CopyToOutputs[file];
}
public bool GetIsLink(string file)
{
if (!m_Links.ContainsKey(file)) return false;
return m_Links[file];
}
public bool Contains(string file)
{
return m_Files.Contains(file);
}
public string GetLinkPath(string file)
{
if (!m_LinkPaths.ContainsKey(file)) return string.Empty;
return m_LinkPaths[file];
}
public SubType GetSubType(string file)
{
if (!m_SubTypes.ContainsKey(file)) return SubType.Code;
return m_SubTypes[file];
}
public string GetResourceName(string file)
{
if (!m_ResourceNames.ContainsKey(file)) return string.Empty;
return m_ResourceNames[file];
}
public bool GetPreservePath(string file)
{
if (!m_PreservePaths.ContainsKey(file)) return false;
return m_PreservePaths[file];
}
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
foreach (XmlNode child in node.ChildNodes)
{
var dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is FileNode)
{
var fileNode = (FileNode)dataNode;
if (fileNode.IsValid)
if (!m_Files.Contains(fileNode.Path))
{
m_Files.Add(fileNode.Path);
m_BuildActions[fileNode.Path] = fileNode.BuildAction;
m_SubTypes[fileNode.Path] = fileNode.SubType;
m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
m_PreservePaths[fileNode.Path] = fileNode.PreservePath;
m_Links[fileNode.Path] = fileNode.IsLink;
m_LinkPaths[fileNode.Path] = fileNode.LinkPath;
m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput;
}
}
else if (dataNode is MatchNode)
{
foreach (var file in ((MatchNode)dataNode).Files)
{
var matchNode = (MatchNode)dataNode;
if (!m_Files.Contains(file))
{
m_Files.Add(file);
if (matchNode.BuildAction == null)
m_BuildActions[file] = GetBuildActionByFileName(file);
else
m_BuildActions[file] = matchNode.BuildAction.Value;
if (matchNode.BuildAction == BuildAction.Copy)
{
m_CopyFiles.Add(matchNode.DestinationPath, file);
m_DestinationPath[file] = matchNode.DestinationPath;
}
m_SubTypes[file] = matchNode.SubType == null
? GetSubTypeByFileName(file)
: matchNode.SubType.Value;
m_ResourceNames[file] = matchNode.ResourceName;
m_PreservePaths[file] = matchNode.PreservePath;
m_Links[file] = matchNode.IsLink;
m_LinkPaths[file] = matchNode.LinkPath;
m_CopyToOutputs[file] = matchNode.CopyToOutput;
}
}
}
}
}
// TODO: Check in to why StringCollection's enumerator doesn't implement
// IEnumerator?
public IEnumerator<string> GetEnumerator()
{
return m_Files.GetEnumerator();
}
#endregion
}

284
src/Core/Nodes/MatchNode.cs Normal file
View file

@ -0,0 +1,284 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Match")]
public class MatchNode : DataNode
{
#region Private Methods
/// <summary>
/// Recurses the directories.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="pattern">The pattern.</param>
/// <param name="recurse">if set to <c>true</c> [recurse].</param>
/// <param name="useRegex">if set to <c>true</c> [use regex].</param>
private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex,
List<ExcludeNode> exclusions)
{
Match match;
try
{
string[] files;
bool excludeFile;
if (!useRegex)
{
try
{
files = Directory.GetFiles(path, pattern);
}
catch (IOException)
{
// swallow weird IOException error when running in a virtual box
// guest OS on a network share when the host OS is not Windows.
// This seems to happen on network shares
// when no files match, and may be related to this report:
// http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=254546
files = null;
}
if (files != null)
foreach (var file in files)
{
excludeFile = false;
string fileTemp;
if (file.Substring(0, 2) == "./" || file.Substring(0, 2) == ".\\")
fileTemp = file.Substring(2);
else
fileTemp = file;
// Check all excludions and set flag if there are any hits.
foreach (var exclude in exclusions)
{
var exRegEx = new Regex(exclude.Pattern);
match = exRegEx.Match(file);
excludeFile |= match.Success;
}
if (!excludeFile) m_Files.Add(fileTemp);
}
// don't call return here, because we may need to recursively search directories below
// this one, even if no matches were found in this directory.
}
else
{
try
{
files = Directory.GetFiles(path);
}
catch (IOException)
{
// swallow weird IOException error when running in a virtual box
// guest OS on a network share.
files = null;
}
if (files != null)
foreach (var file in files)
{
excludeFile = false;
match = m_Regex.Match(file);
if (match.Success)
{
// Check all excludions and set flag if there are any hits.
foreach (var exclude in exclusions)
{
var exRegEx = new Regex(exclude.Pattern);
match = exRegEx.Match(file);
excludeFile |= !match.Success;
}
if (!excludeFile) m_Files.Add(file);
}
}
}
if (recurse)
{
var dirs = Directory.GetDirectories(path);
if (dirs != null && dirs.Length > 0)
foreach (var str in dirs)
{
// hack to skip subversion folders. Not having this can cause
// a significant performance hit when running on a network drive.
if (str.EndsWith(".svn") || str.EndsWith(".git"))
continue;
var dname = Path.GetFileName(str);
if (dname[0] == '.' && (dname[1] == '/' || dname[1] == '\\'))
dname = dname.Substring(2);
if (Kernel.Instance.excludeFolders.Contains(dname))
continue;
RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions);
}
}
}
catch (DirectoryNotFoundException)
{
}
catch (ArgumentException)
{
}
}
#endregion
#region Public Methods
/// <summary>
/// </summary>
/// <param name="node"></param>
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
var path = Helper.AttributeValue(node, "path", ".");
var pattern = Helper.AttributeValue(node, "pattern", "*");
var destination = Helper.AttributeValue(node, "destination", string.Empty);
var recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
var useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
var buildAction = Helper.AttributeValue(node, "buildAction", string.Empty);
if (buildAction != string.Empty)
BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
//TODO: Figure out where the subtype node is being assigned
//string subType = Helper.AttributeValue(node, "subType", string.Empty);
//if (subType != String.Empty)
// m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
ResourceName = Helper.AttributeValue(node, "resourceName", ResourceName);
CopyToOutput = (CopyToOutput)Enum.Parse(typeof(CopyToOutput),
Helper.AttributeValue(node, "copyToOutput", CopyToOutput.ToString()));
IsLink = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
if (IsLink) LinkPath = Helper.AttributeValue(node, "linkPath", string.Empty);
PreservePath = bool.Parse(Helper.AttributeValue(node, "preservePath", bool.FalseString));
if (buildAction == "Copy")
DestinationPath = destination;
if (path != null && path.Length == 0)
path = "."; //use current directory
//throw new WarningException("Match must have a 'path' attribute");
if (pattern == null) throw new WarningException("Match must have a 'pattern' attribute");
path = Helper.NormalizePath(path);
if (!Directory.Exists(path)) throw new WarningException("Match path does not exist: {0}", path);
try
{
if (useRegex) m_Regex = new Regex(pattern);
}
catch (ArgumentException ex)
{
throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
}
foreach (XmlNode child in node.ChildNodes)
{
var dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is ExcludeNode)
{
var excludeNode = (ExcludeNode)dataNode;
m_Exclusions.Add(excludeNode);
}
}
RecurseDirectories(path, pattern, recurse, useRegex, m_Exclusions);
if (m_Files.Count < 1)
{
// Include the project name when the match node returns no matches to provide extra
// debug info.
var project = Parent.Parent as ProjectNode;
var projectName = "";
if (project != null)
projectName = " in project " + project.AssemblyName;
throw new WarningException("Match" + projectName + " returned no files: {0}{1}", Helper.EndPath(path),
pattern);
}
m_Regex = null;
}
#endregion
#region Fields
private readonly List<string> m_Files = new();
private Regex m_Regex;
private readonly List<ExcludeNode> m_Exclusions = new();
#endregion
#region Properties
/// <summary>
/// </summary>
public IEnumerable<string> Files => m_Files;
/// <summary>
/// </summary>
public BuildAction? BuildAction { get; private set; }
public string DestinationPath { get; private set; } = "";
/// <summary>
/// </summary>
public SubType? SubType { get; }
public CopyToOutput CopyToOutput { get; private set; }
public bool IsLink { get; private set; }
public string LinkPath { get; private set; }
/// <summary>
/// </summary>
public string ResourceName { get; private set; } = "";
public bool PreservePath { get; private set; }
#endregion
}

View file

@ -0,0 +1,354 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Options")]
public class OptionsNode : DataNode
{
#region Constructors
/// <summary>
/// Initializes the <see cref="OptionsNode" /> class.
/// </summary>
static OptionsNode()
{
var t = typeof(OptionsNode);
foreach (var f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance))
{
var attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false);
if (attrs == null || attrs.Length < 1) continue;
var ona = (OptionNodeAttribute)attrs[0];
m_OptionFields[ona.NodeName] = f;
}
}
#endregion
#region Fields
private static readonly Dictionary<string, FieldInfo> m_OptionFields = new();
/// <summary>
/// </summary>
[field: OptionNode("CompilerDefines")]
public string CompilerDefines { get; set; } = "";
/// <summary>
/// </summary>
[field: OptionNode("OptimizeCode")]
public bool OptimizeCode { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("CheckUnderflowOverflow")]
public bool CheckUnderflowOverflow { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("AllowUnsafe")]
public bool AllowUnsafe { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("PreBuildEvent")]
public string PreBuildEvent { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("PostBuildEvent")]
public string PostBuildEvent { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("PreBuildEventArgs")]
public string PreBuildEventArgs { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("PostBuildEventArgs")]
public string PostBuildEventArgs { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("RunPostBuildEvent")]
public string RunPostBuildEvent { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("RunScript")]
public string RunScript { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("WarningLevel")]
public int WarningLevel { get; set; } = 4;
/// <summary>
/// </summary>
[field: OptionNode("WarningsAsErrors")]
public bool WarningsAsErrors { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("SuppressWarnings")]
public string SuppressWarnings { get; set; } = "";
/// <summary>
/// </summary>
[field: OptionNode("Prefer32Bit")]
public bool Prefer32Bit { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("OutDir")]
public string OutDir { get; set; } = "bin/";
[field: OptionNode("EnableDefaultItems")]
public bool EnableDefaultItems { get; set; } = true;
[field: OptionNode("UseCommonOutputDirectory")]
public bool UseCommonOutputDirectory { get; set; } = false;
[field: OptionNode("AppendTargetFrameworkToOutputPath")]
public bool AppendTargetFrameworkToOutputPath { get; set; } = true;
[field: OptionNode("AppendRuntimeIdentifierToOutputPath")]
public bool AppendRuntimeIdentifierToOutputPath { get; set; } = true;
/// <summary>
/// </summary>
[field: OptionNode("OutputPath")]
public string OutputPath { get; set; } = "bin/";
/// <summary>
/// </summary>
[field: OptionNode("OutputType")]
public string OutputType { get; set; } = "Exe";
/// <summary>
/// </summary>
[field: OptionNode("RootNamespace")]
public string RootNamespace { get; set; } = "";
/// <summary>
/// </summary>
[field: OptionNode("GenerateDocumentation")]
public bool GenerateDocumentation { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("GenerateXmlDocFile")]
public bool GenerateXmlDocFile { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("XmlDocFile")]
public string XmlDocFile { get; set; } = "";
/// <summary>
/// </summary>
[field: OptionNode("KeyFile")]
public string KeyFile { get; set; } = "";
/// <summary>
/// </summary>
[field: OptionNode("DebugInformation")]
public bool DebugInformation { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("RegisterComInterop")]
public bool RegisterComInterop { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("RemoveIntegerChecks")]
public bool RemoveIntegerChecks { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("IncrementalBuild")]
public bool IncrementalBuild { get; set; }
/// <summary>
/// </summary>
[field: OptionNode("BaseAddress")]
public string BaseAddress { get; set; } = "285212672";
/// <summary>
/// </summary>
[field: OptionNode("FileAlignment")]
public int FileAlignment { get; set; } = 4096;
/// <summary>
/// </summary>
[field: OptionNode("NoStdLib")]
public bool NoStdLib { get; set; }
[field: OptionNode("UseDependencyFile")]
public bool UseDepsFile { get; }
[field: OptionNode("SelfContained")] public bool SelfContained { get; }
[field: OptionNode("UseRuntimeIdentifier")]
public bool UseRuntimeIdentifier { get; }
private readonly List<string> m_FieldsDefined = new();
#endregion
#region Properties
/// <summary>
/// Gets the <see cref="object" /> at the specified index.
/// </summary>
/// <value></value>
public object this[string index]
{
get
{
if (!m_OptionFields.ContainsKey(index)) return null;
var f = m_OptionFields[index];
return f.GetValue(this);
}
}
/// <summary>
/// Gets the <see cref="object" /> at the specified index.
/// </summary>
/// <value></value>
public object this[string index, object defaultValue]
{
get
{
var valueObject = this[index];
if (valueObject != null && valueObject is string && ((string)valueObject).Length == 0) return defaultValue;
return valueObject;
}
}
#endregion
#region Private Methods
private void FlagDefined(string name)
{
if (!m_FieldsDefined.Contains(name)) m_FieldsDefined.Add(name);
}
private void SetOption(string nodeName, string val)
{
lock (m_OptionFields)
{
if (!m_OptionFields.ContainsKey(nodeName)) return;
var f = m_OptionFields[nodeName];
f.SetValue(this, Helper.TranslateValue(f.FieldType, val));
FlagDefined(f.Name);
}
}
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
foreach (XmlNode child in node.ChildNodes)
SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText));
}
/// <summary>
/// Return 'true' if the option symbol has had a value set
/// </summary>
/// <param name="name"></param>
/// <returns>'true' if the option value has been set</returns>
public bool IsDefined(string name)
{
return m_FieldsDefined.Contains("m_" + name);
}
// Return the names of all the fields that have had a value set
public IEnumerable<string> AllDefined()
{
foreach (var name in m_FieldsDefined) yield return name.Substring(2);
}
/// <summary>
/// Copies to.
/// </summary>
/// <param name="opt">The opt.</param>
public void CopyTo(OptionsNode opt)
{
if (opt == null) return;
foreach (var f in m_OptionFields.Values)
if (m_FieldsDefined.Contains(f.Name))
{
f.SetValue(opt, f.GetValue(this));
opt.m_FieldsDefined.Add(f.Name);
}
}
public override string ToString()
{
var buff = new StringBuilder();
foreach (var f in m_OptionFields.Values)
if (m_FieldsDefined.Contains(f.Name))
{
buff.Append(f.Name);
buff.Append("=");
buff.Append(f.GetValue(this));
buff.Append(",");
}
return buff.ToString();
}
#endregion
}

View file

@ -0,0 +1,83 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("PackageReference")]
public class PackageReferenceNode : DataNode, IComparable
{
#region IComparable Members
public int CompareTo(object obj)
{
var that = (PackageReferenceNode)obj;
return Name.CompareTo(that.Name);
}
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
Version = Helper.AttributeValue(node, "version", Version);
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; private set; } = "unknown";
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version { get; private set; }
#endregion
}

View file

@ -0,0 +1,85 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Process")]
public class ProcessNode : DataNode
{
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (Path == null) Path = "";
try
{
Path = Helper.ResolvePath(Path);
}
catch (ArgumentException)
{
Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", Path);
IsValid = false;
}
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; private set; }
/// <summary>
/// Gets a value indicating whether this instance is valid.
/// </summary>
/// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
public bool IsValid { get; private set; } = true;
#endregion
}

View file

@ -0,0 +1,547 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// A set of values that the Project's type can be
/// </summary>
public enum ProjectType
{
/// <summary>
/// The project is a console executable
/// </summary>
Exe,
/// <summary>
/// The project is a windows executable
/// </summary>
WinExe,
/// <summary>
/// The project is a library
/// </summary>
Library,
/// <summary>
/// The project is a website
/// </summary>
Web
}
/// <summary>
/// </summary>
public enum ClrRuntime
{
/// <summary>
/// </summary>
Microsoft,
/// <summary>
/// </summary>
Mono
}
/// <summary>
/// The version of the .NET framework to use (Required for VS2008)
/// <remarks>We don't need .NET 1.1 in here, it'll default when using vs2003.</remarks>
/// </summary>
public enum FrameworkVersion : byte
{
none = 0,
/// <summary>
/// .NET 2.0
/// </summary>
v2_0,
/// <summary>
/// .NET 3.0
/// </summary>
v3_0,
/// <summary>
/// .NET 3.5
/// </summary>
v3_5,
/// <summary>
/// .NET 4.0
/// </summary>
v4_0,
/// <summary>
/// .NET 4.5
/// </summary>
v4_5,
/// <summary>
/// .NET 4.5.1
/// </summary>
v4_5_1,
v4_5_2,
/// <summary>
/// .NET 4.6
/// </summary>
v4_6,
/// <summary>
/// .NET 4.6.1
/// </summary>
v4_6_1,
v4_6_2,
v4_7,
v4_7_1,
v4_7_2,
v4_8,
netstandard2_0,
net5_0,
net6_0,
net7_0
}
/// <summary>
/// The Node object representing /Prebuild/Solution/Project elements
/// </summary>
[DataNode("Project")]
public class ProjectNode : DataNode, IComparable
{
#region IComparable Members
public int CompareTo(object obj)
{
var that = (ProjectNode)obj;
return Name.CompareTo(that.Name);
}
#endregion
#region Private Methods
private void HandleConfiguration(ConfigurationNode conf)
{
if (string.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first,
//so it *may* override changes to the same properties for configurations defines at the project level
foreach (var confNode in ConfigurationsTable.Values)
conf.CopyTo(confNode); //update the config templates defines at the project level with the overrides
if (ConfigurationsTable.ContainsKey(conf.NameAndPlatform))
{
var parentConf = ConfigurationsTable[conf.NameAndPlatform];
conf.CopyTo(parentConf); //update the config templates defines at the project level with the overrides
}
else
{
ConfigurationsTable[conf.NameAndPlatform] = conf;
}
}
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
Path = Helper.AttributeValue(node, "path", Path);
FilterGroups = Helper.AttributeValue(node, "filterGroups", FilterGroups);
Version = Helper.AttributeValue(node, "version", Version);
AppIcon = Helper.AttributeValue(node, "icon", AppIcon);
ApplicationManifest = Helper.AttributeValue(node, "appmanifest", ApplicationManifest);
ConfigFile = Helper.AttributeValue(node, "configFile", ConfigFile);
DesignerFolder = Helper.AttributeValue(node, "designerFolder", DesignerFolder);
AssemblyName = Helper.AttributeValue(node, "assemblyName", AssemblyName);
Language = Helper.AttributeValue(node, "language", Language);
Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), Type);
Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), Runtime);
if (m_useFramework)
m_Framework =
(FrameworkVersion)Helper.EnumAttributeValue(node, "frameworkVersion", typeof(FrameworkVersion),
m_Framework);
m_Framework =
(FrameworkVersion)Helper.EnumAttributeValue(node, "forceFrameworkVersion", typeof(FrameworkVersion),
m_Framework);
StartupObject = Helper.AttributeValue(node, "startupObject", StartupObject);
RootNamespace = Helper.AttributeValue(node, "rootNamespace", RootNamespace);
CopyLocalLockFileAssemblies =
Helper.ParseBoolean(node, "copyDependencies", true); // This gives us legacy behavior.
var hash = Name.GetHashCode();
var guidByHash = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
var guid = Helper.AttributeValue(node, "guid", guidByHash.ToString());
Guid = new Guid(guid);
GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty);
if (string.IsNullOrEmpty(AssemblyName)) AssemblyName = Name;
if (string.IsNullOrEmpty(RootNamespace)) RootNamespace = Name;
FullPath = Path;
try
{
FullPath = Helper.ResolvePath(FullPath);
}
catch
{
throw new WarningException("Could not resolve Solution path: {0}", Path);
}
Kernel.Instance.CurrentWorkingDirectory.Push();
try
{
Helper.SetCurrentDir(FullPath);
if (node == null) throw new ArgumentNullException("node");
foreach (XmlNode child in node.ChildNodes)
{
var dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is ConfigurationNode)
HandleConfiguration((ConfigurationNode)dataNode);
else if (dataNode is ReferencePathNode)
m_ReferencePaths.Add((ReferencePathNode)dataNode);
else if (dataNode is ReferenceNode)
m_References.Add((ReferenceNode)dataNode);
else if (dataNode is PackageReferenceNode)
m_PackageReferences.Add((PackageReferenceNode)dataNode);
else if (dataNode is ProjectReferenceNode)
m_ProjectReferences.Add((ProjectReferenceNode)dataNode);
else if (dataNode is AuthorNode)
Authors.Add((AuthorNode)dataNode);
else if (dataNode is FilesNode) Files = (FilesNode)dataNode;
}
}
finally
{
Kernel.Instance.CurrentWorkingDirectory.Pop();
}
}
#endregion
#region Fields
private FrameworkVersion m_Framework = FrameworkVersion.none;
private bool m_useFramework = true;
private readonly List<ReferencePathNode> m_ReferencePaths = new();
private readonly List<ProjectReferenceNode> m_ProjectReferences = new();
private readonly List<PackageReferenceNode> m_PackageReferences = new();
private readonly List<ReferenceNode> m_References = new();
private readonly Dictionary<FrameworkVersion, string> m_frameworkVersionToCondionalVersion = new()
{
{ FrameworkVersion.v2_0, "NET20" },
{ FrameworkVersion.v3_0, "NET30" },
{ FrameworkVersion.v3_5, "NET35" },
{ FrameworkVersion.v4_0, "NET40" },
{ FrameworkVersion.v4_5, "NET45" },
{ FrameworkVersion.v4_5_1, "NET451" },
{ FrameworkVersion.v4_5_2, "NET452" },
{ FrameworkVersion.v4_6, "NET46" },
{ FrameworkVersion.v4_6_1, "NET461" },
{ FrameworkVersion.v4_6_2, "NET462" },
{ FrameworkVersion.v4_7, "NET47" },
{ FrameworkVersion.v4_7_1, "NET471" },
{ FrameworkVersion.v4_7_2, "NET472" },
{ FrameworkVersion.v4_8, "NET48" },
{ FrameworkVersion.netstandard2_0, "NETSTANDARD2_0" },
{ FrameworkVersion.net5_0, "NET5_0" },
{ FrameworkVersion.net6_0, "NET6_0" },
{ FrameworkVersion.net7_0, "NET7_0" }
};
#endregion
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; private set; } = "unknown";
/// <summary>
/// The version of the .NET Framework to compile under
/// </summary>
public FrameworkVersion FrameworkVersion
{
get => m_Framework;
set
{
m_Framework = value;
m_useFramework = false;
}
}
public string FrameworkVersionForConditional
{
get
{
if (m_frameworkVersionToCondionalVersion.TryGetValue(m_Framework, out var ret))
return ret;
return string.Empty;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; private set; } = "";
/// <summary>
/// Gets the filter groups.
/// </summary>
/// <value>The filter groups.</value>
public string FilterGroups { get; private set; } = "";
/// <summary>
/// Gets the project's version
/// </summary>
/// <value>The project's version.</value>
public string Version { get; private set; } = "";
/// <summary>
/// Gets the full path.
/// </summary>
/// <value>The full path.</value>
public string FullPath { get; private set; } = "";
/// <summary>
/// Gets the name of the assembly.
/// </summary>
/// <value>The name of the assembly.</value>
public string AssemblyName { get; private set; }
/// <summary>
/// Copies the local dependencies to the output on build.
/// This is the same behavior as publish.
/// </summary>
public bool CopyLocalLockFileAssemblies { get; private set; }
/// <summary>
/// Gets the app icon.
/// </summary>
/// <value>The app icon.</value>
public string AppIcon { get; private set; } = "";
/// <summary>
/// Gets the Application Manifest.
/// </summary>
/// <value>The Application Manifest.</value>
public string ApplicationManifest { get; private set; } = "";
/// <summary>
/// Gets the app icon.
/// </summary>
/// <value>The app icon.</value>
public string ConfigFile { get; private set; } = "";
/// <summary>
/// </summary>
public string DesignerFolder { get; private set; } = "";
/// <summary>
/// Gets the language.
/// </summary>
/// <value>The language.</value>
public string Language { get; private set; } = "C#";
/// <summary>
/// Gets the type.
/// </summary>
/// <value>The type.</value>
public ProjectType Type { get; private set; } = ProjectType.Exe;
/// <summary>
/// Gets the runtime.
/// </summary>
/// <value>The runtime.</value>
public ClrRuntime Runtime { get; private set; } = ClrRuntime.Microsoft;
/// <summary>
/// </summary>
public bool GenerateAssemblyInfoFile { get; set; }
/// <summary>
/// Gets the startup object.
/// </summary>
/// <value>The startup object.</value>
public string StartupObject { get; private set; } = "";
/// <summary>
/// Gets the root namespace.
/// </summary>
/// <value>The root namespace.</value>
public string RootNamespace { get; private set; }
/// <summary>
/// Gets the configurations.
/// </summary>
/// <value>The configurations.</value>
public List<ConfigurationNode> Configurations
{
get
{
var tmp = new List<ConfigurationNode>(ConfigurationsTable.Values);
tmp.Sort();
return tmp;
}
}
/// <summary>
/// Gets the configurations table.
/// </summary>
/// <value>The configurations table.</value>
public Dictionary<string, ConfigurationNode> ConfigurationsTable { get; } = new();
/// <summary>
/// Gets the reference paths.
/// </summary>
/// <value>The reference paths.</value>
public List<ReferencePathNode> ReferencePaths
{
get
{
var tmp = new List<ReferencePathNode>(m_ReferencePaths);
tmp.Sort();
return tmp;
}
}
/// <summary>
/// Gets the references.
/// </summary>
/// <value>The references.</value>
public List<ReferenceNode> References
{
get
{
var tmp = new List<ReferenceNode>(m_References);
tmp.Sort();
return tmp;
}
}
/// <summary>
/// Gets the references.
/// </summary>
/// <value>The references.</value>
public List<ProjectReferenceNode> ProjectReferences
{
get
{
var tmp = new List<ProjectReferenceNode>(m_ProjectReferences);
tmp.Sort();
return tmp;
}
}
/// <summary>
/// Gets the package references.
/// </summary>
/// <value>The references.</value>
public List<PackageReferenceNode> PackageReferences
{
get
{
var tmp = new List<PackageReferenceNode>(m_PackageReferences);
tmp.Sort();
return tmp;
}
}
/// <summary>
/// Gets the Authors list.
/// </summary>
/// <value>The list of the project's authors.</value>
public List<AuthorNode> Authors { get; } = new();
/// <summary>
/// Gets the files.
/// </summary>
/// <value>The files.</value>
public FilesNode Files { get; private set; } = new();
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
public override IDataNode Parent
{
get => base.Parent;
set
{
base.Parent = value;
if (base.Parent is SolutionNode && ConfigurationsTable.Count < 1)
{
var parent = (SolutionNode)base.Parent;
foreach (var conf in parent.Configurations)
ConfigurationsTable[conf.NameAndPlatform] = (ConfigurationNode)conf.Clone();
if (m_useFramework)
{
if (parent.ForceFramework != FrameworkVersion.none)
{
m_Framework = parent.ForceFramework;
m_useFramework = false;
}
else if (m_Framework == FrameworkVersion.none)
{
m_Framework = parent.DefaultFramework != FrameworkVersion.none
? parent.DefaultFramework
: FrameworkVersion.v2_0;
}
}
}
}
}
/// <summary>
/// Gets the GUID.
/// </summary>
/// <value>The GUID.</value>
public Guid Guid { get; private set; }
public string DebugStartParameters { get; private set; }
#endregion
}

View file

@ -0,0 +1,83 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("ProjectReference")]
public class ProjectReferenceNode : DataNode, IComparable
{
#region IComparable Members
public int CompareTo(object obj)
{
var that = (ProjectReferenceNode)obj;
return Name.CompareTo(that.Name);
}
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
Include = Helper.AttributeValue(node, "include", Include);
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; private set; } = "unknown";
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Include { get; private set; }
#endregion
}

View file

@ -0,0 +1,112 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Reference")]
public class ReferenceNode : DataNode, IComparable
{
#region IComparable Members
public int CompareTo(object obj)
{
var that = (ReferenceNode)obj;
return Name.CompareTo(that.Name);
}
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
Path = Helper.AttributeValue(node, "path", Path);
m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy);
Version = Helper.AttributeValue(node, "version", Version);
}
#endregion
#region Fields
private string m_LocalCopy;
#endregion
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; private set; } = "unknown";
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; private set; }
/// <summary>
/// Gets a value indicating whether [local copy specified].
/// </summary>
/// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value>
public bool LocalCopySpecified => m_LocalCopy != null && m_LocalCopy.Length == 0;
/// <summary>
/// Gets a value indicating whether [local copy].
/// </summary>
/// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value>
public bool LocalCopy
{
get
{
if (m_LocalCopy == null) return false;
return bool.Parse(m_LocalCopy);
}
}
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version { get; private set; }
#endregion
}

View file

@ -0,0 +1,81 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("ReferencePath")]
public class ReferencePathNode : DataNode, IComparable
{
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; private set; }
#endregion
#region IComparable Members
public int CompareTo(object obj)
{
var that = (ReferencePathNode)obj;
return Path.CompareTo(that.Path);
}
#endregion
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null) throw new ArgumentNullException("node");
Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (Path == null) Path = "";
Path = Path.Trim();
}
#endregion
}

View file

@ -0,0 +1,276 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes;
/// <summary>
/// </summary>
[DataNode("Solution")]
[DataNode("EmbeddedSolution")]
[DebuggerDisplay("{Name}")]
public class SolutionNode : DataNode
{
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
Name = Helper.AttributeValue(node, "name", Name);
ActiveConfig = Helper.AttributeValue(node, "activeConfig", ActiveConfig);
Path = Helper.AttributeValue(node, "path", Path);
Version = Helper.AttributeValue(node, "version", Version);
var tmp = Helper.AttributeValue(node, "forceFrameworkVersion", "");
if (tmp.Length > 0)
if (!Enum.TryParse(tmp, true, out ForceFramework))
ForceFramework = FrameworkVersion.none;
if (ForceFramework == FrameworkVersion.none)
{
tmp = Helper.AttributeValue(node, "frameworkVersion", "");
if (tmp.Length > 0)
if (!Enum.TryParse(tmp, true, out DefaultFramework))
DefaultFramework = FrameworkVersion.none;
}
FullPath = Path;
try
{
FullPath = Helper.ResolvePath(FullPath);
}
catch
{
throw new WarningException("Could not resolve solution path: {0}", Path);
}
Kernel.Instance.CurrentWorkingDirectory.Push();
try
{
Helper.SetCurrentDir(FullPath);
if (node == null) throw new ArgumentNullException("node");
foreach (XmlNode child in node.ChildNodes)
{
var dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is OptionsNode)
{
Options = (OptionsNode)dataNode;
}
else if (dataNode is FilesNode)
{
Files = (FilesNode)dataNode;
}
else if (dataNode is ConfigurationNode)
{
var configurationNode = (ConfigurationNode)dataNode;
ConfigurationsTable[configurationNode.NameAndPlatform] = configurationNode;
// If the active configuration is null, then we populate it.
if (ActiveConfig == null) ActiveConfig = configurationNode.Name;
}
else if (dataNode is ProjectNode)
{
ProjectsTable[((ProjectNode)dataNode).Name] = (ProjectNode)dataNode;
ProjectsTableOrder.Add((ProjectNode)dataNode);
}
else if (dataNode is SolutionNode)
{
SolutionsTable[((SolutionNode)dataNode).Name] = (SolutionNode)dataNode;
}
else if (dataNode is ProcessNode)
{
var p = (ProcessNode)dataNode;
Kernel.Instance.ProcessFile(p, this);
}
else if (dataNode is DatabaseProjectNode)
{
m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = (DatabaseProjectNode)dataNode;
}
else if (dataNode is CleanupNode)
{
if (Cleanup != null)
throw new WarningException("There can only be one Cleanup node.");
Cleanup = (CleanupNode)dataNode;
}
}
}
finally
{
Kernel.Instance.CurrentWorkingDirectory.Pop();
}
}
#endregion
#region Fields
public FrameworkVersion DefaultFramework = FrameworkVersion.none;
public FrameworkVersion ForceFramework = FrameworkVersion.none;
private readonly Dictionary<string, DatabaseProjectNode> m_DatabaseProjects = new();
#endregion
#region Properties
public override IDataNode Parent
{
get => base.Parent;
set
{
if (value is SolutionNode)
{
var solution = (SolutionNode)value;
foreach (var conf in solution.Configurations)
ConfigurationsTable[conf.Name] = (ConfigurationNode)conf.Clone();
}
base.Parent = value;
}
}
public CleanupNode Cleanup { get; set; }
public Guid Guid { get; set; } = Guid.NewGuid();
/// <summary>
/// Gets or sets the active config.
/// </summary>
/// <value>The active config.</value>
public string ActiveConfig { get; set; }
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; private set; } = "unknown";
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; private set; } = "";
/// <summary>
/// Gets the full path.
/// </summary>
/// <value>The full path.</value>
public string FullPath { get; private set; } = "";
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version { get; private set; } = "1.0.0";
/// <summary>
/// Gets the options.
/// </summary>
/// <value>The options.</value>
public OptionsNode Options { get; private set; }
/// <summary>
/// Gets the files.
/// </summary>
/// <value>The files.</value>
public FilesNode Files { get; private set; }
/// <summary>
/// Gets the configurations.
/// </summary>
/// <value>The configurations.</value>
public ConfigurationNodeCollection Configurations
{
get
{
var tmp = new ConfigurationNodeCollection();
tmp.AddRange(ConfigurationsTable);
return tmp;
}
}
/// <summary>
/// Gets the configurations table.
/// </summary>
/// <value>The configurations table.</value>
public ConfigurationNodeCollection ConfigurationsTable { get; } = new();
/// <summary>
/// Gets the database projects.
/// </summary>
public ICollection<DatabaseProjectNode> DatabaseProjects => m_DatabaseProjects.Values;
/// <summary>
/// Gets the nested solutions.
/// </summary>
public ICollection<SolutionNode> Solutions => SolutionsTable.Values;
/// <summary>
/// Gets the nested solutions hash table.
/// </summary>
public Dictionary<string, SolutionNode> SolutionsTable { get; } = new();
/// <summary>
/// Gets the projects.
/// </summary>
/// <value>The projects.</value>
public ICollection<ProjectNode> Projects
{
get
{
var tmp = new List<ProjectNode>(ProjectsTable.Values);
tmp.Sort();
return tmp;
}
}
/// <summary>
/// Gets the projects table.
/// </summary>
/// <value>The projects table.</value>
public Dictionary<string, ProjectNode> ProjectsTable { get; } = new();
/// <summary>
/// Gets the projects table.
/// </summary>
/// <value>The projects table.</value>
public List<ProjectNode> ProjectsTableOrder { get; } = new();
#endregion
}

116
src/Core/Parse/IfContext.cs Normal file
View file

@ -0,0 +1,116 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
namespace Prebuild.Core.Parse;
/// <summary>
/// </summary>
public enum IfState
{
/// <summary>
/// </summary>
None,
/// <summary>
/// </summary>
If,
/// <summary>
/// </summary>
ElseIf,
/// <summary>
/// </summary>
Else
}
/// <summary>
/// Summary description for IfContext.
/// </summary>
// Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/)
public class IfContext
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="IfContext" /> class.
/// </summary>
/// <param name="active">if set to <c>true</c> [active].</param>
/// <param name="keep">if set to <c>true</c> [keep].</param>
/// <param name="state">The state.</param>
public IfContext(bool active, bool keep, IfState state)
{
Active = active;
m_Keep = keep;
EverKept = keep;
State = state;
}
#endregion
#region Properties
private bool m_Keep;
#endregion
#region Properties
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IfContext" /> is active.
/// </summary>
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
public bool Active { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IfContext" /> is keep.
/// </summary>
/// <value><c>true</c> if keep; otherwise, <c>false</c>.</value>
public bool Keep
{
get => m_Keep;
set
{
m_Keep = value;
if (m_Keep) EverKept = true;
}
}
/// <summary>
/// Gets a value indicating whether [ever kept].
/// </summary>
/// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value>
public bool EverKept { get; private set; }
/// <summary>
/// Gets or sets the state.
/// </summary>
/// <value>The state.</value>
public IfState State { get; set; } = IfState.None;
#endregion
}

View file

@ -0,0 +1,557 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
namespace Prebuild.Core.Parse;
/// <summary>
/// </summary>
public enum OperatorSymbol
{
/// <summary>
/// </summary>
None,
/// <summary>
/// </summary>
Equal,
/// <summary>
/// </summary>
NotEqual,
/// <summary>
/// </summary>
LessThan,
/// <summary>
/// </summary>
GreaterThan,
/// <summary>
/// </summary>
LessThanEqual,
/// <summary>
/// </summary>
GreaterThanEqual
}
/// <summary>
/// </summary>
public class Preprocessor
{
#region Constants
/// <summary>
/// Includes the regex to look for file tags in the <?include
/// ?> processing instruction.
/// </summary>
private static readonly Regex includeFileRegex = new("file=\"(.+?)\"");
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="Preprocessor" /> class.
/// </summary>
public Preprocessor()
{
RegisterVariable("OS", GetOS());
RegisterVariable("RuntimeVersion", Environment.Version.Major);
RegisterVariable("RuntimeMajor", Environment.Version.Major);
RegisterVariable("RuntimeMinor", Environment.Version.Minor);
RegisterVariable("RuntimeRevision", Environment.Version.Revision);
}
#endregion
#region Properties
/// <summary>
/// Gets the processed doc.
/// </summary>
/// <value>The processed doc.</value>
public XmlDocument ProcessedDoc { get; } = new();
#endregion
#region Fields
private readonly Stack<IfContext> m_IfStack = new();
private readonly Dictionary<string, object> m_Variables = new();
#endregion
#region Private Methods
/// <summary>
/// Parts of this code were taken from NAnt and is subject to the GPL
/// as per NAnt's license. Thanks to the NAnt guys for this little gem.
/// </summary>
/// <returns></returns>
public static string GetOS()
{
var platId = Environment.OSVersion.Platform;
if (platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows) return "Win32";
if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa")) return "MACOSX";
/*
* .NET 1.x, under Mono, the UNIX code is 128. Under
* .NET 2.x, Mono or MS, the UNIX code is 4
*/
if (Environment.Version.Major == 1)
{
if ((int)platId == 128) return "UNIX";
}
else if ((int)platId == 4)
{
return "UNIX";
}
return "Unknown";
}
private static bool CompareNum(OperatorSymbol oper, int val1, int val2)
{
switch (oper)
{
case OperatorSymbol.Equal:
return val1 == val2;
case OperatorSymbol.NotEqual:
return val1 != val2;
case OperatorSymbol.LessThan:
return val1 < val2;
case OperatorSymbol.LessThanEqual:
return val1 <= val2;
case OperatorSymbol.GreaterThan:
return val1 > val2;
case OperatorSymbol.GreaterThanEqual:
return val1 >= val2;
}
throw new WarningException("Unknown operator type");
}
private static bool CompareStr(OperatorSymbol oper, string val1, string val2)
{
switch (oper)
{
case OperatorSymbol.Equal:
return val1 == val2;
case OperatorSymbol.NotEqual:
return val1 != val2;
case OperatorSymbol.LessThan:
return val1.CompareTo(val2) < 0;
case OperatorSymbol.LessThanEqual:
return val1.CompareTo(val2) <= 0;
case OperatorSymbol.GreaterThan:
return val1.CompareTo(val2) > 0;
case OperatorSymbol.GreaterThanEqual:
return val1.CompareTo(val2) >= 0;
}
throw new WarningException("Unknown operator type");
}
private static char NextChar(int idx, string str)
{
if (idx + 1 >= str.Length) return char.MaxValue;
return str[idx + 1];
}
// Very very simple expression parser. Can only match expressions of the form
// <var> <op> <value>:
// OS = Windows
// OS != Linux
// RuntimeMinor > 0
private bool ParseExpression(string exp)
{
if (exp == null) throw new ArgumentException("Invalid expression, cannot be null");
exp = exp.Trim();
if (exp.Length < 1) throw new ArgumentException("Invalid expression, cannot be 0 length");
var id = "";
var str = "";
var oper = OperatorSymbol.None;
var inStr = false;
for (var i = 0; i < exp.Length; i++)
{
var c = exp[i];
if (char.IsWhiteSpace(c)) continue;
if (char.IsLetterOrDigit(c) || c == '_')
{
if (inStr)
str += c;
else
id += c;
}
else if (c == '\"')
{
inStr = !inStr;
if (inStr) str = "";
}
else
{
if (inStr)
str += c;
else
switch (c)
{
case '=':
oper = OperatorSymbol.Equal;
break;
case '!':
if (NextChar(i, exp) == '=') oper = OperatorSymbol.NotEqual;
break;
case '<':
if (NextChar(i, exp) == '=')
oper = OperatorSymbol.LessThanEqual;
else
oper = OperatorSymbol.LessThan;
break;
case '>':
if (NextChar(i, exp) == '=')
oper = OperatorSymbol.GreaterThanEqual;
else
oper = OperatorSymbol.GreaterThan;
break;
}
}
}
if (inStr) throw new WarningException("Expected end of string in expression");
if (oper == OperatorSymbol.None) throw new WarningException("Expected operator in expression");
if (id.Length < 1) throw new WarningException("Expected identifier in expression");
if (str.Length < 1) throw new WarningException("Expected value in expression");
bool ret;
try
{
var val = m_Variables[id.ToLower()];
if (val == null) throw new WarningException("Unknown identifier '{0}'", id);
var t = val.GetType();
if (t.IsAssignableFrom(typeof(int)))
{
var numVal = (int)val;
var numVal2 = int.Parse(str);
ret = CompareNum(oper, numVal, numVal2);
}
else
{
var strVal = val.ToString();
var strVal2 = str;
ret = CompareStr(oper, strVal, strVal2);
}
}
catch (ArgumentException ex)
{
ex.ToString();
throw new WarningException("Invalid value type for system variable '{0}', expected int", id);
}
return ret;
}
/// <summary>
/// Taken from current Prebuild included in OpenSim 0.7.x
/// </summary>
/// <param name="readerStack">
/// A <see cref="Stack<XmlReader>"/>
/// </param>
/// <param name="include">
/// A <see cref="System.String" />
/// </param>
private static void WildCardInclude(Stack<XmlReader> readerStack, string include)
{
if (!include.Contains("*")) return;
// Console.WriteLine("Processing {0}", include);
// Break up the include into pre and post wildcard sections
var preWildcard = include.Substring(0, include.IndexOf("*"));
var postWildcard = include.Substring(include.IndexOf("*") + 2);
// If preWildcard is a directory, recurse
if (Directory.Exists(preWildcard))
{
var directories = Directory.GetDirectories(preWildcard);
Array.Sort(directories);
Array.Reverse(directories);
foreach (var dirPath in directories)
{
//Console.WriteLine ("Scanning : {0}", dirPath);
var includeFile = Path.Combine(dirPath, postWildcard);
if (includeFile.Contains("*"))
{
// postWildcard included another wildcard, recurse.
WildCardInclude(readerStack, includeFile);
}
else
{
var file = new FileInfo(includeFile);
if (file.Exists)
{
//Console.WriteLine ("Including File: {0}", includeFile);
XmlReader newReader =
new XmlTextReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read));
readerStack.Push(newReader);
}
}
}
}
else
{
// preWildcard is not a path to a directory, so the wildcard is in the filename
var searchFilename =
Path.GetFileName(preWildcard.Substring(preWildcard.IndexOf("/") + 1) + "*" + postWildcard);
Console.WriteLine("searchFilename: {0}", searchFilename);
var searchDirectory = Path.GetDirectoryName(preWildcard);
Console.WriteLine("searchDirectory: {0}", searchDirectory);
var files = Directory.GetFiles(searchDirectory, searchFilename);
Array.Sort(files);
Array.Reverse(files);
foreach (var includeFile in files)
{
var file = new FileInfo(includeFile);
if (file.Exists)
{
// Console.WriteLine ("Including File: {0}", includeFile);
XmlReader newReader = new XmlTextReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read));
readerStack.Push(newReader);
}
}
}
}
#endregion
#region Public Methods
/// <summary>
/// </summary>
/// <param name="name"></param>
/// <param name="variableValue"></param>
public void RegisterVariable(string name, object variableValue)
{
if (name == null || variableValue == null) return;
m_Variables[name.ToLower()] = variableValue;
}
/// <summary>
/// Performs validation on the xml source as well as evaluates conditional and flow expresions
/// </summary>
/// <exception cref="ArgumentException">
/// For invalid use of conditional expressions or for invalid XML syntax. If a
/// XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml
/// </exception>
/// <param name="initialReader"></param>
/// <returns>the output xml </returns>
public string Process(XmlReader initialReader)
{
if (initialReader == null) throw new ArgumentException("Invalid XML reader to pre-process");
var context = new IfContext(true, true, IfState.None);
var xmlText = new StringWriter();
var writer = new XmlTextWriter(xmlText);
writer.Formatting = Formatting.Indented;
// Create a queue of XML readers and add the initial
// reader to it. Then we process until we run out of
// readers which lets the <?include?> operation add more
// readers to generate a multi-file parser and not require
// XML fragments that a recursive version would use.
var readerStack = new Stack<XmlReader>();
readerStack.Push(initialReader);
while (readerStack.Count > 0)
{
// Pop off the next reader.
var reader = readerStack.Pop();
// Process through this XML reader until it is
// completed (or it is replaced by the include
// operation).
while (reader.Read())
{
// The prebuild file has a series of processing
// instructions which allow for specific
// inclusions based on operating system or to
// include additional files.
if (reader.NodeType == XmlNodeType.ProcessingInstruction)
{
var ignore = false;
switch (reader.LocalName)
{
case "include":
// use regular expressions to parse out the attributes.
var matches = includeFileRegex.Matches(reader.Value);
// make sure there is only one file attribute.
if (matches.Count > 1)
throw new WarningException(
"An <?include ?> node was found, but it specified more than one file.");
if (matches.Count == 0)
throw new WarningException(
"An <?include ?> node was found, but it did not specify the file attribute.");
// ***** Adding for wildcard handling
// Push current reader back onto the stack.
readerStack.Push(reader);
// Pull the file out from the regex and make sure it is a valid file before using it.
var filename = matches[0].Groups[1].Value;
filename = string.Join(Path.DirectorySeparatorChar.ToString(), filename.Split('/', '\\'));
if (!filename.Contains("*"))
{
var includeFile = new FileInfo(filename);
if (!includeFile.Exists)
throw new WarningException("Cannot include file: " + includeFile.FullName);
// Create a new reader object for this file. Then put the old reader back on the stack and start
// processing using this new XML reader.
XmlReader newReader =
new XmlTextReader(includeFile.Open(FileMode.Open, FileAccess.Read, FileShare.Read));
reader = newReader;
readerStack.Push(reader);
}
else
{
WildCardInclude(readerStack, filename);
}
reader = readerStack.Pop();
ignore = true;
break;
case "if":
m_IfStack.Push(context);
context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value),
IfState.If);
ignore = true;
break;
case "elseif":
if (m_IfStack.Count == 0) throw new WarningException("Unexpected 'elseif' outside of 'if'");
if (context.State != IfState.If && context.State != IfState.ElseIf)
throw new WarningException("Unexpected 'elseif' outside of 'if'");
context.State = IfState.ElseIf;
if (!context.EverKept)
context.Keep = ParseExpression(reader.Value);
else
context.Keep = false;
ignore = true;
break;
case "else":
if (m_IfStack.Count == 0) throw new WarningException("Unexpected 'else' outside of 'if'");
if (context.State != IfState.If && context.State != IfState.ElseIf)
throw new WarningException("Unexpected 'else' outside of 'if'");
context.State = IfState.Else;
context.Keep = !context.EverKept;
ignore = true;
break;
case "endif":
if (m_IfStack.Count == 0) throw new WarningException("Unexpected 'endif' outside of 'if'");
context = m_IfStack.Pop();
ignore = true;
break;
}
if (ignore) continue;
} //end pre-proc instruction
if (!context.Active || !context.Keep) continue;
switch (reader.NodeType)
{
case XmlNodeType.Element:
var empty = reader.IsEmptyElement;
writer.WriteStartElement(reader.Name);
while (reader.MoveToNextAttribute()) writer.WriteAttributeString(reader.Name, reader.Value);
if (empty) writer.WriteEndElement();
break;
case XmlNodeType.EndElement:
writer.WriteEndElement();
break;
case XmlNodeType.Text:
writer.WriteString(reader.Value);
break;
case XmlNodeType.CDATA:
writer.WriteCData(reader.Value);
break;
}
}
if (m_IfStack.Count != 0) throw new WarningException("Mismatched 'if', 'endif' pair");
}
return xmlText.ToString();
}
#endregion
}

View file

@ -0,0 +1,971 @@
#region BSD License
/*
Copyright (c) 2004 - 2008
Matthew Holmes (matthew@wildfiregames.com),
Dan Moorehead (dan05a@gmail.com),
Dave Hudson (jendave@yahoo.com),
C.J. Adams-Collier (cjac@colliertech.org),
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
#region MIT X11 license
/*
Portions of this file authored by Lluis Sanchez Gual
Copyright (C) 2006 Novell, Inc (http://www.novell.com)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Xsl;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Parse;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets;
public enum ClrVersion
{
Default,
Net_1_1,
Net_2_0
}
public class SystemPackage
{
public string Name { get; private set; }
public string Version { get; private set; }
public string Description { get; private set; }
public ClrVersion TargetVersion { get; private set; }
// The package is part of the mono SDK
public bool IsCorePackage => Name == "mono";
// The package has been registered by an add-in, and is not installed
// in the system.
public bool IsInternalPackage { get; private set; }
public string[] Assemblies { get; private set; }
public void Initialize(string name,
string version,
string description,
string[] assemblies,
ClrVersion targetVersion,
bool isInternal)
{
IsInternalPackage = isInternal;
Name = name;
Version = version;
Assemblies = assemblies;
Description = description;
TargetVersion = targetVersion;
}
}
/// <summary>
/// </summary>
[Target("autotools")]
public class AutotoolsTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
private XmlDocument autotoolsDoc;
private XmlUrlResolver xr;
private readonly Dictionary<string, SystemPackage> assemblyPathToPackage = new();
private readonly Dictionary<string, string> assemblyFullNameToPath = new();
private readonly Dictionary<string, SystemPackage> packagesHash = new();
private readonly List<SystemPackage> packages = new();
#endregion
#region Private Methods
private static void mkdirDashP(string dirName)
{
var di = new DirectoryInfo(dirName);
if (di.Exists)
return;
var parentDirName = Path.GetDirectoryName(dirName);
var parentDi = new DirectoryInfo(parentDirName);
if (!parentDi.Exists)
mkdirDashP(parentDirName);
di.Create();
}
private static void chkMkDir(string dirName)
{
var di =
new DirectoryInfo(dirName);
if (!di.Exists)
di.Create();
}
private void transformToFile(string filename, XsltArgumentList argList, string nodeName)
{
// Create an XslTransform for this file
var templateTransformer = new XslTransform();
// Load up the template
var templateNode = autotoolsDoc.SelectSingleNode(nodeName + "/*");
//templateTransformer.Load(templateNode.CreateNavigator(), xr, e);
templateTransformer.Load(templateNode.CreateNavigator(), xr);
// Create a writer for the transformed template
var templateWriter = new XmlTextWriter(filename, null);
// Perform transformation, writing the file
templateTransformer.Transform(m_Kernel.CurrentDoc, argList, templateWriter, xr);
}
private static string NormalizeAsmName(string name)
{
var i = name.IndexOf(", PublicKeyToken=null");
if (i != -1)
return name.Substring(0, i).Trim();
return name;
}
private void AddAssembly(string assemblyfile, SystemPackage package)
{
if (!File.Exists(assemblyfile))
return;
try
{
var an = AssemblyName.GetAssemblyName(assemblyfile);
assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile;
assemblyPathToPackage[assemblyfile] = package;
}
catch
{
}
}
private static List<string> GetAssembliesWithLibInfo(string line, string file)
{
var references = new List<string>();
var libdirs = new List<string>();
var retval = new List<string>();
foreach (var piece in line.Split(' '))
if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
references.Add(ProcessPiece(piece.Substring(3).Trim(), file));
else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:"))
libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file));
foreach (var refrnc in references)
foreach (var libdir in libdirs)
if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc))
retval.Add(libdir + Path.DirectorySeparatorChar + refrnc);
return retval;
}
private static List<string> GetAssembliesWithoutLibInfo(string line, string file)
{
var references = new List<string>();
foreach (var reference in line.Split(' '))
if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
{
var final_ref = reference.Substring(3).Trim();
references.Add(ProcessPiece(final_ref, file));
}
return references;
}
private static string ProcessPiece(string piece, string pcfile)
{
var start = piece.IndexOf("${");
if (start == -1)
return piece;
var end = piece.IndexOf("}");
if (end == -1)
return piece;
var variable = piece.Substring(start + 2, end - start - 2);
var interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile));
return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
}
private static string GetVariableFromPkgConfig(string var, string pcfile)
{
var psi = new ProcessStartInfo("pkg-config");
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
psi.Arguments = string.Format("--variable={0} {1}", var, pcfile);
var p = new Process();
p.StartInfo = psi;
p.Start();
var ret = p.StandardOutput.ReadToEnd().Trim();
p.WaitForExit();
if (string.IsNullOrEmpty(ret))
return string.Empty;
return ret;
}
private void ParsePCFile(string pcfile)
{
// Don't register the package twice
var pname = Path.GetFileNameWithoutExtension(pcfile);
if (packagesHash.ContainsKey(pname))
return;
List<string> fullassemblies = null;
var version = "";
var desc = "";
var package = new SystemPackage();
using (var reader = new StreamReader(pcfile))
{
string line;
while ((line = reader.ReadLine()) != null)
{
var lowerLine = line.ToLower();
if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1)
{
var choppedLine = line.Substring(5).Trim();
if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1)
fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile);
else
fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile);
}
else if (lowerLine.StartsWith("version:"))
{
// "version:".Length == 8
version = line.Substring(8).Trim();
}
else if (lowerLine.StartsWith("description:"))
{
// "description:".Length == 12
desc = line.Substring(12).Trim();
}
}
}
if (fullassemblies == null)
return;
foreach (var assembly in fullassemblies) AddAssembly(assembly, package);
package.Initialize(pname,
version,
desc,
fullassemblies.ToArray(),
ClrVersion.Default,
false);
packages.Add(package);
packagesHash[pname] = package;
}
private void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
{
var package = new SystemPackage();
var list = new List<string>();
var dir = Path.Combine(prefix, version);
if (!Directory.Exists(dir)) return;
foreach (var assembly in Directory.GetFiles(dir, "*.dll"))
{
AddAssembly(assembly, package);
list.Add(assembly);
}
package.Initialize("mono",
version,
"The Mono runtime",
list.ToArray(),
ver,
false);
packages.Add(package);
}
private void RunInitialization()
{
string versionDir;
if (Environment.Version.Major == 1)
versionDir = "1.0";
else
versionDir = "2.0";
//Pull up assemblies from the installed mono system.
var prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);
if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
prefix = Path.Combine(prefix, "mono");
else
prefix = Path.GetDirectoryName(prefix);
RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);
var search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
var libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");
if (string.IsNullOrEmpty(libpath))
{
var path_dirs = Environment.GetEnvironmentVariable("PATH");
foreach (var pathdir in path_dirs.Split(Path.PathSeparator))
{
if (pathdir == null)
continue;
if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
{
libpath = Path.Combine(pathdir, "..");
libpath = Path.Combine(libpath, "lib");
libpath = Path.Combine(libpath, "pkgconfig");
break;
}
}
}
search_dirs += Path.PathSeparator + libpath;
if (!string.IsNullOrEmpty(search_dirs))
{
var scanDirs = new List<string>();
foreach (var potentialDir in search_dirs.Split(Path.PathSeparator))
if (!scanDirs.Contains(potentialDir))
scanDirs.Add(potentialDir);
foreach (var pcdir in scanDirs)
{
if (pcdir == null)
continue;
if (Directory.Exists(pcdir))
foreach (var pcfile in Directory.GetFiles(pcdir, "*.pc"))
ParsePCFile(pcfile);
}
}
}
private void WriteCombine(SolutionNode solution)
{
#region "Create Solution directory if it doesn't exist"
var solutionDir = Path.Combine(solution.FullPath,
Path.Combine("autotools",
solution.Name));
chkMkDir(solutionDir);
#endregion
#region "Write Solution-level files"
var argList = new XsltArgumentList();
argList.AddParam("solutionName", "", solution.Name);
// $solutionDir is $rootDir/$solutionName/
transformToFile(Path.Combine(solutionDir, "configure.ac"),
argList, "/Autotools/SolutionConfigureAc");
transformToFile(Path.Combine(solutionDir, "Makefile.am"),
argList, "/Autotools/SolutionMakefileAm");
transformToFile(Path.Combine(solutionDir, "autogen.sh"),
argList, "/Autotools/SolutionAutogenSh");
#endregion
foreach (var project in solution.ProjectsTableOrder)
{
m_Kernel.Log.Write(string.Format("Writing project: {0}",
project.Name));
WriteProject(solution, project);
}
}
private static string FindFileReference(string refName,
ProjectNode project)
{
foreach (var refPath in project.ReferencePaths)
{
var fullPath =
Helper.MakeFilePath(refPath.Path, refName, "dll");
if (File.Exists(fullPath)) return fullPath;
}
return null;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if (conf == null) throw new ArgumentNullException("conf");
if (project == null) throw new ArgumentNullException("project");
var docFile = (string)conf.Options["XmlDocFile"];
// if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
// {
// return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
// }
return docFile;
}
/// <summary>
/// Normalizes the path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns></returns>
public static string NormalizePath(string path)
{
if (path == null) return "";
StringBuilder tmpPath;
if (Preprocessor.GetOS() == "Win32")
{
tmpPath = new StringBuilder(path.Replace('\\', '/'));
tmpPath.Replace("/", @"\\");
}
else
{
tmpPath = new StringBuilder(path.Replace('\\', '/'));
tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
}
return tmpPath.ToString();
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
var solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name));
var projectDir = Path.Combine(solutionDir, project.Name);
var projectVersion = project.Version;
var hasAssemblyConfig = false;
chkMkDir(projectDir);
List<string>
compiledFiles = new(),
contentFiles = new(),
embeddedFiles = new(),
binaryLibs = new(),
pkgLibs = new(),
systemLibs = new(),
runtimeLibs = new(),
extraDistFiles = new(),
localCopyTargets = new();
// If there exists a .config file for this assembly, copy
// it to the project folder
// TODO: Support copying .config.osx files
// TODO: support processing the .config file for native library deps
var projectAssemblyName = project.Name;
if (project.AssemblyName != null)
projectAssemblyName = project.AssemblyName;
if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config"))
{
hasAssemblyConfig = true;
File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"),
Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true);
extraDistFiles.Add(project.AssemblyName + ".dll.config");
}
foreach (var conf in project.Configurations)
if (conf.Options.KeyFile != string.Empty)
{
// Copy snk file into the project's directory
// Use the snk from the project directory directly
var source = Path.Combine(project.FullPath, conf.Options.KeyFile);
var keyFile = conf.Options.KeyFile;
var re = new Regex(".*/");
keyFile = re.Replace(keyFile, "");
var dest = Path.Combine(projectDir, keyFile);
// Tell the user if there's a problem copying the file
try
{
mkdirDashP(Path.GetDirectoryName(dest));
File.Copy(source, dest, true);
}
catch (IOException e)
{
Console.WriteLine(e.Message);
}
}
// Copy compiled, embedded and content files into the project's directory
foreach (var filename in project.Files)
{
var source = Path.Combine(project.FullPath, filename);
var dest = Path.Combine(projectDir, filename);
/*
if (filename.Contains("AssemblyInfo.cs"))
{
// If we've got an AssemblyInfo.cs, pull the version number from it
string[] sources = { source };
string[] args = { "" };
Microsoft.CSharp.CSharpCodeProvider cscp =
new Microsoft.CSharp.CSharpCodeProvider();
string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
System.CodeDom.Compiler.CompilerParameters cparam =
new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
System.CodeDom.Compiler.CompilerResults cr =
cscp.CompileAssemblyFromFile(cparam, sources);
foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
Console.WriteLine("Error! '{0}'", error.ErrorText);
try
{
string projectFullName = cr.CompiledAssembly.FullName;
Regex verRegex = new Regex("Version=([\\d\\.]+)");
Match verMatch = verRegex.Match(projectFullName);
if (verMatch.Success)
projectVersion = verMatch.Groups[1].Value;
}
catch
{
Console.WriteLine("Couldn't compile AssemblyInfo.cs");
}
// Clean up the temp file
try
{
if (File.Exists(tempAssemblyFile))
File.Delete(tempAssemblyFile);
}
catch
{
Console.WriteLine("Error! '{0}'", e);
}
}
*/
// Tell the user if there's a problem copying the file
try
{
mkdirDashP(Path.GetDirectoryName(dest));
File.Copy(source, dest, true);
}
catch (IOException e)
{
Console.WriteLine(e.Message);
}
switch (project.Files.GetBuildAction(filename))
{
case BuildAction.Compile:
compiledFiles.Add(filename);
break;
case BuildAction.Content:
contentFiles.Add(filename);
extraDistFiles.Add(filename);
break;
case BuildAction.EmbeddedResource:
embeddedFiles.Add(filename);
break;
}
}
// Set up references
for (var refNum = 0; refNum < project.References.Count; refNum++)
{
var refr = project.References[refNum];
var refAssembly = Assembly.Load(refr.Name);
/* Determine which pkg-config (.pc) file refers to
this assembly */
SystemPackage package = null;
if (packagesHash.ContainsKey(refr.Name))
{
package = packagesHash[refr.Name];
}
else
{
var assemblyFullName = string.Empty;
if (refAssembly != null)
assemblyFullName = refAssembly.FullName;
var assemblyFileName = string.Empty;
if (assemblyFullName != string.Empty &&
assemblyFullNameToPath.ContainsKey(assemblyFullName)
)
assemblyFileName =
assemblyFullNameToPath[assemblyFullName];
if (assemblyFileName != string.Empty &&
assemblyPathToPackage.ContainsKey(assemblyFileName)
)
package = assemblyPathToPackage[assemblyFileName];
}
/* If we know the .pc file and it is not "mono"
(already in the path), add a -pkg: argument */
if (package != null &&
package.Name != "mono" &&
!pkgLibs.Contains(package.Name)
)
pkgLibs.Add(package.Name);
var fileRef =
FindFileReference(refr.Name, (ProjectNode)refr.Parent);
if (refr.LocalCopy ||
solution.ProjectsTable.ContainsKey(refr.Name) ||
fileRef != null ||
refr.Path != null
)
{
/* Attempt to copy the referenced lib to the
project's directory */
var filename = refr.Name + ".dll";
var source = filename;
if (refr.Path != null)
source = Path.Combine(refr.Path, source);
source = Path.Combine(project.FullPath, source);
var dest = Path.Combine(projectDir, filename);
/* Since we depend on this binary dll to build, we
* will add a compile- time dependency on the
* copied dll, and add the dll to the list of
* files distributed with this package
*/
binaryLibs.Add(refr.Name + ".dll");
extraDistFiles.Add(refr.Name + ".dll");
// TODO: Support copying .config.osx files
// TODO: Support for determining native dependencies
if (File.Exists(source + ".config"))
{
File.Copy(source + ".config", Path.GetDirectoryName(dest), true);
extraDistFiles.Add(refr.Name + ".dll.config");
}
try
{
File.Copy(source, dest, true);
}
catch (IOException)
{
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
/* If an assembly is referenced, marked for
* local copy, in the list of projects for
* this solution, but does not exist, put a
* target into the Makefile.am to build the
* assembly and copy it to this project's
* directory
*/
var sourcePrj =
solution.ProjectsTable[refr.Name];
var target =
string.Format("{0}:\n" +
"\t$(MAKE) -C ../{1}\n" +
"\tln ../{2}/$@ $@\n",
filename,
sourcePrj.Name,
sourcePrj.Name);
localCopyTargets.Add(target);
}
}
}
else if (!pkgLibs.Contains(refr.Name))
{
// Else, let's assume it's in the GAC or the lib path
var assemName = string.Empty;
var index = refr.Name.IndexOf(",");
if (index > 0)
assemName = refr.Name.Substring(0, index);
else
assemName = refr.Name;
m_Kernel.Log.Write(string.Format(
"Warning: Couldn't find an appropriate assembly " +
"for reference:\n'{0}'", refr.Name
));
systemLibs.Add(assemName);
}
}
const string lineSep = " \\\n\t";
var compiledFilesString = string.Empty;
if (compiledFiles.Count > 0)
compiledFilesString =
lineSep + string.Join(lineSep, compiledFiles.ToArray());
var embeddedFilesString = "";
if (embeddedFiles.Count > 0)
embeddedFilesString =
lineSep + string.Join(lineSep, embeddedFiles.ToArray());
var contentFilesString = "";
if (contentFiles.Count > 0)
contentFilesString =
lineSep + string.Join(lineSep, contentFiles.ToArray());
var extraDistFilesString = "";
if (extraDistFiles.Count > 0)
extraDistFilesString =
lineSep + string.Join(lineSep, extraDistFiles.ToArray());
var pkgLibsString = "";
if (pkgLibs.Count > 0)
pkgLibsString =
lineSep + string.Join(lineSep, pkgLibs.ToArray());
var binaryLibsString = "";
if (binaryLibs.Count > 0)
binaryLibsString =
lineSep + string.Join(lineSep, binaryLibs.ToArray());
var systemLibsString = "";
if (systemLibs.Count > 0)
systemLibsString =
lineSep + string.Join(lineSep, systemLibs.ToArray());
var localCopyTargetsString = "";
if (localCopyTargets.Count > 0)
localCopyTargetsString =
string.Join("\n", localCopyTargets.ToArray());
var monoPath = "";
foreach (var runtimeLib in runtimeLibs) monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`";
// Add the project name to the list of transformation
// parameters
var argList = new XsltArgumentList();
argList.AddParam("projectName", "", project.Name);
argList.AddParam("solutionName", "", solution.Name);
argList.AddParam("assemblyName", "", projectAssemblyName);
argList.AddParam("compiledFiles", "", compiledFilesString);
argList.AddParam("embeddedFiles", "", embeddedFilesString);
argList.AddParam("contentFiles", "", contentFilesString);
argList.AddParam("extraDistFiles", "", extraDistFilesString);
argList.AddParam("pkgLibs", "", pkgLibsString);
argList.AddParam("binaryLibs", "", binaryLibsString);
argList.AddParam("systemLibs", "", systemLibsString);
argList.AddParam("monoPath", "", monoPath);
argList.AddParam("localCopyTargets", "", localCopyTargetsString);
argList.AddParam("projectVersion", "", projectVersion);
argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : "");
// Transform the templates
transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc");
transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm");
transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh");
if (project.Type == ProjectType.Library)
transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn");
if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe)
transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList,
"/Autotools/ProjectWrapperScriptIn");
}
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
var projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
Helper.DeleteIfExists(projectFile);
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
var slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
Helper.DeleteIfExists(slnFile);
slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
Helper.DeleteIfExists(slnFile);
slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
Helper.DeleteIfExists(slnFile);
slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
Helper.DeleteIfExists(slnFile);
slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
Helper.DeleteIfExists(slnFile);
foreach (var project in solution.Projects) CleanProject(project);
m_Kernel.Log.Write("");
}
#endregion
#region ITarget Members
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
m_Kernel.Log.Write("Parsing system pkg-config files");
RunInitialization();
const string streamName = "autotools.xml";
var fqStreamName = string.Format("Prebuild.data.{0}", streamName);
// Retrieve stream for the autotools template XML
var autotoolsStream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(fqStreamName);
if (autotoolsStream == null)
{
/*
* try without the default namespace prepended, in
* case prebuild.exe assembly was compiled with
* something other than Visual Studio .NET
*/
autotoolsStream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(streamName);
if (autotoolsStream == null)
{
var errStr =
string.Format("Could not find embedded resource file:\n" +
"'{0}' or '{1}'", streamName, fqStreamName);
m_Kernel.Log.Write(errStr);
throw new TargetException(errStr);
}
}
// Create an XML URL Resolver with default credentials
xr = new XmlUrlResolver();
xr.Credentials = CredentialCache.DefaultCredentials;
// Load the autotools XML
autotoolsDoc = new XmlDocument();
autotoolsDoc.Load(autotoolsStream);
/* rootDir is the filesystem location where the Autotools
* build tree will be created - for now we'll make it
* $PWD/autotools
*/
var pwd = Directory.GetCurrentDirectory();
//string pwd = System.Environment.GetEnvironmentVariable("PWD");
//if (pwd.Length != 0)
//{
var rootDir = Path.Combine(pwd, "autotools");
//}
//else
//{
// pwd = Assembly.GetExecutingAssembly()
//}
chkMkDir(rootDir);
foreach (var solution in kern.Solutions)
{
m_Kernel.Log.Write(string.Format("Writing solution: {0}",
solution.Name));
WriteCombine(solution);
}
m_Kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var sol in kern.Solutions) CleanSolution(sol);
m_Kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name => "autotools";
#endregion
}

View file

@ -0,0 +1,100 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-09-20 03:42:51 -0400 (Wed, 20 Sep 2006) $
* $Revision: 164 $
*/
#endregion
#if (DEBUG && _DEBUG_TARGET)
namespace Prebuild.Core.Targets
{
[Target("debug")]
public class DebugTarget : ITarget
{
#region Fields
private Kernel m_Kernel = null;
#endregion
#region ITarget Members
public void Write()
{
foreach(SolutionNode s in m_Kernel.Solutions)
{
Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path);
foreach(string file in s.Files)
{
Console.WriteLine("\tFile [ {0} ]", file);
}
foreach(ProjectNode proj in s.Projects)
{
Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language);
foreach(string file in proj.Files)
Console.WriteLine("\t\tFile [ {0} ]", file);
}
}
}
public void Clean()
{
Console.WriteLine("Not implemented");
}
public string Name
{
get
{
return "debug";
}
}
public Kernel Kernel
{
get
{
return m_Kernel;
}
set
{
m_Kernel = value;
}
}
#endregion
}
}
#endif

View file

@ -0,0 +1,450 @@
#region BSD License
/*
Copyright (c) 2004 Crestez Leonard (cleonard@go.ro)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System.IO;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets;
[Target("makefile")]
public class MakefileTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
#endregion
#region Private Methods
// This converts a path relative to the path of a project to
// a path relative to the solution path.
private string NicePath(ProjectNode proj, string path)
{
string res;
var solution = (SolutionNode)proj.Parent;
res = Path.Combine(Helper.NormalizePath(proj.FullPath, '/'), Helper.NormalizePath(path, '/'));
res = Helper.NormalizePath(res, '/');
res = res.Replace("/./", "/");
while (res.IndexOf("/../") >= 0)
{
var a = res.IndexOf("/../");
var b = res.LastIndexOf("/", a - 1);
res = res.Remove(b, a - b + 3);
}
res = Helper.MakePathRelativeTo(solution.FullPath, res);
if (res.StartsWith("./"))
res = res.Substring(2, res.Length - 2);
res = Helper.NormalizePath(res, '/');
return res;
}
private void WriteProjectFiles(StreamWriter f, SolutionNode solution, ProjectNode project)
{
// Write list of source code files
f.WriteLine("SOURCES_{0} = \\", project.Name);
foreach (var file in project.Files)
if (project.Files.GetBuildAction(file) == BuildAction.Compile)
f.WriteLine("\t{0} \\", NicePath(project, file));
f.WriteLine();
// Write list of resource files
f.WriteLine("RESOURCES_{0} = \\", project.Name);
foreach (var file in project.Files)
if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource)
{
var path = NicePath(project, file);
f.WriteLine("\t-resource:{0},{1} \\", path, Path.GetFileName(path));
}
f.WriteLine();
// There's also Content and None in BuildAction.
// What am I supposed to do with that?
}
private string FindFileReference(string refName, ProjectNode project)
{
foreach (var refPath in project.ReferencePaths)
{
var fullPath = NicePath(project, Helper.MakeFilePath(refPath.Path, refName, "dll"));
if (File.Exists(fullPath))
return fullPath;
}
return null;
}
private void WriteProjectReferences(StreamWriter f, SolutionNode solution, ProjectNode project)
{
f.WriteLine("REFERENCES_{0} = \\", project.Name);
foreach (var refr in project.References)
{
string path;
// Project references change with configurations.
if (solution.ProjectsTable.ContainsKey(refr.Name))
continue;
path = FindFileReference(refr.Name, project);
if (path != null)
f.WriteLine("\t-r:{0} \\", path);
else
f.WriteLine("\t-r:{0} \\", refr.Name);
}
f.WriteLine();
}
private void WriteProjectDependencies(StreamWriter f, SolutionNode solution, ProjectNode project)
{
f.WriteLine("DEPENDENCIES_{0} = \\", project.Name);
f.WriteLine("\t$(SOURCES_{0}) \\", project.Name);
foreach (var file in project.Files)
if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource)
f.WriteLine("\t{0} \\", NicePath(project, file));
f.WriteLine();
}
private string ProjectTypeToExtension(ProjectType t)
{
if (t == ProjectType.Exe || t == ProjectType.WinExe)
return "exe";
if (t == ProjectType.Library)
return "dll";
throw new FatalException("Bad ProjectType: {0}", t);
}
private string ProjectTypeToTarget(ProjectType t)
{
if (t == ProjectType.Exe)
return "exe";
if (t == ProjectType.WinExe)
return "winexe";
if (t == ProjectType.Library)
return "library";
throw new FatalException("Bad ProjectType: {0}", t);
}
private string ProjectOutput(ProjectNode project, ConfigurationNode config)
{
string filepath;
filepath = Helper.MakeFilePath((string)config.Options["OutputPath"],
project.AssemblyName, ProjectTypeToExtension(project.Type));
return NicePath(project, filepath);
}
// Returns true if two configs in one project have the same output.
private bool ProjectClashes(ProjectNode project)
{
foreach (var conf1 in project.Configurations)
foreach (var conf2 in project.Configurations)
if (ProjectOutput(project, conf1) == ProjectOutput(project, conf2) && conf1 != conf2)
{
m_Kernel.Log.Write("Warning: Configurations {0} and {1} for project {2} output the same file",
conf1.Name, conf2.Name, project.Name);
m_Kernel.Log.Write("Warning: I'm going to use some timestamps(extra empty files).");
return true;
}
return false;
}
private void WriteProject(StreamWriter f, SolutionNode solution, ProjectNode project)
{
f.WriteLine("# This is for project {0}", project.Name);
f.WriteLine();
WriteProjectFiles(f, solution, project);
WriteProjectReferences(f, solution, project);
WriteProjectDependencies(f, solution, project);
var clash = ProjectClashes(project);
foreach (var conf in project.Configurations)
{
var outpath = ProjectOutput(project, conf);
var filesToClean = outpath;
if (clash)
{
f.WriteLine("{0}-{1}: .{0}-{1}-timestamp", project.Name, conf.Name);
f.WriteLine();
f.Write(".{0}-{1}-timestamp: $(DEPENDENCIES_{0})", project.Name, conf.Name);
}
else
{
f.WriteLine("{0}-{1}: {2}", project.Name, conf.Name, outpath);
f.WriteLine();
f.Write("{2}: $(DEPENDENCIES_{0})", project.Name, conf.Name, outpath);
}
// Dependencies on other projects.
foreach (var refr in project.References)
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
var refProj = solution.ProjectsTable[refr.Name];
if (ProjectClashes(refProj))
f.Write(" .{0}-{1}-timestamp", refProj.Name, conf.Name);
else
f.Write(" {0}", ProjectOutput(refProj, conf));
}
f.WriteLine();
// make directory for output.
if (Path.GetDirectoryName(outpath) != "") f.WriteLine("\tmkdir -p {0}", Path.GetDirectoryName(outpath));
// mcs command line.
f.Write("\tgmcs", project.Name);
f.Write(" -warn:{0}", conf.Options["WarningLevel"]);
if ((bool)conf.Options["DebugInformation"])
f.Write(" -debug");
if ((bool)conf.Options["AllowUnsafe"])
f.Write(" -unsafe");
if ((bool)conf.Options["CheckUnderflowOverflow"])
f.Write(" -checked");
if (project.StartupObject != "")
f.Write(" -main:{0}", project.StartupObject);
if ((string)conf.Options["CompilerDefines"] != "")
f.Write(" -define:\"{0}\"", conf.Options["CompilerDefines"]);
f.Write(" -target:{0} -out:{1}", ProjectTypeToTarget(project.Type), outpath);
// Build references to other projects. Now that sux.
// We have to reference the other project in the same conf.
foreach (var refr in project.References)
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ProjectNode refProj;
refProj = solution.ProjectsTable[refr.Name];
f.Write(" -r:{0}", ProjectOutput(refProj, conf));
}
f.Write(" $(REFERENCES_{0})", project.Name);
f.Write(" $(RESOURCES_{0})", project.Name);
f.Write(" $(SOURCES_{0})", project.Name);
f.WriteLine();
// Copy references with localcopy.
foreach (var refr in project.References)
if (refr.LocalCopy)
{
string outPath, srcPath, destPath;
outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]);
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ProjectNode refProj;
refProj = solution.ProjectsTable[refr.Name];
srcPath = ProjectOutput(refProj, conf);
destPath = Path.Combine(outPath, Path.GetFileName(srcPath));
destPath = NicePath(project, destPath);
if (srcPath != destPath)
{
f.WriteLine("\tcp -f {0} {1}", srcPath, destPath);
filesToClean += " " + destPath;
}
continue;
}
srcPath = FindFileReference(refr.Name, project);
if (srcPath != null)
{
destPath = Path.Combine(outPath, Path.GetFileName(srcPath));
destPath = NicePath(project, destPath);
f.WriteLine("\tcp -f {0} {1}", srcPath, destPath);
filesToClean += " " + destPath;
}
}
if (clash)
{
filesToClean += string.Format(" .{0}-{1}-timestamp", project.Name, conf.Name);
f.WriteLine("\ttouch .{0}-{1}-timestamp", project.Name, conf.Name);
f.Write("\trm -rf");
foreach (var otherConf in project.Configurations)
if (otherConf != conf)
f.WriteLine(" .{0}-{1}-timestamp", project.Name, otherConf.Name);
f.WriteLine();
}
f.WriteLine();
f.WriteLine("{0}-{1}-clean:", project.Name, conf.Name);
f.WriteLine("\trm -rf {0}", filesToClean);
f.WriteLine();
}
}
private void WriteIntro(StreamWriter f, SolutionNode solution)
{
f.WriteLine("# Makefile for {0} generated by Prebuild ( http://dnpb.sf.net )", solution.Name);
f.WriteLine("# Do not edit.");
f.WriteLine("#");
f.Write("# Configurations:");
foreach (var conf in solution.Configurations)
f.Write(" {0}", conf.Name);
f.WriteLine();
f.WriteLine("# Projects:");
foreach (var proj in solution.Projects)
f.WriteLine("#\t{0}", proj.Name);
f.WriteLine("#");
f.WriteLine("# Building:");
f.WriteLine("#\t\"make\" to build everything under the default(first) configuration");
f.WriteLine("#\t\"make CONF\" to build every project under configuration CONF");
f.WriteLine("#\t\"make PROJ\" to build project PROJ under the default(first) configuration");
f.WriteLine("#\t\"make PROJ-CONF\" to build project PROJ under configuration CONF");
f.WriteLine("#");
f.WriteLine("# Cleaning (removing results of build):");
f.WriteLine("#\t\"make clean\" to clean everything, that's what you probably want");
f.WriteLine("#\t\"make CONF\" to clean everything for a configuration");
f.WriteLine("#\t\"make PROJ\" to clean everything for a project");
f.WriteLine("#\t\"make PROJ-CONF\" to clea project PROJ under configuration CONF");
f.WriteLine();
}
private void WritePhony(StreamWriter f, SolutionNode solution)
{
var defconf = "";
foreach (var conf in solution.Configurations)
{
defconf = conf.Name;
break;
}
f.Write(".PHONY: all");
foreach (var proj in solution.Projects)
f.Write(" {0} {0}-clean", proj.Name);
foreach (var conf in solution.Configurations)
f.Write(" {0} {0}-clean", conf.Name);
foreach (var proj in solution.Projects)
foreach (var conf in solution.Configurations)
f.Write(" {0}-{1} {0}-{1}-clean", proj.Name, conf.Name);
f.WriteLine();
f.WriteLine();
f.WriteLine("all: {0}", defconf);
f.WriteLine();
f.Write("clean:");
foreach (var conf in solution.Configurations)
f.Write(" {0}-clean", conf.Name);
f.WriteLine();
f.WriteLine();
foreach (var conf in solution.Configurations)
{
f.Write("{0}: ", conf.Name);
foreach (var proj in solution.Projects)
f.Write(" {0}-{1}", proj.Name, conf.Name);
f.WriteLine();
f.WriteLine();
f.Write("{0}-clean: ", conf.Name);
foreach (var proj in solution.Projects)
f.Write(" {0}-{1}-clean", proj.Name, conf.Name);
f.WriteLine();
f.WriteLine();
}
foreach (var proj in solution.Projects)
{
f.WriteLine("{0}: {0}-{1}", proj.Name, defconf);
f.WriteLine();
f.Write("{0}-clean:", proj.Name);
foreach (var conf in proj.Configurations)
f.Write(" {0}-{1}-clean", proj.Name, conf.Name);
f.WriteLine();
f.WriteLine();
}
}
private void WriteSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Creating makefile for {0}", solution.Name);
m_Kernel.CurrentWorkingDirectory.Push();
var file = "Makefile"; // Helper.MakeFilePath(solution.FullPath, solution.Name, "make");
var f = new StreamWriter(file);
Helper.SetCurrentDir(Path.GetDirectoryName(file));
using (f)
{
WriteIntro(f, solution);
WritePhony(f, solution);
foreach (var project in solution.Projects)
{
m_Kernel.Log.Write("...Creating Project: {0}", project.Name);
WriteProject(f, solution, project);
}
}
m_Kernel.Log.Write("");
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning makefile for {0}", solution.Name);
var file = Helper.MakeFilePath(solution.FullPath, solution.Name, "make");
Helper.DeleteIfExists(file);
m_Kernel.Log.Write("");
}
#endregion
#region ITarget Members
public void Write(Kernel kern)
{
m_Kernel = kern;
foreach (var solution in kern.Solutions)
WriteSolution(solution);
m_Kernel = null;
}
public virtual void Clean(Kernel kern)
{
m_Kernel = kern;
foreach (var sol in kern.Solutions)
CleanSolution(sol);
m_Kernel = null;
}
public string Name => "makefile";
#endregion
}

View file

@ -0,0 +1,463 @@
#region BSD License
/*
Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("monodev")]
public class MonoDevelopTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
#endregion
#region Private Methods
private static string PrependPath(string path)
{
var tmpPath = Helper.NormalizePath(path, '/');
var regex = new Regex(@"(\w):/(\w+)");
var match = regex.Match(tmpPath);
if (match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
tmpPath = Helper.NormalizePath(tmpPath);
else
tmpPath = Helper.NormalizePath("./" + tmpPath);
return tmpPath;
}
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
{
var ret = "<ProjectReference type=\"";
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ret += "Project\"";
ret += " localcopy=\"" + refr.LocalCopy + "\" refto=\"" + refr.Name + "\" />";
}
else
{
var project = (ProjectNode)refr.Parent;
var fileRef = FindFileReference(refr.Name, project);
if (refr.Path != null || fileRef != null)
{
ret += "Assembly\" refto=\"";
var finalPath = refr.Path != null ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
ret += finalPath;
ret += "\" localcopy=\"" + refr.LocalCopy + "\" />";
return ret;
}
ret += "Gac\"";
ret += " localcopy=\"" + refr.LocalCopy + "\"";
ret += " refto=\"";
try
{
/*
Day changed to 28 Mar 2007
...
08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ?
08:09 < jonp> no
08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the
ability to load any assembly version by-name was an inherently
bad idea
08:11 < cj> I'm thinking of a bunch of four-letter words right now...
08:11 < cj> security through making it difficult for the developer!!!
08:12 < jonp> just use the Obsolete API
08:12 < jonp> it should still work
08:12 < cj> alrighty.
08:12 < jonp> you just get warnings when using it
*/
var assem = Assembly.Load(refr.Name);
ret += assem.FullName;
//ret += refr.Name;
}
catch (NullReferenceException e)
{
e.ToString();
ret += refr.Name;
}
ret += "\" />";
}
return ret;
}
private static string FindFileReference(string refName, ProjectNode project)
{
foreach (var refPath in project.ReferencePaths)
{
var fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
if (File.Exists(fullPath)) return fullPath;
}
return null;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if (conf == null) throw new ArgumentNullException("conf");
if (project == null) throw new ArgumentNullException("project");
var docFile = (string)conf.Options["XmlDocFile"];
if (docFile != null && docFile.Length == 0) //default to assembly name if not specified
return "False";
return "True";
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
var csComp = "Mcs";
var netRuntime = "Mono";
if (project.Runtime == ClrRuntime.Microsoft)
{
csComp = "Csc";
netRuntime = "MsNet";
}
var projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
var ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
using (ss)
{
ss.WriteLine(
"<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">",
project.Name,
project.RootNamespace
);
var count = 0;
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
foreach (var conf in project.Configurations)
{
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name);
ss.Write(" <Output");
ss.Write(" directory=\"{0}\"",
Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"])));
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
//ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
//ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
ss.Write(" executeBeforeBuild=\"{0}\"",
Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
else
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
ss.Write(" executeAfterBuild=\"{0}\"",
Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
else
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.WriteLine(" />");
ss.Write(" <Build");
ss.Write(" debugmode=\"True\"");
if (project.Type == ProjectType.WinExe)
ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString());
else
ss.Write(" target=\"{0}\"", project.Type);
ss.WriteLine(" />");
ss.Write(" <Execution");
ss.Write(" runwithwarnings=\"{0}\"", !conf.Options.WarningsAsErrors);
ss.Write(" consolepause=\"True\"");
ss.Write(" runtime=\"{0}\"", netRuntime);
ss.Write(" clr-version=\"Net_2_0\"");
ss.WriteLine(" />");
ss.Write(" <CodeGeneration");
ss.Write(" compiler=\"{0}\"", csComp);
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
ss.Write(" target=\"{0}\"", project.Type);
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
ss.Write(" win32Icon=\"{0}\"", project.AppIcon);
ss.Write(" ctype=\"CSharpCompilerParameters\"");
ss.WriteLine(" />");
ss.WriteLine(" </Configuration>");
count++;
}
ss.WriteLine(" </Configurations>");
ss.Write(" <DeploymentInformation");
ss.Write(" target=\"\"");
ss.Write(" script=\"\"");
ss.Write(" strategy=\"File\"");
ss.WriteLine(">");
ss.WriteLine(" <excludeFiles />");
ss.WriteLine(" </DeploymentInformation>");
ss.WriteLine(" <Contents>");
foreach (var file in project.Files)
{
string buildAction;
var dependson = "";
var resource_id = "";
var copyToOutput = "";
switch (project.Files.GetBuildAction(file))
{
case BuildAction.None:
buildAction = "Nothing";
break;
case BuildAction.Content:
buildAction = "Exclude";
break;
case BuildAction.EmbeddedResource:
buildAction = "EmbedAsResource";
break;
default:
buildAction = "Compile";
break;
}
if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
buildAction = "FileCopy";
// Sort of a hack, we try and resolve the path and make it relative, if we can.
var extension = Path.GetExtension(file);
var designer_format = string.Format(".Designer{0}", extension);
if (file.EndsWith(designer_format))
{
var basename = file.Substring(0, file.LastIndexOf(designer_format));
string[] extensions = { ".cs", ".resx", ".settings" };
foreach (var ext in extensions)
if (project.Files.Contains(basename + ext))
{
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext);
break;
}
}
if (extension == ".resx")
{
buildAction = "EmbedAsResource";
var basename = file.Substring(0, file.LastIndexOf(".resx"));
// Visual Studio type resx + form dependency
if (project.Files.Contains(basename + ".cs"))
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs");
// We need to specify a resources file name to avoid MissingManifestResourceExceptions
// in libraries that are built.
resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"",
project.AssemblyName, basename.Replace("/", "."));
}
switch (project.Files.GetCopyToOutput(file))
{
case CopyToOutput.Always:
copyToOutput = " copyToOutputDirectory=\"Always\"";
break;
case CopyToOutput.PreserveNewest:
copyToOutput = " copyToOutputDirectory=\"PreserveNewest\"";
break;
}
// Sort of a hack, we try and resolve the path and make it relative, if we can.
var filePath = PrependPath(file);
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\"{2}{3}{4} />",
filePath, buildAction, dependson, resource_id, copyToOutput);
}
ss.WriteLine(" </Contents>");
ss.WriteLine(" <References>");
foreach (var refr in project.References) ss.WriteLine(" {0}", BuildReference(solution, refr));
ss.WriteLine(" </References>");
ss.WriteLine("</Project>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void WriteCombine(SolutionNode solution)
{
m_Kernel.Log.Write("Creating MonoDevelop combine and project files");
foreach (var project in solution.Projects)
if (m_Kernel.AllowProject(project.FilterGroups))
{
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
WriteProject(solution, project);
}
m_Kernel.Log.Write("");
var combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
var ss = new StreamWriter(combFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
var count = 0;
using (ss)
{
ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name);
count = 0;
foreach (var conf in solution.Configurations)
{
if (count == 0) ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name);
foreach (var project in solution.Projects)
ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name,
conf.Name);
ss.WriteLine(" </Configuration>");
count++;
}
ss.WriteLine(" </Configurations>");
count = 0;
foreach (var project in solution.Projects)
{
if (count == 0)
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name);
count++;
}
ss.WriteLine(" </StartMode>");
ss.WriteLine(" <Entries>");
foreach (var project in solution.Projects)
{
var path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.WriteLine(" <Entry filename=\"{0}\" />",
Helper.MakeFilePath(path, project.Name, "mdp"));
}
ss.WriteLine(" </Entries>");
ss.WriteLine("</Combine>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
var projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
Helper.DeleteIfExists(projectFile);
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name);
var slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
Helper.DeleteIfExists(slnFile);
foreach (var project in solution.Projects) CleanProject(project);
m_Kernel.Log.Write("");
}
#endregion
#region ITarget Members
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var solution in kern.Solutions) WriteCombine(solution);
m_Kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var sol in kern.Solutions) CleanSolution(sol);
m_Kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name => "sharpdev";
#endregion
}

View file

@ -0,0 +1,715 @@
#region BSD License
/*
Copyright (c) 2004 - 2008
Matthew Holmes (matthew@wildfiregames.com),
Dan Moorehead (dan05a@gmail.com),
C.J. Adams-Collier (cjac@colliertech.org),
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("nant")]
public class NAntTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
#endregion
#region Private Methods
private static string PrependPath(string path)
{
var tmpPath = Helper.NormalizePath(path, '/');
var regex = new Regex(@"(\w):/(\w+)");
var match = regex.Match(tmpPath);
//if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
//{
tmpPath = Helper.NormalizePath(tmpPath);
//}
// else
// {
// tmpPath = Helper.NormalizePath("./" + tmpPath);
// }
return tmpPath;
}
private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
{
if (!string.IsNullOrEmpty(refr.Path)) return refr.Path;
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
var projectRef = solution.ProjectsTable[refr.Name];
var finalPath =
Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/');
return finalPath;
}
var project = (ProjectNode)refr.Parent;
// Do we have an explicit file reference?
var fileRef = FindFileReference(refr.Name, project);
if (fileRef != null) return fileRef;
// Is there an explicit path in the project ref?
if (refr.Path != null)
return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/');
// No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
return refr.Name + ".dll";
}
public static string GetRefFileName(string refName)
{
if (ExtensionSpecified(refName))
return refName;
return refName + ".dll";
}
private static bool ExtensionSpecified(string refName)
{
return refName.EndsWith(".dll") || refName.EndsWith(".exe");
}
private static string GetProjectExtension(ProjectNode project)
{
var extension = ".dll";
if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe) extension = ".exe";
return extension;
}
private static string FindFileReference(string refName, ProjectNode project)
{
foreach (var refPath in project.ReferencePaths)
{
var fullPath = Helper.MakeFilePath(refPath.Path, refName);
if (File.Exists(fullPath)) return fullPath;
fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
if (File.Exists(fullPath)) return fullPath;
fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe");
if (File.Exists(fullPath)) return fullPath;
}
return null;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if (conf == null) throw new ArgumentNullException("conf");
if (project == null) throw new ArgumentNullException("project");
var docFile = (string)conf.Options["XmlDocFile"];
// if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
// {
// return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
// }
return docFile;
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
var projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
var ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
var hasDoc = false;
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
ss.WriteLine(" <target name=\"{0}\">", "build");
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
foreach (var refr in project.References)
if (refr.LocalCopy)
ss.WriteLine(" <include name=\"{0}",
Helper.NormalizePath(
Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) +
"\" />", '/'));
ss.WriteLine(" </fileset>");
ss.WriteLine(" </copy>");
if (project.ConfigFile != null && project.ConfigFile.Length != 0)
{
ss.Write(" <copy file=\"" + project.ConfigFile +
"\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
ss.Write(".dll.config\"");
else
ss.Write(".exe.config\"");
ss.WriteLine(" />");
}
// Add the content files to just be copied
ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
ss.WriteLine(" {0}", "<fileset basedir=\".\">");
foreach (var file in project.Files)
{
// Ignore if we aren't content
if (project.Files.GetBuildAction(file) != BuildAction.Content)
continue;
// Create a include tag
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
}
ss.WriteLine(" {0}", "</fileset>");
ss.WriteLine(" {0}", "</copy>");
ss.Write(" <csc ");
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
ss.Write(" debug=\"{0}\"", "${build.debug}");
ss.Write(" platform=\"${build.platform}\"");
foreach (var conf in project.Configurations)
if (conf.Options.KeyFile != "")
{
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
break;
}
foreach (var conf in project.Configurations)
{
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
break;
}
foreach (var conf in project.Configurations)
{
ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
break;
}
foreach (var conf in project.Configurations)
{
ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
break;
}
foreach (var conf in project.Configurations)
{
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
break;
}
ss.Write(" main=\"{0}\"", project.StartupObject);
foreach (var conf in project.Configurations)
{
if (GetXmlDocFile(project, conf) != "")
{
ss.Write(" doc=\"{0}\"",
"${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
hasDoc = true;
}
break;
}
ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
ss.Write(".dll\"");
else
ss.Write(".exe\"");
if (project.AppIcon != null && project.AppIcon.Length != 0)
ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
// This disables a very different behavior between VS and NAnt. With Nant,
// If you have using System.Xml; it will ensure System.Xml.dll is referenced,
// but not in VS. This will force the behaviors to match, so when it works
// in nant, it will work in VS.
ss.Write(" noconfig=\"true\"");
ss.WriteLine(">");
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
foreach (var file in project.Files)
switch (project.Files.GetBuildAction(file))
{
case BuildAction.EmbeddedResource:
ss.WriteLine(" {0}",
"<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
if (project.Files.GetSubType(file) != SubType.Code &&
project.Files.GetSubType(file) != SubType.Settings)
ss.WriteLine(" <include name=\"{0}\" />",
file.Substring(0, file.LastIndexOf('.')) + ".resx");
break;
}
//if (project.Files.GetSubType(file).ToString() != "Code")
//{
// ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ss.WriteLine(" </resources>");
ss.WriteLine(" <sources failonempty=\"true\">");
foreach (var file in project.Files)
switch (project.Files.GetBuildAction(file))
{
case BuildAction.Compile:
ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
}
ss.WriteLine(" </sources>");
ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <lib>");
ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
foreach (var refPath in project.ReferencePaths)
ss.WriteLine(" <include name=\"${project::get-base-directory()}/" +
refPath.Path.TrimEnd('/', '\\') + "\" />");
ss.WriteLine(" </lib>");
foreach (var refr in project.References)
{
var path = Helper.NormalizePath(
Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
if (refr.Path != null)
{
if (ExtensionSpecified(refr.Name))
ss.WriteLine(" <include name=\"" + path + refr.Name + "\"/>");
else
ss.WriteLine(" <include name=\"" + path + refr.Name + ".dll\"/>");
}
else
{
ss.WriteLine(" <include name=\"" + path + "\" />");
}
}
ss.WriteLine(" </references>");
ss.WriteLine(" </csc>");
foreach (var conf in project.Configurations)
if (!string.IsNullOrEmpty(conf.Options.OutputPath))
{
var targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/');
ss.WriteLine(
" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" +
targetDir + "\" />");
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>");
ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">");
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >");
ss.WriteLine(" <include name=\"*.dll\"/>");
ss.WriteLine(" <include name=\"*.exe\"/>");
ss.WriteLine(" <include name=\"*.mdb\" if='${build.debug}'/>");
ss.WriteLine(" <include name=\"*.pdb\" if='${build.debug}'/>");
ss.WriteLine(" </fileset>");
ss.WriteLine(" </copy>");
break;
}
ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"clean\">");
ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
if (hasDoc)
{
ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
ss.WriteLine(" </if>");
ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
ss.WriteLine(".dll\" />");
else
ss.WriteLine(".exe\" />");
ss.WriteLine(" </assemblies>");
ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
ss.WriteLine(" </summaries>");
ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}\" />");
// foreach(ReferenceNode refr in project.References)
// {
// string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
// if (path != "")
// {
// ss.WriteLine(" <include name=\"{0}\" />", path);
// }
// }
ss.WriteLine(" </referencepaths>");
ss.WriteLine(" <documenters>");
ss.WriteLine(" <documenter name=\"MSDN\">");
ss.WriteLine(
" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
ss.WriteLine(" </documenter>");
ss.WriteLine(" </documenters>");
ss.WriteLine(" </ndoc>");
}
ss.WriteLine(" </target>");
ss.WriteLine("</project>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void WriteCombine(SolutionNode solution)
{
m_Kernel.Log.Write("Creating NAnt build files");
foreach (var project in solution.Projects)
if (m_Kernel.AllowProject(project.FilterGroups))
{
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
WriteProject(solution, project);
}
m_Kernel.Log.Write("");
var combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
var ss = new StreamWriter(combFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
ss.WriteLine();
//ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
//ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
// Use the active configuration, which is the first configuration name in the prebuild file.
var emittedConfigurations = new Dictionary<string, string>();
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
ss.WriteLine();
foreach (var conf in solution.Configurations)
{
// If the name isn't in the emitted configurations, we give a high level target to the
// platform specific on. This lets "Debug" point to "Debug-AnyCPU".
if (!emittedConfigurations.ContainsKey(conf.Name))
{
// Add it to the dictionary so we only emit one.
emittedConfigurations.Add(conf.Name, conf.Platform);
// Write out the target block.
ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name,
conf.Platform);
ss.WriteLine(" </target>");
ss.WriteLine();
}
// Write out the target for the configuration.
ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform);
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />",
conf.Options["DebugInformation"].ToString().ToLower());
ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform);
ss.WriteLine(" </target>");
ss.WriteLine();
}
ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"init\" description=\"\">");
ss.WriteLine(" <call target=\"${project.config}\" />");
ss.WriteLine(" <property name=\"sys.os.platform\"");
ss.WriteLine(" value=\"${platform::get-name()}\"");
ss.WriteLine(" />");
ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />");
ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
// sdague - ok, this is an ugly hack, but what it lets
// us do is native include of files into the nant
// created files from all .nant/*include files. This
// lets us keep using prebuild, but allows for
// extended nant targets to do build and the like.
try
{
var re = new Regex(".include$");
var nantdir = new DirectoryInfo(".nant");
foreach (var item in nantdir.GetFileSystemInfos())
if (item is DirectoryInfo)
{
}
else if (item is FileInfo)
{
if (re.Match(item.FullName) !=
Match.Empty)
{
Console.WriteLine("Including file: " + item.FullName);
using (var fs = new FileStream(item.FullName,
FileMode.Open,
FileAccess.Read,
FileShare.None))
{
using (var sr = new StreamReader(fs))
{
ss.WriteLine("<!-- included from {0} -->", item.FullName);
while (sr.Peek() != -1) ss.WriteLine(sr.ReadLine());
ss.WriteLine();
}
}
}
}
}
catch
{
}
// ss.WriteLine(" <include buildfile=\".nant/local.include\" />");
// ss.WriteLine(" <target name=\"zip\" description=\"\">");
// ss.WriteLine(" <zip zipfile=\"{0}-{1}.zip\">", solution.Name, solution.Version);
// ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
// ss.WriteLine(" <include name=\"${project::get-base-directory()}/**/*.cs\" />");
// // ss.WriteLine(" <include name=\"${project.main.dir}/**/*\" />");
// ss.WriteLine(" </fileset>");
// ss.WriteLine(" </zip>");
// ss.WriteLine(" <echo message=\"Building zip target\" />");
// ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"clean\" description=\"\">");
ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />");
//ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />");
if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0)
foreach (var cleanFile in solution.Cleanup.CleanFiles)
{
ss.WriteLine(" <delete failonerror=\"false\">");
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"{0}/*\"/>", cleanFile.Pattern);
ss.WriteLine(" <include name=\"{0}\"/>", cleanFile.Pattern);
ss.WriteLine(" </fileset>");
ss.WriteLine(" </delete>");
}
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
foreach (var project in solution.Projects)
{
var path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.Write(" <nant buildfile=\"{0}\"",
Helper.NormalizePath(
Helper.MakeFilePath(path, project.Name + GetProjectExtension(project), "build"), '/'));
ss.WriteLine(" target=\"clean\" />");
}
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">");
foreach (var project in solution.ProjectsTableOrder)
{
var path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.Write(" <nant buildfile=\"{0}\"",
Helper.NormalizePath(
Helper.MakeFilePath(path, project.Name + GetProjectExtension(project), "build"), '/'));
ss.WriteLine(" target=\"build\" />");
}
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(
" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />");
ss.WriteLine();
ss.WriteLine(
" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />");
ss.WriteLine();
//ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />");
ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />");
ss.WriteLine();
ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">");
ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />");
foreach (var project in solution.Projects)
{
var path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.Write(" <nant buildfile=\"{0}\"",
Helper.NormalizePath(
Helper.MakeFilePath(path, project.Name + GetProjectExtension(project), "build"), '/'));
ss.WriteLine(" target=\"doc\" />");
}
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine("</project>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
var projectFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
Helper.DeleteIfExists(projectFile);
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name);
var slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
Helper.DeleteIfExists(slnFile);
foreach (var project in solution.Projects) CleanProject(project);
m_Kernel.Log.Write("");
}
#endregion
#region ITarget Members
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var solution in kern.Solutions) WriteCombine(solution);
m_Kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var sol in kern.Solutions) CleanSolution(sol);
m_Kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name => "nant";
#endregion
}

View file

@ -0,0 +1,70 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using Prebuild.Core.Attributes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("sharpdev2")]
public class SharpDevelop2Target : VS2005Target
{
#region Properties
public override string VersionName => "SharpDevelop2";
#endregion
#region Public Methods
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Write(Kernel kern)
{
base.Write(kern);
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Clean(Kernel kern)
{
base.Clean(kern);
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name => "sharpdev2";
#endregion
}

View file

@ -0,0 +1,380 @@
#region BSD License
/*
Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.IO;
using System.Text.RegularExpressions;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("sharpdev")]
public class SharpDevelopTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
#endregion
#region Private Methods
private static string PrependPath(string path)
{
var tmpPath = Helper.NormalizePath(path, '/');
var regex = new Regex(@"(\w):/(\w+)");
var match = regex.Match(tmpPath);
if (match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
tmpPath = Helper.NormalizePath(tmpPath);
else
tmpPath = Helper.NormalizePath("./" + tmpPath);
return tmpPath;
}
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
{
var ret = "<Reference type=\"";
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ret += "Project\" refto=\"" + refr.Name;
ret += "\" localcopy=\"" + refr.LocalCopy + "\" />";
}
else
{
var project = (ProjectNode)refr.Parent;
var fileRef = FindFileReference(refr.Name, project);
if (refr.Path != null || fileRef != null)
{
ret += "Assembly\" refto=\"";
var finalPath = refr.Path != null ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
ret += finalPath;
ret += "\" localcopy=\"" + refr.LocalCopy + "\" />";
return ret;
}
ret += "Gac\" refto=\"";
try
{
//Assembly assem = Assembly.Load(refr.Name);
ret += refr.Name; // assem.FullName;
}
catch (NullReferenceException e)
{
e.ToString();
ret += refr.Name;
}
ret += "\" localcopy=\"" + refr.LocalCopy + "\" />";
}
return ret;
}
private static string FindFileReference(string refName, ProjectNode project)
{
foreach (var refPath in project.ReferencePaths)
{
var fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
if (File.Exists(fullPath)) return fullPath;
}
return null;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if (conf == null) throw new ArgumentNullException("conf");
if (project == null) throw new ArgumentNullException("project");
var docFile = (string)conf.Options["XmlDocFile"];
if (docFile != null && docFile.Length == 0) //default to assembly name if not specified
return "False";
return "True";
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
var csComp = "Csc";
var netRuntime = "MsNet";
if (project.Runtime == ClrRuntime.Mono)
{
csComp = "Mcs";
netRuntime = "Mono";
}
var projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
var ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
using (ss)
{
ss.WriteLine(
"<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">",
project.Name,
project.RootNamespace
);
ss.WriteLine(" <Contents>");
foreach (var file in project.Files)
{
var buildAction = "Compile";
switch (project.Files.GetBuildAction(file))
{
case BuildAction.None:
buildAction = "Nothing";
break;
case BuildAction.Content:
buildAction = "Exclude";
break;
case BuildAction.EmbeddedResource:
buildAction = "EmbedAsResource";
break;
default:
buildAction = "Compile";
break;
}
// Sort of a hack, we try and resolve the path and make it relative, if we can.
var filePath = PrependPath(file);
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />",
filePath, buildAction);
}
ss.WriteLine(" </Contents>");
ss.WriteLine(" <References>");
foreach (var refr in project.References) ss.WriteLine(" {0}", BuildReference(solution, refr));
ss.WriteLine(" </References>");
ss.Write(" <DeploymentInformation");
ss.Write(" target=\"\"");
ss.Write(" script=\"\"");
ss.Write(" strategy=\"File\"");
ss.WriteLine(" />");
var count = 0;
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
foreach (var conf in project.Configurations)
{
ss.Write(" <Configuration");
ss.Write(" runwithwarnings=\"True\"");
ss.Write(" name=\"{0}\"", conf.Name);
ss.WriteLine(">");
ss.Write(" <CodeGeneration");
ss.Write(" runtime=\"{0}\"", netRuntime);
ss.Write(" compiler=\"{0}\"", csComp);
ss.Write(" compilerversion=\"\"");
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
ss.Write(" target=\"{0}\"", project.Type);
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon));
ss.Write(" noconfig=\"{0}\"", "False");
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
ss.WriteLine(" />");
ss.Write(" <Execution");
ss.Write(" commandlineparameters=\"\"");
ss.Write(" consolepause=\"True\"");
ss.WriteLine(" />");
ss.Write(" <Output");
ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString()));
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
ss.Write(" executeBeforeBuild=\"{0}\"",
Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
else
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
ss.Write(" executeAfterBuild=\"{0}\"",
Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
else
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.WriteLine(" />");
ss.WriteLine(" </Configuration>");
count++;
}
ss.WriteLine(" </Configurations>");
ss.WriteLine("</Project>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void WriteCombine(SolutionNode solution)
{
m_Kernel.Log.Write("Creating SharpDevelop combine and project files");
foreach (var project in solution.Projects)
if (m_Kernel.AllowProject(project.FilterGroups))
{
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
WriteProject(solution, project);
}
m_Kernel.Log.Write("");
var combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
var ss = new StreamWriter(combFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
using (ss)
{
ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name);
var count = 0;
foreach (var project in solution.Projects)
{
if (count == 0)
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name);
count++;
}
ss.WriteLine(" </StartMode>");
ss.WriteLine(" <Entries>");
foreach (var project in solution.Projects)
{
var path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.WriteLine(" <Entry filename=\"{0}\" />",
Helper.MakeFilePath(path, project.Name, "prjx"));
}
ss.WriteLine(" </Entries>");
count = 0;
foreach (var conf in solution.Configurations)
{
if (count == 0) ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name);
foreach (var project in solution.Projects)
ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name,
conf.Name);
ss.WriteLine(" </Configuration>");
count++;
}
ss.WriteLine(" </Configurations>");
ss.WriteLine("</Combine>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
var projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
Helper.DeleteIfExists(projectFile);
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name);
var slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
Helper.DeleteIfExists(slnFile);
foreach (var project in solution.Projects) CleanProject(project);
m_Kernel.Log.Write("");
}
#endregion
#region ITarget Members
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var solution in kern.Solutions) WriteCombine(solution);
m_Kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var sol in kern.Solutions) CleanSolution(sol);
m_Kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name => "sharpdev";
#endregion
}

View file

@ -0,0 +1,137 @@
using System;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
public struct ToolInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the GUID.
/// </summary>
/// <value>The GUID.</value>
public string Guid { get; set; }
/// <summary>
/// Gets or sets the file extension.
/// </summary>
/// <value>The file extension.</value>
public string FileExtension { get; set; }
public string LanguageExtension
{
get
{
switch (Name)
{
case "C#":
return ".cs";
case "VisualBasic":
return ".vb";
case "Boo":
return ".boo";
default:
return ".cs";
}
}
}
/// <summary>
/// Gets or sets the XML tag.
/// </summary>
/// <value>The XML tag.</value>
public string XmlTag { get; set; }
/// <summary>
/// Gets or sets the import project property.
/// </summary>
/// <value>The ImportProject tag.</value>
public string ImportProject { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo" /> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
/// <param name="importProject">The import project.</param>
public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
{
this.Name = name;
this.Guid = guid;
this.FileExtension = fileExtension;
XmlTag = xml;
this.ImportProject = importProject;
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo" /> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
public ToolInfo(string name, string guid, string fileExtension, string xml)
{
this.Name = name;
this.Guid = guid;
this.FileExtension = fileExtension;
XmlTag = xml;
ImportProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="obj">ToolInfo to compare</param>
/// <returns>true if toolInfos are equal</returns>
public override bool Equals(object obj)
{
if (obj == null) throw new ArgumentNullException("obj");
if (obj.GetType() != typeof(ToolInfo))
return false;
var c = (ToolInfo)obj;
return Name == c.Name && Guid == c.Guid && FileExtension == c.FileExtension && ImportProject == c.ImportProject;
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are equal</returns>
public static bool operator ==(ToolInfo c1, ToolInfo c2)
{
return c1.Name == c2.Name && c1.Guid == c2.Guid && c1.FileExtension == c2.FileExtension &&
c1.ImportProject == c2.ImportProject && c1.XmlTag == c2.XmlTag;
}
/// <summary>
/// Not equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are not equal</returns>
public static bool operator !=(ToolInfo c1, ToolInfo c2)
{
return !(c1 == c2);
}
/// <summary>
/// Hash Code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
return Name.GetHashCode() ^ Guid.GetHashCode() ^ FileExtension.GetHashCode() ^ ImportProject.GetHashCode() ^
XmlTag.GetHashCode();
}
}

View file

@ -0,0 +1,79 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using Prebuild.Core.Attributes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2002")]
public class VS2002Target : VS2003Target
{
#region Private Methods
private void SetVS2002()
{
SolutionVersion = "7.00";
ProductVersion = "7.0.9254";
SchemaVersion = "1.0";
VersionName = "2002";
Version = VSVersion.VS70;
}
#endregion
#region Public Methods
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Write(Kernel kern)
{
SetVS2002();
base.Write(kern);
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Clean(Kernel kern)
{
SetVS2002();
base.Clean(kern);
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name => "vs2002";
#endregion
}

View file

@ -0,0 +1,485 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets;
[Target("vs2003")]
public class VS2003Target : ITarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2003Target" /> class.
/// </summary>
public VS2003Target()
{
m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP");
m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic");
}
#endregion
#region Fields
private readonly Dictionary<string, ToolInfo> m_Tools = new();
private Kernel m_Kernel;
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
protected string SolutionVersion { get; set; } = "8.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
protected string ProductVersion { get; set; } = "7.10.3077";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
protected string SchemaVersion { get; set; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
protected string VersionName { get; set; } = "2003";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
protected VSVersion Version { get; set; } = VSVersion.VS71;
#endregion
#region Private Methods
private string MakeRefPath(ProjectNode project)
{
var ret = "";
foreach (var node in project.ReferencePaths)
try
{
var fullPath = Helper.ResolvePath(node.Path);
if (ret.Length < 1)
ret = fullPath;
else
ret += ";" + fullPath;
}
catch (ArgumentException)
{
m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
}
return ret;
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
if (!m_Tools.ContainsKey(project.Language))
throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
var toolInfo = m_Tools[project.Language];
var projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
var ps = new StreamWriter(projectFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
using (ps)
{
ps.WriteLine("<VisualStudioProject>");
ps.WriteLine(" <{0}", toolInfo.XmlTag);
ps.WriteLine("\t\t\t\tProjectType = \"Local\"");
ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", ProductVersion);
ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", SchemaVersion);
ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper());
ps.WriteLine("\t\t>");
ps.WriteLine("\t\t\t\t<Build>");
ps.WriteLine(" <Settings");
ps.WriteLine("\t\t\t\t ApplicationIcon = \"{0}\"", project.AppIcon);
ps.WriteLine("\t\t\t\t AssemblyKeyContainerName = \"\"");
ps.WriteLine("\t\t\t\t AssemblyName = \"{0}\"", project.AssemblyName);
ps.WriteLine("\t\t\t\t AssemblyOriginatorKeyFile = \"\"");
ps.WriteLine("\t\t\t\t DefaultClientScript = \"JScript\"");
ps.WriteLine("\t\t\t\t DefaultHTMLPageLayout = \"Grid\"");
ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\"");
ps.WriteLine("\t\t\t\t DelaySign = \"false\"");
if (Version == VSVersion.VS70) ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\"");
ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type);
foreach (var conf in project.Configurations)
{
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"",
Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
else
ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", conf.Options["PreBuildEvent"]);
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"",
Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
else
ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", conf.Options["PostBuildEvent"]);
if (conf.Options["RunPostBuildEvent"] == null)
ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", "OnBuildSuccess");
else
ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", conf.Options["RunPostBuildEvent"]);
break;
}
ps.WriteLine("\t\t\t\t RootNamespace = \"{0}\"", project.RootNamespace);
ps.WriteLine("\t\t\t\t StartupObject = \"{0}\"", project.StartupObject);
ps.WriteLine("\t\t >");
foreach (var conf in project.Configurations)
{
ps.WriteLine("\t\t\t\t <Config");
ps.WriteLine("\t\t\t\t Name = \"{0}\"", conf.Name);
ps.WriteLine("\t\t\t\t AllowUnsafeBlocks = \"{0}\"",
conf.Options["AllowUnsafe"].ToString().ToLower());
ps.WriteLine("\t\t\t\t BaseAddress = \"{0}\"", conf.Options["BaseAddress"]);
ps.WriteLine("\t\t\t\t CheckForOverflowUnderflow = \"{0}\"",
conf.Options["CheckUnderflowOverflow"].ToString().ToLower());
ps.WriteLine("\t\t\t\t ConfigurationOverrideFile = \"\"");
ps.WriteLine("\t\t\t\t DefineConstants = \"{0}\"", conf.Options["CompilerDefines"]);
ps.WriteLine("\t\t\t\t DocumentationFile = \"{0}\"",
GetXmlDocFile(project, conf)); //default to the assembly name
ps.WriteLine("\t\t\t\t DebugSymbols = \"{0}\"",
conf.Options["DebugInformation"].ToString().ToLower());
ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]);
ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"",
conf.Options["IncrementalBuild"].ToString().ToLower());
if (Version == VSVersion.VS71)
{
ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower());
ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"",
conf.Options["SuppressWarnings"].ToString().ToLower());
}
ps.WriteLine("\t\t\t\t Optimize = \"{0}\"", conf.Options["OptimizeCode"].ToString().ToLower());
ps.WriteLine(" OutputPath = \"{0}\"",
Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
ps.WriteLine(" RegisterForComInterop = \"{0}\"",
conf.Options["RegisterComInterop"].ToString().ToLower());
ps.WriteLine(" RemoveIntegerChecks = \"{0}\"",
conf.Options["RemoveIntegerChecks"].ToString().ToLower());
ps.WriteLine(" TreatWarningsAsErrors = \"{0}\"",
conf.Options["WarningsAsErrors"].ToString().ToLower());
ps.WriteLine(" WarningLevel = \"{0}\"", conf.Options["WarningLevel"]);
ps.WriteLine(" />");
}
ps.WriteLine(" </Settings>");
ps.WriteLine(" <References>");
foreach (var refr in project.References)
{
ps.WriteLine(" <Reference");
ps.WriteLine(" Name = \"{0}\"", refr.Name);
ps.WriteLine(" AssemblyName = \"{0}\"", refr.Name);
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
var refProject = solution.ProjectsTable[refr.Name];
ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper());
ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToUpper());
}
else
{
if (refr.Path != null)
ps.WriteLine(" HintPath = \"{0}\"",
Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
}
if (refr.LocalCopySpecified) ps.WriteLine(" Private = \"{0}\"", refr.LocalCopy);
ps.WriteLine(" />");
}
ps.WriteLine(" </References>");
ps.WriteLine(" </Build>");
ps.WriteLine(" <Files>");
ps.WriteLine(" <Include>");
foreach (var file in project.Files)
{
var fileName = file.Replace(".\\", "");
ps.WriteLine(" <File");
ps.WriteLine(" RelPath = \"{0}\"", fileName);
ps.WriteLine(" SubType = \"{0}\"", project.Files.GetSubType(file));
ps.WriteLine(" BuildAction = \"{0}\"", project.Files.GetBuildAction(file));
ps.WriteLine(" />");
if (project.Files.GetSubType(file) != SubType.Code &&
project.Files.GetSubType(file) != SubType.Settings)
{
ps.WriteLine(" <File");
ps.WriteLine(" RelPath = \"{0}\"",
fileName.Substring(0, fileName.LastIndexOf('.')) + ".resx");
var slash = fileName.LastIndexOf('\\');
if (slash == -1)
ps.WriteLine(" DependentUpon = \"{0}\"", fileName);
else
ps.WriteLine(" DependentUpon = \"{0}\"",
fileName.Substring(slash + 1, fileName.Length - slash - 1));
ps.WriteLine(" BuildAction = \"{0}\"", "EmbeddedResource");
ps.WriteLine(" />");
}
}
ps.WriteLine(" </Include>");
ps.WriteLine(" </Files>");
ps.WriteLine(" </{0}>", toolInfo.XmlTag);
ps.WriteLine("</VisualStudioProject>");
}
ps = new StreamWriter(projectFile + ".user");
using (ps)
{
ps.WriteLine("<VisualStudioProject>");
ps.WriteLine(" <{0}>", toolInfo.XmlTag);
ps.WriteLine(" <Build>");
ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
foreach (var conf in project.Configurations)
{
ps.WriteLine(" <Config");
ps.WriteLine(" Name = \"{0}\"", conf.Name);
ps.WriteLine(" />");
}
ps.WriteLine(" </Settings>");
ps.WriteLine(" </Build>");
ps.WriteLine(" </{0}>", toolInfo.XmlTag);
ps.WriteLine("</VisualStudioProject>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if (conf == null) throw new ArgumentNullException("conf");
if (project == null) throw new ArgumentNullException("project");
// if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false
// {
// return string.Empty;
// }
//default to "AssemblyName.xml"
//string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
//return (string)conf.Options["XmlDocFile", defaultValue];
//default to no XmlDocFile file
return (string)conf.Options["XmlDocFile", ""];
}
private void WriteSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", VersionName);
foreach (var project in solution.Projects)
if (m_Kernel.AllowProject(project.FilterGroups))
{
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
WriteProject(solution, project);
}
m_Kernel.Log.Write("");
var solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
var ss = new StreamWriter(solutionFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
using (ss)
{
ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
foreach (var project in solution.Projects)
{
if (!m_Tools.ContainsKey(project.Language))
throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
var toolInfo = m_Tools[project.Language];
var path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
toolInfo.FileExtension), project.Guid.ToString().ToUpper());
ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject");
ss.WriteLine("\tEndProjectSection");
ss.WriteLine("EndProject");
}
ss.WriteLine("Global");
ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution");
foreach (var conf in solution.Configurations) ss.WriteLine("\t\t{0} = {0}", conf.Name);
ss.WriteLine("\tEndGlobalSection");
ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution");
foreach (var project in solution.Projects)
for (var i = 0; i < project.References.Count; i++)
{
var refr = project.References[i];
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
var refProject = solution.ProjectsTable[refr.Name];
ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})",
project.Guid.ToString().ToUpper()
, i,
refProject.Guid.ToString().ToUpper()
);
}
}
ss.WriteLine("\tEndGlobalSection");
ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution");
foreach (var project in solution.Projects)
foreach (var conf in solution.Configurations)
{
ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET",
project.Guid.ToString().ToUpper(),
conf.Name);
ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET",
project.Guid.ToString().ToUpper(),
conf.Name);
}
ss.WriteLine("\tEndGlobalSection");
if (solution.Files != null)
{
ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution");
foreach (var file in solution.Files) ss.WriteLine("\t\t{0} = {0}", file);
ss.WriteLine("\tEndGlobalSection");
}
ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution");
ss.WriteLine("\tEndGlobalSection");
ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution");
ss.WriteLine("\tEndGlobalSection");
ss.WriteLine("EndGlobal");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
var toolInfo = m_Tools[project.Language];
var projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
var userFile = projectFile + ".user";
Helper.DeleteIfExists(projectFile);
Helper.DeleteIfExists(userFile);
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", VersionName, solution.Name);
var slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
var suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
Helper.DeleteIfExists(slnFile);
Helper.DeleteIfExists(suoFile);
foreach (var project in solution.Projects) CleanProject(project);
m_Kernel.Log.Write("");
}
#endregion
#region ITarget Members
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Write(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var sol in m_Kernel.Solutions) WriteSolution(sol);
m_Kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var sol in m_Kernel.Solutions) CleanSolution(sol);
m_Kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public virtual string Name => "vs2003";
#endregion
}

View file

@ -0,0 +1,99 @@
#region BSD License
/*
Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2005")]
public class VS2005Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target" /> class.
/// </summary>
public VS2005Target()
{
}
#endregion
#region Inner Classes
#endregion
#region Fields
public override string SolutionTag => "# Visual Studio 2005";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
return string.Empty;
}
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "9.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "8.0.50727";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual C# 2005";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS80;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2005";
#endregion
}

View file

@ -0,0 +1,76 @@
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2008")]
public class VS2008Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target" /> class.
/// </summary>
public VS2008Target()
{
}
#endregion
#region Fields
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "10.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "9.0.21022";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual Studio 2008";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS90;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2008";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.v3_5:
return "ToolsVersion=\"3.5\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag => "# Visual Studio 2008";
#endregion
}

View file

@ -0,0 +1,83 @@
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2010")]
public class VS2010Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target" /> class.
/// </summary>
public VS2010Target()
{
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "11.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "9.0.30729";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual Studio 2010";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS10;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2010";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag => "# Visual Studio 2010";
#endregion
}

View file

@ -0,0 +1,89 @@
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2012")]
public class VS2012Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target" /> class.
/// </summary>
public VS2012Target()
{
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "12.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "11.0.61030.0";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual Studio 2012";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS11;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2012";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.v4_7_1:
case FrameworkVersion.v4_7:
case FrameworkVersion.v4_6_2:
case FrameworkVersion.v4_6_1:
case FrameworkVersion.v4_6:
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag => "# Visual Studio 2012";
#endregion
}

View file

@ -0,0 +1,87 @@
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2013")]
public class VS2013Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target" /> class.
/// </summary>
public VS2013Target()
{
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "12.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "12.0.31101";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual Studio 2013";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS12;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2013";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.v4_6_1:
case FrameworkVersion.v4_6:
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
return "ToolsVersion=\"12.0\"";
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag => "# Visual Studio 2013";
#endregion
}

View file

@ -0,0 +1,93 @@
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2015")]
public class VS2015Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2012Target" /> class.
/// </summary>
public VS2015Target()
{
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "12.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "14.0.23107.0";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual Studio 14";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS15;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2015";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.v4_8:
case FrameworkVersion.v4_7_2:
case FrameworkVersion.v4_7_1:
case FrameworkVersion.v4_7:
case FrameworkVersion.v4_6_2:
case FrameworkVersion.v4_6_1:
case FrameworkVersion.v4_6:
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_2:
return "ToolsVersion=\"12.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag => "# Visual Studio 14";
#endregion
}

View file

@ -0,0 +1,94 @@
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2017")]
public class VS2017Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2012Target" /> class.
/// </summary>
public VS2017Target()
{
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "12.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "15.9.50";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual Studio 17";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS17;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2017";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.v4_8:
case FrameworkVersion.v4_7_2:
case FrameworkVersion.v4_7_1:
case FrameworkVersion.v4_7:
return "ToolsVersion=\"15.0\"";
case FrameworkVersion.v4_6_2:
case FrameworkVersion.v4_6_1:
case FrameworkVersion.v4_6:
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_2:
return "ToolsVersion=\"12.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag => "# Visual Studio 17";
#endregion
}

View file

@ -0,0 +1,99 @@
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2019")]
public class VS2019Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2012Target" /> class.
/// </summary>
public VS2019Target()
{
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "12.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "16.7.3";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual Studio 19";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS19;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2019";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.netstandard2_0:
case FrameworkVersion.net5_0:
case FrameworkVersion.net6_0:
case FrameworkVersion.net7_0:
case FrameworkVersion.v4_8:
case FrameworkVersion.v4_7_2:
return "ToolsVersion=\"16.0\"";
case FrameworkVersion.v4_7_1:
case FrameworkVersion.v4_7:
return "ToolsVersion=\"15.0\"";
case FrameworkVersion.v4_6_2:
case FrameworkVersion.v4_6_1:
case FrameworkVersion.v4_6:
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_2:
return "ToolsVersion=\"12.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag => "# Visual Studio 19";
#endregion
}

View file

@ -0,0 +1,100 @@
using Prebuild.Core.Attributes;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("vs2022")]
public class VS2022Target : VSGenericTarget
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2012Target" /> class.
/// </summary>
public VS2022Target()
{
}
#endregion
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion { get; } = "12.00";
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion { get; } = "117.3.2";
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion { get; } = "2.0";
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName { get; } = "Visual Studio Version 17";
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version { get; } = VSVersion.VS22;
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name { get; } = "vs2022";
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.net5_0:
case FrameworkVersion.net6_0:
case FrameworkVersion.net7_0:
return "ToolsVersion=\"17.0\"";
case FrameworkVersion.netstandard2_0:
case FrameworkVersion.v4_8:
case FrameworkVersion.v4_7_2:
return "ToolsVersion=\"16.0\"";
case FrameworkVersion.v4_7_1:
case FrameworkVersion.v4_7:
return "ToolsVersion=\"15.0\"";
case FrameworkVersion.v4_6_2:
case FrameworkVersion.v4_6_1:
case FrameworkVersion.v4_6:
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_2:
return "ToolsVersion=\"12.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag => "# Visual Studio 22";
#endregion
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,76 @@
#region BSD License
/*
Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
public enum VSVersion
{
/// <summary>
/// Visual Studio 2002
/// </summary>
VS70,
/// <summary>
/// Visual Studio 2003
/// </summary>
VS71,
/// <summary>
/// Visual Studio 2005
/// </summary>
VS80,
/// <summary>
/// Visual Studio 2008
/// </summary>
VS90,
/// <summary>
/// Visual Studio 2010
/// </summary>
VS10,
/// <summary>
/// Visual Studio 2012
/// </summary>
VS11,
/// <summary>
/// Visual Studio 2013
/// </summary>
VS12,
/// <summary>
/// Visual Studio 2015
/// </summary>
VS15,
VS17,
VS19,
VS22
}

View file

@ -0,0 +1,565 @@
#region BSD License
/*
Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets;
/// <summary>
/// </summary>
[Target("xcode")]
public class XcodeTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
#endregion
#region Private Methods
private static string PrependPath(string path)
{
var tmpPath = Helper.NormalizePath(path, '/');
var regex = new Regex(@"(\w):/(\w+)");
var match = regex.Match(tmpPath);
//if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
//{
tmpPath = Helper.NormalizePath(tmpPath);
//}
// else
// {
// tmpPath = Helper.NormalizePath("./" + tmpPath);
// }
return tmpPath;
}
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
{
var ret = "";
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
var project = solution.ProjectsTable[refr.Name];
var fileRef = FindFileReference(refr.Name, project);
var finalPath =
Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/');
ret += finalPath;
return ret;
}
else
{
var project = (ProjectNode)refr.Parent;
var fileRef = FindFileReference(refr.Name, project);
if (refr.Path != null || fileRef != null)
{
var finalPath = refr.Path != null
? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/')
: fileRef;
ret += finalPath;
return ret;
}
try
{
//Assembly assem = Assembly.Load(refr.Name);
//if (assem != null)
//{
//ret += (refr.Name + ".dll");
//}
//else
//{
ret += refr.Name + ".dll";
//}
}
catch (NullReferenceException e)
{
e.ToString();
ret += refr.Name + ".dll";
}
}
return ret;
}
private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
{
var ret = "";
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
var project = solution.ProjectsTable[refr.Name];
var fileRef = FindFileReference(refr.Name, project);
var finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/');
ret += finalPath;
return ret;
}
else
{
var project = (ProjectNode)refr.Parent;
var fileRef = FindFileReference(refr.Name, project);
if (refr.Path != null || fileRef != null)
{
var finalPath = refr.Path != null ? Helper.NormalizePath(refr.Path, '/') : fileRef;
ret += finalPath;
return ret;
}
try
{
var assem = Assembly.Load(refr.Name);
if (assem != null)
ret += "";
else
ret += "";
}
catch (NullReferenceException e)
{
e.ToString();
ret += "";
}
}
return ret;
}
private static string FindFileReference(string refName, ProjectNode project)
{
foreach (var refPath in project.ReferencePaths)
{
var fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
if (File.Exists(fullPath)) return fullPath;
}
return null;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if (conf == null) throw new ArgumentNullException("conf");
if (project == null) throw new ArgumentNullException("project");
var docFile = (string)conf.Options["XmlDocFile"];
// if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
// {
// return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
// }
return docFile;
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
var projFile = Helper.MakeFilePath(project.FullPath,
project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
var ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
var hasDoc = false;
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
ss.WriteLine(" <target name=\"{0}\">", "build");
ss.WriteLine(
" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">");
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
foreach (var refr in project.References)
if (refr.LocalCopy)
ss.WriteLine(" <include name=\"{0}",
Helper.NormalizePath(
Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, refr)) + "\" />",
'/'));
ss.WriteLine(" </fileset>");
ss.WriteLine(" </copy>");
ss.Write(" <csc");
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
ss.Write(" debug=\"{0}\"", "${build.debug}");
foreach (var conf in project.Configurations)
if (conf.Options.KeyFile != "")
{
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
break;
}
foreach (var conf in project.Configurations)
{
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
break;
}
foreach (var conf in project.Configurations)
{
ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
break;
}
foreach (var conf in project.Configurations)
{
if (GetXmlDocFile(project, conf) != "")
{
ss.Write(" doc=\"{0}\"",
"${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
hasDoc = true;
}
break;
}
ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
ss.Write(".dll\"");
else
ss.Write(".exe\"");
if (project.AppIcon != null && project.AppIcon.Length != 0)
ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
ss.WriteLine(">");
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
foreach (var file in project.Files)
switch (project.Files.GetBuildAction(file))
{
case BuildAction.EmbeddedResource:
ss.WriteLine(" {0}",
"<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
if (project.Files.GetSubType(file) != SubType.Code &&
project.Files.GetSubType(file) != SubType.Settings)
ss.WriteLine(" <include name=\"{0}\" />",
file.Substring(0, file.LastIndexOf('.')) + ".resx");
break;
}
//if (project.Files.GetSubType(file).ToString() != "Code")
//{
// ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ss.WriteLine(" </resources>");
ss.WriteLine(" <sources failonempty=\"true\">");
foreach (var file in project.Files)
switch (project.Files.GetBuildAction(file))
{
case BuildAction.Compile:
ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') +
"\" />");
break;
}
ss.WriteLine(" </sources>");
ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <lib>");
ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" </lib>");
foreach (var refr in project.References)
ss.WriteLine(" <include name=\"{0}",
Helper.NormalizePath(
Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, refr)) + "\" />", '/'));
ss.WriteLine(" </references>");
ss.WriteLine(" </csc>");
ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"clean\">");
ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
if (hasDoc)
{
ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
ss.WriteLine(" </if>");
ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
ss.WriteLine(".dll\" />");
else
ss.WriteLine(".exe\" />");
ss.WriteLine(" </assemblies>");
ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
ss.WriteLine(" </summaries>");
ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}\" />");
//foreach(ReferenceNode refr in project.References)
//{
// string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
// if (path != "")
// {
// ss.WriteLine(" <include name=\"{0}\" />", path);
// }
//}
ss.WriteLine(" </referencepaths>");
ss.WriteLine(" <documenters>");
ss.WriteLine(" <documenter name=\"MSDN\">");
ss.WriteLine(
" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
ss.WriteLine(
" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
ss.WriteLine(
" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
ss.WriteLine(" </documenter>");
ss.WriteLine(" </documenters>");
ss.WriteLine(" </ndoc>");
}
ss.WriteLine(" </target>");
ss.WriteLine("</project>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void WriteCombine(SolutionNode solution)
{
m_Kernel.Log.Write("Creating Xcode build files");
foreach (var project in solution.Projects)
if (m_Kernel.AllowProject(project.FilterGroups))
{
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
WriteProject(solution, project);
}
m_Kernel.Log.Write("");
var directoryInfo = new DirectoryInfo(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"));
if (!directoryInfo.Exists) directoryInfo.Create();
var combFile = Helper.MakeFilePath(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"), "project",
"pbxproj");
var ss = new StreamWriter(combFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
ss.WriteLine();
//ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
//ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
foreach (var conf in solution.Configurations)
{
// Set the project.config to a non-debug configuration
if (conf.Options["DebugInformation"].ToString().ToLower() != "true")
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
ss.WriteLine();
ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name);
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />",
conf.Options["DebugInformation"].ToString().ToLower());
ss.WriteLine(" </target>");
ss.WriteLine();
}
ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"init\" description=\"\">");
ss.WriteLine(" <call target=\"${project.config}\" />");
ss.WriteLine(" <sysinfo />");
ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />");
ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"clean\" description=\"\">");
ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />");
//ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />");
ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
//foreach(ProjectNode project in solution.Projects)
//{
// string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
// ss.Write(" <nant buildfile=\"{0}\"",
// Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/'));
// ss.WriteLine(" target=\"clean\" />");
//}
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">");
foreach (var project in solution.ProjectsTableOrder)
{
var path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.Write(" <nant buildfile=\"{0}\"",
Helper.NormalizePath(
Helper.MakeFilePath(path,
project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/'));
ss.WriteLine(" target=\"build\" />");
}
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(
" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />");
ss.WriteLine();
ss.WriteLine(
" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />");
ss.WriteLine();
//ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />");
ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />");
ss.WriteLine();
ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">");
ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />");
foreach (var project in solution.Projects)
{
var path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.Write(" <nant buildfile=\"{0}\"",
Helper.NormalizePath(
Helper.MakeFilePath(path,
project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/'));
ss.WriteLine(" target=\"doc\" />");
}
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine("</project>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
var projectFile = Helper.MakeFilePath(project.FullPath,
project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
Helper.DeleteIfExists(projectFile);
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning Xcode build files for", solution.Name);
var slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
Helper.DeleteIfExists(slnFile);
foreach (var project in solution.Projects) CleanProject(project);
m_Kernel.Log.Write("");
}
#endregion
#region ITarget Members
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var solution in kern.Solutions) WriteCombine(solution);
m_Kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null) throw new ArgumentNullException("kern");
m_Kernel = kern;
foreach (var sol in kern.Solutions) CleanSolution(sol);
m_Kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name => "xcode";
#endregion
}

View file

@ -0,0 +1,60 @@
/*
* $RCSfile$
* Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
using System;
using System.Runtime.Serialization;
namespace Prebuild.Core;
/// <summary>
/// </summary>
[Serializable]
public class UnknownLanguageException : Exception
{
/// <summary>
/// Basic exception.
/// </summary>
public UnknownLanguageException()
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public UnknownLanguageException(string message) : base(message)
{
}
/// <summary>
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public UnknownLanguageException(string message, Exception exception) : base(message, exception)
{
}
/// <summary>
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}

View file

@ -0,0 +1,152 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System.Collections;
using System.Collections.Generic;
namespace Prebuild.Core.Utilities;
/// <summary>
/// The CommandLine class parses and interprets the command-line arguments passed to
/// prebuild.
/// </summary>
public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
{
#region Constructors
/// <summary>
/// Create a new CommandLine instance and set some internal variables.
/// </summary>
public CommandLineCollection(string[] args)
{
m_RawArgs = args;
Parse();
}
#endregion
#region Properties
/// <summary>
/// Gets the parameter associated with the command line option
/// </summary>
/// <remarks>
/// Returns null if option was not specified,
/// null string if no parameter was specified, and the value if a parameter was specified
/// </remarks>
public string this[string index]
{
get
{
if (m_Arguments.ContainsKey(index)) return m_Arguments[index];
return null;
}
}
#endregion
#region Private Methods
private void Parse()
{
if (m_RawArgs.Length < 1)
return;
var idx = 0;
string lastArg = null;
while (idx < m_RawArgs.Length)
{
var arg = m_RawArgs[idx];
if (arg.Length > 2 && arg[0] == '/')
{
arg = arg.Substring(1);
lastArg = arg;
m_Arguments[arg] = "";
}
else
{
if (lastArg != null)
{
m_Arguments[lastArg] = arg;
lastArg = null;
}
}
idx++;
}
}
#endregion
#region Public Methods
/// <summary>
/// Wases the passed.
/// </summary>
/// <param name="arg">The arg.</param>
/// <returns></returns>
public bool WasPassed(string arg)
{
return m_Arguments.ContainsKey(arg);
}
#endregion
#region Fields
// The raw OS arguments
private readonly string[] m_RawArgs;
// Command-line argument storage
private readonly Dictionary<string, string> m_Arguments = new();
#endregion
#region IEnumerable Members
/// <summary>
/// Returns an enumerator that can iterate through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IDictionaryEnumerator" />
/// that can be used to iterate through the collection.
/// </returns>
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
{
return m_Arguments.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
#endregion
}

View file

@ -0,0 +1,65 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Generic;
namespace Prebuild.Core.Utilities;
/// <summary>
/// </summary>
public class CurrentDirectory
{
#region Fields
private readonly Stack<string> m_Stack = new();
#endregion
#region Public Methods
/// <summary>
/// Pushes this instance.
/// </summary>
public void Push()
{
m_Stack.Push(Environment.CurrentDirectory);
}
/// <summary>
/// Pops this instance.
/// </summary>
public void Pop()
{
if (m_Stack.Count < 1) return;
var cwd = m_Stack.Pop();
Helper.SetCurrentDir(cwd);
}
#endregion
}

View file

@ -0,0 +1,474 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections.Specialized;
using System.IO;
using System.Xml;
using Prebuild.Core.Nodes;
namespace Prebuild.Core.Utilities;
/// <summary>
/// </summary>
public class Helper
{
#region Fields
/// <summary>
/// </summary>
public static bool CheckForOSVariables { get; set; }
#endregion
#region Public Methods
#region String Parsing
public delegate string StringLookup(string key);
/// <summary>
/// Gets a collection of StringLocationPair objects that represent the matches
/// </summary>
/// <param name="target">The target.</param>
/// <param name="beforeGroup">The before group.</param>
/// <param name="afterGroup">The after group.</param>
/// <param name="includeDelimitersInSubstrings">if set to <c>true</c> [include delimiters in substrings].</param>
/// <returns></returns>
public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup,
bool includeDelimitersInSubstrings)
{
if (beforeGroup == null) throw new ArgumentNullException("beforeGroup");
if (afterGroup == null) throw new ArgumentNullException("afterGroup");
var results = new StringCollection();
if (target == null || target.Length == 0) return results;
var beforeMod = 0;
var afterMod = 0;
if (includeDelimitersInSubstrings)
{
//be sure to not exlude the delims
beforeMod = beforeGroup.Length;
afterMod = afterGroup.Length;
}
var startIndex = 0;
while ((startIndex = target.IndexOf(beforeGroup, startIndex)) != -1)
{
var endIndex = target.IndexOf(afterGroup, startIndex); //the index of the char after it
if (endIndex == -1) break;
var length = endIndex - startIndex - beforeGroup.Length; //move to the first char in the string
var substring = target.Substring(startIndex + beforeGroup.Length - beforeMod,
length - afterMod);
results.Add(substring);
//results.Add(new StringLocationPair(substring,startIndex));
startIndex = endIndex + 1;
//the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization
//so start after endIndex
}
return results;
}
/// <summary>
/// Replaces the groups.
/// </summary>
/// <param name="target">The target.</param>
/// <param name="beforeGroup">The before group.</param>
/// <param name="afterGroup">The after group.</param>
/// <param name="lookup">The lookup.</param>
/// <returns></returns>
public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup)
{
if (target == null) throw new ArgumentNullException("target");
//int targetLength = target.Length;
var strings = FindGroups(target, beforeGroup, afterGroup, false);
if (lookup == null) throw new ArgumentNullException("lookup");
foreach (var substring in strings)
target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring));
return target;
}
/// <summary>
/// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate
/// </summary>
/// <param name="target">The target.</param>
/// <param name="lookup">The lookup.</param>
/// <returns></returns>
public static string InterpolateForVariables(string target, StringLookup lookup)
{
return ReplaceGroups(target, "${", "}", lookup);
}
/// <summary>
/// Replaces ${var} statements in a string with the corresonding environment variable with name var
/// </summary>
/// <param name="target"></param>
/// <returns></returns>
public static string InterpolateForEnvironmentVariables(string target)
{
return InterpolateForVariables(target, Environment.GetEnvironmentVariable);
}
#endregion
/// <summary>
/// Translates the value.
/// </summary>
/// <param name="translateType">Type of the translate.</param>
/// <param name="translationItem">The translation item.</param>
/// <returns></returns>
public static object TranslateValue(Type translateType, string translationItem)
{
if (translationItem == null) return null;
try
{
var lowerVal = translationItem.ToLower();
if (translateType == typeof(bool))
return lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" ||
lowerVal == "on";
if (translateType == typeof(int))
return int.Parse(translationItem);
return translationItem;
}
catch (FormatException)
{
return null;
}
}
/// <summary>
/// Deletes if exists.
/// </summary>
/// <param name="file">The file.</param>
/// <returns></returns>
public static bool DeleteIfExists(string file)
{
string resFile = null;
try
{
resFile = ResolvePath(file);
}
catch (ArgumentException)
{
return false;
}
if (!File.Exists(resFile)) return false;
File.Delete(resFile);
return true;
}
public static bool DeleteFolderIfExists(string file)
{
string resFile = null;
try
{
resFile = ResolvePath(file);
}
catch (ArgumentException)
{
return false;
}
if (!Directory.Exists(resFile)) return false;
Directory.Delete(resFile, true);
return true;
}
private static readonly char seperator = Path.DirectorySeparatorChar;
// This little gem was taken from the NeL source, thanks guys!
/// <summary>
/// Makes a relative path
/// </summary>
/// <param name="startPath">Path to start from</param>
/// <param name="endPath">Path to end at</param>
/// <returns>Path that will get from startPath to endPath</returns>
public static string MakePathRelativeTo(string startPath, string endPath)
{
var tmp = NormalizePath(startPath, seperator);
var src = NormalizePath(endPath, seperator);
var prefix = "";
while (true)
{
if (string.Compare(tmp, 0, src, 0, tmp.Length) == 0)
{
string ret;
var size = tmp.Length;
if (size == src.Length) return "./";
if (src.Length > tmp.Length && src[tmp.Length - 1] != seperator)
{
}
else
{
ret = prefix + endPath.Substring(size, endPath.Length - size);
ret = ret.Trim();
if (ret[0] == seperator) ret = "." + ret;
return NormalizePath(ret);
}
}
if (tmp.Length < 2) break;
var lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2);
var prevPos = tmp.IndexOf(seperator);
if (lastPos == prevPos || lastPos == -1) break;
tmp = tmp.Substring(0, lastPos + 1);
prefix += ".." + seperator;
}
return endPath;
}
/// <summary>
/// Resolves the path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns></returns>
public static string ResolvePath(string path)
{
var tmpPath = NormalizePath(path);
if (tmpPath.Length < 1) tmpPath = ".";
tmpPath = Path.GetFullPath(tmpPath);
if (!File.Exists(tmpPath) && !Directory.Exists(tmpPath))
throw new ArgumentException("Path could not be resolved: " + tmpPath);
return tmpPath;
}
/// <summary>
/// Normalizes the path.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="separatorCharacter">The separator character.</param>
/// <returns></returns>
public static string NormalizePath(string path, char separatorCharacter)
{
if (path == null || path == "" || path.Length < 1) return "";
var tmpPath = path.Replace('\\', '/');
tmpPath = tmpPath.Replace('/', separatorCharacter);
return tmpPath;
}
/// <summary>
/// Normalizes the path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns></returns>
public static string NormalizePath(string path)
{
return NormalizePath(path, Path.DirectorySeparatorChar);
}
/// <summary>
/// Ends the path.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="separatorCharacter">The separator character.</param>
/// <returns></returns>
public static string EndPath(string path, char separatorCharacter)
{
if (path == null || path == "" || path.Length < 1) return "";
if (!path.EndsWith(separatorCharacter.ToString())) return path + separatorCharacter;
return path;
}
/// <summary>
/// Ends the path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns></returns>
public static string EndPath(string path)
{
return EndPath(path, Path.DirectorySeparatorChar);
}
/// <summary>
/// Makes the file path.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="name">The name.</param>
/// <param name="ext">The ext.</param>
/// <returns></returns>
public static string MakeFilePath(string path, string name, string ext)
{
var ret = EndPath(NormalizePath(path));
if (name == null) throw new ArgumentNullException("name");
ret += name;
if (!name.EndsWith("." + ext)) ret += "." + ext;
//foreach(char c in Path.GetInvalidPathChars())
//{
// ret = ret.Replace(c, '_');
//}
return ret;
}
/// <summary>
/// Makes the file path.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="name">The name.</param>
/// <returns></returns>
public static string MakeFilePath(string path, string name)
{
var ret = EndPath(NormalizePath(path));
if (name == null) throw new ArgumentNullException("name");
ret += name;
//foreach (char c in Path.GetInvalidPathChars())
//{
// ret = ret.Replace(c, '_');
//}
return ret;
}
/// <summary>
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static string MakeReferencePath(string path)
{
var ret = EndPath(NormalizePath(path));
//foreach (char c in Path.GetInvalidPathChars())
//{
// ret = ret.Replace(c, '_');
//}
return ret;
}
/// <summary>
/// Sets the current dir.
/// </summary>
/// <param name="path">The path.</param>
public static void SetCurrentDir(string path)
{
if (path == null) throw new ArgumentNullException("path");
if (path.Length < 1) return;
Environment.CurrentDirectory = path;
}
/// <summary>
/// Checks the type.
/// </summary>
/// <param name="typeToCheck">The type to check.</param>
/// <param name="attr">The attr.</param>
/// <param name="inter">The inter.</param>
/// <returns></returns>
public static object CheckType(Type typeToCheck, Type attr, Type inter)
{
if (typeToCheck == null || attr == null) return null;
var attrs = typeToCheck.GetCustomAttributes(attr, false);
if (attrs == null || attrs.Length < 1) return null;
if (inter == null) throw new ArgumentNullException("inter");
if (typeToCheck.GetInterface(inter.FullName) == null) return null;
return attrs[0];
}
/// <summary>
/// Attributes the value.
/// </summary>
/// <param name="node">The node.</param>
/// <param name="attr">The attr.</param>
/// <param name="def">The def.</param>
/// <returns></returns>
public static string AttributeValue(XmlNode node, string attr, string def)
{
if (node == null) throw new ArgumentNullException("node");
if (node.Attributes[attr] == null) return def;
var val = node.Attributes[attr].Value;
if (!CheckForOSVariables) return val;
return InterpolateForEnvironmentVariables(val);
}
/// <summary>
/// Parses the boolean.
/// </summary>
/// <param name="node">The node.</param>
/// <param name="attr">The attr.</param>
/// <param name="defaultValue">if set to <c>true</c> [default value].</param>
/// <returns></returns>
public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue)
{
if (node == null) throw new ArgumentNullException("node");
if (node.Attributes[attr] == null) return defaultValue;
return bool.Parse(node.Attributes[attr].Value);
}
/// <summary>
/// Enums the attribute value.
/// </summary>
/// <param name="node">The node.</param>
/// <param name="attr">The attr.</param>
/// <param name="enumType">Type of the enum.</param>
/// <param name="def">The def.</param>
/// <returns></returns>
public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def)
{
if (def == null) throw new ArgumentNullException("def");
var val = AttributeValue(node, attr, def.ToString());
return Enum.Parse(enumType, val, true);
}
/// <summary>
/// </summary>
/// <param name="assemblyName"></param>
/// <param name="projectType"></param>
/// <returns></returns>
public static string AssemblyFullName(string assemblyName, ProjectType projectType)
{
return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe");
}
#endregion
}

250
src/Core/Utilities/Log.cs Normal file
View file

@ -0,0 +1,250 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.IO;
namespace Prebuild.Core.Utilities;
/// <summary>
/// </summary>
public enum LogType
{
/// <summary>
/// </summary>
None,
/// <summary>
/// </summary>
Info,
/// <summary>
/// </summary>
Warning,
/// <summary>
/// </summary>
Error
}
/// <summary>
/// </summary>
[Flags]
public enum LogTargets
{
/// <summary>
/// </summary>
None = 0,
/// <summary>
/// </summary>
Null = 1,
/// <summary>
/// </summary>
File = 2,
/// <summary>
/// </summary>
Console = 4
}
/// <summary>
/// Summary description for Log.
/// </summary>
public class Log : IDisposable
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="Log" /> class.
/// </summary>
/// <param name="target">The target.</param>
/// <param name="fileName">Name of the file.</param>
public Log(LogTargets target, string fileName)
{
m_Target = target;
if ((m_Target & LogTargets.File) != 0)
m_Writer = new StreamWriter(fileName, false);
else if ((m_Target & LogTargets.Console) != 0)
// Prevents null reference exceptions when outputing to the log file.
// This seems to only happen when running on a network drive.
m_Writer = Console.Out;
}
#endregion
#region Fields
private TextWriter m_Writer;
private readonly LogTargets m_Target = LogTargets.Null;
private bool disposed;
#endregion
#region Public Methods
/// <summary>
/// Writes this instance.
/// </summary>
public void Write()
{
Write(string.Empty);
}
/// <summary>
/// Writes the specified MSG.
/// </summary>
/// <param name="msg">The MSG.</param>
public void Write(string msg)
{
if ((m_Target & LogTargets.Null) != 0) return;
if ((m_Target & LogTargets.Console) != 0) Console.WriteLine(msg);
if ((m_Target & LogTargets.File) != 0 && m_Writer != null) m_Writer.WriteLine(msg);
}
/// <summary>
/// Writes the specified format.
/// </summary>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public void Write(string format, params object[] args)
{
Write(string.Format(format, args));
}
/// <summary>
/// Writes the specified type.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public void Write(LogType type, string format, params object[] args)
{
if ((m_Target & LogTargets.Null) != 0) return;
var str = "";
switch (type)
{
case LogType.Info:
str = "[I] ";
break;
case LogType.Warning:
str = "[!] ";
break;
case LogType.Error:
str = "[X] ";
break;
}
Write(str + format, args);
}
/// <summary>
/// Writes the exception.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="ex">The ex.</param>
public void WriteException(LogType type, Exception ex)
{
if (ex != null)
{
Write(type, ex.Message);
//#if DEBUG
m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name);
m_Writer.WriteLine(ex.StackTrace);
m_Writer.WriteLine("]]");
//#endif
}
}
/// <summary>
/// Flushes this instance.
/// </summary>
public void Flush()
{
if (m_Writer != null) m_Writer.Flush();
}
#endregion
#region IDisposable Members
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or
/// resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose objects
/// </summary>
/// <param name="disposing">
/// If true, it will dispose close the handle
/// </param>
/// <remarks>
/// Will dispose managed and unmanaged resources.
/// </remarks>
protected virtual void Dispose(bool disposing)
{
if (!disposed)
if (disposing)
if (m_Writer != null)
{
m_Writer.Close();
m_Writer = null;
}
disposed = true;
}
/// <summary>
/// </summary>
~Log()
{
Dispose(false);
}
/// <summary>
/// Closes and destroys this object
/// </summary>
/// <remarks>
/// Same as Dispose(true)
/// </remarks>
public void Close()
{
Dispose();
}
#endregion
}

View file

@ -0,0 +1,80 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Runtime.Serialization;
namespace Prebuild.Core;
/// <summary>
/// </summary>
[Serializable]
public class WarningException : Exception
{
#region Constructors
/// <summary>
/// </summary>
public WarningException()
{
}
/// <summary>
/// </summary>
/// <param name="format"></param>
/// <param name="args"></param>
public WarningException(string format, params object[] args)
: base(string.Format(format, args))
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public WarningException(string message) : base(message)
{
}
/// <summary>
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public WarningException(string message, Exception exception) : base(message, exception)
{
}
/// <summary>
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected WarningException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endregion
}

130
src/Prebuild.cs Normal file
View file

@ -0,0 +1,130 @@
#region BSD License
/*
Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
#region CVS Information
/*
* $Source$
* $Author: kunnis $
* $Date: 2009-04-14 21:33:14 -0400 (Tue, 14 Apr 2009) $
* $Revision: 308 $
*/
#endregion
using System;
using Prebuild.Core;
using Prebuild.Core.Utilities;
namespace Prebuild;
/// <summary>
/// </summary>
internal class Prebuild
{
#region Main
[STAThread]
private static void Main(string[] args)
{
Kernel kernel = null;
try
{
kernel = Kernel.Instance;
kernel.Initialize(LogTargets.File | LogTargets.Console, args);
var exit = false;
if (kernel.CommandLine.WasPassed("usage"))
{
exit = true;
OutputUsage();
}
if (kernel.CommandLine.WasPassed("showtargets"))
{
exit = true;
OutputTargets(kernel);
}
if (!exit) kernel.Process();
}
#if !DEBUG
catch (Exception ex)
{
Console.WriteLine("Unhandled error: {0}", ex.Message);
Console.WriteLine("{0}", ex.StackTrace);
}
#endif
finally
{
if (kernel != null && kernel.PauseAfterFinish)
{
Console.WriteLine("\nPress enter to continue...");
Console.ReadLine();
}
}
}
#endregion
#region Private Methods
private static void OutputUsage()
{
Console.WriteLine("Usage: prebuild /target <target> [options]");
Console.WriteLine("Available command-line switches:");
Console.WriteLine();
Console.WriteLine("/target Target for Prebuild");
Console.WriteLine("/clean Clean the build files for the given target");
Console.WriteLine("/file XML file to process");
Console.WriteLine("/log Log file to write to");
Console.WriteLine("/ppo Pre-process the file, but perform no other processing");
Console.WriteLine("/pause Pauses the application after execution to view the output");
Console.WriteLine("/yes Default to yes to any questions asked");
Console.WriteLine();
Console.WriteLine("See 'prebuild /showtargets for a list of available targets");
Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information");
Console.WriteLine();
}
private static void OutputTargets(Kernel kern)
{
Console.WriteLine("Targets available in Prebuild:");
Console.WriteLine("");
if (kern.Targets.Keys.Count > 0)
{
var targs = new string[kern.Targets.Keys.Count];
kern.Targets.Keys.CopyTo(targs, 0);
Array.Sort(targs);
foreach (var target in targs) Console.WriteLine(target);
}
Console.WriteLine("");
}
#endregion
}

View file

@ -0,0 +1,115 @@
#region BSD License
/*
Copyright (c) 2004 - 2008
Matthew Holmes (matthew@wildfiregames.com),
Dan Moorehead (dan05a@gmail.com),
Dave Hudson (jendave@yahoo.com),
Rob Loach (http://www.robloach.net),
C.J. Adams-Collier (cjac@colliertech.org),
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
// FxCop recommended attributes
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle(".NET Prebuild")]
[assembly: AssemblyDescription("A .NET project file build tool")]
[assembly: AssemblyConfiguration(".NET CLR")]
[assembly: AssemblyCompany("The Prebuild Project")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright 2004-2015 " +
"Tara Piccari (Aria's Creations)" +
"Matthew Holmes, " +
"Dan Moorehead, " +
"C.J. Adams-Collier, " +
"Rob Loach, " +
"David Hudson," +
"John Hurliman" +
"WhiteCore Development" +
"OpenSimulator developers")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: AssemblyVersion("2.2.0.0")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyName("")]

855
src/data/autotools.xml Normal file
View file

@ -0,0 +1,855 @@
<?xml version="1.0" encoding="utf-8" ?>
<Autotools>
<ProjectAutogenSh>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnpb="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
version="1.0"
exclude-result-prefixes="dnpb"
>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">#!/bin/sh
# Run this to generate all the initial makefiles, etc.
# Ripped off from Mono, which ripped off from GNOME macros version
DIE=0
srcdir=`dirname $0`
test -z "$srcdir" &amp;&amp; srcdir=.
if [ -n "$MONO_PATH" ]; then
# from -> /mono/lib:/another/mono/lib
# to -> /mono /another/mono
for i in `echo ${MONO_PATH} | tr ":" " "`; do
i=`dirname ${i}`
if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
fi
if [ -n "{i}" -a -d "${i}/bin" ]; then
PATH="${i}/bin:$PATH"
fi
done
export PATH
fi
(autoconf --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: You must have \`autoconf' installed to compile Mono."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if [ -z "$LIBTOOL" ]; then
LIBTOOL=`which glibtool 2>/dev/null`
if [ ! -x "$LIBTOOL" ]; then
LIBTOOL=`which libtool`
fi
fi
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) &amp;&amp; {
($LIBTOOL --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: You must have \`libtool' installed to compile Mono."
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null &amp;&amp; {
grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
(gettext --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: You must have \`gettext' installed to compile Mono."
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
(automake --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: You must have \`automake' installed to compile Mono."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
NO_AUTOMAKE=yes
}
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$NOCONFIGURE"; then
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
if test -z "$NO_LIBTOOLIZE" ; then
echo "Running libtoolize..."
${LIBTOOL}ize --force --copy
fi
fi
echo "Running aclocal $ACLOCAL_FLAGS ..."
aclocal $ACLOCAL_FLAGS || {
echo
echo "**Error**: aclocal failed. This may mean that you have not"
echo "installed all of the packages you need, or you may need to"
echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
echo "for the prefix where you installed the packages whose"
echo "macros were not found"
exit 1
}
if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
echo "Running autoheader..."
autoheader || { echo "**Error**: autoheader failed."; exit 1; }
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu $am_opt ||
{ echo "**Error**: automake failed."; exit 1; }
echo "Running autoconf ..."
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&amp;&amp; echo Now type \`make\' to compile $PKG_NAME || exit 1
else
echo Skipping configure process.
fi
</xsl:text>
</xsl:template>
</xsl:stylesheet>
</ProjectAutogenSh>
<ProjectConfigureAc>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnpb="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
version="1.0"
exclude-result-prefixes="dnpb"
xml:space="preserve"
>
<!-- Removes the xml version header in the generated file -->
<xsl:output method="text"/>
<xsl:param name="solutionName"/>
<xsl:param name="projectName"/>
<xsl:param name="projectVersion"/>
<xsl:param name="assemblyName"/>
<xsl:variable name="lcProjectName"><xsl:value-of select="translate($projectName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/></xsl:variable>
<xsl:template match="/">
<xsl:for-each select="//dnpb:Solution[@name=$solutionName]/dnpb:Project[@name=$projectName]"
>AC_INIT([<xsl:value-of select="$projectName"/>],[<xsl:value-of select="$projectVersion"/>])
AC_PREREQ(2.60)
AC_CANONICAL_SYSTEM
AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE([1.9 tar-ustar foreign])
AM_MAINTAINER_MODE
dnl AC_PROG_INTLTOOL([0.25])
AC_PROG_INSTALL
ASSEMBLY_NAME=
<xsl:value-of select="$assemblyName"/>
PROJECT_NAME=
<xsl:value-of select="$projectName"/>
PROJECT_VERSION=$VERSION
PROJECT_DESCRIPTION="<xsl:value-of select="dnpb:Description/text()"/>"
PROJECT_TYPE="<xsl:value-of select="@type"/>"
AC_SUBST(ASSEMBLY_NAME)
AC_SUBST(PROJECT_NAME)
AC_SUBST(PROJECT_VERSION)
AC_SUBST(DESCRIPTION)
AC_MSG_CHECKING([assembly type])
case $PROJECT_TYPE in
*Exe)
ASSEMBLY_EXTENSION=exe
;;
*Library)
ASSEMBLY_EXTENSION=dll
;;
*)
AC_MSG_ERROR([*** Please add support for project type $PROJECT_TYPE to configure.ac checks!])
;;
esac
AC_MSG_RESULT([$PROJECT_TYPE])
AC_SUBST(ASSEMBLY_EXTENSION)
AC_MSG_CHECKING([whether we're compiling from an RCS])
if test -f "$srcdir/.cvs_version" ; then
from_rcs=cvs
else
if test -f "$srcdir/.svn/entries" ; then
from_rcs=svn
else
from_rcs=no
fi
fi
AC_MSG_RESULT($from_rcs)
MONO_REQUIRED_VERSION=1.1
<xsl:text disable-output-escaping="yes">
PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)
</xsl:text>
if test "x$has_mono" = "xtrue"; then
AC_PATH_PROG(RUNTIME, mono, no)
AC_PATH_PROG(CSC, gmcs, no)
AC_PATH_PROG(RESGEN, resgen2, no)
if test `uname -s` = "Darwin"; then
LIB_PREFIX=
LIB_SUFFIX=.dylib
else
LIB_PREFIX=.so
LIB_SUFFIX=
fi
else
AC_PATH_PROG(CSC, csc.exe, no)
if test x$CSC = "xno"; then
AC_MSG_ERROR([You need to install either mono or .Net])
else
RUNTIME=
LIB_PREFIX=
LIB_SUFFIX=
fi
fi
AC_PATH_PROG(GACUTIL, gacutil)
if test "x$GACUTIL" = "xno" ; then
AC_MSG_ERROR([No gacutil tool found])
fi
GACUTIL_FLAGS='/package
<xsl:value-of select="$assemblyName"/>
/gacdir $(DESTDIR)$(prefix)/lib'
AC_SUBST(GACUTIL_FLAGS)
AC_SUBST(PATH)
AC_SUBST(LD_LIBRARY_PATH)
AC_SUBST(LIB_PREFIX)
AC_SUBST(LIB_SUFFIX)
AC_SUBST(RUNTIME)
AC_SUBST(CSC)
AC_SUBST(RESGEN)
AC_SUBST(GACUTIL)
AC_SUBST(BASE_DEPENDENCIES_CFLAGS)
AC_SUBST(BASE_DEPENDENCIES_LIBS)
dnl Find monodoc
MONODOC_REQUIRED_VERSION=1.0
AC_SUBST(MONODOC_REQUIRED_VERSION)
<xsl:text disable-output-escaping="yes">
PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)
</xsl:text>
if test "x$enable_monodoc" = "xyes"; then
AC_PATH_PROG(MONODOC, monodoc, no)
if test x$MONODOC = xno; then
enable_monodoc=no
fi
else
MONODOC=
fi
AC_SUBST(MONODOC)
AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes")
winbuild=no
case "$host" in
*-*-mingw*|*-*-cygwin*)
winbuild=yes
;;
esac
AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)
<xsl:if test="@type='Exe' or @type='WinExe'">AC_CONFIG_FILES(<xsl:value-of select="$lcProjectName"/>)</xsl:if>
<xsl:if test="@type='Library'">AC_CONFIG_FILES(<xsl:value-of select="$projectName"/>.pc)</xsl:if>
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
echo "==="
echo ""
echo "Project configuration summary"
echo ""
echo " * Installation prefix: $prefix"
echo " * compiler: $CSC"
echo " * Documentation: $enable_monodoc ($MONODOC)"
echo " * Project Name: $PROJECT_NAME"
echo " * Version: $PROJECT_VERSION"
echo ""
echo "==="
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</ProjectConfigureAc>
<ProjectMakefileAm>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnpb="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
version="1.0"
exclude-result-prefixes="dnpb"
xml:space="preserve"
>
<xsl:param name="projectName"/>
<xsl:param name="solutionName"/>
<xsl:param name="assemblyName"/>
<xsl:variable name="lcProjectName"><xsl:value-of select="translate($projectName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/></xsl:variable>
<xsl:param name="embeddedFiles"/>
<xsl:param name="compiledFiles"/>
<xsl:param name="contentFiles"/>
<xsl:param name="extraDistFiles"/>
<xsl:param name="pkgLibs"/>
<xsl:param name="binaryLibs"/>
<xsl:param name="systemLibs"/>
<xsl:param name="localCopyTargets"/>
<xsl:param name="hasAssemblyConfig"/>
<xsl:template match="/">
<xsl:for-each select="//dnpb:Solution[@name=$solutionName]/dnpb:Project[@name=$projectName]">
<xsl:variable name="lcType"><xsl:value-of select="translate(@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" /></xsl:variable>
ASSEMBLY=$(ASSEMBLY_NAME).$(ASSEMBLY_EXTENSION)
<!--
If the project is an application, create targets for the wrapper script
-->
<xsl:if test="@type='Exe' or @type='WinExe'">
<xsl:value-of select="$lcProjectName"/>dir = $(prefix)/lib/
<xsl:value-of select="$lcProjectName"/>
<xsl:value-of select="$lcProjectName"/>_DATA = $(ASSEMBLY)
<xsl:if test="$hasAssemblyConfig='true'"> $(ASSEMBLY).config</xsl:if>
bin_SCRIPTS=
<xsl:value-of select="$lcProjectName"/>
</xsl:if>
<xsl:if test="@type='Library'">
pkgconfigdir = $(prefix)/lib/pkgconfig
pkgconfig_DATA = <xsl:value-of select="$projectName"/>.pc
<xsl:if test="$hasAssemblyConfig='true'">
<xsl:value-of select="translate($lcProjectName, '.', '_')"/>dir = $(prefix)/lib/mono/
<xsl:value-of select="$projectName"/>
<xsl:value-of select="translate($lcProjectName, '.', '_')"/>_DATA = $(ASSEMBLY).config
</xsl:if>
noinst_DATA = $(ASSEMBLY)
</xsl:if>
PACKAGES =
<xsl:value-of select="$pkgLibs"/>
BINARY_LIBS =
<xsl:value-of select="$binaryLibs"/>
SYSTEM_LIBS =
<xsl:value-of select="$systemLibs"/>
RESOURCES_SRC =
<xsl:value-of select="$embeddedFiles"/>
RESOURCES = $(RESOURCES_SRC:.resx=.resources)
SOURCES =
<xsl:value-of select="$compiledFiles"/>
EXTRA_DIST=$(SOURCES) $(BINARY_LIBS) $(RESOURCES_SRC) install-sh missing
<xsl:value-of select="$extraDistFiles"/>
CLEANFILES=$(ASSEMBLY)
<xsl:value-of select="$localCopyTargets"/>
<xsl:for-each select="//dnpb:Solution[@name=$solutionName]/dnpb:Project[@name=$projectName]/dnpb:Configuration">
<xsl:variable name="outputPath"><xsl:value-of select="dnpb:Options/dnpb:OutputPath/text()" /></xsl:variable>
<xsl:variable name="keyFile"><xsl:value-of select="dnpb:Options/dnpb:KeyFile/text()" /></xsl:variable>
<xsl:variable name="docFile"><xsl:value-of select="dnpb:Options/dnpb:XmlDocFile/text()" /></xsl:variable>
<xsl:value-of select="$outputPath"/>/$(ASSEMBLY): $(srcdir)/$(ASSEMBLY).response $(RESOURCES) $(SOURCES)
$(BINARY_LIBS)
<xsl:call-template name="substring-after-last-mod"><xsl:with-param name="input" select="$keyFile" />
<xsl:with-param name="substr" select="'/'"/></xsl:call-template>
<xsl:if test="$docFile!=''">mkdir -p doc <xsl:text disable-output-escaping="yes">&amp;&amp;</xsl:text> </xsl:if>
mkdir -p
<xsl:value-of select="$outputPath"/>
<xsl:text disable-output-escaping="yes">&amp;&amp;</xsl:text> $(CSC) /out:$@ \
/target:
<xsl:value-of select="$lcType"/>
\
<xsl:if test="$embeddedFiles!=''">
$(addprefix /resource:$(srcdir)/, $(RESOURCES)) \</xsl:if>
<xsl:if test="$pkgLibs!=''">
$(addprefix /pkg:, $(PACKAGES)) \</xsl:if>
<xsl:if test="$systemLibs!=''">
$(addprefix /r:, $(SYSTEM_LIBS)) \</xsl:if>
<xsl:if test="$binaryLibs!=''">
$(addprefix /r:$(srcdir)/, $(BINARY_LIBS)) \</xsl:if>
@$(srcdir)/$(ASSEMBLY).response \
<xsl:if test="$docFile!=''">
/doc:doc/<xsl:value-of select="$docFile"/>
\</xsl:if>
<xsl:if test="$keyFile!=''">
/keyfile:$(srcdir)/<xsl:call-template name="substring-after-last-mod"><xsl:with-param name="input" select="$keyFile" />
<xsl:with-param name="substr" select="'/'"/></xsl:call-template>
\</xsl:if>
<xsl:if test="dnpb:Options/dnpb:AllowUnsafe/text()='true'">
/unsafe \</xsl:if>
<xsl:text disable-output-escaping="yes">
&amp;&amp; rm -f $(ASSEMBLY) \
&amp;&amp; ln $@ $(ASSEMBLY)</xsl:text>
CLEANFILES+=<xsl:value-of select="$outputPath"/>/$(ASSEMBLY)
<!-- if this project config has a KeyFile -->
<xsl:if test="$keyFile!=''">EXTRA_DIST+=<xsl:call-template name="substring-after-last-mod"><xsl:with-param name="input" select="$keyFile" />
<xsl:with-param name="substr" select="'/'"/></xsl:call-template></xsl:if>
<xsl:value-of select="@name"/>:<xsl:value-of select="$outputPath"/>/$(ASSEMBLY)<xsl:text
disable-output-escaping="yes">
rm -f $(ASSEMBLY) \
&amp;&amp;</xsl:text> ln<xsl:value-of select="$outputPath"/>/$(ASSEMBLY) $(ASSEMBLY)
<!-- If the project is a library, create library-specific targets -->
<xsl:if test="//dnpb:Solution[@name=$solutionName]/dnpb:Project[@name=$projectName]/@type='Library'">
<xsl:choose>
<!--
If the project has a keyfile, make a gac install/uninstall target
-->
<xsl:when test="dnpb:Options/dnpb:KeyFile/text()!=''">
<xsl:value-of select="@name"/>_install-data-local:<xsl:value-of select="$outputPath"/>/$(ASSEMBLY)
echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \
$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1;
<xsl:value-of select="@name"/>_uninstall-local:
if [`gacutil -l
<xsl:value-of select="$projectName"/>
| grep "Number" | awk -F= '{print $$2}'` -gt "0" ] ; \
then \
echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \
$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; \
fi
</xsl:when>
<!--
If there is no keyfile for the project, define a filesystem
install target
-->
<xsl:otherwise>
noinst_<xsl:value-of select="@name"/>_<xsl:value-of select="translate($lcProjectName, '.', '_')"/>dir =
$(prefix)/lib/mono/
<xsl:value-of select="$projectName"/>
noinst_<xsl:value-of select="@name"/>_<xsl:value-of select="translate($lcProjectName, '.', '_')"/>_DATA =
<xsl:value-of select="$outputPath"/>/$(ASSEMBLY)
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<xsl:variable name="defaultConfig"><xsl:value-of select="//dnpb:Solution[@name=$solutionName]/dnpb:Project[@name=$projectName]/dnpb:Configuration/@name" /></xsl:variable>
$(ASSEMBLY):
<xsl:value-of select="$defaultConfig"/>
<xsl:text disable-output-escaping="yes">
$(srcdir)/$(ASSEMBLY).response: $(srcdir)/Makefile
echo "$(addprefix $(srcdir)/, $(SOURCES))" &gt; $@
</xsl:text>
all: $(ASSEMBLY)
# rule to compile .resx files to .resources
%.resources: %.resx
$(RESGEN) /useSourcePath /compile $(@:.resources=.resx)
<xsl:if test="@type='Library'">
<!-- if the default config has a KeyFile -->
<xsl:choose>
<xsl:when
test="//dnpb:Solution[@name=$solutionName]/dnpb:Project[@name=$projectName]/dnpb:Configuration[@name=$defaultConfig]/dnpb:Options/dnpb:KeyFile/text()!=''">
install-data-local: <xsl:value-of select="$defaultConfig"/>_install-data-local
uninstall-local:<xsl:value-of select="$defaultConfig"/>_uninstall-local
</xsl:when>
<!--
If the default config does not have a KeyFile, don't really do
anything
-->
<xsl:otherwise>
#<xsl:value-of select="translate($lcProjectName, '.', '_')"/>dir+=$(noinst_<xsl:value-of select="$defaultConfig"/>_
<xsl:value-of select="translate($lcProjectName, '.', '_')"/>dir)
#<xsl:value-of select="translate($lcProjectName, '.', '_')"/>_DATA+=$(noinst_<xsl:value-of
select="$defaultConfig"/>_<xsl:value-of select="translate($lcProjectName, '.', '_')"/>_DATA)
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="substring-after-last" xml:space="default">
<xsl:param name="input"/>
<xsl:param name="substr"/>
<!-- Extract the string which comes after the first occurence -->
<xsl:variable name="temp" select="substring-after($input,$substr)"/>
<xsl:choose>
<!-- If it still contains the search string then recursively process -->
<xsl:when test="$substr and contains($temp,$substr)">
<xsl:call-template name="substring-after-last">
<xsl:with-param name="input" select="$temp"/>
<xsl:with-param name="substr" select="$substr"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$temp"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="substring-after-last-mod" xml:space="default">
<xsl:param name="input"/>
<xsl:param name="substr"/>
<xsl:choose>
<xsl:when test="contains($input,$substr)">
<xsl:call-template name="substring-after-last">
<xsl:with-param name="input" select="$input"/>
<xsl:with-param name="substr" select="$substr"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
</ProjectMakefileAm>
<ProjectPcIn>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnpb="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
version="1.0"
exclude-result-prefixes="dnpb"
xml:space="preserve"
>
<!-- Removes the xml version header in the generated file -->
<xsl:output method="text"/>
<xsl:param name="projectName"/>
<xsl:param name="solutionName"/>
<xsl:variable name="lcProjectName"><xsl:value-of select="translate($projectName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/></xsl:variable>
<xsl:template match="/"><xsl:for-each select="//dnpb:Solution[@name=$solutionName]/dnpb:Project[@name=$projectName]">prefix=@prefix@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib/mono/@PROJECT_NAME@
Name: <xsl:value-of select="@name"/>
Description:
<xsl:value-of select="Description/text()"/>
Version: @PROJECT_VERSION@
Requires:
<xsl:for-each select="Reference"><xsl:if test="@localCopy=false"><xsl:text disable-output-escaping="yes"> </xsl:text><xsl:value-of
select="@name"/></xsl:if></xsl:for-each>
Libs: -r:${libdir}/@PROJECT_NAME@.dll
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</ProjectPcIn>
<SolutionAutogenSh>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnpb="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
version="1.0"
exclude-result-prefixes="dnpb"
>
<xsl:param name="solutionName"/>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">#!/bin/sh
# Run this to generate all the initial makefiles, etc.
# Ripped off from Mono, which ripped off from GNOME macros version
DIE=0
srcdir=`dirname $0`
test -z "$srcdir" &amp;&amp; srcdir=.
if [ -n "$MONO_PATH" ]; then
# from -> /mono/lib:/another/mono/lib
# to -> /mono /another/mono
for i in `echo ${MONO_PATH} | tr ":" " "`; do
i=`dirname ${i}`
if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
fi
if [ -n "{i}" -a -d "${i}/bin" ]; then
PATH="${i}/bin:$PATH"
fi
done
export PATH
fi
(autoconf --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: You must have \`autoconf' installed to compile Mono."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if [ -z "$LIBTOOL" ]; then
LIBTOOL=`which glibtool 2>/dev/null`
if [ ! -x "$LIBTOOL" ]; then
LIBTOOL=`which libtool`
fi
fi
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) &amp;&amp; {
($LIBTOOL --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: You must have \`libtool' installed to compile Mono."
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null &amp;&amp; {
grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
(gettext --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: You must have \`gettext' installed to compile Mono."
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
(automake --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: You must have \`automake' installed to compile Mono."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
NO_AUTOMAKE=yes
}
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) &lt; /dev/null > /dev/null 2>&amp;1 || {
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
if test -z "$NO_LIBTOOLIZE" ; then
echo "Running libtoolize..."
${LIBTOOL}ize --force --copy
fi
fi
echo "Running aclocal $ACLOCAL_FLAGS ..."
aclocal $ACLOCAL_FLAGS || {
echo
echo "**Error**: aclocal failed. This may mean that you have not"
echo "installed all of the packages you need, or you may need to"
echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
echo "for the prefix where you installed the packages whose"
echo "macros were not found"
exit 1
}
if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
echo "Running autoheader..."
autoheader || { echo "**Error**: autoheader failed."; exit 1; }
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu $am_opt ||
{ echo "**Error**: automake failed."; exit 1; }
echo "Running autoconf ..."
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
</xsl:text>
<xsl:for-each select="/dnpb:Prebuild/dnpb:Solution[@name=$solutionName]/dnpb:Project">
echo Running<xsl:value-of select="@name"/>/autogen.sh ...
(cd $srcdir/
<xsl:value-of select="@name"/>
; NOCONFIGURE=1 /bin/sh ./autogen.sh "$@")
echo Done running<xsl:value-of select="@name"/>/autogen.sh ...
</xsl:for-each>
<xsl:text disable-output-escaping="yes">
conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&amp;&amp; echo Now type \`make\' to compile $PKG_NAME || exit 1
else
echo Skipping configure process.
fi
</xsl:text>
</xsl:template>
</xsl:stylesheet>
</SolutionAutogenSh>
<SolutionConfigureAc>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnpb="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
version="1.0"
exclude-result-prefixes="dnpb"
xml:space="preserve"
>
<!-- Removes the xml version header in the generated file -->
<xsl:output method="text"/>
<xsl:param name="solutionName"/>
<xsl:template match="/"
>AC_INIT([<xsl:value-of select="$solutionName"/>]-solution,[<xsl:value-of
select="/dnpb:Prebuild/dnpb:Solution[@name=$solutionName]/@version"/>])
AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE([1.9 tar-ustar foreign])
EXTRA_DIST="install-sh missing"
SOLUTION_NAME=
<xsl:value-of select="$solutionName"/>
SOLUTION_VERSION=$VERSION
SOLUTION_DESCRIPTION="<xsl:value-of
select="/dnpb:Prebuild/dnpb:Solution[@name=$solutionName]/dnpb:Description"/>"
AC_SUBST(DESCRIPTION)
AM_MAINTAINER_MODE
dnl AC_PROG_INTLTOOL([0.25])
AC_PROG_INSTALL
AC_MSG_CHECKING([whether we're building from an RCS])
if test -f "$srcdir/.cvs_version" ; then
from_rcs=cvs
else
if test -f "$srcdir/.svn/entries" ; then
from_rcs=svn
else
from_rcs=no
fi
fi
AC_MSG_RESULT($from_rcs)
CONFIG="Release"
AC_SUBST(CONFIG)
<!-- TODO: Ensure that these SUBDIRS are processed in dependency order -->
AC_CONFIG_SUBDIRS(
<xsl:for-each select="/dnpb:Prebuild/dnpb:Solution[@name=$solutionName]/dnpb:Project"><xsl:text disable-output-escaping="yes"> </xsl:text>
<xsl:value-of select="@name"/>
</xsl:for-each>
)
<xsl:text disable-output-escaping="yes">
AC_OUTPUT([
Makefile
])
echo "==="
echo ""
echo "Solution configuration summary"
echo ""
echo " * Solution Name: $SOLUTION_NAME"
echo " * Version: $SOLUTION_VERSION"
echo " * Packages:"</xsl:text>
<xsl:for-each
select="/dnpb:Prebuild/dnpb:Solution[@name=$solutionName]/dnpb:Project">echo " - <xsl:value-of
select="@name"/>"
</xsl:for-each>
<xsl:text disable-output-escaping="yes">echo ""
echo "==="
</xsl:text>
</xsl:template>
</xsl:stylesheet>
</SolutionConfigureAc>
<SolutionMakefileAm>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnpb="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
version="1.0"
exclude-result-prefixes="dnpb"
xml:space="preserve"
>
<xsl:param name="solutionName"/>
<xsl:template match="/">SUBDIRS =<xsl:for-each select="//dnpb:Solution[@name=$solutionName]/dnpb:Project"><xsl:text disable-output-escaping="yes"> </xsl:text>
<xsl:value-of select="@name"/></xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</SolutionMakefileAm>
<ProjectWrapperScriptIn>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dnpb="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
version="1.0"
exclude-result-prefixes="dnpb"
xml:space="preserve"
>
<!-- Removes the xml version header in the generated file -->
<xsl:output method="text"/>
<xsl:param name="projectName"/>
<xsl:param name="assemblyName"/>
<xsl:param name="solutionName"/>
<xsl:param name="monoPath"/>
<xsl:variable name="lcProjectName"><xsl:value-of select="translate($projectName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/></xsl:variable>
<xsl:template match="/"><xsl:for-each select="//dnpb:Solution[@name=$solutionName]/dnpb:Project[@name=$projectName]">#! /bin/sh
PACKAGE=<xsl:value-of select="$assemblyName"/>
prefix=@prefix@
exec_prefix=@exec_prefix@
# %%$@%$# why oh why isn't it $sharedir/
<xsl:value-of select="$lcProjectName"/>
# Day changed to 30 Mar 2007
# ...
# 07:50 &lt; cj> why are we installing .exe assemblies to $prefix/lib/$package/ and
# not $prefix/share/$package ?
# 07:50 &lt; jonp> momentum.
# 07:50 &lt; jonp> and it's hard to say that a .exe isn't platform specific
# 07:50 &lt; jonp> as it can still contain DllImport's which make platform
# assumptions
packagedir=$prefix/lib/
<xsl:value-of select="$lcProjectName"/>
export MONO_PATH=$MONO_PATH
<xsl:value-of select="$monoPath"/>
exec @RUNTIME@ $packagedir/$PACKAGE.exe "$@"
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</ProjectWrapperScriptIn>
</Autotools>

183
src/data/dnpb-1.0.xsd Normal file
View file

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.0.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.0.xsd"
>
<xs:annotation>
<xs:documentation>
Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="DNPreBuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="Reference" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:all>
<xs:element ref="Options" minOccurs="0" />
</xs:all>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:sequence>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:attribute name="path" type="xs:string" use="required" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
</xs:complexType>
</xs:element>
</xs:schema>

184
src/data/dnpb-1.1.xsd Normal file
View file

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.1.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.1.xsd"
>
<xs:annotation>
<xs:documentation>
Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="DNPreBuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:all>
<xs:element ref="Options" minOccurs="0" />
</xs:all>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:sequence>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:attribute name="path" type="xs:string" use="required" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
</xs:complexType>
</xs:element>
</xs:schema>

198
src/data/dnpb-1.2.xsd Normal file
View file

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.2.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.2.xsd"
>
<xs:annotation>
<xs:documentation>
Copyright (c) 2004 Matthew Holmes (calefaction _at_ houston _._ rr _._ com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="DNPreBuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:all>
<xs:element ref="Options" minOccurs="0" />
</xs:all>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:attribute name="path" type="xs:string" use="required" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

206
src/data/dnpb-1.3.xsd Normal file
View file

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.3.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.3.xsd"
>
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
.NET Pre-Build is an XML-driven pre-build tool allowing developers to
easily generate project or make files for major IDE's and .NET
development tools including: Visual Studio 2003, Visual Studio 2002,
SharpDevelop, MonoDevelop, and NAnt.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="DNPreBuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:all>
<xs:element ref="Options" minOccurs="0" />
</xs:all>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

212
src/data/dnpb-1.4.xsd Normal file
View file

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.4.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.4.xsd"
>
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002 and
2003, SharpDevelop, MonoDevelop, and NAnt.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="DNPreBuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" />
<xs:attribute name="checkOsVars" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

215
src/data/dnpb-1.5.xsd Normal file
View file

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.5.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.5.xsd"
>
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002 and
2003, SharpDevelop, MonoDevelop, and NAnt.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="DNPreBuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" />
<xs:attribute name="checkOsVars" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="filterGroups" type="xs:string" default="" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="GenerateXmlDocFile" type="xs:boolean" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

345
src/data/prebuild-1.10.xsd Normal file
View file

@ -0,0 +1,345 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.10.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.10.xsd">
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2007
Matthew Holmes (calefaction at houston . rr . com),
Dan Moorehead (dan05a at gmail . com),
David Hudson (jendave at yahoo dot com),
C.J. Adams-Collier (cjac at colliertech dot com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002,
2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="Prebuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Solution" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="version"/>
<xs:attribute name="checkOsVars"/>
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string"/>
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded"/>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Options" minOccurs="0"/>
<xs:element ref="Files" minOccurs="0"/>
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="activeConfig" type="xs:string" default="Debug"/>
<xs:attribute name="path" type="xs:string" default=""/>
<xs:attribute name="version" type="xs:string" default="1.0.0"/>
</xs:complexType>
</xs:element>
<xs:element name="EmbeddedSolution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Files" minOccurs="0"/>
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="activeConfig" type="xs:string" default="Debug"/>
<xs:attribute name="path" type="xs:string" default=""/>
<xs:attribute name="version" type="xs:string" default="1.0.0"/>
</xs:complexType>
</xs:element>
<xs:element name="DatabaseProject">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="DatabaseReference" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="path" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="DatabaseReference">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="providerId" type="xs:string"/>
<xs:attribute name="providerName" type="xs:string"/>
<xs:attribute name="connectionString" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="path" type="xs:string"/>
<xs:attribute name="localCopy" type="xs:boolean"/>
<xs:attribute name="version" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element ref="Files"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="designerFolder" type="xs:string" default=""/>
<xs:attribute name="filterGroups" type="xs:string" default=""/>
<xs:attribute name="path" type="xs:string" default=""/>
<xs:attribute name="icon" type="xs:string" default=""/>
<xs:attribute name="configFile" type="xs:string" default=""/>
<xs:attribute name="version" type="xs:string" default="1.0.0"/>
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#"/>
<xs:enumeration value="VB.NET"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe"/>
<xs:enumeration value="WinExe"/>
<xs:enumeration value="Library"/>
<xs:enumeration value="Web"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft"/>
<xs:enumeration value="Mono"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="frameworkVersion" default="v2_0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="v2_0"/>
<xs:enumeration value="v3_0"/>
<xs:enumeration value="v3_5"/>
<xs:enumeration value="v4_0"/>
<xs:enumeration value="v4_5"/>
<xs:enumeration value="v4_5_1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default=""/>
<xs:attribute name="rootNamespace" type="xs:string"/>
<xs:attribute name="assemblyName" type="xs:string"/>
<xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false"/>
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="platform" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0"/>
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0"/>
<xs:element name="Prefer32Bit" type="xs:boolean" minOccurs="0"/>
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0"/>
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0"/>
<xs:element name="PreBuildEvent" type="xs:string" minOccurs="0"/>
<xs:element name="PostBuildEvent" type="xs:string" minOccurs="0"/>
<xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="OnBuildSuccess"/>
<xs:enumeration value="Always"/>
<xs:enumeration value="OnOutputUpdated"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RunScript" type="xs:string" minOccurs="0"/>
<xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0"/>
<xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0"/>
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0"/>
<xs:element name="SuppressWarnings" type="xs:string" minOccurs="0"/>
<xs:element name="UseCommonOutputDirectory" type="xs:boolean" minOccurs="0"/>
<xs:element name="AppendTargetFrameworkToOutputPath" type="xs:boolean" minOccurs="0"/>
<xs:element name="AppendRuntimeIdentifierToOutputPath" type="xs:boolean" minOccurs="0"/>
<xs:element name="EnableDefaultItems" type="xs:boolean" minOccurs="0"/>
<xs:element name="OutputPath" type="xs:string" minOccurs="0"/>
<xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0"/>
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0"/>
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0"/>
<xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0"/>
<xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0"/>
<xs:element name="BaseAddress" type="xs:string" minOccurs="0"/>
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0"/>
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0"/>
<xs:element name="KeyFile" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="resourceName" type="xs:string" default=""/>
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None"/>
<xs:enumeration value="Compile"/>
<xs:enumeration value="Content"/>
<xs:enumeration value="EmbeddedResource"/>
<xs:enumeration value="ApplicationDefinition"/>
<xs:enumeration value="Page"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code"/>
<xs:enumeration value="CodeBehind"/>
<xs:enumeration value="Component"/>
<xs:enumeration value="Form"/>
<xs:enumeration value="Settings"/>
<xs:enumeration value="UserControl"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean"/>
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never"/>
<xs:enumeration value="Always"/>
<xs:enumeration value="PreserveNewest"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean"/>
<xs:attribute name="linkPath" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:sequence>
<xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="path" type="xs:string"/>
<xs:attribute name="pattern" type="xs:string" use="required"/>
<xs:attribute name="recurse" type="xs:boolean" default="false"/>
<xs:attribute name="useRegex" type="xs:boolean" default="false"/>
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None"/>
<xs:enumeration value="Compile"/>
<xs:enumeration value="Content"/>
<xs:enumeration value="EmbeddedResource"/>
<xs:enumeration value="ApplicationDefinition"/>
<xs:enumeration value="Page"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="resourceName" type="xs:string" default=""/>
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code"/>
<xs:enumeration value="CodeBehind"/>
<xs:enumeration value="Component"/>
<xs:enumeration value="Designer"/>
<xs:enumeration value="Form"/>
<xs:enumeration value="Settings"/>
<xs:enumeration value="UserControl"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean"/>
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never"/>
<xs:enumeration value="Always"/>
<xs:enumeration value="PreserveNewest"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean"/>
<xs:attribute name="linkPath" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="Exclude">
<xs:complexType>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="pattern" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>

356
src/data/prebuild-1.11.xsd Normal file
View file

@ -0,0 +1,356 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.10.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.10.xsd">
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2007
Matthew Holmes (calefaction at houston . rr . com),
Dan Moorehead (dan05a at gmail . com),
David Hudson (jendave at yahoo dot com),
C.J. Adams-Collier (cjac at colliertech dot com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002,
2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="Prebuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="1" maxOccurs="1" />
</xs:sequence>
<xs:attribute name="version" />
<xs:attribute name="checkOsVars" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="EmbeddedSolution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseProject">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseReference" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseReference">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="providerId" type="xs:string" />
<xs:attribute name="providerName" type="xs:string" />
<xs:attribute name="connectionString" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="ProjectReference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="include" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:complexType>
</xs:element>
<xs:element name="PackageReference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="designerFolder" type="xs:string" default="" />
<xs:attribute name="filterGroups" type="xs:string" default="" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="configFile" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
<xs:enumeration value="Web" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="frameworkVersion" default="v2_0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="v2_0" />
<xs:enumeration value="v3_0" />
<xs:enumeration value="v3_5" />
<xs:enumeration value="v4_0" />
<xs:enumeration value="v4_5" />
<xs:enumeration value="v4_5_1" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
<xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" />
<xs:attribute name="assemblyName" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="platform" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="Prefer32Bit" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="OnBuildSuccess" />
<xs:enumeration value="Always" />
<xs:enumeration value="OnOutputUpdated" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RunScript" type="xs:string" minOccurs="0" />
<xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
<xs:element name="KeyFile" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="resourceName" type="xs:string" default="" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
<xs:enumeration value="ApplicationDefinition" />
<xs:enumeration value="Page" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" />
<xs:enumeration value="Form" />
<xs:enumeration value="Settings" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean" />
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never" />
<xs:enumeration value="Always" />
<xs:enumeration value="PreserveNewest" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean" />
<xs:attribute name="linkPath" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:sequence>
<xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
<xs:enumeration value="ApplicationDefinition" />
<xs:enumeration value="Page" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="resourceName" type="xs:string" default="" />
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" />
<xs:enumeration value="Designer" />
<xs:enumeration value="Form" />
<xs:enumeration value="Settings" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean" />
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never" />
<xs:enumeration value="Always" />
<xs:enumeration value="PreserveNewest" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean" />
<xs:attribute name="linkPath" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Exclude">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>

231
src/data/prebuild-1.6.xsd Normal file
View file

@ -0,0 +1,231 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd"
xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002 and
2003, SharpDevelop, MonoDevelop, and NAnt.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="Prebuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" />
<xs:attribute name="checkOsVars" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="filterGroups" type="xs:string" default="" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="OnBuildSuccess" />
<xs:enumeration value="Always" />
<xs:enumeration value="OnOutputUpdated" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RunScript" type="xs:string" minOccurs="0" />
<xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="Component" />
<xs:enumeration value="Form" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:sequence>
<xs:element ref="Exclude" minOccurs="0" />
</xs:sequence>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="Component" />
<xs:enumeration value="Form" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="Exclude">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>

350
src/data/prebuild-1.7.xsd Normal file
View file

@ -0,0 +1,350 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2007
Matthew Holmes (calefaction at houston . rr . com),
Dan Moorehead (dan05a at gmail . com),
David Hudson (jendave at yahoo dot com),
C.J. Adams-Collier (cjac at colliertech dot com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002,
2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="Prebuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" />
<xs:attribute name="checkOsVars" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Cleanup" minOccurs="0" maxOccurs="1" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="EmbeddedSolution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseProject">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseReference" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseReference">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="providerId" type="xs:string" />
<xs:attribute name="providerName" type="xs:string" />
<xs:attribute name="connectionString" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="designerFolder" type="xs:string" default="" />
<xs:attribute name="filterGroups" type="xs:string" default="" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="configFile" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
<xs:enumeration value="Web" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="frameworkVersion" default="v2_0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="v2_0" />
<xs:enumeration value="v3_0" />
<xs:enumeration value="v3_5" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="debugStartParameters" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
<xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="OnBuildSuccess" />
<xs:enumeration value="Always" />
<xs:enumeration value="OnOutputUpdated" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RunScript" type="xs:string" minOccurs="0" />
<xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
<xs:element name="KeyFile" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="resourceName" type="xs:string" default="" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" />
<xs:enumeration value="Form" />
<xs:enumeration value="Settings" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean" />
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never" />
<xs:enumeration value="Always" />
<xs:enumeration value="PreserveNewest" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean" />
<xs:attribute name="linkPath" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:sequence>
<xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="resourceName" type="xs:string" default="" />
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" />
<xs:enumeration value="Designer" />
<xs:enumeration value="Form" />
<xs:enumeration value="Settings" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean" />
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never" />
<xs:enumeration value="Always" />
<xs:enumeration value="PreserveNewest" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean" />
<xs:attribute name="linkPath" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Exclude">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Cleanup">
<xs:complexType>
<xs:sequence>
<xs:element ref="CleanFiles" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CleanFiles">
<xs:complexType>
<xs:attribute name="pattern" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>

331
src/data/prebuild-1.8.xsd Normal file
View file

@ -0,0 +1,331 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.8.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.8.xsd">
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2007
Matthew Holmes (calefaction at houston . rr . com),
Dan Moorehead (dan05a at gmail . com),
David Hudson (jendave at yahoo dot com),
C.J. Adams-Collier (cjac at colliertech dot com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002,
2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="Prebuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="1" maxOccurs="1" />
</xs:sequence>
<xs:attribute name="version" />
<xs:attribute name="checkOsVars" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="EmbeddedSolution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseProject">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseReference" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseReference">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="providerId" type="xs:string" />
<xs:attribute name="providerName" type="xs:string" />
<xs:attribute name="connectionString" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="designerFolder" type="xs:string" default="" />
<xs:attribute name="filterGroups" type="xs:string" default="" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="configFile" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
<xs:enumeration value="Web" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="frameworkVersion" default="v2_0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="v2_0" />
<xs:enumeration value="v3_0" />
<xs:enumeration value="v3_5" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
<xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="platform" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="OnBuildSuccess" />
<xs:enumeration value="Always" />
<xs:enumeration value="OnOutputUpdated" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RunScript" type="xs:string" minOccurs="0" />
<xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
<xs:element name="KeyFile" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="resourceName" type="xs:string" default="" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" />
<xs:enumeration value="Form" />
<xs:enumeration value="Settings" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean" />
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never" />
<xs:enumeration value="Always" />
<xs:enumeration value="PreserveNewest" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean" />
<xs:attribute name="linkPath" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:sequence>
<xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="resourceName" type="xs:string" default="" />
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" />
<xs:enumeration value="Designer" />
<xs:enumeration value="Form" />
<xs:enumeration value="Settings" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean" />
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never" />
<xs:enumeration value="Always" />
<xs:enumeration value="PreserveNewest" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean" />
<xs:attribute name="linkPath" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Exclude">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>

336
src/data/prebuild-1.9.xsd Normal file
View file

@ -0,0 +1,336 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.9.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.9.xsd">
<xs:annotation>
<xs:documentation>
Copyright (c) 2004-2007
Matthew Holmes (calefaction at houston . rr . com),
Dan Moorehead (dan05a at gmail . com),
David Hudson (jendave at yahoo dot com),
C.J. Adams-Collier (cjac at colliertech dot com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002,
2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
</xs:annotation>
<xs:element name="Prebuild">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Solution" minOccurs="1" maxOccurs="1" />
</xs:sequence>
<xs:attribute name="version" />
<xs:attribute name="checkOsVars" />
</xs:complexType>
</xs:element>
<xs:element name="Process" type="xs:string" />
<xs:element name="Solution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Options" minOccurs="0" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="EmbeddedSolution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseProject">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseReference" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseReference">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="providerId" type="xs:string" />
<xs:attribute name="providerName" type="xs:string" />
<xs:attribute name="connectionString" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="localCopy" type="xs:boolean" />
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element ref="Files" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="designerFolder" type="xs:string" default="" />
<xs:attribute name="filterGroups" type="xs:string" default="" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="configFile" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="language" default="C#">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C#" />
<xs:enumeration value="VB.NET" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" default="Exe">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" />
<xs:enumeration value="Library" />
<xs:enumeration value="Web" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="runtime" default="Microsoft">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Microsoft" />
<xs:enumeration value="Mono" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="frameworkVersion" default="v2_0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="v2_0" />
<xs:enumeration value="v3_0" />
<xs:enumeration value="v3_5" />
<xs:enumeration value="v4_0" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" />
<xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" />
</xs:complexType>
</xs:element>
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element ref="Options" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="platform" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Options">
<xs:complexType>
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="OnBuildSuccess" />
<xs:enumeration value="Always" />
<xs:enumeration value="OnOutputUpdated" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RunScript" type="xs:string" minOccurs="0" />
<xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
<xs:element name="WarningLevel" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="4" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
<xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
<xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
<xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
<xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
<xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
<xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
<xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
<xs:element name="KeyFile" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Files">
<xs:complexType>
<xs:sequence>
<xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="resourceName" type="xs:string" default="" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
<xs:enumeration value="ApplicationDefinition" />
<xs:enumeration value="Page" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" />
<xs:enumeration value="Form" />
<xs:enumeration value="Settings" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean" />
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never" />
<xs:enumeration value="Always" />
<xs:enumeration value="PreserveNewest" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean" />
<xs:attribute name="linkPath" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Match">
<xs:complexType>
<xs:sequence>
<xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="path" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" use="required" />
<xs:attribute name="recurse" type="xs:boolean" default="false" />
<xs:attribute name="useRegex" type="xs:boolean" default="false" />
<xs:attribute name="buildAction" default="Compile">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="Compile" />
<xs:enumeration value="Content" />
<xs:enumeration value="EmbeddedResource" />
<xs:enumeration value="ApplicationDefinition" />
<xs:enumeration value="Page" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="resourceName" type="xs:string" default="" />
<xs:attribute name="subType" default="Code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" />
<xs:enumeration value="Designer" />
<xs:enumeration value="Form" />
<xs:enumeration value="Settings" />
<xs:enumeration value="UserControl" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="link" type="xs:boolean" />
<xs:attribute name="copyToOutput" default="Never">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Never" />
<xs:enumeration value="Always" />
<xs:enumeration value="PreserveNewest" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="preservePath" type="xs:boolean" />
<xs:attribute name="linkPath" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Exclude">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="pattern" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>