<commit_before><?xml version="1.0" encoding="UTF-8"?>
<project name="optaplanner-training-generator" default="overwrite-all-labs" basedir=".">
  <description>
    OptaPlanner solves planning problems.
    This lightweight, embeddable planning engine implements powerful and scalable algorithms
    to optimize business resource scheduling and planning.

    This module generates and overwrites the training labs.
  </description>

  <property name="optaplanner.examples.dir" value="${basedir}/../../optaplanner/optaplanner-examples"/>

  <patternset id="example.cloudbalance.patternset">
    <include name="pom.xml"/>
    <include name=".gitignore"/>
    <include name="src/main/java/org/optaplanner/examples/common/"/>
    <include name="src/main/resources/logback.xml"/>
    <include name="src/main/resources/org/optaplanner/examples/common/"/>
    <!-- Specific stuff -->
    <include name="data/cloudbalancing/unsolved/"/>
    <include name="src/main/java/org/optaplanner/examples/cloudbalancing/app/CloudBalancingApp.java"/>
    <include name="src/main/java/org/optaplanner/examples/cloudbalancing/domain/"/>
    <include name="src/main/java/org/optaplanner/examples/cloudbalancing/persistence/CloudBalancingDao.java"/>
    <include name="src/main/java/org/optaplanner/examples/cloudbalancing/swingui/"/>
    <include name="src/main/resources/org/optaplanner/examples/cloudbalancing/solver/"/>
    <include name="src/main/resources/org/optaplanner/examples/cloudbalancing/swingui/"/>
  </patternset>

  <target name="overwrite-all-labs" depends="overwrite-lab101, overwrite-lab102, overwrite-lab103"/>

  <target name="overwrite-lab101" depends="checks">
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab101"/>
    </antcall>

    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab101-solution"/>
    </antcall>
    <concat destfile="${basedir}/../optaplanner-training-lab101-solution/src/main/resources/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl" append="true">
      <![CDATA[

// ############################################################################
// Solution lab101
// ############################################################################

rule "atMost4ProcessesPerComputer"
  when
    $computer : CloudComputer()
    $count : Number(intValue > 4) from accumulate(
    $c : CloudProcess(computer == $computer),
      count($c)
    )
  then
    scoreHolder.addHardConstraintMatch(kcontext, 4 - $count.intValue());
end
]]>
    </concat>
  </target>

  <target name="overwrite-lab102" depends="checks">
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab102"/>
    </antcall>

    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab102-solution"/>
    </antcall>
  </target>

  <target name="overwrite-lab103" depends="checks">
    <property name="lab.number" value="103" />
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab103"/>
    </antcall>

    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab103-solution"/>
    </antcall>
  </target>



  <target name="overwrite-cloudBalance">
    <property name="lab.directory" value="${basedir}/../${lab.artifactId}"/>
    <echo>Overwriting of ${lab.directory}</echo>
    <delete failonerror="false">
      <fileset dir="${lab.directory}" defaultexcludes="false">
        <patternset refid="example.cloudbalance.patternset"/>
      </fileset>
    </delete>
    <copy todir="${lab.directory}" overwrite="true">
      <fileset dir="${optaplanner.examples.dir}" defaultexcludes="false">
        <patternset refid="example.cloudbalance.patternset"/>
      </fileset>
    </copy>
    <replaceregexp file="${lab.directory}/pom.xml"
                   match="&lt;artifactId&gt;optaplanner\-examples&lt;/artifactId&gt;"
                   replace="&lt;artifactId&gt;${lab.artifactId}&lt;/artifactId&gt;"/>
    <replaceregexp file="${lab.directory}/pom.xml"
                   match="&lt;name&gt;.*&lt;/name&gt;"
                   replace="&lt;name&gt;${lab.artifactId}&lt;/name&gt;"/>
    <replaceregexp file="${lab.directory}/pom.xml"
                   match="&lt;description&gt;[^&lt;]*&lt;/description&gt;"
                   replace="&lt;description&gt;${lab.artifactId}&lt;/description&gt;"
                   byline="false"/>
    <!--<replaceregexp file="${output.directory}/pom.xml"-->
    <!--match="&lt;dependency&gt;[\n ]*&lt;groupId&gt;org.optaplanner&lt;/groupId&gt;[\n ]*&lt;artifactId&gt;optaplanner-benchmark&lt;/artifactId&gt;[\n ]*&lt;/dependency&gt;"-->
    <!--replace="&lt;dependency&gt;${line.separator}      &lt;groupId&gt;org.optaplanner&lt;/groupId&gt;${line.separator}      &lt;artifactId&gt;optaplanner-benchmark&lt;/artifactId&gt;${line.separator}    &lt;/dependency&gt;${line.separator}    &lt;dependency&gt;${line.separator}      &lt;groupId&gt;org.optaplanner&lt;/groupId&gt;${line.separator}      &lt;artifactId&gt;optaplanner-examples&lt;/artifactId&gt;${line.separator}    &lt;/dependency&gt;"-->
    <!--byline="false"/>-->

  </target>

  <target name="checks">
    <available file="${optaplanner.examples.dir}" property="optaplanner.examples.dir.available" />
    <fail unless="optaplanner.examples.dir.available"
          message="The optaplanner.examples.dir (${optaplanner.examples.dir}) does not exist." />
  </target>

</project><commit_msg>optaplanner-training: build valid, unique maven stuff<commit_after><?xml version="1.0" encoding="UTF-8"?>
<project name="optaplanner-training-generator" default="overwrite-all-labs" basedir=".">
  <description>
    OptaPlanner solves planning problems.
    This lightweight, embeddable planning engine implements powerful and scalable algorithms
    to optimize business resource scheduling and planning.

    This module generates and overwrites the training labs.
  </description>

  <property name="project.version" value="6.0.0.Final-training-1"/>
  <property name="optaplanner.examples.dir" value="${basedir}/../../optaplanner/optaplanner-examples"/>

  <patternset id="example.cloudbalance.patternset">
    <include name="pom.xml"/>
    <include name=".gitignore"/>
    <include name="src/main/java/org/optaplanner/examples/common/"/>
    <include name="src/main/resources/logback.xml"/>
    <include name="src/main/resources/org/optaplanner/examples/common/"/>
    <!-- Specific stuff -->
    <include name="data/cloudbalancing/unsolved/"/>
    <include name="src/main/java/org/optaplanner/examples/cloudbalancing/app/CloudBalancingApp.java"/>
    <include name="src/main/java/org/optaplanner/examples/cloudbalancing/domain/"/>
    <include name="src/main/java/org/optaplanner/examples/cloudbalancing/persistence/CloudBalancingDao.java"/>
    <include name="src/main/java/org/optaplanner/examples/cloudbalancing/swingui/"/>
    <include name="src/main/resources/org/optaplanner/examples/cloudbalancing/solver/"/>
    <include name="src/main/resources/org/optaplanner/examples/cloudbalancing/swingui/"/>
  </patternset>


  <target name="overwrite-all-labs" depends="overwrite-lab101, overwrite-lab102, overwrite-lab103"/>


  <target name="overwrite-lab101" depends="checks">
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab101"/>
    </antcall>
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab101-solution"/>
    </antcall>
    <concat destfile="${basedir}/../optaplanner-training-lab101-solution/src/main/resources/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl" append="true">
      <![CDATA[

// ############################################################################
// Solution lab101
// ############################################################################

rule "atMost4ProcessesPerComputer"
  when
    $computer : CloudComputer()
    $count : Number(intValue > 4) from accumulate(
    $c : CloudProcess(computer == $computer),
      count($c)
    )
  then
    scoreHolder.addHardConstraintMatch(kcontext, 4 - $count.intValue());
end
]]>
    </concat>
  </target>


  <target name="overwrite-lab102" depends="checks">
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab102"/>
    </antcall>
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab102-solution"/>
    </antcall>
  </target>


  <target name="overwrite-lab103" depends="checks">
    <property name="lab.number" value="103" />
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab103"/>
    </antcall>
    <antcall target="overwrite-cloudBalance">
      <param name="lab.artifactId" value="optaplanner-training-lab103-solution"/>
    </antcall>
  </target>


  <target name="overwrite-cloudBalance">
    <property name="lab.directory" value="${basedir}/../${lab.artifactId}"/>
    <echo>Overwriting of ${lab.directory}</echo>
    <delete failonerror="false">
      <fileset dir="${lab.directory}" defaultexcludes="false">
        <patternset refid="example.cloudbalance.patternset"/>
      </fileset>
    </delete>
    <copy todir="${lab.directory}" overwrite="true">
      <fileset dir="${optaplanner.examples.dir}" defaultexcludes="false">
        <patternset refid="example.cloudbalance.patternset"/>
      </fileset>
    </copy>
    <replaceregexp file="${lab.directory}/pom.xml"
                   match="&lt;artifactId&gt;optaplanner\-examples&lt;/artifactId&gt;"
                   replace="&lt;artifactId&gt;${lab.artifactId}&lt;/artifactId&gt;"/>
    <replaceregexp file="${lab.directory}/pom.xml"
                   match="&lt;name&gt;.*&lt;/name&gt;"
                   replace="&lt;name&gt;${lab.artifactId}&lt;/name&gt;"/>
    <replaceregexp file="${lab.directory}/pom.xml"
                   match="&lt;description&gt;[^&lt;]*&lt;/description&gt;"
                   replace="&lt;description&gt;${lab.artifactId}&lt;/description&gt;"
                   byline="false"/>

    <replaceregexp file="${lab.directory}/pom.xml"
                   match="&lt;parent&gt;\n.*\n.*\n.*\n.*&lt;/parent&gt;"
                   replace="&lt;parent&gt;&lt;groupId&gt;org.optaplanner&lt;/groupId&gt;&lt;artifactId&gt;optaplanner-training&lt;/artifactId&gt;&lt;version&gt;${project.version}&lt;/version&gt;&lt;/parent&gt;"/>
  </target>

  <target name="checks">
    <available file="${optaplanner.examples.dir}" property="optaplanner.examples.dir.available" />
    <fail unless="optaplanner.examples.dir.available"
          message="The optaplanner.examples.dir (${optaplanner.examples.dir}) does not exist." />
  </target>

</project>
{'fraction_non_alphanumeric': 0.195598799672638, 'fraction_numerical': 0.009638992452487042, 'mean_word_length': 4.197542533081285, 'pattern_counts': {'":': 0, '<': 154, '<?xml version=': 2, '>': 156, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '5550773', 'n_tokens_mistral': 3638, 'n_tokens_neox': 3333, 'n_words': 442}