Is there a plugin or some other way to mark a section of code (any language) in such a way that when gradle runs, it will recognize the start and end of the section to remove and strip it out of the file before the file gets compiled? I'm mostly interested in stripping out stuff in html or Java, so maybe there is another approach.
Asked
Active
Viewed 176 times
0
-
What's you're use case? I've heard of _generating_ code at compile time but not _removing_ code (but that doesn't mean it's not done). – Slaw Aug 21 '18 at 13:46
-
In my html I have script tags that reference javascript files. These are used during development but during production release, the scripts are all compiled into a single script file and that file alone is used. The former script files need to either be commented out or removed. Preferably removed. – Johann Aug 21 '18 at 14:08
1 Answers
0
What you are looking for would be something like the preprocessor instructions in c++ which does not exist in java. See this question: #define in Java
To modify actual source files in the build system i would consider dangerous and error prone. I would support the answer of @johnquacker if you consider the comments as well. Especially a dependency injection Framework or the OSGi framework might be very helpful here.

fl0w
- 3,593
- 30
- 34