Ant 1.8.1 and Jarbundler task

MCroft

Developer
Staff member
I use cygwin, but I don't see why it should be a requirement for building mafia.

Unless I'm quite wrong, y'all are misstating the scope. Building should be unaffected. This change only affects the command make a complete set of cross-platform distributable packages (ant dist, not ant build). I still think it should be further improved, and I can do it any of the ways I suggested (not today, off to my wife's 25th HS reunion, wherein I will meet strangers who knew her at age 14), but I didn't want to change the way the dist process worked without hearing how the maintainers wanted it.

Hope that's clearer.
 

Theraze

Active member
Yeah... and even if you do have cygwin installed (I do, as I code in C and C++ a fair bit) it fails if you're compiling with Ant and haven't put the cygwin bin folder into the main path...
 

Veracity

Developer
Staff member
It might be cleaner to put the version in an ANT properties file and insert it in the KoLConstants, but that wasn't what we talked about.
At your leisure, let's do it this way. I currently have to edit KoLConstants every time I spin a new release. Changing, instead, build.properties (or whatever) - and having that be directly usable by the build file and automatically inserted into KoLConstants - would be the same, from the release-spinner's viewpoint. Plus OS independence.
 
Yay! I'm liking these proposed build changes - they'll make compiling KoLmafia.exe or what have you SO much simpler. It'll also make maintenance easier... but don't forget to use Windows conventions (CR+LF) in text files, in case Windows users want to open them up in Notepad - it doesn't understand Unix-style LF only, for example.
 

Dudicle

New member
Dadnab! I was halfway looking into building my own files to tinker with, and even got some help on the subject. Then again this might be the perfect time!

I'm installing ant for the first time today on my Mac. Come to think of it, I think this is the first time I've installed ant at all! :D

I know it is rather unlikely, but is there any way that I might be able to help?

~Dudicle

EDIT: I didn't realize that you can't format your posts, and removed said formatting.
 

Grotfang

Developer
Unless I'm quite wrong, y'all are misstating the scope. Building should be unaffected.

As Alhifar said, you are quite wrong.

Code:
% ant daily
Buildfile: build.xml

BUILD FAILED
C:\Users\Ben\Documents\KoLmafia\source\kolmafia\build.xml:25: Execute failed: java.io.IOException: Cannot run program "grep": CreateProcess error=2, The system cannot find the file specified

Total time: 0 seconds
 

MCroft

Developer
Staff member
Properties file based build

Once more, with four part harmony and feeling. Implemented as discussed, with a properties file and no grep. It does use regexreplace. Hopefully the requirement to have a regular expression parser in the classpath is a given these days, otherwise we may need to find one to include.

I'd love to have a windows user check the dist target, the daily target, and the .exe version to make sure they work.

All these files need to be saved without the .txt extension. I don't know if the text editor handled line endings as requested.
 

Attachments

  • default.properties.txt
    1 KB · Views: 78
  • build.xml.txt
    11.4 KB · Views: 183
  • build.properties.txt
    484 bytes · Views: 79
Last edited:

Grotfang

Developer
I'd love to have a windows user check the dist target, the daily target, and the .exe version to make sure they work.

Thanks for the quick response.

First time through:

Code:
% ant daily
Buildfile: build.xml

clean:
  [delete] Deleting directory C:\Users\Ben\Documents\KoLmafia\source\kolmafia\build
  [symlink] Removing symlink: dist/KoLmafia-14.4/Applications
  [symlink] java.io.FileNotFoundException: No such symlink: dist\KoLmafia-14.4\Applications

BUILD FAILED
C:\Users\Ben\Documents\KoLmafia\source\kolmafia\build.xml:100: delete doesn't support the "removeNotFollowedSymlinks" attribute

Total time: 54 seconds

That time through most of the time was spent on a delay between [delete] (having deleted the build directory) and [symlink]. On subsequent attempts:

Code:
% ant daily
Buildfile: build.xml

clean:
  [symlink] Removing symlink: dist/KoLmafia-14.4/Applications
  [symlink] java.io.FileNotFoundException: No such symlink: dist\KoLmafia-14.4\Applications

BUILD FAILED
C:\Users\Ben\Documents\KoLmafia\source\kolmafia\build.xml:100: delete doesn't support the "removeNotFollowedSymlinks" attribute

Total time: 0 seconds

I know very little about ant, so I'm afraid that's the best I can do re assistance. Thank you for working to resolve this -- it is appreciated.
 

MCroft

Developer
Staff member
...

I know very little about ant, so I'm afraid that's the best I can do re assistance. Thank you for working to resolve this -- it is appreciated.

Ben,

Thank you for testing this. That's a very useful report. The delete property started supporting "removeNotFollowedSymlinks" in ANT 1.8.0. I removed that and also changed the properties file so that Windows users can edit it more easily if their text editors don't support unix style line endings.

The downside is that I can't seem to get the delete task to remove the staging directory we create to make the disk image. I think that's harmless, but vexing. Anyone have any ideas?
 

Attachments

  • default.properties.txt
    1.1 KB · Views: 30
  • build.xml.txt
    11.3 KB · Views: 58
  • build.properties.txt
    498 bytes · Views: 32

Theraze

Active member
Builds a KoLmafia-14.4.jar file for me in Windows. I'll stare at the delete a bit... is that always failing to delete properly, or just a specific build target?

Edit: Note: build.xml also has the *nix line endings.

Assuming that the delete problem you're talking about is from changing:
Code:
 <target name="clean">
  <delete dir="${build}" failonerror="false"/>
  <delete dir="${docs}" failonerror="false"/>
  <delete failonerror="false">
   <fileset dir="${dist}">
    <include name="${ant.project.name}*"/>
   </fileset>
  </delete>
  <symlink action="delete" link="${dist}/${KoLVersionedBaseFileName}/Applications" failonerror="false" />
                <delete dir="${appfile}" failonerror="false"/>
 </target>
to this:
Code:
 <target name="clean">
  <delete dir="${build}" failonerror="false"/>
  <delete dir="${docs}" failonerror="false"/>
  <symlink action="delete" link="${dist}/${version-name}/Applications" failonerror="false" />
        <delete dir="${appfile}" failonerror="false" />
        <!-- Really important not to follow the symlink to /Applications and delete it...-->        
  <delete failonerror="false">
   <fileset dir="${dist}" defaultexcludes="no" followsymlinks="false" />
  </delete>
                
 </target>

Any chance part of the issue is the difference in primacy? In the old code, dist is deleted first, then the symlink... *ponders* Is that what you're saying... as it stood, it was possible for the build to wipe out your Applications folder? If so, why didn't it do it for everyone in the past? Maybe because you've skipped the part for
Code:
    <include name="${ant.project.name}*"/>
in the updated files?
 
Last edited:

MCroft

Developer
Staff member
Builds a KoLmafia-14.4.jar file for me in Windows. I'll stare at the delete a bit... is that always failing to delete properly, or just a specific build target?
So the problem only came up after the dmg target got fixed and put back in the dist target. It's an artifact of that process creating an intermediate directory to build the disk image from. The first time I got that target working, it started deleting stuff from /Applications, which is sorta important.

For me, it leaves artifacts in dist when I type ant dist followed by ant clean. An ideal clean target leaves the system the way it would be following a fresh svn checkout and it's vexing that I can't make it so.

Edit: Note: build.xml also has the *nix line endings.

will fix!
 

MCroft

Developer
Staff member
Would a specific include help, like it had before?

I tried it, and it didn't. However, I did look at parameters for the delete task and found I needed to specify includeemptydirs="true". Properly cleaning version coming up...
 

Theraze

Active member
Seems that it's generating both an empty directory and the one that actually gets used... fairly certain the empty one isn't supposed to happen, but... long as it cleans, that works. :)
 

MCroft

Developer
Staff member
more revisions...

  • Added automatically setting REVISION to null
  • Changed line endings in the build.xml file
  • Fixed the clean target to remove empty directories

As usual, I would be pleased to hear from anyone trying this on platforms I don't use.

I'm looking at automating the notes creation. It's taking me longer than I expected because of the build putting the release notes in different places on different platforms.

There are at least two options:
1: I get off my lazy butt and code it like the app does, just in ANT
2: we re-work that to put the history.txt and release.txt somewhere else like ${build} or ${dist}
 

Attachments

  • build.properties.txt
    574 bytes · Views: 43
  • build.xml.txt
    12.1 KB · Views: 99
  • default.properties.txt
    1.2 KB · Views: 50

Theraze

Active member
Buildfile: C:\kolmafia\build.xml
BUILD FAILED
C:\kolmafia\build.xml:384: Unexpected text "-->"

Compiles if you remove the bad comment-end.
 
Last edited:

MCroft

Developer
Staff member
Famous last words... "I'll just add a comment. That won't need to be retested."

Fixed, and thank you for testing this.
 

Attachments

  • build.xml.txt
    12.1 KB · Views: 158
Top