java

2020-07-10T08:09:22.027600Z

@jjttjj Looks like this is working for me, I can see the parameter names when I compile with :javac-options ["-parameters"] and I don't see them without -parameters

2020-07-11T15:16:15.028100Z

@ewen So now I have the javac part working but I'm having issues with building a jar. I basically have a directory of class files and want to put those in a jar. I'm on windows and I have a feeling it relates to that, and specifically path separator differences I can build a working jar with the jar at the command line. Here is the jar file listing output of using badigeon vs the command line:

Badigeon generated jar:

(jar/jar mvn-id {:mvn/version mvn-version}
  {:out-path "my.jar"
   :paths    [(str class-dir)]
   :deps     {}})

-rw-rw-rw-        91  11-Jul-2020  11:11:30  meta-inf/manifest.mf
  -rw-rw-rw-       220  11-Jul-2020  10:12:46  META-INF/badigeon/com.interactivebrokers/tws-api/deps.edn
  -rw-rw-rw-      1048  11-Jul-2020  11:11:30  META-INF/maven/com.interactivebrokers/tws-api/pom.xml
  -rw-rw-rw-      1059  11-Jul-2020  11:11:28  com\ib\client\Bar.class
  -rw-rw-rw-       754  11-Jul-2020  11:11:28  com\ib\client\BitMask.class
  -rw-rw-rw-       955  11-Jul-2020  11:11:28  com\ib\client\Builder$ByteBuffer.class
  -rw-rw-rw-      6446  11-Jul-2020  11:11:28  com\ib\client\Builder.class

............
  
-rw-rw-rw-      1373  11-Jul-2020  11:11:30  com\ib\controller\Profile$Type.class
  -rw-rw-rw-      1809  11-Jul-2020  11:11:30  com\ib\controller\Profile.class
  -rw-rw-rw-      8100  11-Jul-2020  11:11:30  com\ib\controller\ScanCode.class
  -rw-rw-rw-       599  11-Jul-2020  11:11:30  com\ib\controller\TradeId.class
  -rw-rw-rw-       127  11-Jul-2020  11:11:30  META-INF/maven/com.interactivebrokers/tws-api/pom.properties
- ----------  --------  -----------  --------  ----------------------------------------------------------------
                542012                         172 files



Commandline generated jar:


M Filemode      Length  Date         Time      File
- ----------  --------  -----------  --------  ----------------------------------------------------------------
  drwxrwxrwx         0  11-Jul-2020  11:02:08  meta-inf/
  -rw-rw-rw-        66  11-Jul-2020  11:02:08  meta-inf/manifest.mf
  drwxrwxrwx         0  11-Jul-2020  11:02:02  com/
  drwxrwxrwx         0  11-Jul-2020  11:02:02  com/ib/
  drwxrwxrwx         0  11-Jul-2020  11:02:02  com/ib/client/
  -rw-rw-rw-      1059  11-Jul-2020  11:02:02  com/ib/client/Bar.class
  -rw-rw-rw-       754  11-Jul-2020  11:02:02  com/ib/client/BitMask.class
  -rw-rw-rw-       955  11-Jul-2020  11:02:02  com/ib/client/Builder$ByteBuffer.class
  -rw-rw-rw-      6446  11-Jul-2020  11:02:02  com/ib/client/Builder.class

...............
                  
  -rw-rw-rw-      1373  11-Jul-2020  11:02:02  com/ib/controller/Profile$Type.class
  -rw-rw-rw-      1809  11-Jul-2020  11:02:02  com/ib/controller/Profile.class
  -rw-rw-rw-      8100  11-Jul-2020  11:02:02  com/ib/controller/ScanCode.class
  -rw-rw-rw-       599  11-Jul-2020  11:02:02  com/ib/controller/TradeId.class
- ----------  --------  -----------  --------  ----------------------------------------------------------------
                540592                         175 files

2020-07-11T15:19:08.028300Z

It seems like Badigeon omits the empty directory listings? fwiw this is a java project with no deps, I just need to put all the class files in jar

2020-07-11T15:19:35.028500Z

(I can open an actual issue later, I'm realizing that probably would have been better)

2020-07-12T13:51:43.028800Z

Yes, the empty directory might be missing. I will try to make the output closer to the javac one, although I don't think that it makes a difference. The path separators seems different, I will try to run it on windows

2020-07-12T17:28:30.029600Z

(disregard my previous deleted message if it shows up for you) Ok I think changing this line: https://github.com/EwenG/badigeon/blob/54436429d324c17c916e4922fcd2b62b6a514ab7/src/badigeon/jar.clj#L118 to this:

(put-jar-entry! jar-out f (str/replace relative-path "\\" "/"))
to replace backslashes with slashes seems to fix things on windows. There might be a better way to do this.

2020-07-13T08:37:28.030Z

Yes it makes sense, replacing the path separator is something that is done in a few places already, but it looks like everything was not covered :)

2020-07-13T09:04:44.030200Z

I made a new release to fix the path separator on windows

2020-07-13T11:40:41.030400Z

Tested, works now, thanks!

2020-07-13T11:53:08.030600Z

One other thing, sorry to keep bugging you: Currently usage of the jar stuff seems dependent on a deps.edn file in the project root where badigeon is used. Due to this line: https://github.com/EwenG/badigeon/blob/7eb120a132e7a443e492df16393e9821da221368/src/badigeon/jar.clj#L204 What I'm trying to do is write a little script that can be run in isolation with a clj command that will download a zip of java source files, compile them and maven install them locally. So I'm using it as a general "do stuff with java source" library, unrelated to a clojure/tools.deps project. Is this valid for your intended uses of badigeon? If so would you consider making the existence of the deps.edn file optional, or somehow parameterizing it?

2020-07-13T12:12:22.030900Z

The deps map is already a parameter of others badigeon api like "uberjar". The fact that the jar api is not consistent is unfortunate and the reason is simply that it was written earlier. So I guess defaulting to an empty map when deps.edn is not there would be ok

2020-07-13T12:15:13.031100Z

Yeah I do use the :deps option, it just looks like the jar function assumes the deps file exists anyway (and is merged with the passed in :deps.

2020-07-14T08:08:31.031300Z

I pushed a change on master to make it optional

2020-07-15T03:40:50.031500Z

Awesome, thank you so much!

2020-07-10T14:14:22.027700Z

Thanks! yeah I had figuired it out and thought I deleted my message here but it looks like it didn't work. I think it was an issue with a previously cached jar being used

2020-07-10T14:19:12.027900Z

👍