Re: Maven build file - generation of OSX, Windows, Linux fil
Hey why is there an android library in our maven dependency? There are a lot more dependencies listed now, compared to the last git version I had pulled.
High Quality Resources for Collectible Card Games and Home of the CCGHQ Team
https://www.slightlymagic.net/forum/
https://www.slightlymagic.net/forum/viewtopic.php?f=52&t=4759
There are no new direct deps. The new version of Substance has a transitive dep on android.Rob Cashwalker wrote:Hey why is there an android library in our maven dependency? There are a lot more dependencies listed now, compared to the last git version I had pulled.
it's going into Forge.model.FModel real soon now, available via Singletons.getModel().someMethodNameIHaveNotDecidedYetProbablyMoreThanOne()Rob Cashwalker wrote:Yeah, the code dave provided just prints to the console as an example. a little tweaking and it becomes a callable method that can be used by any part of Forge that needs it.
but only for binaries built with Maven. this makes unit testing the methods to fetch these values difficult. after some thought, i have decided that i'll have to make a mock jar file for unit test if it can't find the real one.jendave wrote:Yes, there is a plugin that will grab the SVN (or GIT, Mercurial) rev number. The best place to put it would be in the manifest file. Then your Mantis code could grab it. . .
i updated svn to r9743. i then ran the maven goal "-U -B clean install" from pom.xml in eclipse. the resulting MANIFEST.MF in target/forge-1.1.2-SNAPSHOT-jar-with-dependencies.jar does not contain the build number:jendave wrote:The manifest file now includes . . .
Implementation-Version: 1.1.2-SNAPSHOT
. . .
Implementation-Build: 9734 <----- SVN Rev
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: Braids
Build-Jdk: 1.6.0_26
Implementation-Title: Forge
Implementation-Version: 1.1.2-SNAPSHOT
Implementation-Vendor-Id: forge
Implementation-Vendor: CardForge
Main-Class: forge.Gui_NewGame
Implementation-Build:
jendave wrote:Here is some sample code to grab it
- Code: Select all
String appServerHome = getServletContext().getRealPath("/");
File manifestFile = new File(appServerHome, "META-INF/MANIFEST.MF");
Manifest mf = new Manifest();
mf.read(new FileInputStream(manifestFile));
Attributes atts = mf.getMainAttributes();
System.out.println("Version: " + atts.getValue("Implementation-Version"));
System.out.println("Build: " + atts.getValue("Implementation-Build"));
ok, but then i need a path to a jar file.jendave, in a PM to me wrote:This code was not meant to be run. I simply copied it from a tutorial on how to use the manifest attributes. Disregard the first line
ClassLoader.getSystemResourceAsStream("META-INF/MANIFEST.MF");
there is, usingBraids wrote:is there some way to get the currently executing jar file from System.properties or something? would it be the first item in the classpath perhaps?
URL url = Gui_NewGame.class.getProtectionDomain().getCodeSource().getLocation();
Yes. This is a good use case for a mock.Braids wrote:but only for binaries built with Maven. this makes unit testing the methods to fetch these values difficult. after some thought, i have decided that i'll have to make a mock jar file for unit test if it can't find the real one.
Not sure what happened here. I cannot recreate the issue. I added the buildnumber to the regular jar as well as the jar-with-deps just in case.Braids wrote:
i updated svn to r9743. i then ran the maven goal "-U -B clean install" from pom.xml in eclipse. the resulting MANIFEST.MF in target/forge-1.1.2-SNAPSHOT-jar-with-dependencies.jar does not contain the build number:do i need to run a different maven build command?
- Code: Select all
...
Main-Class: forge.Gui_NewGame
Implementation-Build:
i now have the build number in the manifest file. there are two potential causes for my prior problem.jendave wrote:Not sure what happened here. I cannot recreate the issue. I added the buildnumber to the regular jar as well as the jar-with-deps just in case.Braids wrote:i updated svn to r9743. i then ran the maven goal "-U -B clean install" from pom.xml in eclipse. the resulting MANIFEST.MF in target/forge-1.1.2-SNAPSHOT-jar-with-dependencies.jar does not contain the build number:
...
as of r9761, to access these values, you can make the following calls:Braids wrote:it's going into Forge.model.FModel real soon now . . .Rob Cashwalker wrote:Yeah, the code dave provided just prints to the console as an example. a little tweaking and it becomes a callable method that can be used by any part of Forge that needs it.
import forge.Singletons;
import forge.model.BuildInfo;
BuildInfo buildInfo = Singletons.getModel().getBuildInfo();
String version = buildInfo.getVersion(); // returns "SVN" if unknown
String buildID = buildInfo.getBuildID(); // returns null if unknown
i got even more clever. if getBuildID() can't deduce the version number, it tries to invoke the OS command svnversion as a last-ditch effort. so, your buildID could end up looking like "4123", "4123:4168", "4168M", "4123S", "4123P" or even "4123:4168MS".
edit: if it finds more than one, it throws a special MultipleForgeJarsFoundError. this should never happen in real life, right?only if "the most recent version" is well defined. it could go by the file with the later timestamp, or the one that is last in dictionary order, i guess.friarsol wrote:If it finds more than one, can it just grab from the most recent version?
mvn -U clean install -P windows-linux
`jendave wrote:Chris - I updated the launch4j Maven plugin (I maintain a fork of it). It should work on Lion now. Can you do a testThat should create a Windows executable. Let me know if it works on OSX Lion.
- Code: Select all
mvn -U clean install -P windows-linux
The new version works on Snow Leopard.
Please update from SVN and re-run theChris H. wrote:It looks like the AdiumApplescriptRunner app has the same PPC error under Lion.
`
mvn clean install -P windows-linux,osx
`jendave wrote:Please update from SVN and re-run the`
- Code: Select all
mvn clean install -P windows-linux,osx
I checked in a change that removes the dependency on AdiumApplescriptRunner.