scala-2.13.0 & ant support

I could not find anymore ant scalac task definition in scala-2.13.0

In <=2.12.8 was in lib/scala-compiler.jar scala/tools/ant/ antlib.xml + Scalac.class
In 2.13.0 in lib/scala-compiler.jar scala/tools/ ant folder is gone
Is it somewhere else? 'looks it is not supported anymore: will it be added later?

cheers

1 Like

It was removed by remove Ant support, remove Eclipse support by SethTisue Ā· Pull Request #6255 Ā· scala/scala Ā· GitHub

As the PR says,

it ought to be a separate project, if anyone still wants it to exist in 2.13+ world.

The removed code is open-source, so anyone reading this should feel free to revive it and make it available separately.

It had already been unmaintained for a long time. (Perhaps in a separate repo, it might actually attract more maintenance than it was getting before? For example, it could now be released on its own schedule, instead of having to wait for a Scala release to happen.)

3 Likes

so, it was removed ā€¦ because we are all supposed to use only sbt ?
http://www.lihaoyi.com/post/SowhatswrongwithSBT.html

1 Like

SBT has improve a lot since then ā€¦ why not you give it a try ?

In a personal note: I love Ant, Iā€™ve used Ant a lot by 2001 and 2002 ā€¦ you make me bring tons of nice memories :wink: :slight_smile:

1 Like

or Gradle, or Maven, or Bloop, or Mill, or CBT, or Fury, orā€¦

or even Ant, if sufficient community interest and commitment exists. all of these things are community-based efforts, in whole or in part.

3 Likes

one can use ant, not for the sake of using old tech, but to ā€œfit inā€ within a legacy java environment. removing such legacy support wonā€™t help scala adoption into the real world

There are many projects out there sill using Ant for various reasons. I personally canā€™t move a few of them to Scala 2.13 as Ant support is dropped, as I donā€™t have an option to modify other aspects of those projects. Itā€™s not like Ant is an obsolete tool. And supporting it in Scala does not seem to be a big deal. Showstopper for me :frowning:
Moreover, there is no mention of this change in Release notes found here: https://github.com/scala/scala/releases/tag/v2.13.0. Is Ant negligible enough build tool that is not worth mentioning when you drop support for it?!!
Would it be possible at least to provide a separate library for transition? If the community wants to support it, they could start from that separate library. Just like the way XML was handledā€¦

At least for scalac: to bypass that annoying removal, I created a scalac target that exec the scalac command e.g.

<target name="scalac">
    <echo message="Compiling source files to ${build.target.dir}" />
    <exec executable="scalac" failonerror="true">
        <arg line="-cp '${lib.dir}/*'" />
        <arg line="-d '${build.target.dir}'" />
        <arg line="@${basedir}/files2compile" />
    </exec>
</target>


<target name="compile">
    <pathconvert property="src2compile" pathsep=" ">
        <fileset dir="${src.dir}">
            <include name="**/*.scala"/>
            <exclude name="**/test*"/>
            <exclude name="**/*Tmp*"/>
            <exclude name="**/*Test.scala"/>
        </fileset>
    </pathconvert>
    <echo file="${basedir}/files2compile" message="${src2compile}" />
    <property name="build.target.dir" value="${build.production.dir}" />
    <antcall target="scalac" />
</target>

ā€¦

(needs SCALA_HOME env set, and scalac in PATH)

1 Like

this is now fixed

1 Like

It was removed because we would prefer that someone else maintained this. Weā€™re a small team and we have to focus on what we do best. As Seth said, I hope someone will take the code from that PR and move it to a separate project, just like the maven plugin(s) that are maintained outside of scala/scala.

2 Likes

I can understand that. Yet, it was there up until M2, right? Scala community, thankfully, is not so small anymore. I think dropping the support without giving a transition library, or documenting how to replace scalac and scaladoc targets in an ant file, is not such a responsible behavior towards that community. dece is nice enough to list an option here with some assumptions about path and environment variable. But I think it is your responsibility to provide a standard example, and put it in release documentation.

or Gradle

where Scala pluginā€™s scaladoc task is broken, since it uses ā€˜scala/tools/ant/antlib.xmlā€™ā€¦

1 Like

I see youā€™ve opened https://github.com/gradle/gradle/issues/9855 on the Gradle thing; linking it here so that interested users can subscribe to it.

Iā€™ve extracted ant related code from 2.12.x source, changed some 2.13 issues and recompiled it using scala 2.13.0 to separate jar. It is working for me. I am pretty much sure that this is far from perfection, but maybe it could be used as start point for future improvements. Also, this can be used to solve scaladoc problem in gradle.
is there any ā€œofficialā€ place where to put those source files or should I simply put that on my github space?

1 Like

Cool! Iā€™d suggest starting under your own GitHub account, and we can worry later about whether it makes sense to transfer ownership to the Scala org.

Iā€™d be interested in adding this to the Scala community build, once the repo exists.

Iā€™d also be happy to do some publicity via https://twitter.com/scala_lang once the project is up and running smoothly. (Or, if you feel such publicity might help attract interested contributors, we could do it sooner.)

Sorry for not replying earlier :frowning:
Code that Iā€™ve extracted from Scala 12.7 and adapted to 2.13 is located on GitHub at https://github.com/cigaly/scala-ant . At the moment it can be compiled using 2.13.1 and it is working for me. Of course, it is possible (or even likely) thta it will not work generally. So, please, let me know if you have some problems using this, I will try to fix if I can. [I will be on vacation for next two weeks and unable to answer]

Unfortunately, contrary to most of other languages and packages that Iā€™ve used where differences between two minor versions are (unsurprisingly?) minor, in Scala changes between tow (consecutive) versions can break thnigs. Latest example is ā€˜targetā€™ compiler option which in 2.13.0 accepted as values ā€˜jvm-1.[5-8]ā€™ (with everything except ā€˜jvm-1.8ā€™ deprecated), in 2.13.1 accepted values are simple numbers 8-12.

1 Like

Kindly add the Ant support back into the project. Ant provides absolute transparency into the build activity. I personally prefer Ant over SBT. If nothing, it helps learning and adaption for the language. Thanks!