Menu

#156 Codesize added to properties file

1.9.0.0
closed
1
2014-02-16
2014-01-26
Anonymous
No

Would it be possible to store a new variable in the .properties files post compile/package for upload. It would require a small change to RobotItem + editor + package bot.
I have been trying to run codesize.jar from a php exec java command on my web server to try and extract the code size for bots in a repository and i'm getting blocked by permissions.
If we add the codesize value in to the .properties file i will be able to read this out of the jar file. The same value could also be used to enhance the game GUI for the bot selection. i.e. select bot by size category. It would not be 100% tamper proof, so things like roborumble would not be able to rely on the value as it could have been modified. so code size would still need to be called. But it would be an otherwise good reference value to be able to get your hands on.

Related

Feature Requests: #156

Discussion

  • MrDragonbyte

    MrDragonbyte - 2014-01-26

    Bah, didn't realise I wasn't logged in. This is my request.

     
  • Flemming N. Larsen

    I implemented the part that writes the codesize into the .properties file when the properties file is being created. The implementation can be seen here at GitHub.

     
    • MrDragonbyte

      MrDragonbyte - 2014-02-01

      Thank you.
      The changes look good to me, just what I needed.
      Sorry that you beat me too it.
      I'll check out the latest and test.

       
  • Flemming N. Larsen

    I did it because I am already working in the exact same area with solving the the bug Bug-364 Robot Packager does not include the robot data dir in the .jar file. And the fix was easy to do and I needed to do some refactoring where the Codesize tool is being called. :-)

    I should like to hear if it works as expected. When you download the sources, you just need to run the mvnassembly script, which will build everything for you. The output jar file robocode-1.9.0.0-setup.jar will be put inside the /robocode.distribution/target directory. :-)

     

    Last edit: Flemming N. Larsen 2014-02-01
  • MrDragonbyte

    MrDragonbyte - 2014-02-05

    sorry for the delay, been having fun and games building robocode :s
    any idea why i'm getting missing librarys on M2_REPO/net/sf/robocode/robocode.tests/1.9.0.0/robocode.tests-1.9.0.0.jar ? projects robocode.dotnet.tests & robocode.testing.samples. failing the build tests at the moment. jni4net also failed , had to manually fetch the files.

     
  • MrDragonbyte

    MrDragonbyte - 2014-02-05

    Meh.. dont worry about the missing test jar, was caused by failing junits. have created a bug report. have been able to fully build now so will test the request

     
  • MrDragonbyte

    MrDragonbyte - 2014-02-06

    Robocode Robot

    Wed Feb 05 23:59:05 GMT 2014

    robot.description=Photon
    robot.webpage=
    robot.include.source=false
    robocode.version=1.9.0.0
    robot.version=2.1
    robot.author.name=Dragonbyte
    robot.classname=dragonbyte.nano.Photon

    properties file from the packaged jar - no codesize value :(
    cant see why, went over your commit. i have checked out https://github.com/robo-code/robocode.git/trunk

     
  • MrDragonbyte

    MrDragonbyte - 2014-02-06

    ok, so found that if its compiled in eclipse then it will not add the codesize to properties.
    If you use built in editor, with found compiler and package then it will.

    Robocode Robot
    Thu Feb 06 00:18:27 GMT 2014
    robot.description=ddd
    robot.include.source=true
    robocode.version=1.9.0.0
    robot.version=1.0
    robot.author.name=
    robot.codesize=186
    robot.classname=DR.WallsX

     
  • MrDragonbyte

    MrDragonbyte - 2014-02-06

    seams that when using the built in editor, and files are in the robots/package directory that when it packages up it will write a properties file down with the code size included.
    however when using dev directors in eclipse the same is not true. The properties file will be written to the projectRoot/class/package folder without the code size added.
    thaught it was me not referencing the right robocode.jar from eclipse but made no difference once changed / clean / repackage.

     
    • Flemming N. Larsen

      Sorry for the late reply. I have been busy these days.

      With Eclipse, the codesize tool is not normally setup and run with Robocode
      per default. But is is easy to get just by adding Codesize to the classpath
      (build path).
      That is one of the reason why Robocode and the built-in RoboRumble client
      uses reflection when accessing Codesize, as it has no guarantee that
      Codesize is on the classpath.

      Regarding the robot dir, you can set the robot directory using the 'VM
      Options' in your launch configuration for Robocode in Eclipse.
      Normally it is set like this:

      -DROBOTPATH=${workspace_loc:robocode.samples/target/classes} -Xmx512m

      But if you want to point the ROBOTPATH to something else, you are free to
      do this. :-)

      I admit that it is somewhat terrible to understand how Robocode is setup in
      Eclipse and with Maven... and IntelliJ IDEA for that matter.

      Cheers,
      - Flemming

      2014-02-06 1:46 GMT+01:00 MrDragonbyte mr-dragonbyte@users.sf.net:

      seams that when using the built in editor, and files are in the
      robots/package directory that when it packages up it will write a
      properties file down with the code size included.
      however when using dev directors in eclipse the same is not true. The
      properties file will be written to the projectRoot/class/package folder
      without the code size added.
      thaught it was me not referencing the right robocode.jar from eclipse but
      made no difference once changed / clean / repackage.


      Status: open
      Labels: codesize properties packaging
      Created: Sun Jan 26, 2014 01:00 PM UTC by Anonymous
      Last Updated: Thu Feb 06, 2014 12:23 AM UTC
      Owner: Flemming N. Larsen

      Would it be possible to store a new variable in the .properties files post
      compile/package for upload. It would require a small change to RobotItem +
      editor + package bot.
      I have been trying to run codesize.jar from a php exec java command on my
      web server to try and extract the code size for bots in a repository and
      i'm getting blocked by permissions.
      If we add the codesize value in to the .properties file i will be able to
      read this out of the jar file. The same value could also be used to enhance
      the game GUI for the bot selection. i.e. select bot by size category. It
      would not be 100% tamper proof, so things like roborumble would not be able
      to rely on the value as it could have been modified. so code size would
      still need to be called. But it would be an otherwise good reference value
      to be able to get your hands on.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/robocode/feature-requests/156/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Feature Requests: #156

  • Flemming N. Larsen

    Sorry for the late reply. I have been busy these days.

    With Eclipse, the codesize tool is not normally setup and run with Robocode per default. But is is easy to get just by adding Codesize to the classpath (build path). See the attachment to see how I have set it up my pointing at the codesize .jar file in the Maven (.m2) cache. :-)
    That is one of the reason why Robocode and the built-in RoboRumble client uses reflection when accessing Codesize, as it has no guarantee that Codesize is on the classpath.

    Regarding the robot dir, you can set the robot directory using the 'VM Options' in your launch configuration for Robocode in Eclipse.
    Normally it is set like this:

    -DROBOTPATH=${workspace_loc:robocode.samples/target/classes} -Xmx512m

    But if you want to point the ROBOTPATH to something else, you are free to do this. :-)

    I admit that it is somewhat terrible to understand how Robocode is setup in Eclipse and with Maven... and IntelliJ IDEA for that matter.

     

    Last edit: Flemming N. Larsen 2014-02-07
  • Flemming N. Larsen

    Implemented in version 1.9.0.0 just released.

     
  • Flemming N. Larsen

    • status: open --> closed
     
  • Flemming N. Larsen

    • Group: Future Release --> 1.9.0.0
     

Anonymous
Anonymous

Add attachments
Cancel