1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827
|
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-support" xmlns:artifact="urn:maven-artifact-ant">
<description> Macros for Scala's ant build </description>
<macrodef name="optimized">
<attribute name="name"/>
<sequential>
<antcall target="@{name}">
<param name="scalac.args.optimise" value="-optimise"/>
</antcall>
</sequential>
</macrodef>
<macrodef name="copy-deps" description="Copy a file set based on maven dependency resolution to a directory. Currently used by the IntelliJ config files.">
<attribute name="project"/>
<attribute name="refid" default="@{project}.fileset"/>
<sequential>
<delete dir="${build-deps.dir}/@{project}" includes="*.jar"/>
<copy todir="${build-deps.dir}/@{project}">
<resources refid="@{refid}"/>
<mapper type="flatten"/>
</copy>
</sequential>
</macrodef>
<!-- Set a property @{name}.cross to the actual cross suffix that should be
used when resolving the module "@{name}". If the (user-supplied)
@{name}.cross.suffix property exists then use that value, otherwise use
"_${scala.binary.version}". -->
<macrodef name="prepareCross">
<attribute name="name" />
<sequential>
<if>
<isset property="@{name}.cross.suffix" />
<then>
<property name="@{name}.cross" value="${@{name}.cross.suffix}" />
</then>
<else>
<property name="@{name}.cross" value="_${scala.binary.version}" />
</else>
</if>
</sequential>
</macrodef>
<!-- Set property named @{name} to the jar resolved as @{jar}_${scala.binary.version}:jar.
@{jar}_${scala.binary.version} must be a maven dependency. -->
<macrodef name="propertyForCrossedArtifact">
<attribute name="name"/>
<attribute name="jar"/>
<attribute name="suffix" default="${@{name}.cross}"/>
<sequential>
<readProperty name="@{name}" property="@{jar}@{suffix}:jar"/>
<readProperty name="@{name}-sources" property="@{jar}@{suffix}:java-source:sources"/>
<readProperty name="@{name}-javadoc" property="@{jar}@{suffix}:java-source:javadoc"/>
</sequential>
</macrodef>
<!-- Set property named @{name} to the value of the property named @{property}.
Helper for performing nested property expansion without using the ant props lib -->
<macrodef name="readProperty">
<attribute name="name"/>
<attribute name="property"/>
<sequential>
<property name="@{name}" value="${@{property}}"/>
</sequential>
</macrodef>
<macrodef name="init-project-prop">
<attribute name="project"/>
<attribute name="name"/>
<attribute name="default"/>
<sequential>
<local name="@{name}"/>
<if>
<not>
<isset property="@{project}.@{name}"/>
</not>
<then>
<property name="@{project}.@{name}" value="@{default}"/>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="clean">
<attribute name="build"/>
<sequential>
<delete dir="${build-@{build}.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
</sequential>
</macrodef>
<macrodef name="simple-javac">
<attribute name="project"/>
<!-- project: forkjoin -->
<attribute name="args" default=""/>
<attribute name="jar" default="yes"/>
<sequential>
<uptodate property="@{project}.available" targetfile="${build-libs.dir}/@{project}.complete">
<srcfiles dir="${src.dir}/@{project}"/>
</uptodate>
<if>
<not>
<isset property="@{project}.available"/>
</not>
<then>
<stopwatch name="@{project}.timer"/>
<mkdir dir="${@{project}-classes}"/>
<javac debug="true" srcdir="${src.dir}/@{project}" destdir="${@{project}-classes}" classpath="${@{project}-classes}" includes="**/*.java" target="1.6" source="1.5" compiler="javac1.6">
<compilerarg line="${javac.args} @{args}"/>
</javac>
<if>
<equals arg1="@{jar}" arg2="yes"/>
<then>
<jar whenmanifestonly="fail" destfile="${build-libs.dir}/@{project}.jar" basedir="${@{project}-classes}"/>
</then>
</if>
<stopwatch name="@{project}.timer" action="total"/>
<mkdir dir="${build-libs.dir}"/>
<touch file="${build-libs.dir}/@{project}.complete" verbose="no"/>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="staged-javac">
<attribute name="stage"/>
<!-- current stage (locker, quick, strap) -->
<attribute name="project"/>
<!-- project: library/reflect/compiler/actors -->
<attribute name="destproject" default="@{project}"/>
<!-- overrides the output directory; used when building multiple projects into the same directory-->
<attribute name="args" default=""/>
<attribute name="excludes" default=""/>
<sequential>
<javac debug="true" srcdir="${src.dir}/@{project}" destdir="${build-@{stage}.dir}/classes/@{destproject}" includes="**/*.java" excludes="@{excludes}" target="1.6" source="1.5">
<compilerarg line="${javac.args} @{args}"/>
<classpath refid="@{stage}.@{destproject}.build.path"/>
</javac>
</sequential>
</macrodef>
<!-- Zinc assumes a one-to-one correspondence of output folder to set of source files.
When compiling different sets of source files in multiple compilations to the same output directory,
Zinc thinks source files that appeared in an earlier compilation but are absent in the current one,
were deleted and thus deletes the corresponding output files.
Note that zinc also requires each arg to scalac to be prefixed by -S.
-->
<macrodef name="zinc">
<attribute name="compilerpathref"/>
<attribute name="destdir"/>
<attribute name="srcdir"/>
<attribute name="srcpath" default="NOT SET"/>
<!-- needed to compile the library, "NOT SET" is just a convention to denote an optional attribute -->
<attribute name="buildpathref"/>
<attribute name="params" default=""/>
<attribute name="java-excludes" default=""/>
<sequential>
<local name="sources"/>
<pathconvert pathsep=" " property="sources">
<fileset dir="@{srcdir}">
<include name="**/*.java"/>
<include name="**/*.scala"/>
<exclude name="@{java-excludes}"/>
</fileset>
</pathconvert>
<local name="args"/>
<local name="sargs"/>
<if>
<not>
<equals arg1="@{srcpath}" arg2="NOT SET"/>
</not>
<then>
<property name="args" value="@{params} -sourcepath @{srcpath}"/>
</then>
</if>
<property name="args" value="@{params}"/>
<!-- default -->
<!-- HACK: prefix scalac args by -S -->
<script language="javascript">
project.setProperty("sargs", project.getProperty("args").trim().replaceAll(" ", " -S"));
</script>
<exec osfamily="unix" executable="tools/zinc" failifexecutionfails="true" failonerror="true">
<arg line="-nailed -compile-order JavaThenScala -scala-path ${ant.refid:@{compilerpathref}} -d @{destdir} -classpath ${toString:@{buildpathref}} ${sargs} ${sources}"/>
</exec>
</sequential>
</macrodef>
<!-- STAGED COMPILATION MACROS -->
<macrodef name="staged-scalac">
<attribute name="with"/>
<!-- will use path `@{with}.compiler.path` to locate scalac -->
<attribute name="stage"/>
<!-- current stage (locker, quick, strap) -->
<attribute name="project"/>
<!-- project: library/reflect/compiler/actors -->
<attribute name="srcpath" default="NOT SET"/>
<!-- needed to compile the library -->
<attribute name="args" default=""/>
<!-- additional args -->
<attribute name="destproject" default="@{project}"/>
<!-- overrides the output directory; used when building multiple projects into the same directory-->
<attribute name="srcdir" default="@{project}"/>
<attribute name="java-excludes" default=""/>
<sequential>
<!-- TODO: detect zinc anywhere on PATH
use zinc for the quick stage if it's available;
would use it for locker but something is iffy in sbt: get a class cast error on global phase -->
<if>
<and>
<available file="tools/zinc"/>
<equals arg1="@{stage}" arg2="quick"/>
</and>
<then>
<zinc taskname="Z.@{stage}.@{project}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" srcpath="@{srcpath}" buildpathref="@{stage}.@{project}.build.path" params="${scalac.args.@{stage}} @{args}" java-excludes="@{java-excludes}"/>
</then>
<else>
<if>
<equals arg1="@{srcpath}" arg2="NOT SET"/>
<then>
<scalacfork taskname="@{stage}.@{project}" jvmargs="${scalacfork.jvmargs}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" params="${scalac.args.@{stage}} @{args}">
<include name="**/*.scala"/>
<exclude name="**/*Test.scala"/>
<compilationpath refid="@{stage}.@{project}.build.path"/>
</scalacfork>
</then>
<else>
<scalacfork taskname="@{stage}.@{project}" jvmargs="${scalacfork.jvmargs}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" srcpath="@{srcpath}" params="${scalac.args.@{stage}} @{args}">
<include name="**/*.scala"/>
<exclude name="**/*Test.scala"/>
<compilationpath refid="@{stage}.@{project}.build.path"/>
</scalacfork>
</else>
</if>
</else>
</if>
</sequential>
</macrodef>
<macrodef name="staged-uptodate">
<attribute name="stage"/>
<attribute name="project"/>
<element name="check"/>
<element name="do"/>
<sequential>
<uptodate property="@{stage}.@{project}.available" targetfile="${build-@{stage}.dir}/@{project}.complete">
<check/>
</uptodate>
<if>
<not>
<isset property="@{stage}.@{project}.available"/>
</not>
<then>
<do/>
<touch file="${build-@{stage}.dir}/@{project}.complete" verbose="no"/>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="staged-build">
<attribute name="with"/>
<!-- will use path `@{with}.compiler.path` to locate scalac -->
<attribute name="stage"/>
<!-- current stage (locker, quick, strap) -->
<attribute name="project"/>
<!-- project: library/reflect/compiler/actors -->
<attribute name="srcpath" default="NOT SET"/>
<!-- needed to compile the library -->
<attribute name="args" default=""/>
<!-- additional args -->
<attribute name="includes" default="comp.includes"/>
<attribute name="java-excludes" default=""/>
<attribute name="version" default=""/>
<!-- non-empty for scaladoc: use @{version}.version.number in property file-->
<sequential>
<staged-uptodate stage="@{stage}" project="@{project}">
<check>
<srcfiles dir="${src.dir}/@{project}"/>
</check>
<do>
<stopwatch name="@{stage}.@{project}.timer"/>
<mkdir dir="${build-@{stage}.dir}/classes/@{project}"/>
<staged-javac stage="@{stage}" project="@{project}" excludes="@{java-excludes}"/>
<!-- always compile with javac for simplicity and regularity; it's cheap -->
<staged-scalac with="@{with}" stage="@{stage}" project="@{project}" srcpath="@{srcpath}" args="@{args}" java-excludes="@{java-excludes}"/>
<if>
<equals arg1="@{version}" arg2=""/>
<then>
<propertyfile file="${build-@{stage}.dir}/classes/@{project}/@{project}.properties">
<entry key="version.number" value="${version.number}"/>
<entry key="maven.version.number" value="${maven.version.number}"/>
<entry key="osgi.version.number" value="${osgi.version.number}"/>
<entry key="copyright.string" value="${copyright.string}"/>
</propertyfile>
</then>
<else>
<propertyfile file="${build-@{stage}.dir}/classes/@{project}/@{project}.properties">
<entry key="version.number" value="${@{version}.version.number}"/>
<entry key="copyright.string" value="${copyright.string}"/>
</propertyfile>
</else>
</if>
<copy todir="${build-@{stage}.dir}/classes/@{project}">
<fileset dir="${src.dir}/@{project}">
<patternset refid="@{includes}"/>
</fileset>
</copy>
<stopwatch name="@{stage}.@{project}.timer" action="total"/>
</do>
</staged-uptodate>
</sequential>
</macrodef>
<macrodef name="staged-bin">
<attribute name="stage"/>
<attribute name="classpathref" default="NOT SET"/>
<sequential>
<staged-uptodate stage="@{stage}" project="bin">
<check>
<srcfiles dir="${src.dir}">
<include name="compiler/scala/tools/ant/templates/**"/>
</srcfiles>
</check>
<do>
<taskdef name="mk-bin" classname="scala.tools.ant.ScalaTool" classpathref="@{stage}.bin.tool.path"/>
<mkdir dir="${build-@{stage}.dir}/bin"/>
<if>
<equals arg1="@{classpathref}" arg2="NOT SET"/>
<then>
<mk-bin file="${build-@{stage}.dir}/bin/scala" class="scala.tools.nsc.MainGenericRunner" javaFlags="${java.flags}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scalac" class="scala.tools.nsc.Main" javaFlags="${java.flags}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scaladoc" class="scala.tools.nsc.ScalaDoc" javaFlags="${java.flags}"/>
<mk-bin file="${build-@{stage}.dir}/bin/fsc" class="scala.tools.nsc.CompileClient" javaFlags="${java.flags}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scalap" class="scala.tools.scalap.Main" javaFlags="${java.flags}"/>
</then>
<else>
<mk-bin file="${build-@{stage}.dir}/bin/scala" class="scala.tools.nsc.MainGenericRunner" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scalac" class="scala.tools.nsc.Main" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scaladoc" class="scala.tools.nsc.ScalaDoc" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
<mk-bin file="${build-@{stage}.dir}/bin/fsc" class="scala.tools.nsc.CompileClient" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scalap" class="scala.tools.scalap.Main" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
</else>
</if>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scala"/>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scalac"/>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scaladoc"/>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/fsc"/>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scalap"/>
</do>
</staged-uptodate>
</sequential>
</macrodef>
<macrodef name="staged-pack">
<attribute name="project"/>
<attribute name="manifest" default=""/>
<element name="pre" optional="true"/>
<element name="jar-opts" optional="true"/>
<sequential>
<local name="destfile"/>
<property name="destfile" value="${build-pack.dir}/${@{project}.targetdir}/${@{project}.targetjar}"/>
<uptodate property="pack.@{project}.available" targetfile="${destfile}">
<srcresources>
<resources refid="pack.@{project}.files"/>
<!-- <path><pathelement location="${build-quick.dir}/@{project}.complete"/></path> -->
</srcresources>
</uptodate>
<if>
<not>
<isset property="pack.@{project}.available"/>
</not>
<then>
<mkdir dir="${build-pack.dir}/${@{project}.targetdir}"/>
<pre/>
<!-- can't check if a fileset is defined, so we have an additional property -->
<if><not><isset property="pack.@{project}.include-jars.defined"/></not><then>
<fileset id="pack.@{project}.include-jars" dir="." excludes="**" />
</then></if>
<if>
<not>
<equals arg1="@{manifest}" arg2=""/>
</not>
<then>
<jar whenmanifestonly="fail" destfile="${destfile}" manifest="@{manifest}">
<!-- update="true" makes no difference on my machine, so starting from scratch-->
<jar-opts/>
<path refid="pack.@{project}.files"/>
<zipgroupfileset refid="pack.@{project}.include-jars"/>
</jar>
</then>
<else>
<jar whenmanifestonly="fail" destfile="${destfile}">
<jar-opts/>
<path refid="pack.@{project}.files"/>
</jar>
</else>
</if>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="staged-docs">
<attribute name="project"/>
<element name="includes" implicit="true"/>
<sequential>
<staged-uptodate stage="docs" project="@{project}">
<check>
<srcfiles dir="${src.dir}/${@{project}.srcdir}"/>
</check>
<do>
<stopwatch name="docs.@{project}.timer"/>
<mkdir dir="${build-docs.dir}/@{project}"/>
<if>
<equals arg1="${@{project}.docroot}" arg2="NOT SET"/>
<then>
<scaladoc
destdir="${build-docs.dir}/@{project}"
doctitle="${@{project}.description}"
docfooter="epfl"
docversion="${version.number}"
sourcepath="${src.dir}"
classpathref="docs.@{project}.build.path"
srcdir="${src.dir}/${@{project}.srcdir}"
addparams="${scalac.args.all}"
docsourceurl="${scaladoc.url}€{FILE_PATH}.scala#L1"
implicits="on"
diagrams="on"
groups="on"
rawOutput="${scaladoc.raw.output}"
noPrefixes="${scaladoc.no.prefixes}"
docUncompilable="${src.dir}/library-aux"
skipPackages="${@{project}.skipPackages}">
<includes/>
</scaladoc>
</then>
<else>
<scaladoc docRootContent="${src.dir}/@{project}/${@{project}.docroot}"
destdir="${build-docs.dir}/@{project}"
doctitle="${@{project}.description}"
docfooter="epfl"
docversion="${version.number}"
sourcepath="${src.dir}"
classpathref="docs.@{project}.build.path"
srcdir="${src.dir}/${@{project}.srcdir}"
addparams="${scalac.args.all}"
docsourceurl="${scaladoc.url}€{FILE_PATH}.scala#L1"
implicits="on"
diagrams="on"
groups="on"
rawOutput="${scaladoc.raw.output}"
noPrefixes="${scaladoc.no.prefixes}"
docUncompilable="${src.dir}/library-aux"
skipPackages="${@{project}.skipPackages}">
<includes/>
</scaladoc>
</else>
</if>
<stopwatch name="docs.@{project}.timer" action="total"/>
</do>
</staged-uptodate>
</sequential>
</macrodef>
<macrodef name="make-bundle">
<attribute name="project"/>
<element name="srcs" description="Sources for this bundle" optional="true" implicit="true"/>
<sequential>
<copy file="${src.dir}/build/bnd/${@{project}.name}.bnd" tofile="${build-osgi.dir}/${@{project}.name}.bnd" overwrite="true">
<filterset>
<filter token="VERSION" value="${osgi.version.number}"/>
<filter token="SCALA_BINARY_VERSION" value="${scala.binary.version}"/>
<filter token="SCALA_FULL_VERSION" value="${scala.full.version}"/>
<filter token="SCALA_COMPILER_DOC_VERSION" value="${scala-compiler-doc.version.number}"/>
<filter token="SCALA_COMPILER_INTERACTIVE_VERSION" value="${scala-compiler-interactive.version.number}"/>
<filter token="XML_VERSION" value="${scala-xml.version.number}" />
<filter token="PARSER_COMBINATORS_VERSION" value="${scala-parser-combinators.version.number}" />
<filter token="CONTINUATIONS_PLUGIN_VERSION" value="${scala-continuations-plugin.version.number}" />
<filter token="CONTINUATIONS_LIBRARY_VERSION" value="${scala-continuations-library.version.number}" />
<filter token="SCALA_SWING_VERSION" value="${scala-swing.version.number}" />
</filterset>
</copy>
<bnd classpath="${@{project}.jar}" eclipse="false" failok="false" exceptions="true" files="${build-osgi.dir}/${@{project}.name}.bnd" output="${build-osgi.dir}"/>
<if>
<equals arg1="${@{project}.src}" arg2="true"/>
<then>
<!--
A jar-like task that creates an OSGi source bundle. It adds the required MANIFEST.MF headers that allow
Eclipse to match sources with the corresponding binaries.
-->
<jar whenmanifestonly="fail" destfile="${build-osgi.dir}/${@{project}.name}-src.jar">
<srcs/>
<manifest>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Bundle-Name" value="${@{project}.description} Sources"/>
<attribute name="Bundle-SymbolicName" value="org.scala-lang.${@{project}.package}${@{project}.name}${@{project}.namesuffix}.source"/>
<attribute name="Bundle-Version" value="${@{project}.version}"/>
<attribute name="Eclipse-SourceBundle" value="org.scala-lang.${@{project}.package}${@{project}.name}${@{project}.namesuffix};version="${@{project}.version}";roots:=".""/>
</manifest>
</jar>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="copy-bundle">
<attribute name="project"/>
<sequential>
<copy tofile="${dist.dir}/${@{project}.targetdir}/${@{project}.name}.jar" file="${build-osgi.dir}/org.scala-lang.${@{project}.package}${@{project}.name}.jar" overwrite="true"/>
<copy tofile="${dist.dir}/src/${@{project}.name}-src.jar" file="${@{project}.srcjar}" overwrite="true"/>
</sequential>
</macrodef>
<macrodef name="mvn-package">
<attribute name="project"/>
<sequential>
<local name="artifact-base"/>
<property name="artifact-base" value="${dist.maven}/${@{project}.dir}${@{project}.name}/${@{project}.name}"/>
<mkdir dir="${dist.maven}/${@{project}.dir}${@{project}.name}"/>
<copy tofile="${artifact-base}.jar" file="${build-osgi.dir}/org.scala-lang.${@{project}.package}${@{project}.name}${@{project}.namesuffix}.jar" overwrite="true"/>
<copy tofile="${artifact-base}-src.jar" file="${build-osgi.dir}/${@{project}.name}-src.jar" overwrite="true"/>
<copy tofile="${artifact-base}-pom.xml" file="${src.dir}/build/maven/${@{project}.dir}/${@{project}.name}-pom.xml" overwrite="true"/>
<if>
<not>
<isset property="docs.skip"/>
</not>
<then>
<jar destfile="${artifact-base}-docs.jar" basedir="${build-docs.dir}/@{project}" whenmanifestonly="fail">
<include name="**/*"/>
</jar>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="deploy-remote">
<attribute name="jar" default=""/>
<attribute name="pom"/>
<element name="artifacts" implicit="true" optional="true"/>
<sequential>
<if><equals arg1="@{jar}" arg2="true"/><then>
<artifact:deploy settingsFile="${settings.file}">
<artifact:remoteRepository url="${remote.repository}" id="${repository.credentials.id}" />
<artifact:pom refid="@{pom}" />
<artifacts/>
</artifact:deploy>
</then><else>
<artifact:deploy file="@{jar}" settingsFile="${settings.file}">
<artifact:remoteRepository url="${remote.repository}" id="${repository.credentials.id}" />
<artifact:pom refid="@{pom}" />
<artifacts/>
</artifact:deploy>
</else></if>
</sequential>
</macrodef>
<macrodef name="deploy-local">
<attribute name="jar" default=""/>
<attribute name="pom"/>
<element name="artifacts" implicit="true" optional="true"/>
<sequential>
<if><equals arg1="@{jar}" arg2="true"/><then>
<artifact:install>
<artifact:localRepository path="${local.repository}" id="${repository.credentials.id}" />
<artifact:pom refid="@{pom}" />
<artifacts/>
</artifact:install>
</then><else>
<artifact:install file="@{jar}">
<artifact:localRepository path="${local.repository}" id="${repository.credentials.id}" />
<artifact:pom refid="@{pom}" />
<artifacts/>
</artifact:install>
</else></if>
</sequential>
</macrodef>
<macrodef name="deploy-to">
<attribute name="jar" default=""/>
<attribute name="pom"/>
<attribute name="local"/>
<element name="artifacts" implicit="true" optional="true"/>
<sequential>
<if><equals arg1="@{local}" arg2="true"/><then>
<deploy-local jar="@{jar}" pom="@{pom}"> <artifacts/> </deploy-local>
</then><else>
<deploy-remote jar="@{jar}" pom="@{pom}"> <artifacts/> </deploy-remote>
</else></if>
</sequential>
</macrodef>
<macrodef name="filter-pom">
<attribute name="path" />
<attribute name="name" />
<sequential>
<copy file="${path}-pom.xml" tofile="${path}-pom-filtered.xml" overwrite="true">
<filterset>
<filter token="VERSION" value="${maven.version.number}" />
<filter token="SCALA_BINARY_VERSION" value="${scala.binary.version}" />
<filter token="SCALA_FULL_VERSION" value="${scala.full.version}" />
<filter token="XML_VERSION" value="${scala-xml.version.number}" />
<filter token="PARSER_COMBINATORS_VERSION" value="${scala-parser-combinators.version.number}" />
<filter token="CONTINUATIONS_PLUGIN_VERSION" value="${scala-continuations-plugin.version.number}" />
<filter token="CONTINUATIONS_LIBRARY_VERSION" value="${scala-continuations-library.version.number}" />
<filter token="SCALA_SWING_VERSION" value="${scala-swing.version.number}" />
<filter token="RELEASE_REPOSITORY" value="${remote.release.repository}" />
<filter token="SNAPSHOT_REPOSITORY" value="${remote.snapshot.repository}" />
<filter token="JLINE_VERSION" value="${jline.version}" />
<filter token="AKKA_ACTOR_VERSION" value="${akka-actor.version.number}" />
<filter token="ACTORS_MIGRATION_VERSION" value="${actors-migration.version.number}" />
<!-- TODO modularize compiler.
<filter token="SCALA_COMPILER_DOC_VERSION" value="${scala-compiler-doc.version.number}" />
<filter token="SCALA_COMPILER_INTERACTIVE_VERSION" value="${scala-compiler-interactive.version.number}" />
-->
</filterset>
</copy>
<artifact:pom id="@{name}.pom" file="${path}-pom-filtered.xml" />
</sequential>
</macrodef>
<macrodef name="deploy-one">
<attribute name="name" />
<attribute name="local" default="false"/>
<attribute name="signed" default="false"/>
<sequential>
<local name="path"/> <property name="path" value="${dist.maven}/@{name}/@{name}"/>
<echo>Deploying ${path}-[pom.xml|src.jar|docs.jar].</echo>
<filter-pom name="@{name}" path="@{path}"/>
<if><equals arg1="@{signed}" arg2="false"/><then>
<if><isset property="docs.skip"/><then>
<deploy-to local="@{local}" jar="${path}.jar" pom="@{name}.pom">
<artifact:attach type="jar" file="${path}-src.jar" classifier="sources" />
</deploy-to>
</then><else>
<deploy-to local="@{local}" jar="${path}.jar" pom="@{name}.pom">
<artifact:attach type="jar" file="${path}-src.jar" classifier="sources" />
<artifact:attach type="jar" file="${path}-docs.jar" classifier="javadoc" />
</deploy-to>
</else></if>
</then><else>
<local name="repo"/>
<if><equals arg1="@{local}" arg2="false"/><then>
<property name="repo" value="${remote.repository}"/>
</then><else>
<property name="repo" value="${local.repository}"/>
</else></if>
<artifact:mvn failonerror="true">
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${repo}" />
<arg value="-DrepositoryId=${repository.credentials.id}" />
<arg value="-DpomFile=${path}-pom-filtered.xml" />
<arg value= "-Dfile=${path}.jar" />
<arg value="-Dsources=${path}-src.jar" />
<arg value="-Djavadoc=${path}-docs.jar" />
<arg value="-Pgpg" />
<arg value="-Dgpg.useagent=true" />
</artifact:mvn>
</else></if>
</sequential>
</macrodef>
<macrodef name="deploy-jar">
<attribute name="name" />
<attribute name="local" default="false"/>
<attribute name="signed" default="false"/>
<sequential>
<local name="path"/> <property name="path" value="${dist.maven}/@{name}/@{name}"/>
<echo>Deploying ${path}.jar with ${path}-pom.xml.</echo>
<filter-pom name="@{name}" path="@{path}"/>
<if><equals arg1="@{signed}" arg2="false"/><then>
<deploy-to local="@{local}" jar="${path}.jar" pom="@{name}.pom"/>
</then><else>
<local name="repo"/>
<if><equals arg1="@{local}" arg2="false"/><then>
<property name="repo" value="${remote.repository}"/>
</then><else>
<property name="repo" value="${local.repository}"/>
</else></if>
<artifact:mvn failonerror="true">
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${repo}" />
<arg value="-DrepositoryId=${repository.credentials.id}" />
<arg value="-DpomFile=${path}-pom-filtered.xml" />
<arg value= "-Dfile=${path}.jar" />
<arg value="-Pgpg" />
<arg value="-Dgpg.useagent=true" />
</artifact:mvn>
</else></if>
</sequential>
</macrodef>
<macrodef name="deploy-pom">
<attribute name="name" />
<attribute name="local" default="false"/>
<attribute name="signed" default="false"/>
<sequential>
<local name="path"/> <property name="path" value="${dist.maven}/@{name}/@{name}"/>
<echo>Deploying ${path}-pom.xml.</echo>
<filter-pom name="@{name}" path="@{path}"/>
<if><equals arg1="@{signed}" arg2="false"/><then>
<deploy-to local="@{local}" pom="@{name}.pom"/>
</then><else>
<local name="repo"/>
<if><equals arg1="@{local}" arg2="false"/><then>
<property name="repo" value="${remote.repository}"/>
</then><else>
<property name="repo" value="${local.repository}"/>
</else></if>
<artifact:mvn failonerror="true">
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${repo}" />
<arg value="-DrepositoryId=${repository.credentials.id}" />
<arg value="-DpomFile=${path}-pom-filtered.xml" />
<arg value= "-Dfile=${path}-pom-filtered.xml" />
<arg value="-Pgpg" />
<arg value="-Dgpg.useagent=true" />
</artifact:mvn>
</else></if>
</sequential>
</macrodef>
<macrodef name="deploy">
<attribute name="local" default="false"/>
<attribute name="signed" default="false"/>
<sequential>
<deploy-one name="scala-library" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-reflect" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-compiler" local="@{local}" signed="@{signed}"/>
<!-- TODO modularize compiler.
<deploy-one name="scala-compiler-doc" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-compiler-interactive" local="@{local}" signed="@{signed}"/>
-->
<deploy-one name="scala-actors" local="@{local}" signed="@{signed}"/>
<deploy-one name="scalap" local="@{local}" signed="@{signed}"/>
</sequential>
</macrodef>
<macrodef name="testSuite">
<attribute name="dir" default="${partest.dir}"/>
<attribute name="srcdir" default="files"/> <!-- TODO: make targets for `pending` and other subdirs -->
<attribute name="colors" default="${partest.colors}"/>
<attribute name="scalacOpts" default="${partest.scalac_opts} ${scalac.args.optimise}"/>
<attribute name="javaOpts" default="${env.ANT_OPTS}"/>
<attribute name="pcp" default="${toString:partest.compilation.path}"/>
<attribute name="kinds"/>
<sequential>
<property name="partest.dir" value="@{dir}" />
<partest srcdir="@{srcdir}"
kinds="@{kinds}"
colors="@{colors}"
scalacOpts="@{scalacOpts}"
javaOpts="@{javaOpts}"
compilationpath="@{pcp}"/>
</sequential>
</macrodef>
<macrodef name="bc.run-mima">
<attribute name="jar-name"/>
<attribute name="prev"/>
<attribute name="curr"/>
<attribute name="direction"/>
<sequential>
<echo message="Checking @{direction} binary compatibility for @{jar-name} (against ${bc-reference-version})"/>
<java taskname="mima" fork="true" failonerror="true" classname="com.typesafe.tools.mima.cli.Main">
<arg value="--prev"/>
<arg value="@{prev}"/>
<arg value="--curr"/>
<arg value="@{curr}"/>
<arg value="--filters"/>
<arg value="${basedir}/bincompat-@{direction}.whitelist.conf"/>
<arg value="--generate-filters"/>
<classpath>
<path refid="mima.classpath"/>
</classpath>
</java>
</sequential>
</macrodef>
<macrodef name="bc.check">
<attribute name="project"/>
<sequential>
<bc.run-mima jar-name="scala-@{project}" prev="${org.scala-lang:scala-@{project}:jar}" curr="${@{project}.jar}" direction="backward"/>
<bc.run-mima jar-name="scala-@{project}" prev="${@{project}.jar}" curr="${org.scala-lang:scala-@{project}:jar}" direction="forward"/>
</sequential>
</macrodef>
<macrodef name="tarz">
<attribute name="name" description="The tar file name (without extension)."/>
<element name="file-sets" description="A sequence of fileset elements to be included in the tar balls." optional="false" implicit="true"/>
<sequential>
<tar destfile="@{name}.tar" compression="none" longfile="gnu">
<file-sets/>
</tar>
<gzip src="@{name}.tar" destfile="@{name}.tgz"/>
<if>
<not>
<equals arg1="${archives.skipxz}" arg2="true"/>
</not>
<then>
<exec executable="xz" failifexecutionfails="false">
<arg line="-k -9e -S .xz @{name}.tar"/>
</exec>
<move file="@{name}.tar.xz" tofile="@{name}.txz" failonerror="false"/>
</then>
</if>
<delete file="@{name}.tar"/>
</sequential>
</macrodef>
</project>
|