Unable to include dynlib resources (original) (raw)
I am trying to include some native libraries which are in a maven repository using:
lib/=${repo;org.weasis.thirdparty.org.opencv:libopencv_java:so:linux-x86-64;4.4.0.-dcm};lib:=true,\
lib/=${repo;org.weasis.thirdparty.org.opencv:libopencv_java:so:linux-x86;4.4.0.-dcm};lib:=true,\
lib/=${repo;org.weasis.thirdparty.org.opencv:libopencv_java:jnilib:macosx-x86-64;4.4.0.-dcm};lib:=true,\
lib/=${repo;org.weasis.thirdparty.org.opencv:opencv_java:dll:windows-x86-64;4.4.0.-dcm};lib:=true,\
lib/=${repo;org.weasis.thirdparty.org.opencv:opencv_java:dll:windows-x86;4.4.0.-dcm};lib:=true,\
First of all the 4.4.0.-dcm format really threw me. It is bizarre having to put . before the -. I couldn't find the documentation for this. I did eventually find the regex in:
| private static final String VERSION_STRING = "(\\d{1,10})(\\.(\\d{1,10})(\\.(\\d{1,10})(\\.([-\\w]+))?)?)?"; |
|---|
After working around that gotcha, these all work fine except for the macOS one. It will fail because a file that ends in lib is assumed to be some kind of library:
| if (f.getName() |
|---|
| .endsWith("lib")) |
| container = new Container(this, bsn, range, Container.TYPE.LIBRARY, f, null, attrs, db); |
| else |
| container = new Container(this, bsn, range, Container.TYPE.REPO, f, null, attrs, db); |
When then blows up because of course a dynlib is a dynamically linked library, not a text file so this doesn't work:
| // Are ww a library? If no, we are the result |
|---|
| if (getType() == TYPE.LIBRARY) { |
| // We are a library, parse the file. This is |
| // basically a specification clause per line. |
| // I.e. you can do bsn; version, bsn2; version. But also |
| // spread it out over lines. |
| try (BufferedReader rd = IO.reader(getFile(), Constants.DEFAULT_CHARSET)) { |
| String line; |
| while ((line = rd.readLine()) != null) { |
| line = line.trim(); |
| if (!line.startsWith("#") && line.length() > 0) { |
| List<Container> list = project.getBundles(Strategy.HIGHEST, line, null); |
| result.addAll(list); |
| } |
| } |
| } |
| } else |
| result.add(this); |