[Mono-list] About CSProj -> Makefile

yoros@wanadoo.es yoros@wanadoo.es
Tue, 29 Apr 2003 02:34:44 +0200


--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit


Hello,

I have a sample of what could be the conversion of .csproj file to
makefile using XSL.

Compile XslTransform and then run:

    ./XmlTransform.exe prueba.csproj prueba.xsl

Then you'll get the output Makefile in the screen.

Please, feedback any idea or question. I will be back in about 18-20
hours and I could not reply soon. Thank you.

Regards,

    Pedro

-- 
Pedro Martínez Juliá
\  yoros@terra.es
)|    yoros@wanadoo.es
/        http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information:  pub  1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC

--8t9RHnE3ZwKMSgU+
Content-Type: text/xml; charset=us-ascii
Content-Disposition: attachment; filename="prueba.xsl"

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="VisualStudioProject">
# VisualStudioProject
<xsl:apply-templates/>
# End Project
  </xsl:template>

  <xsl:template match="CSHARP">
    <xsl:apply-templates/>

$(ASMNAME): $(DEPS)
	$(CSC) /out:$(ASMNAME) $(SOURCES) $(REFERENCES)
	cp $(ASMNAME) $(OUTPUTPATH)
  </xsl:template>

  <xsl:template match="Build">
    <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="Settings">
ASMNAME = <xsl:if test="@OutputType='Exe'"><xsl:value-of select="@AssemblyName"/>.exe</xsl:if><xsl:if test="@OutputType='Library'"><xsl:value-of select="@AssemblyName"/>.dll</xsl:if>

    <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="Config">
    <xsl:if test="@Name = 'Release'">
OUTPUTPATH = <xsl:value-of select="@OutputPath"/></xsl:if>
    <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="References">
REFERENCES =<xsl:apply-templates/>
  </xsl:template>
 
  <xsl:template match="Reference"> /r:<xsl:value-of select="@Name"/>.dll</xsl:template>
  
  <xsl:template match="Files">
    <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="Include">
SOURCES =<xsl:apply-templates/>
  </xsl:template>
  
<xsl:template match="File"><xsl:if test="@BuildAction = 'Compile'">&#32;<xsl:value-of select="@RelPath"/></xsl:if></xsl:template>
  
</xsl:stylesheet>

--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="prueba.csproj"

<VisualStudioProject>
    <CSHARP
        ProjectType = "Local"
        ProductVersion = "7.0.9466"
        SchemaVersion = "1.0"
        ProjectGuid = "{62F3C092-D33B-46F9-B86E-8E1DEB1E533D}"
    >
        <Build>
            <Settings
                ApplicationIcon = "App.ico"
                AssemblyKeyContainerName = ""
                AssemblyName = "EchoClient"
                AssemblyOriginatorKeyFile = ""
                DefaultClientScript = "JScript"
                DefaultHTMLPageLayout = "Grid"
                DefaultTargetSchema = "IE50"
                DelaySign = "false"
                OutputType = "Exe"
                RootNamespace = "EchoClient"
                StartupObject = ""
            >
                <Config
                    Name = "Debug"
                    AllowUnsafeBlocks = "false"
                    BaseAddress = "285212672"
                    CheckForOverflowUnderflow = "false"
                    ConfigurationOverrideFile = ""
                    DefineConstants = "DEBUG;TRACE"
                    DocumentationFile = ""
                    DebugSymbols = "true"
                    FileAlignment = "4096"
                    IncrementalBuild = "true"
                    Optimize = "false"
                    OutputPath = "bin\Debug\"
                    RegisterForComInterop = "false"
                    RemoveIntegerChecks = "false"
                    TreatWarningsAsErrors = "false"
                    WarningLevel = "4"
                />
                <Config
                    Name = "Release"
                    AllowUnsafeBlocks = "false"
                    BaseAddress = "285212672"
                    CheckForOverflowUnderflow = "false"
                    ConfigurationOverrideFile = ""
                    DefineConstants = "TRACE"
                    DocumentationFile = ""
                    DebugSymbols = "false"
                    FileAlignment = "4096"
                    IncrementalBuild = "false"
                    Optimize = "true"
                    OutputPath = "bin\Release\"
                    RegisterForComInterop = "false"
                    RemoveIntegerChecks = "false"
                    TreatWarningsAsErrors = "false"
                    WarningLevel = "4"
                />
            </Settings>
            <References>
                <Reference
                    Name = "System"
                    AssemblyName = "System"
                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
                />
                <Reference
                    Name = "RemotingCorbaLibrary"
                    Project = "{1114D980-183E-41C8-B5CD-F9F4DB5C187D}"
                    Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
                />
            </References>
        </Build>
        <Files>
            <Include>
                <File
                    RelPath = "App.ico"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "AssemblyInfo.cs"
                    SubType = "Code"
                    BuildAction = "Compile"
                />
                <File
                    RelPath = "EchoClient.cs"
                    SubType = "Code"
                    BuildAction = "Compile"
                />
            </Include>
        </Files>
    </CSHARP>
</VisualStudioProject>


--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="XmlTransform.cs"

using System;
using System.Xml.Xsl;
using System.Xml;
using System.Xml.XPath;

public class EntryPoint {

	public static void Main (string[] args) {
		XslTransform xslt = new XslTransform();
		xslt.Load(args[1]);
		XPathDocument mydata = new XPathDocument(args[0]);
		XmlWriter writer = new XmlTextWriter(Console.Out);
		xslt.Transform(mydata,null,writer);
	}

}

--8t9RHnE3ZwKMSgU+--