Based on the conversation on PR, the intent was not to pollute the source
directory and hence we are placing the generated file outside it in the
target/extra-resources directory. I agree that the "sbt way" is to add the
generated resources under the resourceManaged setting which was essentially
the earlier approach implemented.

However, even on generating the  file under the default resourceDirectory
=> core/src/resources doesn't pick the file in jar after doing a clean. So
this seems to be a different issue.





On Thu, May 19, 2016 at 4:17 PM, Jakob Odersky <ja...@odersky.com> wrote:

> To echo my comment on the PR: I think the "sbt way" to add extra,
> generated resources to the classpath is by adding a new task to the
> `resourceGenerators` setting. Also, the task should output any files
> into the directory specified by the `resourceManaged` setting. See
> http://www.scala-sbt.org/0.13/docs/Howto-Generating-Files.html. There
> shouldn't by any issues with clean if you follow the above
> conventions.
>
> On Tue, May 17, 2016 at 12:00 PM, Marcelo Vanzin <van...@cloudera.com>
> wrote:
> > Perhaps you need to make the "compile" task of the appropriate module
> > depend on the task that generates the resource file?
> >
> > Sorry but my knowledge of sbt doesn't really go too far.
> >
> > On Tue, May 17, 2016 at 11:58 AM, dhruve ashar <dhruveas...@gmail.com>
> wrote:
> >> We are trying to pick the spark version automatically from pom instead
> of
> >> manually modifying the files. This also includes richer pieces of
> >> information like last commit, version, user who built the code etc to
> better
> >> identify the framework running.
> >>
> >> The setup is as follows :
> >> - A shell script generates this piece of information and dumps it into a
> >> properties file under core/target/extra-resources - we don't want to
> pollute
> >> the source directory and hence we are generating this under target as
> its
> >> dealing with build information.
> >> - The shell script is invoked in both mvn and sbt.
> >>
> >> The issue is that sbt doesn't pick up the generated properties file
> after
> >> doing a clean. But it does pick it up in subsequent runs. Note, the
> >> properties file is created before the classes are generated.
> >>
> >> The code for this is available in the PR :
> >> https://github.com/apache/spark/pull/13061
> >>
> >> Does anybody have an idea about how we can achieve this in sbt?
> >>
> >> Thanks,
> >> Dhruve
> >>
> >
> >
> >
> > --
> > Marcelo
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@spark.apache.org
> > For additional commands, e-mail: dev-h...@spark.apache.org
> >
>



-- 
-Dhruve Ashar

Reply via email to