Skip to content

Commit 85319c2

Browse files
Fix MilCodeGen and Csp build (#10417)
* Fix MilCodeGen and Csp build * PR feedback * Remove references to SdxRoot * PR feedback
1 parent 33d29f7 commit 85319c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+459
-643
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,7 @@ ASALocalRun/
345345
Network Trash Folder
346346
Temporary Items
347347
.apdisk
348+
349+
# Exceptions to the exclusions
350+
!src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/*.rsp
351+
!src/Microsoft.DotNet.Wpf/src/WpfGfx/tools/csp/**/*.rsp

global.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
},
1414
"msbuild-sdks": {
1515
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25106.4",
16-
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25106.4"
16+
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25106.4",
17+
"Microsoft.Build.NoTargets": "3.7.56"
1718
},
1819
"sdk": {
1920
"version": "10.0.100-alpha.1.25077.2"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# MilCodeGen
2+
This directory contains MilCodeGen, which uses the Csp tool to generate source code for the MIL resources.
3+
4+
## How to run MilCodeGen
5+
Run this command at the root of the WPF repo:
6+
```
7+
build.cmd -projects "src\Microsoft.DotNet.Wpf\src\WpfGfx\codegen\mcg\mcg.proj"
8+
```
9+
10+
## Generated files
11+
List of generated resources:
12+
```
13+
src\Microsoft.DotNet.Wpf\src\WpfGfx\Include\Generated\wgx_resource_types.*
14+
src\Microsoft.DotNet.Wpf\src\WpfGfx\Include\Generated\wgx_sdk_version.*
15+
src\Microsoft.DotNet.Wpf\src\WpfGfx\Include\Generated\*_command*
16+
src\Microsoft.DotNet.Wpf\src\WpfGfx\Include\Generated\wgx_misc.*
17+
src\Microsoft.DotNet.Wpf\src\WpfGfx\Include\Generated\wgx_render_types.h
18+
src\Microsoft.DotNet.Wpf\src\WpfGfx\Include\Generated\wincodec_private_generated.h
19+
src\Microsoft.DotNet.Wpf\src\WpfGfx\Include\Generated\wgx_render_types_generated.h
20+
src\Microsoft.DotNet.Wpf\src\WindowsBase\System\Windows\Converters\Generated\.
21+
src\Microsoft.DotNet.Wpf\src\WindowsBase\System\Windows\Generated\.
22+
src\Microsoft.DotNet.Wpf\src\WindowsBase\System\Windows\Media\Generated\.
23+
src\Microsoft.DotNet.Wpf\src\WindowsBase\System\Windows\Media\Converters\Generated\.
24+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Generated\.
25+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media3D\Converters\Generated\.
26+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media3D\Generated\.
27+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\Animation\Generated\.
28+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\Converters\Generated\.
29+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\Effects\Generated\.
30+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\Generated\.
31+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\Imaging\Generated\.
32+
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Generated\.
33+
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Media\Animation\Generated\.
34+
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\Generated\.
35+
src\Microsoft.DotNet.Wpf\src\WpfGfx\codegen\mcg\ResourceModel\Generated\.
36+
src\Microsoft.DotNet.Wpf\src\WpfGfx\core\resources\*_generated.*
37+
src\Microsoft.DotNet.Wpf\src\WpfGfx\core\uce\generated_*
38+
src\Microsoft.DotNet.Wpf\src\WpfGfx\exts\cmdstruct.h
39+
```
40+
41+
List of generated elements:
42+
```
43+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Generated\UIElement.cs
44+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Generated\UIElement3D.cs
45+
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Generated\ContentElement.cs
46+
```
47+
48+
## Documentation
49+
Control flow in these templates is as follows:
50+
* Execution starts at ResourceGenerator.Main()
51+
* That method invokes the Go() method on each subclass of GeneratorBase.
52+
i.e. it invokes methods like ManagedResource.Go() and DataStruct.Go().

src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/Runtime/FileCodeSink.cs

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ public FileCodeSink(string dir, string filename, bool createDirIfNecessary)
4848
{
4949
Directory.CreateDirectory(dir);
5050
}
51-
52-
_fileCreated = !File.Exists(_filePath);
53-
54-
// If the file exists and is readonly attempt to check out the file.
55-
if (!_fileCreated && ((File.GetAttributes(_filePath) & FileAttributes.ReadOnly) != 0))
56-
{
57-
TfFile(_filePath, "edit");
58-
}
5951

6052
_streamWriter = new StreamWriter(_filePath, false, Encoding.ASCII);
6153
}
@@ -79,40 +71,6 @@ public void Dispose()
7971
Dispose(true);
8072
}
8173

82-
public static void DisableSd()
83-
{
84-
_disableSd = true;
85-
}
86-
87-
public void TfFile(string filename, string op)
88-
{
89-
if (_tfOperation != "")
90-
{
91-
throw new Exception("Internal error");
92-
}
93-
94-
_tfOperation = op;
95-
96-
if (_disableSd) return;
97-
98-
Process tfProcess = new Process();
99-
100-
tfProcess.StartInfo.FileName = "tf.cmd";
101-
tfProcess.StartInfo.Arguments = op + " " + filename;
102-
tfProcess.StartInfo.CreateNoWindow = true;
103-
tfProcess.StartInfo.UseShellExecute = true;
104-
105-
tfProcess.Start();
106-
107-
tfProcess.WaitForExit();
108-
109-
if (0 != tfProcess.ExitCode)
110-
{
111-
throw new ApplicationException("Non-zero return code (" + tfProcess.ExitCode + ") encountered executing:\n"+
112-
tfProcess.StartInfo.FileName + " " + tfProcess.StartInfo.Arguments);
113-
}
114-
}
115-
11674
#endregion Public Methods
11775

11876
//------------------------------------------------------
@@ -155,12 +113,6 @@ protected virtual void Dispose(bool disposing)
155113
_streamWriter = null;
156114
}
157115

158-
if (_fileCreated)
159-
{
160-
// If we created the file, we now need to Sd Add it
161-
TfFile(_filePath, "add");
162-
}
163-
164116
LogCreation();
165117
}
166118

@@ -219,14 +171,8 @@ private void FlushCurrentLine()
219171
// Log the creation of this file, and any sd operations performed.
220172
private void LogCreation()
221173
{
222-
string tf = "";
223-
if (_tfOperation != "")
224-
{
225-
tf = " (and 'tf " + _tfOperation + "')";
226-
}
227-
228174
// Log the creation of this file
229-
Console.WriteLine("\tCreated: {0}{1}", _filePath, tf);
175+
Console.WriteLine("\tCreated: {0}", _filePath);
230176
}
231177
#endregion Private Methods
232178

@@ -237,11 +183,7 @@ private void LogCreation()
237183
//------------------------------------------------------
238184

239185
#region Private Fields
240-
static bool _disableSd = false;
241-
242186
StreamWriter _streamWriter;
243-
bool _fileCreated = true;
244-
string _tfOperation = "";
245187
string _filePath;
246188
bool disposed = false;
247189
string _currentLine = "";

src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/csp.exe.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/csp.exe.manifest

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/AnimationBaseTemplate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ public override void Go(ResourceModel resourceModel)
7979
// requiring that they be split across two namespaces.
8080
switch (instance.ModuleName)
8181
{
82-
case @"Core\CSharp":
82+
case @"PresentationCore":
8383
moduleReference = "using MS.Internal.PresentationCore;";
8484
sridReference =
8585
[[inline]]
8686
using SR=MS.Internal.PresentationCore.SR;
8787
[[/inline]];
8888
break;
89-
case "Framework":
89+
case "PresentationFramework":
9090
moduleReference = "using MS.Internal.PresentationFramework;";
9191
break;
9292
default:

src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/AnimationClockResource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public AnimationClockResource(ResourceModel rm) : base(rm) {}
4848

4949
public override void Go()
5050
{
51-
// AnimationClockResources end up in src\Core\CSharp\system\windows\media\animation
51+
// AnimationClockResources end up in src\PresentationCore\system\windows\media\animation
5252
string generatedPath = Path.Combine(_resourceModel.OutputDirectory,
53-
"src\\Core\\CSharp\\system\\windows\\media\\animation\\generated");
53+
"src\\PresentationCore\\System\\Windows\\Media\\Animation\\Generated");
5454

5555
foreach (McgResource resource in _resourceModel.Resources)
5656
{

src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/AnimationTemplate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ public override void Go(ResourceModel resourceModel)
9090
// requiring that they be split across two namespaces.
9191
switch (instance.ModuleName)
9292
{
93-
case @"Core\CSharp":
93+
case @"PresentationCore":
9494
moduleReference = "using MS.Internal.PresentationCore;";
9595
break;
96-
case "Framework":
96+
case "PresentationFramework":
9797
moduleReference = "using MS.Internal.PresentationFramework;";
9898
break;
9999
}

src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/AnimationUsingKeyFramesTemplate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ public override void Go(ResourceModel resourceModel)
7777
// requiring that they be split across two namespaces.
7878
switch (instance.ModuleName)
7979
{
80-
case @"Core\CSharp":
80+
case @"PresentationCore":
8181
moduleReference = "using MS.Internal.PresentationCore;";
8282
sridReference =
8383
[[inline]]
8484
using SR=MS.Internal.PresentationCore.SR;
8585
[[/inline]];
8686
break;
87-
case "Framework":
87+
case "PresentationFramework":
8888
moduleReference = "using MS.Internal.PresentationFramework;";
8989
break;
9090
}

0 commit comments

Comments
 (0)