EgonOlsen71 / basicv2

A Commodore (CBM) BASIC V2 interpreter/compiler written in Java
https://egonolsen71.github.io/basicv2/
The Unlicense
84 stars 15 forks source link

Ant-generated build number #59

Closed nietoperz809 closed 1 year ago

nietoperz809 commented 1 year ago

Automatically incremented build number (before each compilation). So the host process (C64Screen, for example) can detect which version of basicv2.jar it is running. .... println (buildnum.BuildInfo.buildInfo);

EgonOlsen71 commented 1 year ago

Can you make it so that build_jar.xml automatically includes the buildnum.xml and run the target defined in it? I briefly tried it with "include" and "depends" but it didn't work, at least not from within Eclipse. But my ANT-days are actually long gone, so I couldn't be bothered to spend too much time on this one...

nietoperz809 commented 1 year ago

Hello Egon, I'm not using Eclipse but this might help: https://www.w3schools.blog/run-ant-script-eclipse

Btw, I use IntelliJ IDEA where integration of ANT is pretty easy. Just give it a try. You'll love it!

IntelliJ is much easier to use as compared to Eclipse. The learning curve is far faster in IntelliJ, which makes developing easier and more natural. Code completion, Dropdowns, quick view, project wizards, etc. are all possible in both Eclipse and IntelliJ, but the user experience in IntelliJ is much more satisfying. https://www.javatpoint.com/intellij-vs-eclipse

EgonOlsen71 commented 1 year ago

I'm already using IntelliJ for most of my stuff, but this project is older, so it's still in my Eclipse environment and I see no need to switch it over yet. The problem isn't the integration of ANT, I can happily run ANT from within Eclipse, I just would like to include the number-inc-target to the jar building-script. Because otherwise, I would have to call both one after the other. It should work with "include" and "depends" IMHO, but I couldn't get it to work. ANT always complained about the depending target not being present despite of the include. I thought that you might have a working solution for this.

nietoperz809 commented 1 year ago
  1. Start IntelliJ
  2. Click "get from VCS"
  3. Enter: https://github.com/nietoperz809/basicv2 in the URL field
  4. Click on "Clone"
  5. After cloning & scanning/indexing completed and the IDE has loaded the project ... click on "File -> Project Structure"
  6. select "Artifacts" and click on +
  7. click on "JAR - from modules ..."
  8. select a main class if you want (not necessary if JAR is used as a library)
  9. click on View->Tool Windows-> Ant
  10. In the Ant window click + and select buildnum.xml in src/main/java/...
  11. Right-click "buildnum" and select "Execute on - before compilation
  12. click on "Build -> Build Artifacts"
  13. All done!

The JAR can be found in the 'out' folder

EgonOlsen71 commented 1 year ago

Yeah, but that's not what I actually want. If an ANT script is being provided, it should be possible to run it via ANT and do both, increase the number and create the JAR. Doing it solely via the IDE somehow defeats the purpose of providing an ANT script in the first place IMHO.

nietoperz809 commented 1 year ago

Sorry, Egon. I don't know any other trick to provide a build number. Do you have any better idea? I'd appreciate it.

EgonOlsen71 commented 1 year ago

No, the idea is fine. It's just that I couldn't force ANT to include your script AND execute the target defined in it. It should work IMHO, but it didn't for me. I'll investigate a little more when I find the time.