diff options
Diffstat (limited to '')
-rw-r--r-- | Prebuild/src/Prebuild.cs | 165 | ||||
-rw-r--r-- | Prebuild/src/Prebuild.csproj | 199 |
2 files changed, 364 insertions, 0 deletions
diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs new file mode 100644 index 0000000..597db68 --- /dev/null +++ b/Prebuild/src/Prebuild.cs | |||
@@ -0,0 +1,165 @@ | |||
1 | #region BSD License | ||
2 | /* | ||
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | ||
6 | provided that the following conditions are met: | ||
7 | |||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
9 | and the following disclaimer. | ||
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | ||
11 | and the following disclaimer in the documentation and/or other materials provided with the | ||
12 | distribution. | ||
13 | * The name of the author may not be used to endorse or promote products derived from this software | ||
14 | without specific prior written permission. | ||
15 | |||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | */ | ||
24 | #endregion | ||
25 | |||
26 | #region CVS Information | ||
27 | /* | ||
28 | * $Source$ | ||
29 | * $Author: jendave $ | ||
30 | * $Date: 2006-09-26 23:43:35 +0200 (ti, 26 sep 2006) $ | ||
31 | * $Revision: 168 $ | ||
32 | */ | ||
33 | #endregion | ||
34 | |||
35 | using System; | ||
36 | using System.Collections.Specialized; | ||
37 | using System.IO; | ||
38 | using System.Reflection; | ||
39 | using System.Runtime.InteropServices; | ||
40 | using System.EnterpriseServices.Internal; | ||
41 | |||
42 | using Prebuild.Core; | ||
43 | using Prebuild.Core.Utilities; | ||
44 | |||
45 | namespace Prebuild | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// | ||
49 | /// </summary> | ||
50 | class Prebuild | ||
51 | { | ||
52 | #region Main | ||
53 | |||
54 | [STAThread] | ||
55 | static void Main(string[] args) | ||
56 | { | ||
57 | Kernel kernel = null; | ||
58 | try | ||
59 | { | ||
60 | kernel = Kernel.Instance; | ||
61 | kernel.Initialize(LogTargets.File | LogTargets.Console, args); | ||
62 | bool exit = false; | ||
63 | |||
64 | if(kernel.CommandLine.WasPassed("usage")) | ||
65 | { | ||
66 | exit = true; | ||
67 | OutputUsage(); | ||
68 | } | ||
69 | if(kernel.CommandLine.WasPassed("showtargets")) | ||
70 | { | ||
71 | exit = true; | ||
72 | OutputTargets(kernel); | ||
73 | } | ||
74 | if(kernel.CommandLine.WasPassed("install")) | ||
75 | { | ||
76 | exit = true; | ||
77 | InstallAssembly(kernel); | ||
78 | } | ||
79 | if(kernel.CommandLine.WasPassed("remove")) | ||
80 | { | ||
81 | exit = true; | ||
82 | RemoveAssembly(kernel); | ||
83 | } | ||
84 | |||
85 | if(!exit) | ||
86 | { | ||
87 | kernel.Process(); | ||
88 | } | ||
89 | } | ||
90 | catch(Exception ex) | ||
91 | { | ||
92 | Console.WriteLine("Unhandled error: {0}", ex.Message); | ||
93 | //#if DEBUG | ||
94 | Console.WriteLine("{0}", ex.StackTrace); | ||
95 | //#endif | ||
96 | } | ||
97 | finally | ||
98 | { | ||
99 | if(kernel.PauseAfterFinish) | ||
100 | { | ||
101 | Console.WriteLine("\nPress enter to continue..."); | ||
102 | Console.ReadLine(); | ||
103 | } | ||
104 | } | ||
105 | } | ||
106 | |||
107 | #endregion | ||
108 | |||
109 | #region Private Methods | ||
110 | |||
111 | private static void InstallAssembly(Kernel kernel) | ||
112 | { | ||
113 | Publish publish = new Publish(); | ||
114 | string file = kernel.CommandLine["install"]; | ||
115 | //Console.WriteLine(".."+file+".."); | ||
116 | publish.GacInstall(file); | ||
117 | } | ||
118 | |||
119 | private static void RemoveAssembly(Kernel kernel) | ||
120 | { | ||
121 | Publish publish = new Publish(); | ||
122 | string file = kernel.CommandLine["remove"]; | ||
123 | publish.GacRemove(file); | ||
124 | } | ||
125 | |||
126 | private static void OutputUsage() | ||
127 | { | ||
128 | Console.WriteLine("Usage: prebuild /target <target> [options]"); | ||
129 | Console.WriteLine("Available command-line switches:"); | ||
130 | Console.WriteLine(); | ||
131 | Console.WriteLine("/target Target for Prebuild"); | ||
132 | Console.WriteLine("/clean Clean the build files for the given target"); | ||
133 | Console.WriteLine("/file XML file to process"); | ||
134 | Console.WriteLine("/log Log file to write to"); | ||
135 | Console.WriteLine("/ppo Pre-process the file, but perform no other processing"); | ||
136 | Console.WriteLine("/pause Pauses the application after execution to view the output"); | ||
137 | Console.WriteLine("/yes Default to yes to any questions asked"); | ||
138 | Console.WriteLine("/install Install assembly into the GAC"); | ||
139 | Console.WriteLine("/remove Remove assembly from the GAC"); | ||
140 | Console.WriteLine(); | ||
141 | Console.WriteLine("See 'prebuild /showtargets for a list of available targets"); | ||
142 | Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information"); | ||
143 | Console.WriteLine(); | ||
144 | } | ||
145 | |||
146 | private static void OutputTargets(Kernel kern) | ||
147 | { | ||
148 | Console.WriteLine("Targets available in Prebuild:"); | ||
149 | Console.WriteLine(""); | ||
150 | if(kern.Targets.Keys.Count > 0) | ||
151 | { | ||
152 | string[] targs = new string[kern.Targets.Keys.Count]; | ||
153 | kern.Targets.Keys.CopyTo(targs, 0); | ||
154 | Array.Sort(targs); | ||
155 | foreach(string target in targs) | ||
156 | { | ||
157 | Console.WriteLine(target); | ||
158 | } | ||
159 | } | ||
160 | Console.WriteLine(""); | ||
161 | } | ||
162 | |||
163 | #endregion | ||
164 | } | ||
165 | } | ||
diff --git a/Prebuild/src/Prebuild.csproj b/Prebuild/src/Prebuild.csproj new file mode 100644 index 0000000..82589c2 --- /dev/null +++ b/Prebuild/src/Prebuild.csproj | |||
@@ -0,0 +1,199 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{A5CC8344-BEE4-442E-92F1-FBCB05D6AB78}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon>App.ico</ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>prebuild</AssemblyName> | ||
13 | <AssemblyOriginatorKeyFile>Prebuild.snk</AssemblyOriginatorKeyFile> | ||
14 | <SignAssembly>true</SignAssembly> | ||
15 | <DefaultClientScript>JScript</DefaultClientScript> | ||
16 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
17 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
18 | <DelaySign>false</DelaySign> | ||
19 | <OutputType>Exe</OutputType> | ||
20 | <AppDesignerFolder> | ||
21 | </AppDesignerFolder> | ||
22 | <RootNamespace>Prebuild</RootNamespace> | ||
23 | <StartupObject>Prebuild.Prebuild</StartupObject> | ||
24 | <FileUpgradeFlags> | ||
25 | </FileUpgradeFlags> | ||
26 | </PropertyGroup> | ||
27 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
28 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
29 | <BaseAddress>285212672</BaseAddress> | ||
30 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
31 | <ConfigurationOverrideFile> | ||
32 | </ConfigurationOverrideFile> | ||
33 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
34 | <DocumentationFile> | ||
35 | </DocumentationFile> | ||
36 | <DebugSymbols>True</DebugSymbols> | ||
37 | <FileAlignment>4096</FileAlignment> | ||
38 | <Optimize>False</Optimize> | ||
39 | <OutputPath>..\bin\</OutputPath> | ||
40 | <RegisterForComInterop>False</RegisterForComInterop> | ||
41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
43 | <WarningLevel>4</WarningLevel> | ||
44 | <NoWarn>1595</NoWarn> | ||
45 | </PropertyGroup> | ||
46 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
47 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
48 | <BaseAddress>285212672</BaseAddress> | ||
49 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
50 | <ConfigurationOverrideFile> | ||
51 | </ConfigurationOverrideFile> | ||
52 | <DefineConstants>TRACE</DefineConstants> | ||
53 | <DocumentationFile> | ||
54 | </DocumentationFile> | ||
55 | <DebugSymbols>False</DebugSymbols> | ||
56 | <FileAlignment>4096</FileAlignment> | ||
57 | <Optimize>True</Optimize> | ||
58 | <OutputPath>..\bin\</OutputPath> | ||
59 | <RegisterForComInterop>False</RegisterForComInterop> | ||
60 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
61 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
62 | <WarningLevel>4</WarningLevel> | ||
63 | <NoWarn>1595</NoWarn> | ||
64 | </PropertyGroup> | ||
65 | <ItemGroup> | ||
66 | </ItemGroup> | ||
67 | <ItemGroup> | ||
68 | <EmbeddedResource Include="App.ico"> | ||
69 | </EmbeddedResource> | ||
70 | <EmbeddedResource Include="data\prebuild-1.7.xsd"> | ||
71 | </EmbeddedResource> | ||
72 | <Compile Include="Prebuild.cs"> | ||
73 | <SubType>Code</SubType> | ||
74 | </Compile> | ||
75 | <Compile Include="Core\FatalException.cs"> | ||
76 | <SubType>Code</SubType> | ||
77 | </Compile> | ||
78 | <Compile Include="Core\Kernel.cs"> | ||
79 | <SubType>Code</SubType> | ||
80 | </Compile> | ||
81 | <Compile Include="Core\UnknownLanguageException.cs"> | ||
82 | <SubType>Code</SubType> | ||
83 | </Compile> | ||
84 | <Compile Include="Core\WarningException.cs"> | ||
85 | <SubType>Code</SubType> | ||
86 | </Compile> | ||
87 | <Compile Include="Core\Attributes\DataNodeAttribute.cs"> | ||
88 | <SubType>Code</SubType> | ||
89 | </Compile> | ||
90 | <Compile Include="Core\Attributes\OptionNodeAttribute.cs"> | ||
91 | <SubType>Code</SubType> | ||
92 | </Compile> | ||
93 | <Compile Include="Core\Attributes\TargetAttribute.cs"> | ||
94 | <SubType>Code</SubType> | ||
95 | </Compile> | ||
96 | <Compile Include="Core\Interfaces\IDataNode.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
99 | <Compile Include="Core\Interfaces\ITarget.cs"> | ||
100 | <SubType>Code</SubType> | ||
101 | </Compile> | ||
102 | <Compile Include="Core\Nodes\ConfigurationNode.cs"> | ||
103 | <SubType>Code</SubType> | ||
104 | </Compile> | ||
105 | <Compile Include="Core\Nodes\DataNode.cs"> | ||
106 | <SubType>Code</SubType> | ||
107 | </Compile> | ||
108 | <Compile Include="Core\Nodes\ExcludeNode.cs"> | ||
109 | <SubType>Code</SubType> | ||
110 | </Compile> | ||
111 | <Compile Include="Core\Nodes\FileNode.cs"> | ||
112 | <SubType>Code</SubType> | ||
113 | </Compile> | ||
114 | <Compile Include="Core\Nodes\FilesNode.cs"> | ||
115 | <SubType>Code</SubType> | ||
116 | </Compile> | ||
117 | <Compile Include="Core\Nodes\MatchNode.cs"> | ||
118 | <SubType>Code</SubType> | ||
119 | </Compile> | ||
120 | <Compile Include="Core\Nodes\OptionsNode.cs"> | ||
121 | <SubType>Code</SubType> | ||
122 | </Compile> | ||
123 | <Compile Include="Core\Nodes\ProcessNode.cs"> | ||
124 | <SubType>Code</SubType> | ||
125 | </Compile> | ||
126 | <Compile Include="Core\Nodes\ProjectNode.cs"> | ||
127 | <SubType>Code</SubType> | ||
128 | </Compile> | ||
129 | <Compile Include="Core\Nodes\ReferenceNode.cs"> | ||
130 | <SubType>Code</SubType> | ||
131 | </Compile> | ||
132 | <Compile Include="Core\Nodes\ReferencePathNode.cs"> | ||
133 | <SubType>Code</SubType> | ||
134 | </Compile> | ||
135 | <Compile Include="Core\Nodes\SolutionNode.cs"> | ||
136 | <SubType>Code</SubType> | ||
137 | </Compile> | ||
138 | <Compile Include="Core\Parse\IfContext.cs"> | ||
139 | <SubType>Code</SubType> | ||
140 | </Compile> | ||
141 | <Compile Include="Core\Parse\Preprocessor.cs"> | ||
142 | <SubType>Code</SubType> | ||
143 | </Compile> | ||
144 | <Compile Include="Core\Targets\AutotoolsTarget.cs"> | ||
145 | <SubType>Code</SubType> | ||
146 | </Compile> | ||
147 | <Compile Include="Core\Targets\DebugTarget.cs"> | ||
148 | <SubType>Code</SubType> | ||
149 | </Compile> | ||
150 | <Compile Include="Core\Targets\MonoDevelopTarget.cs"> | ||
151 | <SubType>Code</SubType> | ||
152 | </Compile> | ||
153 | <Compile Include="Core\Targets\NAntTarget.cs"> | ||
154 | <SubType>Code</SubType> | ||
155 | </Compile> | ||
156 | <Compile Include="Core\Targets\SharpDevelop2Target.cs"> | ||
157 | <SubType>Code</SubType> | ||
158 | </Compile> | ||
159 | <Compile Include="Core\Targets\SharpDevelopTarget.cs"> | ||
160 | <SubType>Code</SubType> | ||
161 | </Compile> | ||
162 | <Compile Include="Core\Targets\VS2002Target.cs"> | ||
163 | <SubType>Code</SubType> | ||
164 | </Compile> | ||
165 | <Compile Include="Core\Targets\VS2003Target.cs"> | ||
166 | <SubType>Code</SubType> | ||
167 | </Compile> | ||
168 | <Compile Include="Core\Targets\VS2005Target.cs"> | ||
169 | <SubType>Code</SubType> | ||
170 | </Compile> | ||
171 | <Compile Include="Core\Utilities\CommandLineCollection.cs"> | ||
172 | <SubType>Code</SubType> | ||
173 | </Compile> | ||
174 | <Compile Include="Core\Utilities\CurrentDirectory.cs"> | ||
175 | <SubType>Code</SubType> | ||
176 | </Compile> | ||
177 | <Compile Include="Core\Utilities\Helper.cs"> | ||
178 | <SubType>Code</SubType> | ||
179 | </Compile> | ||
180 | <Compile Include="Core\Utilities\Log.cs"> | ||
181 | <SubType>Code</SubType> | ||
182 | </Compile> | ||
183 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
184 | <SubType>Code</SubType> | ||
185 | </Compile> | ||
186 | </ItemGroup> | ||
187 | <ItemGroup> | ||
188 | <Reference Include="System" /> | ||
189 | <Reference Include="System.EnterpriseServices" /> | ||
190 | <Reference Include="System.XML" /> | ||
191 | </ItemGroup> | ||
192 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
193 | <PropertyGroup> | ||
194 | <PreBuildEvent> | ||
195 | </PreBuildEvent> | ||
196 | <PostBuildEvent> | ||
197 | </PostBuildEvent> | ||
198 | </PropertyGroup> | ||
199 | </Project> \ No newline at end of file | ||