6

Is there any way to find classes/objects that extend a certain class in sbt in the sources?

I played around with https://github.com/ruippeixotog/sbt-classfinder but that is only good for Compile and Test it seems.

What I intend to do is:

  1. Find all classes that extends StyleSheet.Standalone (from https://github.com/japgolly/scalacss/)
  2. "Compile" (*) (object.render[TypedTag[String]] them and put the output in a specific folder

(*) Actually I want to invoke the render method on each of them and put the output (a string) into a x.css file.

  • I've never heard about such a plugin before. I doubt one existed. Developing a task to do so does not seem a very heavy-coding exercise. sbt's pretty flexible in this manner. – Jacek Laskowski Mar 06 '17 at 07:29
  • Can you provide some assistance then on how to do that reflection –  Mar 06 '17 at 13:50
  • Doh, that's exactly what I was afraid of the most (and that's why I did not answer your question, but just left a comment :)) I think http://stackoverflow.com/q/31907235/1305344 or http://stackoverflow.com/q/12078366/1305344 can help. If so, mark your question as a duplicate. – Jacek Laskowski Mar 06 '17 at 19:21
  • Could you clarify what you need here that `sbt-classfinder` doesn't provide? I think that project does exactly the "reflection" style searching you're discussing in your comments. – Rich Mar 10 '17 at 12:17
  • @Rich I think that it should do what I want, but I can't get it to work correctly. I could provide that I tried, but it's pretty standard what I tried (setting up universe etc) but I couldn't get it to work :( –  Mar 10 '17 at 20:50

1 Answers1

0

I believe that sbt-classfinder does exactly what you have asked for. If you want more from this question, you will need to be more specific about why it didn't work for you or what you want that it does not provide.

You said:

I want to invoke the render method on each [class that extends StyleSheet.Standalone] and put the output (a string) into a x.css file.

The first example in the sbt-classfinder README shows how to find a class "marked with the annotation QuickRun" and execute it, which is fairly close to that and should get you started..

Rich
  • 15,048
  • 2
  • 66
  • 119