<commit_before><!-- Copyright (C) 2007 Google Inc.
  -
  - Licensed under the Apache License, Version 2.0 (the "License");
  - you may not use this file except in compliance with the License.
  - You may obtain a copy of the License at
  -
  -      http://www.apache.org/licenses/LICENSE-2.0
  -
  - Unless required by applicable law or agreed to in writing, software
  - distributed under the License is distributed on an "AS IS" BASIS,
  - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - See the License for the specific language governing permissions and
  - limitations under the License.
 -->

<!--
  - To run, cd to the directory containing this file, run
  -    ant <rulename>
  - and look for the output in ./ant-* directories.
  -
  - Valid values for <rulename> are:
  -   default   :  builds the plugin compiler (pluginc), tests, and docs
  -   clean     :  wipes generated files
  -   demos     :  demo files
  -   docs      :  javadoc
  -   pluginc   :  the plugin compiler
  -   runtests  :  runs the tests
  -
  - To run with assertions enabled, set the environment variable ANT_FLAGS="-ea"
 -->

<project name="pluginc" default="default" basedir=".">
  <description>
  A subset of javascript that allow an application to securely embed plugins via
  a capability based security model.
  </description>


  <!--== inputs ==-->
  <property name="src"         location="java"/>
  <property name="testsrc"     location="javatests"/>
  <property name="javascript"  location="js"/>
  <property name="third_party" location="./third_party"/>
  <property name="demos"       location="java/com/google/caja/demos"/>
  <!--== outputs ==-->
  <property name="reports"     location="ant-reports"/>  <!-- emma reports -->
  <property name="instr"       location="ant-instr"/>  <!-- instrumented src -->
  <property name="lib"         location="ant-lib"/>
  <property name="docs"        location="ant-docs"/>
  <property name="jars"        location="ant-jars"/>
  <property name="www"         location="ant-www"/>  <!-- demo files dir -->

  <path id="classpath.compile">
    <pathelement path="${third_party}/java/jakarta_commons/commons-cli.jar"/>
    <pathelement path="${third_party}/java/json_simple/json_simple.jar"/>
    <pathelement path="${third_party}/java/htmlparser/htmlparser.jar"/>
  </path>

  <path id="classpath.run">
    <pathelement path="${lib}"/>
  </path>

  <path id="classpath.tests.compile">
    <pathelement path="${third_party}/java/junit/junit.jar"/>
    <pathelement path="${third_party}/java/json_simple/json_simple.jar"/>
    <pathelement path="${third_party}/java/rhino/js.jar"/>
  </path>

  <path id="classpath.tests.run">
    <pathelement path="${third_party}/java/emma/emma.jar"/>
    <pathelement path="${third_party}/java/htmlparser/htmlparser.jar"/>
    <pathelement path="${third_party}/java/json_simple/json_simple.jar"/>
    <pathelement path="${third_party}/java/junit/junit.jar"/>
    <pathelement path="${third_party}/java/rhino/js.jar"/>
    <pathelement path="${instr}/classes"/>
    <!-- In case instrumentation not enabled -->
    <pathelement path="${lib}"/>
  </path>

  <path id="classpath.emma">
    <pathelement path="${third_party}/java/emma/emma.jar"/>
  </path>

  <path id="classpath.extensions">
    <pathelement path="${third_party}/java/emma/emma_ant.jar"/>
    <pathelement path="${third_party}/java/emma/emma.jar"/>
    <pathelement path="${third_party}/java/junit/junit.jar"/>
    <pathelement path="${third_party}/java/apache_ant/ant-junit.jar"/>
  </path>

  <taskdef
    resource="emma_ant.properties"
    classpathref="classpath.extensions" />

  <taskdef
    name="junit"
    classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
    classpathref="classpath.extensions" />

  <!--== rules ==-->
  <target name="default" depends="pluginc,opensocial,docs"
   description="Builds the plugin compiler, and documentation."/>

  <target name="clean"
   description="deletes all generated files leaving only sources">
    <delete dir="${reports}"/>
    <delete dir="${docs}"/>
    <delete dir="${instr}"/>
    <delete dir="${jars}"/>
    <delete dir="${lib}"/>
    <delete dir="${www}"/>
  </target>

  <target name="dirs">
    <mkdir dir="${reports}"/>
    <mkdir dir="${docs}"/>
    <mkdir dir="${instr}"/>
    <mkdir dir="${jars}"/>
    <mkdir dir="${lib}"/>
    <mkdir dir="${www}"/>
  </target>

  <target name="runtests" depends="AllTests"
   description="Builds and runs unittests.">
    <!-- Instrument the compiled class files to gather code coverage stats -->
    <emma enabled="${emma.enabled}">
      <instr instrpath="${lib}" destdir="${instr}" mode="fullcopy"
       metadatafile="${reports}/coverage/metadata.em" merge="true">
        <filter value="${emma.filter}"/>
      </instr>
    </emma>
    <mkdir dir="${reports}/tests"/>
    <!--
      - If this fails to run, try with -verbose.  If you see a problem with
      - forking, check your JAVA and JAVA_HOME environment variables and make
      - sure ant is using jdk1.6.
     -->
    <junit printsummary="yes" fork="yes">
      <assertions><enable/></assertions>  <!-- ignored unless fork="yes" -->
      <classpath refid="classpath.tests.run"/>
      <formatter type="xml" usefile="true" unless="emma.enabled"/>
      <batchtest todir="${reports}/tests" unless="emma.enabled">
        <fileset dir="${testsrc}">
          <include name="**/*Test.java"/>
        </fileset>
      </batchtest>
      <sysproperty key="emma.coverage.out.file"
       value="${reports}/coverage/coverage.ec"/>
      <sysproperty key="emma.coverage.out.merge" value="false"/>
      <test name="com.google.caja.AllTests" if="emma.enabled"/>
    </junit>
    <!-- Generate the code coverage report. -->
    <emma enabled="${emma.enabled}">
      <report sourcepath="${src}:${testsrc}" sort="+block,+name,+method,+class"
       metrics="method:70,block:80,line:80,class:100">
        <fileset dir="${reports}/coverage">
          <include name="*.em" />
          <include name="*.ec" />
        </fileset>
        <html outfile="${reports}/coverage/index.html" encoding="UTF-8"/>
      </report>
    </emma>
    <!-- Generate the test results report. -->
    <junitreport todir="${reports}/tests">
      <fileset dir="${reports}/tests" includes="TEST-*.xml"/>
      <report format="frames" todir="${reports}/tests"
       styledir="${third_party}/ant/etc"/>
    </junitreport>
  </target>

  <target name="docs" description="Builds javadoc documentation.">
    <mkdir dir="${docs}"/>
    <javadoc sourcepath="${src}" destdir="${docs}" access="private"
     author="true"
     bottom="Copyright (C) 2008 Google Inc.&lt;br&gt;
             &lt;a href=http://www.apache.org/licenses/LICENSE-2.0&gt;
             Licensed under the Apache License, Version 2.0&lt;/a&gt;"
     docencoding="utf-8"
     packagenames="com/google/caja/*"
     classpathref="classpath.compile"
     linksource="yes"/>
     <!-- overview="${src}/overview.html" -->
  </target>

  <!-- Cajoles test resources that contain cajita to javascript. -->
  <target name="CajoledTests" depends="pluginc,dirs">
    <java classname="com.google.caja.plugin.PluginCompilerMain"
     failonerror="yes">
      <classpath refid="classpath.run"/>
      <arg value="--out=${lib}/com/google/caja/plugin/domita_test_cajoled"/>
      <arg value="--name=___OUTERS___"/>
      <arg value="--scheme=caja"/>
      <arg value="--pathPrefix=/"/>
      <arg file="${testsrc}/com/google/caja/plugin/domita_test.js"/>
      <arg file="${testsrc}/com/google/caja/plugin/asserts.js"/>
    </java>
  </target>

  <target name="AllTests"
   depends="opensocial,pluginc,TestUtil,CajoledTests,dirs">
    <javac destdir="${lib}" debug="true" target="1.5" source="1.5">
      <src path="${testsrc}"/>
      <classpath refid="classpath.tests.compile"/>
      <include name="**/caja/AllTests.java"/>
      <include name="**/caja/config/ConfigUtilTest.java"/>
      <include name="**/caja/demos/calendar/RRuleTest.java"/>
      <include name="**/caja/demos/calendar/HcalTest.java"/>
      <include name="**/caja/lexer/CharProducerTest.java"/>
      <include name="**/caja/lexer/CommentLexerTest.java"/>
      <include name="**/caja/lexer/CssLexerTest.java"/>
      <include name="**/caja/lexer/HtmlLexerTest.java"/>
      <include name="**/caja/lexer/JsLexerTest.java"/>
      <include name="**/caja/lexer/LookaheadCharProducerTest.java"/>
      <include name="**/caja/lexer/PunctuationTrieTest.java"/>
      <include name="**/caja/lexer/escaping/EscapingTest.java"/>
      <include name="**/caja/opensocial/DefaultGadgetRewriterTest.java"/>
      <include name="**/caja/opensocial/GadgetParserTest.java"/>
      <include name="**/caja/parser/ParseTreeNodeTest.java"/>
      <include name="**/caja/parser/css/Css2Test.java"/>
      <include name="**/caja/parser/css/CssParserTest.java"/>
      <include name="**/caja/parser/css/CssTreeTest.java"/>
      <include name="**/caja/parser/html/DomParserTest.java"/>
      <include name="**/caja/parser/html/JsHtmlParserTest.java"/><commit_msg>Remove obsolete flags from CajoledTests build target that builds domita_test_cajoled.js.<commit_after><!-- Copyright (C) 2007 Google Inc.
  -
  - Licensed under the Apache License, Version 2.0 (the "License");
  - you may not use this file except in compliance with the License.
  - You may obtain a copy of the License at
  -
  -      http://www.apache.org/licenses/LICENSE-2.0
  -
  - Unless required by applicable law or agreed to in writing, software
  - distributed under the License is distributed on an "AS IS" BASIS,
  - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - See the License for the specific language governing permissions and
  - limitations under the License.
 -->

<!--
  - To run, cd to the directory containing this file, run
  -    ant <rulename>
  - and look for the output in ./ant-* directories.
  -
  - Valid values for <rulename> are:
  -   default   :  builds the plugin compiler (pluginc), tests, and docs
  -   clean     :  wipes generated files
  -   demos     :  demo files
  -   docs      :  javadoc
  -   pluginc   :  the plugin compiler
  -   runtests  :  runs the tests
  -
  - To run with assertions enabled, set the environment variable ANT_FLAGS="-ea"
 -->

<project name="pluginc" default="default" basedir=".">
  <description>
  A subset of javascript that allow an application to securely embed plugins via
  a capability based security model.
  </description>


  <!--== inputs ==-->
  <property name="src"         location="java"/>
  <property name="testsrc"     location="javatests"/>
  <property name="javascript"  location="js"/>
  <property name="third_party" location="./third_party"/>
  <property name="demos"       location="java/com/google/caja/demos"/>
  <!--== outputs ==-->
  <property name="reports"     location="ant-reports"/>  <!-- emma reports -->
  <property name="instr"       location="ant-instr"/>  <!-- instrumented src -->
  <property name="lib"         location="ant-lib"/>
  <property name="docs"        location="ant-docs"/>
  <property name="jars"        location="ant-jars"/>
  <property name="www"         location="ant-www"/>  <!-- demo files dir -->

  <path id="classpath.compile">
    <pathelement path="${third_party}/java/jakarta_commons/commons-cli.jar"/>
    <pathelement path="${third_party}/java/json_simple/json_simple.jar"/>
    <pathelement path="${third_party}/java/htmlparser/htmlparser.jar"/>
  </path>

  <path id="classpath.run">
    <pathelement path="${lib}"/>
  </path>

  <path id="classpath.tests.compile">
    <pathelement path="${third_party}/java/junit/junit.jar"/>
    <pathelement path="${third_party}/java/json_simple/json_simple.jar"/>
    <pathelement path="${third_party}/java/rhino/js.jar"/>
  </path>

  <path id="classpath.tests.run">
    <pathelement path="${third_party}/java/emma/emma.jar"/>
    <pathelement path="${third_party}/java/htmlparser/htmlparser.jar"/>
    <pathelement path="${third_party}/java/json_simple/json_simple.jar"/>
    <pathelement path="${third_party}/java/junit/junit.jar"/>
    <pathelement path="${third_party}/java/rhino/js.jar"/>
    <pathelement path="${instr}/classes"/>
    <!-- In case instrumentation not enabled -->
    <pathelement path="${lib}"/>
  </path>

  <path id="classpath.emma">
    <pathelement path="${third_party}/java/emma/emma.jar"/>
  </path>

  <path id="classpath.extensions">
    <pathelement path="${third_party}/java/emma/emma_ant.jar"/>
    <pathelement path="${third_party}/java/emma/emma.jar"/>
    <pathelement path="${third_party}/java/junit/junit.jar"/>
    <pathelement path="${third_party}/java/apache_ant/ant-junit.jar"/>
  </path>

  <taskdef
    resource="emma_ant.properties"
    classpathref="classpath.extensions" />

  <taskdef
    name="junit"
    classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
    classpathref="classpath.extensions" />

  <!--== rules ==-->
  <target name="default" depends="pluginc,opensocial,docs"
   description="Builds the plugin compiler, and documentation."/>

  <target name="clean"
   description="deletes all generated files leaving only sources">
    <delete dir="${reports}"/>
    <delete dir="${docs}"/>
    <delete dir="${instr}"/>
    <delete dir="${jars}"/>
    <delete dir="${lib}"/>
    <delete dir="${www}"/>
  </target>

  <target name="dirs">
    <mkdir dir="${reports}"/>
    <mkdir dir="${docs}"/>
    <mkdir dir="${instr}"/>
    <mkdir dir="${jars}"/>
    <mkdir dir="${lib}"/>
    <mkdir dir="${www}"/>
  </target>

  <target name="runtests" depends="AllTests"
   description="Builds and runs unittests.">
    <!-- Instrument the compiled class files to gather code coverage stats -->
    <emma enabled="${emma.enabled}">
      <instr instrpath="${lib}" destdir="${instr}" mode="fullcopy"
       metadatafile="${reports}/coverage/metadata.em" merge="true">
        <filter value="${emma.filter}"/>
      </instr>
    </emma>
    <mkdir dir="${reports}/tests"/>
    <!--
      - If this fails to run, try with -verbose.  If you see a problem with
      - forking, check your JAVA and JAVA_HOME environment variables and make
      - sure ant is using jdk1.6.
     -->
    <junit printsummary="yes" fork="yes">
      <assertions><enable/></assertions>  <!-- ignored unless fork="yes" -->
      <classpath refid="classpath.tests.run"/>
      <formatter type="xml" usefile="true" unless="emma.enabled"/>
      <batchtest todir="${reports}/tests" unless="emma.enabled">
        <fileset dir="${testsrc}">
          <include name="**/*Test.java"/>
        </fileset>
      </batchtest>
      <sysproperty key="emma.coverage.out.file"
       value="${reports}/coverage/coverage.ec"/>
      <sysproperty key="emma.coverage.out.merge" value="false"/>
      <test name="com.google.caja.AllTests" if="emma.enabled"/>
    </junit>
    <!-- Generate the code coverage report. -->
    <emma enabled="${emma.enabled}">
      <report sourcepath="${src}:${testsrc}" sort="+block,+name,+method,+class"
       metrics="method:70,block:80,line:80,class:100">
        <fileset dir="${reports}/coverage">
          <include name="*.em" />
          <include name="*.ec" />
        </fileset>
        <html outfile="${reports}/coverage/index.html" encoding="UTF-8"/>
      </report>
    </emma>
    <!-- Generate the test results report. -->
    <junitreport todir="${reports}/tests">
      <fileset dir="${reports}/tests" includes="TEST-*.xml"/>
      <report format="frames" todir="${reports}/tests"
       styledir="${third_party}/ant/etc"/>
    </junitreport>
  </target>

  <target name="docs" description="Builds javadoc documentation.">
    <mkdir dir="${docs}"/>
    <javadoc sourcepath="${src}" destdir="${docs}" access="private"
     author="true"
     bottom="Copyright (C) 2008 Google Inc.&lt;br&gt;
             &lt;a href=http://www.apache.org/licenses/LICENSE-2.0&gt;
             Licensed under the Apache License, Version 2.0&lt;/a&gt;"
     docencoding="utf-8"
     packagenames="com/google/caja/*"
     classpathref="classpath.compile"
     linksource="yes"/>
     <!-- overview="${src}/overview.html" -->
  </target>

  <!-- Cajoles test resources that contain cajita to javascript. -->
  <target name="CajoledTests" depends="pluginc,dirs">
    <java classname="com.google.caja.plugin.PluginCompilerMain"
     failonerror="yes">
      <classpath refid="classpath.run"/>
      <arg value="--out=${lib}/com/google/caja/plugin/domita_test_cajoled"/>
      <arg value="--pathPrefix=/"/>
      <arg file="${testsrc}/com/google/caja/plugin/domita_test.js"/>
      <arg file="${testsrc}/com/google/caja/plugin/asserts.js"/>
    </java>
  </target>

  <target name="AllTests"
   depends="opensocial,pluginc,TestUtil,CajoledTests,dirs">
    <javac destdir="${lib}" debug="true" target="1.5" source="1.5">
      <src path="${testsrc}"/>
      <classpath refid="classpath.tests.compile"/>
      <include name="**/caja/AllTests.java"/>
      <include name="**/caja/config/ConfigUtilTest.java"/>
      <include name="**/caja/demos/calendar/RRuleTest.java"/>
      <include name="**/caja/demos/calendar/HcalTest.java"/>
      <include name="**/caja/lexer/CharProducerTest.java"/>
      <include name="**/caja/lexer/CommentLexerTest.java"/>
      <include name="**/caja/lexer/CssLexerTest.java"/>
      <include name="**/caja/lexer/HtmlLexerTest.java"/>
      <include name="**/caja/lexer/JsLexerTest.java"/>
      <include name="**/caja/lexer/LookaheadCharProducerTest.java"/>
      <include name="**/caja/lexer/PunctuationTrieTest.java"/>
      <include name="**/caja/lexer/escaping/EscapingTest.java"/>
      <include name="**/caja/opensocial/DefaultGadgetRewriterTest.java"/>
      <include name="**/caja/opensocial/GadgetParserTest.java"/>
      <include name="**/caja/parser/ParseTreeNodeTest.java"/>
      <include name="**/caja/parser/css/Css2Test.java"/>
      <include name="**/caja/parser/css/CssParserTest.java"/>
      <include name="**/caja/parser/css/CssTreeTest.java"/>
      <include name="**/caja/parser/html/DomParserTest.java"/>
      <include name="**/caja/parser/html/JsHtmlParserTest.java"/>
{'fraction_non_alphanumeric': 0.18219895287958116, 'fraction_numerical': 0.0037475888674565997, 'mean_word_length': 3.3184198000951928, 'pattern_counts': {'":': 0, '<': 315, '<?xml version=': 0, '>': 315, 'https://': 0, 'lorem ipsum': 0, 'www.': 12, 'xml': 4}, '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': '53330', 'n_tokens_mistral': 5801, 'n_tokens_neox': 5686, 'n_words': 1146}