<commit_before><!--

  build file to allow ant (http://jakarta.apache.org/ant/) to be used
  to build the PostgreSQL JDBC Driver.

  $Id$

-->

<project name="postgresqlJDBC" default="jar" basedir=".">

  <!-- set global properties for this build -->
  <property name="src"     value="." />
  <property name="jars"    value="jars" />
  <property name="dest"    value="build" />
  <property name="package" value="org/postgresql" />

  <!--
    defaults for the tests - overide these if required
    junit.ui is one of textui, awtui or swingui

    password must be something. Doesnt matter if trust is used!
  -->
  <property name="database" value="jdbc:postgresql:test" />
  <property name="username" value="test" />
  <property name="password" value="password" />
  <property name="tablename" value="jdbctest" />
  <property name="junit.ui" value="textui" />

  <!--
    This is a simpler method than utils.CheckVersion
    It defaults to jdbc1, but builds jdbc2 if the java.lang.Byte class is
    in the CLASSPATH (ie JDK1.2 or later), and then enterprise if the
    javax.sql.DataSource class is present.

    Important: This must have the following order: jdbc1, jdbc2, enterprise
  -->
  <target name="check_versions">
    <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
    <available property="jdk1.3+" classname="java.lang.StrictMath" />
    <available property="jdk1.2e+" classname="javax.sql.DataSource" />
    <available property="junit" classname="junit.framework.Test" />
  </target>

  <!--
    This generates Driver.java from Driver.java.in
    It's required for importing the driver version properties
  -->
  <target name="driver" depends="prepare,check_versions">

    <!-- determine the edition text -->
    <property name="edition" value="JDBC1" />
    <available property="edition" value="JDBC2" classname="java.lang.ThreadLocal" />
    <available property="edition" value="JDBC2" classname="java.lang.StrictMath" />
    <available property="edition" value="JDBC2 Enterprise" classname="javax.sql.DataSource" />

    <!-- determine the connection class -->
    <property name="connectclass" value="org.postgresql.jdbc1.Connection" />
    <available property="connectclass" value="org.postgresql.jdbc2.Connection" classname="java.lang.ThreadLocal" />

    <!-- comment out 1.3+ stuff -->
    <property name="jdk13only" value="//" />
    <available property="jdk13only" value="" classname="java.lang.StrictMath" />
    <filter token="JDK1.3ONLY" value="${jdk13only}" />

    <!-- Some defaults -->
    <filter token="MAJORVERSION" value="${major}" />
    <filter token="MINORVERSION" value="${minor}" />
    <filter token="VERSION" value="PostgreSQL ${fullversion} ${edition}" />
    <filter token="JDBCCONNECTCLASS" value="${connectclass}" />
    <filter token="DEF_PGPORT" value="${def_pgport}" />

    <!-- Put a check for the current version here -->

    <!-- now copy and filter the file -->
    <copy file="${package}/Driver.java.in"
          tofile="${package}/Driver.java"
          filtering="yes" />

    <echo message="Configured build for the ${edition} edition driver." />

  </target>

  <!-- This target removes any class files from the build directory -->
  <target name="clean">
    <delete>
	<fileset dir="${dest}" />
    	<fileset dir="${jars}" />
    </delete>
    <delete file="${package}/Driver.java" />
  </target>

  <!-- Prepares the build directory -->
  <target name="prepare">
    <mkdir dir="${dest}" />
    <mkdir dir="${jars}" />
  </target>

  <!-- This is the core of the driver. It is common for all three versions -->
  <target name="compile" depends="prepare,check_versions,driver">
    <javac srcdir="${src}" destdir="${dest}">
      <include name="${package}/**" />
      <exclude name="${package}/core/ConnectionHook.java" unless="jdk1.3+" />
      <exclude name="${package}/jdbc1/**" if="jdk1.2+" />
      <exclude name="${package}/jdbc2/**" unless="jdk1.2+" />
      <exclude name="${package}/largeobject/PGblob.java" unless="jdk1.2+" />
      <exclude name="${package}/largeobject/PGclob.java" unless="jdk1.2+" />
      <exclude name="${package}/PostgresqlDataSource.java" unless="jdk1.2e+" />
      <exclude name="${package}/xa/**" unless="jdk1.2e+" />
      <exclude name="${package}/test/**" unless="junit" />
    </javac>
    <copy todir="${dest}" overwrite="true" filtering="on">
      <fileset dir="${src}">
        <include name="**/*.properties" />
        <exclude name="${dest}/**" />
      </fileset>
    </copy>
  </target>

  <!-- This builds the examples -->
  <target name="examples" depends="compile">
    <javac srcdir="${src}" destdir="${dest}">
      <include name="example/**" />
      <exclude name="example/corba/**"/>
      <exclude name="example/blobtest.java" unless="jdk1.2+"/>
    </javac>
  </target>

  <!-- Builds the corba example -->
  <target name="corba" if="jdk1.2+">
    <exec dir="${src}/example/corba" executable="idl2java">
      <arg value="stock.idl" />
    </exec>
    <javac srcdir="${src}" destdir="${dest}">
      <include name="example/corba/**" />
    </javac>
  </target>

  <!-- This builds the jar file containing the driver -->
  <target name="jar" depends="compile,examples">
    <jar jarfile="${jars}/postgresql.jar" basedir="${dest}" includes="${package}/**" excludes="${package}/test/**"/>
    <jar jarfile="${jars}/postgresql-examples.jar" basedir="${dest}" includes="example/**" />
  </target>

  <!--
    This installs the jar file. It's called by the build.xml file in the
    root directory of the source (where configure is). Refer to that file
    on how to use it.
  -->
  <target name="install" depends="jar" if="install.directory">
    <copy todir="${install.directory}" overwrite="true" filtering="off">
      <fileset dir="${jars}">
        <include name="**/*.jar" />
      </fileset>
    </copy>
  </target>

  <!--
    Uninstall the jar file.
  -->
  <target name="uninstall" if="install.directory">
    <delete>
      <fileset dir="${install.directory}">
        <include name="**/*.jar" /><commit_msg>Prevent ANT from recreating the JAR files just because the errors.properties files were being copied.<commit_after><!--

  build file to allow ant (http://jakarta.apache.org/ant/) to be used
  to build the PostgreSQL JDBC Driver.

  $Id$

-->

<project name="postgresqlJDBC" default="jar" basedir=".">

  <!-- set global properties for this build -->
  <property name="src"     value="." />
  <property name="jars"    value="jars" />
  <property name="dest"    value="build" />
  <property name="package" value="org/postgresql" />

  <!--
    defaults for the tests - overide these if required
    junit.ui is one of textui, awtui or swingui

    password must be something. Doesnt matter if trust is used!
  -->
  <property name="database" value="jdbc:postgresql:test" />
  <property name="username" value="test" />
  <property name="password" value="password" />
  <property name="tablename" value="jdbctest" />
  <property name="junit.ui" value="textui" />

  <!--
    This is a simpler method than utils.CheckVersion
    It defaults to jdbc1, but builds jdbc2 if the java.lang.Byte class is
    in the CLASSPATH (ie JDK1.2 or later), and then enterprise if the
    javax.sql.DataSource class is present.

    Important: This must have the following order: jdbc1, jdbc2, enterprise
  -->
  <target name="check_versions">
    <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
    <available property="jdk1.3+" classname="java.lang.StrictMath" />
    <available property="jdk1.2e+" classname="javax.sql.DataSource" />
    <available property="junit" classname="junit.framework.Test" />
  </target>

  <!--
    This generates Driver.java from Driver.java.in
    It's required for importing the driver version properties
  -->
  <target name="driver" depends="prepare,check_versions">

    <!-- determine the edition text -->
    <property name="edition" value="JDBC1" />
    <available property="edition" value="JDBC2" classname="java.lang.ThreadLocal" />
    <available property="edition" value="JDBC2" classname="java.lang.StrictMath" />
    <available property="edition" value="JDBC2 Enterprise" classname="javax.sql.DataSource" />

    <!-- determine the connection class -->
    <property name="connectclass" value="org.postgresql.jdbc1.Connection" />
    <available property="connectclass" value="org.postgresql.jdbc2.Connection" classname="java.lang.ThreadLocal" />

    <!-- comment out 1.3+ stuff -->
    <property name="jdk13only" value="//" />
    <available property="jdk13only" value="" classname="java.lang.StrictMath" />
    <filter token="JDK1.3ONLY" value="${jdk13only}" />

    <!-- Some defaults -->
    <filter token="MAJORVERSION" value="${major}" />
    <filter token="MINORVERSION" value="${minor}" />
    <filter token="VERSION" value="PostgreSQL ${fullversion} ${edition}" />
    <filter token="JDBCCONNECTCLASS" value="${connectclass}" />
    <filter token="DEF_PGPORT" value="${def_pgport}" />

    <!-- Put a check for the current version here -->

    <!-- now copy and filter the file -->
    <copy file="${package}/Driver.java.in"
          tofile="${package}/Driver.java"
          filtering="yes" />

    <echo message="Configured build for the ${edition} edition driver." />

  </target>

  <!-- This target removes any class files from the build directory -->
  <target name="clean">
    <delete>
	<fileset dir="${dest}" />
    	<fileset dir="${jars}" />
    </delete>
    <delete file="${package}/Driver.java" />
  </target>

  <!-- Prepares the build directory -->
  <target name="prepare">
    <mkdir dir="${dest}" />
    <mkdir dir="${jars}" />
  </target>

  <!-- This is the core of the driver. It is common for all three versions -->
  <target name="compile" depends="prepare,check_versions,driver">
    <javac srcdir="${src}" destdir="${dest}">
      <include name="${package}/**" />
      <exclude name="${package}/core/ConnectionHook.java" unless="jdk1.3+" />
      <exclude name="${package}/jdbc1/**" if="jdk1.2+" />
      <exclude name="${package}/jdbc2/**" unless="jdk1.2+" />
      <exclude name="${package}/largeobject/PGblob.java" unless="jdk1.2+" />
      <exclude name="${package}/largeobject/PGclob.java" unless="jdk1.2+" />
      <exclude name="${package}/PostgresqlDataSource.java" unless="jdk1.2e+" />
      <exclude name="${package}/xa/**" unless="jdk1.2e+" />
      <exclude name="${package}/test/**" unless="junit" />
      <exclude name="${package}/*.properties" />
    </javac>
    <copy todir="${dest}" overwrite="true" filtering="on">
      <fileset dir="${src}">
        <include name="${package}/*.properties" />
        <exclude name="${dest}/**" />
      </fileset>
    </copy>
  </target>

  <!-- This builds the examples -->
  <target name="examples" depends="compile">
    <javac srcdir="${src}" destdir="${dest}">
      <include name="example/**" />
      <exclude name="example/corba/**"/>
      <exclude name="example/blobtest.java" unless="jdk1.2+"/>
    </javac>
  </target>

  <!-- Builds the corba example -->
  <target name="corba" if="jdk1.2+">
    <exec dir="${src}/example/corba" executable="idl2java">
      <arg value="stock.idl" />
    </exec>
    <javac srcdir="${src}" destdir="${dest}">
      <include name="example/corba/**" />
    </javac>
  </target>

  <!-- This builds the jar file containing the driver -->
  <target name="jar" depends="compile,examples">
    <jar jarfile="${jars}/postgresql.jar" basedir="${dest}" includes="${package}/**" excludes="${package}/test/**,${package}/*.properties"/>
    <jar jarfile="${jars}/postgresql-examples.jar" basedir="${dest}" includes="example/**" />
  </target>

  <!--
    This installs the jar file. It's called by the build.xml file in the
    root directory of the source (where configure is). Refer to that file
    on how to use it.
  -->
  <target name="install" depends="jar" if="install.directory">
    <copy todir="${install.directory}" overwrite="true" filtering="off">
      <fileset dir="${jars}">
        <include name="**/*.jar" />
      </fileset>
    </copy>
  </target>

  <!--
    Uninstall the jar file.
  -->
  <target name="uninstall" if="install.directory">
    <delete>
      <fileset dir="${install.directory}">
        <include name="**/*.jar" />
{'fraction_non_alphanumeric': 0.18812606889811873, 'fraction_numerical': 0.007981105953253522, 'mean_word_length': 3.4508880028996014, 'pattern_counts': {'":': 0, '<': 230, '<?xml version=': 0, '>': 230, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6452204', 'n_tokens_mistral': 3850, 'n_tokens_neox': 3729, 'n_words': 928}