1

Here is my Ant snippet:

    <target name="-post-jar">
      <taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="${javac.classpath}"/>
      <yguard>
        <inoutpair in="${dist.dir}/Valuemaze.jar" out="${dist.dir}/Valuemaze_obf.jar"/>
      </yguard>
      <copy file="${dist.dir}/Valuemaze.jar" tofile="${dist.dir}/Valuemaze_test.jar"/>
    </target>    

Classpath is ok, target runs as the second task (copy) works properly. So paths are ok.

yguard task does nothing. No any message, warning nor error is provided. Cannot configure any debug logging, yguard seems to have none.

What can be wrong?

ePortfel
  • 119
  • 6

1 Answers1

0

It forced me to dig into yGuard sources.

And the answer is:

    <target name="-post-jar">
      <taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="${javac.classpath}"/>
      <yguard>
        <inoutpair in="${dist.dir}/Valuemaze.jar" out="${dist.dir}/Valuemaze_obf.jar"/>
        <rename mainclass="mypackage.myclass"/>
      </yguard>
    </target>

You have to add subtask to make it working. Why does not docs specify this? Because it doesn't. Why there is no single example for newbies in docs? Because it isn't. Why there is no debug information about task missing? Because so.

Leaving here for other begginers.

ePortfel
  • 119
  • 6
  • There is no _"single example for newbies"_ in the yGuard documentation because that wouldn't be meaningful. If you are using Gradle then the _"single example"_ that was for Maven or Ant would not be helpful, and vice versa. Did you see [the "Setup" documentation for yGuard](https://yworks.github.io/yGuard/setup/)? I think it is pretty good. Also see the [Troubleshooting section](https://yworks.github.io/yGuard/troubleshooting/). – skomisa Aug 18 '22 at 04:57
  • Re You have to add subtask to make it working. Why does not docs specify this? It does. Right there in the second paragraph of [the documentation](https://yworks.github.io/yGuard/task_documentation/) it says: The `yguard` task contains two nested elements that perform the name obfuscation and code shrinking separately: The `shrink` element ... The `rename` element ... – Thomas Behr Aug 18 '22 at 15:06
  • Re Why there is no single example for newbies in docs? Because the yGuard distribution comes with ready-to-use examples in a folder called `examples`. – Thomas Behr Aug 18 '22 at 15:07
  • Re Why there is no debug information about task missing? Because we expect yGuard users to read through the documentation first. Ok, this is a cheap shot. Nobody seems to read the documentation. On the other hand, I really cannot understand how anybody would know what yGuard does without reading the documentation. – Thomas Behr Aug 18 '22 at 15:08
  • Well, I have read docs and could not make it working without source debugging. I started from yguard element docs and maybe it was a mistake because I did not notice preamble. Yguard element doc lists child elements but there is no suggestion that some of them are somehow mandatory. I used to have step-by-step tutorials with code. Well, there are examples in distribution package. I would enrich them with one more: hello world. – ePortfel Aug 18 '22 at 21:07