miniSql

6136600 » zgc123@gmail.com
11/19/2023 创建
<?xml version="1.0"?>
<!--
Build file for Mini SQL Query.
* To create a build (all binaries): "nant full-build"
* To create a release distribution (all binaries, API docs, SDK etc ==> ZIP files - no PDBs): "nant distro"
-->
<project name="Mini SQL Query" default="build">
  <description>Mini SQL Query build file.</description>
  <property name="project.name" value="MiniSqlQuery"/>
  <property name="project.friendly.name" value="Mini SQL Query"/>
  <property name="project.version" value="1.0"/>
  <property name="project.docs" value="false"/>

  <!-- The release build is the 'public distribution', its should not incude test DLLs -->
  <property name="project.release.type" value="Release - No Tests"/>
  <property name="nant.settings.currentframework" value="net-4.0" />

  <property name="project.description" value="Mini SQL Query by Paul Kohler is a minimalist SQL query tool for multiple providers (MSSQL, Oracle, OLEDB, MS Access files etc). The goal of the Mini SQL Query tool is to allow a developer or trouble-shooter to quickly diagnose issues or make changes to a database using a tool with a small footprint, that is fast and easy to use." />
  <property name="create.assemblyinfo" value="true" />

  <property name="release-base" value="${project::get-base-directory()}\"/>
  <property name="release-build-dir" value="${release-base}ReleaseBuild\"/>
  <property name="release-distro-dir" value="${release-base}DISTRO\"/>
  <property name="release-contrib-dir" value="${release-base}Contrib\"/>

  <target name="full-build" depends="create-common-assemblyinfo,build,copy-licences" description="" />
  <target name="distro" depends="create-common-assemblyinfo,build,copy-licences,zip-release-build" description="" />

  <target name="build" description="compiles the source code for a distribution.">
    <delete dir="${release-build-dir}" />
	<!-- Perform a restore before the build starts -->
    <exec program="msbuild.exe" verbose="false">
      <arg value="-m" />
      <arg value="-property:Configuration=${project.release.type}" />
      <arg value="-restore" />
      <arg value="${project.name}.sln" />
    </exec>
	<!-- Build to specific directory -->
    <exec program="msbuild.exe" verbose="false">
      <arg value="-m" />
      <arg value="-property:Configuration=${project.release.type}" />
      <arg value="-property:OutDir=${release-build-dir}" />
      <arg value="-target:Rebuild" />
      <arg value="${project.name}.sln" />
    </exec>
    <call target="build-contrib-plugins" />
    <delete>
      <!-- Clean up some extras -->
      <fileset>
        <include name="${release-build-dir}*.pdb"/>
        <include name="${release-build-dir}*.xml"/>
      </fileset>
    </delete>
  </target>

  <target name="build-contrib-plugins" depends="create-common-assemblyinfo" description="compiles the plugins under the CONTRIB directory source code for a release distribution.">
    <exec workingdir="${release-contrib-dir}" program="msbuild.exe">
      <arg value="-m" />
      <arg value="-property:Configuration=${project.release.type}" />
      <arg value="-property:OutDir=${release-build-dir}" />
      <arg value="-target:Build" />
    </exec>
  </target>

  <target name="clean-debug" description="">
    <exec program="msbuild.exe">
      <arg value="-property:Configuration=Debug" />
      <arg value="-target:Clean" />
    </exec>
  </target>

  <target name="clean-release" description="">
    <exec program="msbuild.exe">
      <arg value="-property:Configuration=${project.release.type}" />
      <arg value="-target:Clean" />
    </exec>
  </target>

  <target name="zip-release-build" description="Create ZIP file of the ReleaseBuild output, the SDK files and all source.">
    <delete dir="${release-distro-dir}" />
    <mkdir dir="${release-distro-dir}" />
    <copy file="ChangeLog.txt" todir="${release-build-dir}" />
    <copy file="ReadMe.htm" todir="${release-build-dir}" />
    <!--<copy file="MiniSqlQueryQuickStart.docx" todir="${release-build-dir}" />-->
    <zip zipfile="${release-distro-dir}${project.name}.zip" ziplevel="9">
      <fileset basedir="${release-build-dir}" >
        <exclude name="*.xml" />
        <include name="*" />
        <include name="Templates\*" />
        <include name="x86\*" />
        <include name="x64\*" />
      </fileset>
    </zip>
  </target>

  <target name="copy-licences" description="">
    <copy todir="${release-build-dir}">
      <fileset basedir="References">
        <include name="License-*" />
      </fileset>
    </copy>
  </target>

  <target name="create-common-assemblyinfo" if="${create.assemblyinfo}">
    <!-- ensure src/CommonAssemblyInfo.cs is writable if it already exists -->
    <attrib file="CommonAssemblyInfo.cs" readonly="false" if="${file::exists('CommonAssemblyInfo.cs')}" />
    <asminfo output="CommonAssemblyInfo.cs" language="CSharp">
      <imports>
        <import namespace="System" />
        <import namespace="System.Reflection" />
        <import namespace="System.Runtime.InteropServices" />
      </imports>
      <attributes>
        <attribute type="ComVisibleAttribute" value="false" />
        <attribute type="CLSCompliantAttribute" value="true" />
        <attribute type="AssemblyConfigurationAttribute" value="${project.release.type}" />
        <attribute type="AssemblyCompanyAttribute" value="Paul Kohler" />
        <attribute type="AssemblyCopyrightAttribute" value="Copyright (C) 2005-${datetime::get-year(datetime::now())} Paul Kohler" />
      </attributes>
    </asminfo>
  </target>

</project>