Permalink
Browse files

Preprocessor internal/pre-built tool (should help fix build errors)

  • Loading branch information...
1 parent 25e2864 commit afbf15dc7319ee6a4e9d4689009dcb74214aa8c9 @nikhilk committed Jul 31, 2012
@@ -41,10 +41,10 @@
<Content Include="TypeSystem\Type.js" />
</ItemGroup>
<Target Name="Build">
- <Exec Command="$(OutputPath)\sspp.exe /nologo /debug /d:DEBUG /crlf /input:$(ProjectDir)mscorlib.js /output:$(OutputPath)\mscorlib.debug.js" />
- <Exec Command="$(OutputPath)\sspp.exe /nologo /stripCommentsOnly /crlf /input:$(ProjectDir)mscorlib.js /output:$(OutputPath)\mscorlib.rel.js" />
- <Exec Command="$(OutputPath)\sspp.exe /nologo /debug /d:DEBUG /crlf /input:$(ProjectDir)loader.js /output:$(OutputPath)\ssloader.debug.js" />
- <Exec Command="$(OutputPath)\sspp.exe /nologo /stripCommentsOnly /crlf /input:$(ProjectDir)loader.js /output:$(OutputPath)\ssloader.rel.js" />
+ <Exec Command="$(ToolsPath)\sspp.exe /nologo /debug /d:DEBUG /crlf /input:$(ProjectDir)mscorlib.js /output:$(OutputPath)\mscorlib.debug.js" />
+ <Exec Command="$(ToolsPath)\sspp.exe /nologo /stripCommentsOnly /crlf /input:$(ProjectDir)mscorlib.js /output:$(OutputPath)\mscorlib.rel.js" />
+ <Exec Command="$(ToolsPath)\sspp.exe /nologo /debug /d:DEBUG /crlf /input:$(ProjectDir)loader.js /output:$(OutputPath)\ssloader.debug.js" />
+ <Exec Command="$(ToolsPath)\sspp.exe /nologo /stripCommentsOnly /crlf /input:$(ProjectDir)loader.js /output:$(OutputPath)\ssloader.rel.js" />
<Exec Command="$(ToolsPath)\ajaxmin.exe -clobber:true $(OutputPath)\mscorlib.rel.js -out $(OutputPath)\mscorlib.js" />
<Exec Command="$(ToolsPath)\ajaxmin.exe -clobber:true $(OutputPath)\ssloader.rel.js -out $(OutputPath)\ssloader.js" />
</Target>
View
@@ -25,16 +25,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FxCop", "Tools\FxCop\FxCop.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compiler", "Core\Compiler\Compiler.csproj", "{1772A38C-7204-42DC-B81D-6C74D17A4F66}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Preprocessor", "Tools\Preprocessor\Preprocessor.csproj", "{35370E49-29C1-4121-A357-3CCE460B7CF5}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "Core\Build\Build.csproj", "{BE1E0A21-F6C0-4698-B405-66FC2BB289F4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZipX", "ZipX\ZipX.csproj", "{4123C976-739E-42A2-87FB-E04D163BC99C}"
ProjectSection(ProjectDependencies) = postProject
{1772A38C-7204-42DC-B81D-6C74D17A4F66} = {1772A38C-7204-42DC-B81D-6C74D17A4F66}
{2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} = {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43}
{31456150-1093-407F-9231-58D0F663945D} = {31456150-1093-407F-9231-58D0F663945D}
- {35370E49-29C1-4121-A357-3CCE460B7CF5} = {35370E49-29C1-4121-A357-3CCE460B7CF5}
{3681A9A8-FC40-4125-B842-7775713C8DCE} = {3681A9A8-FC40-4125-B842-7775713C8DCE}
{36D4B098-A21C-4725-ACD3-400922885F38} = {36D4B098-A21C-4725-ACD3-400922885F38}
{4A9F7CE0-5A45-4B28-AD01-05528709B6E4} = {4A9F7CE0-5A45-4B28-AD01-05528709B6E4}
@@ -106,18 +103,6 @@ Global
{31456150-1093-407F-9231-58D0F663945D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{31456150-1093-407F-9231-58D0F663945D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{31456150-1093-407F-9231-58D0F663945D}.Release|x86.ActiveCfg = Release|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Debug|.NET.ActiveCfg = Debug|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Release|.NET.ActiveCfg = Release|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Release|Any CPU.Build.0 = Release|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {35370E49-29C1-4121-A357-3CCE460B7CF5}.Release|x86.ActiveCfg = Release|Any CPU
{3681A9A8-FC40-4125-B842-7775713C8DCE}.Debug|.NET.ActiveCfg = Debug|Any CPU
{3681A9A8-FC40-4125-B842-7775713C8DCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3681A9A8-FC40-4125-B842-7775713C8DCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
@@ -270,7 +255,6 @@ Global
{1772A38C-7204-42DC-B81D-6C74D17A4F66} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D}
{2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB}
{31456150-1093-407F-9231-58D0F663945D} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E}
- {35370E49-29C1-4121-A357-3CCE460B7CF5} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E}
{3681A9A8-FC40-4125-B842-7775713C8DCE} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB}
{36D4B098-A21C-4725-ACD3-400922885F38} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D}
{4123C976-739E-42A2-87FB-E04D163BC99C} = {BB2DB888-0F52-4CB5-9625-9D99A33DCE4F}
@@ -1,11 +0,0 @@
-// AssemblyInfo.cs
-// Script#/Tools/Preprocessor
-// This source code is subject to terms and conditions of the Apache License, Version 2.0.
-//
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("sspp")]
-[assembly: AssemblyDescription("Script# Preprocessor")]
@@ -0,0 +1,134 @@
+// CommandLine.cs
+// Script#/Common
+// This source code is subject to terms and conditions of the Apache License, Version 2.0.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+
+namespace ScriptSharp {
+
+ internal sealed class CommandLine {
+
+ private string[] _arguments;
+ private IDictionary _options;
+ private bool _showHelp;
+ private bool _hideAbout;
+
+ public CommandLine(string[] args) {
+ if (args == null) {
+ throw new ArgumentNullException("args");
+ }
+ args = ExpandResponseFileArguments(args);
+
+ ArrayList argList = new ArrayList();
+
+ for (int i = 0; i < args.Length; i++) {
+ char c = args[i][0];
+ if ((c != '/') && (c != '-')) {
+ argList.Add(args[i]);
+ }
+ else {
+ int index = args[i].IndexOf(':');
+ if (index == -1) {
+ string option = args[i].Substring(1);
+ if ((String.Compare(option, "help", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (String.Compare(option, "?", StringComparison.Ordinal) == 0)) {
+ _showHelp = true;
+ }
+ else if (String.Compare(option, "nologo", StringComparison.OrdinalIgnoreCase) == 0) {
+ _hideAbout = true;
+ }
+ else {
+ Options[option] = String.Empty;
+ }
+ }
+ else {
+ string optionName = args[i].Substring(1, index - 1);
+ string optionValue = args[i].Substring(index + 1);
+
+ if (Options.Contains(optionName)) {
+ object existingValue = Options[optionName];
+ if (existingValue is string) {
+ ArrayList valueList = new ArrayList();
+ valueList.Add(existingValue);
+ valueList.Add(optionValue);
+
+ Options[optionName] = valueList;
+ }
+ else {
+ Debug.Assert(existingValue is ArrayList);
+
+ ArrayList valueList = (ArrayList)existingValue;
+ valueList.Add(optionValue);
+ }
+ }
+ else {
+ Options[optionName] = optionValue;
+ }
+ }
+ }
+ }
+ _arguments = (string[])argList.ToArray(typeof(string));
+ }
+
+ public string[] Arguments {
+ get {
+ return _arguments;
+ }
+ }
+
+ public bool HideAbout {
+ get {
+ return _hideAbout;
+ }
+ }
+
+ public IDictionary Options {
+ get {
+ if (_options == null) {
+ _options = new HybridDictionary(true);
+ }
+ return _options;
+ }
+ }
+
+ public bool ShowHelp {
+ get {
+ return _showHelp;
+ }
+ }
+
+ private string[] ExpandResponseFileArguments(string[] args) {
+ List<string> expandedArgs = new List<string>();
+
+ for (int i = 0; i < args.Length; i++) {
+ if ((args[i].Length > 1) && args[i].StartsWith("@")) {
+ string responseFile = args[i].Substring(1);
+
+ if (File.Exists(responseFile)) {
+ using (TextReader reader = File.OpenText(responseFile)) {
+ string line;
+ while ((line = reader.ReadLine()) != null) {
+ line = line.Trim();
+ if (line.Length > 0) {
+ expandedArgs.Add(line);
+ }
+ }
+ }
+ }
+ }
+ else {
+ expandedArgs.Add(args[i]);
+ }
+ }
+
+ return expandedArgs.ToArray();
+ }
+ }
+}
@@ -0,0 +1,54 @@
+// FileInputStreamSource.cs
+// Script#/Common
+// This source code is subject to terms and conditions of the Apache License, Version 2.0.
+//
+
+using System;
+using System.Diagnostics;
+using System.IO;
+
+namespace ScriptSharp {
+
+ internal class FileInputStreamSource : IStreamSource {
+
+ private string _path;
+ private string _name;
+
+ public FileInputStreamSource(string path)
+ : this(path, path) {
+ }
+
+ public FileInputStreamSource(string path, string name) {
+ _path = path;
+ _name = name;
+ }
+
+ public string FullName {
+ get {
+ return Path.GetFullPath(_path);
+ }
+ }
+
+ public string Name {
+ get {
+ return _name;
+ }
+ }
+
+ public void CloseStream(Stream stream) {
+ Debug.Assert(stream != null);
+ Debug.Assert(stream is FileStream);
+
+ stream.Close();
+ }
+
+ public Stream GetStream() {
+ try {
+ return new FileStream(FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
+ }
+ catch {
+ return null;
+ }
+ }
+ }
+}
@@ -0,0 +1,61 @@
+// FileOutputStreamSource.cs
+// Script#/Common
+// This source code is subject to terms and conditions of the Apache License, Version 2.0.
+//
+
+using System;
+using System.Diagnostics;
+using System.IO;
+
+namespace ScriptSharp {
+
+ internal class FileOutputStreamSource : IStreamSource {
+
+ private string _path;
+ private string _name;
+
+ public FileOutputStreamSource(string path)
+ : this(path, path) {
+ }
+
+ public FileOutputStreamSource(string path, string name) {
+ _path = path;
+ _name = name;
+ }
+
+ public string FullName {
+ get {
+ return Path.GetFullPath(_path);
+ }
+ }
+
+ public string Name {
+ get {
+ return _name;
+ }
+ }
+
+ public void CloseStream(Stream stream) {
+ Debug.Assert(stream != null);
+ Debug.Assert(stream is FileStream);
+
+ stream.Close();
+ }
+
+ public Stream GetStream() {
+ try {
+ string file = FullName;
+
+ string directory = Path.GetDirectoryName(file);
+ if (Directory.Exists(directory) == false) {
+ Directory.CreateDirectory(directory);
+ }
+
+ return new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None);
+ }
+ catch {
+ return null;
+ }
+ }
+ }
+}
@@ -0,0 +1,14 @@
+// IErrorHandler.cs
+// Script#/Core/ScriptSharp
+// This source code is subject to terms and conditions of the Apache License, Version 2.0.
+//
+
+using System;
+
+namespace ScriptSharp {
+
+ public interface IErrorHandler {
+
+ void ReportError(string errorMessage, string location);
+ }
+}
@@ -0,0 +1,15 @@
+// IScriptInfo.cs
+// Script#/Core/ScriptSharp
+// This source code is subject to terms and conditions of the Apache License, Version 2.0.
+//
+
+using System;
+using System.IO;
+
+namespace ScriptSharp {
+
+ internal interface IScriptInfo {
+
+ string GetValue(string name);
+ }
+}
@@ -0,0 +1,15 @@
+// IStreamResolver.cs
+// Script#/Core/ScriptSharp
+// This source code is subject to terms and conditions of the Apache License, Version 2.0.
+//
+
+using System;
+using System.IO;
+
+namespace ScriptSharp {
+
+ public interface IStreamResolver {
+
+ IStreamSource ResolveInclude(IStreamSource baseStream, string includePath);
+ }
+}
@@ -0,0 +1,25 @@
+// IStreamSource.cs
+// Script#/Core/ScriptSharp
+// This source code is subject to terms and conditions of the Apache License, Version 2.0.
+//
+
+using System;
+using System.IO;
+
+namespace ScriptSharp {
+
+ public interface IStreamSource {
+
+ string FullName {
+ get;
+ }
+
+ string Name {
+ get;
+ }
+
+ void CloseStream(Stream stream);
+
+ Stream GetStream();
+ }
+}
Oops, something went wrong.

0 comments on commit afbf15d

Please sign in to comment.