ikvm icon indicating copy to clipboard operation
ikvm copied to clipboard

Apache FOP.jar to dll

Open shankargv87 opened this issue 1 year ago • 1 comments

I'm trying to convert fop jar to dll using IKVM 8.7.5. Below are the dependency jar files.

"\build\fop-core-2.9.jar" "\build\fop-events-2.9.jar" "\build\fop-util-2.9.jar" "\lib\xmlgraphics-commons-2.9.jar" "\lib\xml-apis-ext-1.3.04.jar" "\lib\xml-apis-1.4.01.jar" "\lib\fontbox-2.0.27.jar" "\lib\commons-logging-1.0.4.jar" "\lib\commons-io-2.11.0.jar" "\lib\batik-xml-1.17.jar" "\lib\batik-util-1.17.jar" "\lib\batik-transcoder-1.17.jar" "\lib\batik-svggen-1.17.jar" "\lib\batik-svg-dom-1.17.jar" "\lib\batik-shared-resources-1.17.jar" "\lib\batik-script-1.17.jar" "\lib\batik-parser-1.17.jar" "\lib\batik-i18n-1.17.jar" "\lib\batik-gvt-1.17.jar" "\lib\batik-extension-1.17.jar" "\lib\batik-ext-1.17.jar" "\lib\batik-dom-1.17.jar" "\lib\batik-css-1.17.jar" "\lib\batik-constants-1.17.jar" "\lib\batik-codec-1.17.jar" "\lib\batik-bridge-1.17.jar" "\lib\batik-awt-util-1.17.jar" "\lib\batik-anim-1.17.jar"

I followed the instructions from link https://github.com/ikvmnet/ikvm. Below is the IkvmReference I added in the project file. When I build the application, it is creating separate dlls for each dependency. I'm expecting a single fop.dll with all the dependency dlls included.

<ItemGroup> <IkvmReference Include="FOP\batik-anim-1.17.jar" /> <IkvmReference Include="FOP\batik-awt-util-1.17.jar" /> <IkvmReference Include="FOP\batik-bridge-1.17.jar" /> <IkvmReference Include="FOP\batik-codec-1.17.jar" /> <IkvmReference Include="FOP\batik-constants-1.17.jar" /> <IkvmReference Include="FOP\batik-css-1.17.jar" /> <IkvmReference Include="FOP\batik-dom-1.17.jar" /> <IkvmReference Include="FOP\batik-ext-1.17.jar" /> <IkvmReference Include="FOP\batik-extension-1.17.jar" /> <IkvmReference Include="FOP\batik-gvt-1.17.jar" /> <IkvmReference Include="FOP\batik-i18n-1.17.jar" /> <IkvmReference Include="FOP\batik-parser-1.17.jar" /> <IkvmReference Include="FOP\batik-script-1.17.jar" /> <IkvmReference Include="FOP\batik-shared-resources-1.17.jar" /> <IkvmReference Include="FOP\batik-svg-dom-1.17.jar" /> <IkvmReference Include="FOP\batik-svggen-1.17.jar" /> <IkvmReference Include="FOP\batik-transcoder-1.17.jar" /> <IkvmReference Include="FOP\batik-util-1.17.jar" /> <IkvmReference Include="FOP\batik-xml-1.17.jar" /> <IkvmReference Include="FOP\commons-io-2.11.0.jar" /> <IkvmReference Include="FOP\commons-logging-1.0.4.jar" /> <IkvmReference Include="FOP\fontbox-2.0.27.jar" /> <IkvmReference Include="FOP\fop-core-2.9.jar" /> <IkvmReference Include="FOP\fop-events-2.9.jar" /> <IkvmReference Include="FOP\fop-util-2.9.jar" /> <IkvmReference Include="FOP\xml-apis-1.4.01.jar" /> <IkvmReference Include="FOP\xml-apis-ext-1.3.04.jar" /> <IkvmReference Include="FOP\xmlgraphics-commons-2.9.jar" /> <IkvmReference Include="FOP\fop-2.9.jar"> <Compile>FOP\batik-anim-1.17.jar;FOP\batik-awt-util-1.17.jar;FOP\batik-bridge-1.17.jar;FOP\batik-codec-1.17.jar;FOP\batik-constants-1.17.jar;FOP\batik-css-1.17.jar;FOP\batik-dom-1.17.jar;FOP\batik-ext-1.17.jar;FOP\batik-extension-1.17.jar;FOP\batik-gvt-1.17.jar;FOP\batik-i18n-1.17.jar;FOP\batik-parser-1.17.jar;FOP\batik-script-1.17.jar;FOP\batik-shared-resources-1.17.jar;FOP\batik-svg-dom-1.17.jar;FOP\batik-svggen-1.17.jar;FOP\batik-transcoder-1.17.jar;FOP\batik-util-1.17.jar;FOP\batik-xml-1.17.jar;FOP\commons-io-2.11.0.jar;FOP\commons-logging-1.0.4.jar;FOP\fontbox-2.0.27.jar;FOP\fop-core-2.9.jar;FOP\fop-events-2.9.jar;FOP\fop-util-2.9.jar;FOP\xml-apis-1.4.01.jar;FOP\xml-apis-ext-1.3.04.jar;FOP\xmlgraphics-commons-2.9.jar</Compile> <References>FOP\batik-anim-1.17.jar;FOP\batik-awt-util-1.17.jar;FOP\batik-bridge-1.17.jar;FOP\batik-codec-1.17.jar;FOP\batik-constants-1.17.jar;FOP\batik-css-1.17.jar;FOP\batik-dom-1.17.jar;FOP\batik-ext-1.17.jar;FOP\batik-extension-1.17.jar;FOP\batik-gvt-1.17.jar;FOP\batik-i18n-1.17.jar;FOP\batik-parser-1.17.jar;FOP\batik-script-1.17.jar;FOP\batik-shared-resources-1.17.jar;FOP\batik-svg-dom-1.17.jar;FOP\batik-svggen-1.17.jar;FOP\batik-transcoder-1.17.jar;FOP\batik-util-1.17.jar;FOP\batik-xml-1.17.jar;FOP\commons-io-2.11.0.jar;FOP\commons-logging-1.0.4.jar;FOP\fontbox-2.0.27.jar;FOP\fop-core-2.9.jar;FOP\fop-events-2.9.jar;FOP\fop-util-2.9.jar;FOP\xml-apis-1.4.01.jar;FOP\xml-apis-ext-1.3.04.jar;FOP\xmlgraphics-commons-2.9.jar</References> </IkvmReference> </ItemGroup>

shankargv87 avatar Mar 08 '24 05:03 shankargv87

@shankargv87

What was the result?

GeorgeS2019 avatar Mar 08 '24 06:03 GeorgeS2019

@GeorgeS2019

After building, it created DLLs for each dependency. I'm expecting a single fop.dll with all the dependencies included, so I don't need to refer to all the dependency DLLs in my project.

image

shankargv87 avatar Mar 08 '24 14:03 shankargv87

If you want multiple Java resources combined into one assembly using IkvmReference, they should be specified within a single IkvmReference. I believe this is pretty well documented in the README.md, where it lists the various Metadata properties of IkvmReference, and their various allowances.

Compile | A semi-colon separated list of Java class path items to compile into the assembly. By default this value is the Identity of the item, if the identity of the item is an existing JAR file or directory (not yet supported). MSBuild globs are supported to reference multiple JAR or .class files.

wasabii avatar Mar 08 '24 21:03 wasabii

@wasabii

He did that but NO single dll?

He could have missed something.

<Compile>FOP\batik-anim-1.17.jar;FOP\batik-awt-util-1.17.jar;FOP\batik-bridge-1.17.jar;FOP\batik-codec-1.17.jar;FOP\batik-constants-1.17.jar;FOP\batik-css-1.17.jar;FOP\batik-dom-1.17.jar;FOP\batik-ext-1.17.jar;FOP\batik-extension-1.17.jar;FOP\batik-gvt-1.17.jar;FOP\batik-i18n-1.17.jar;FOP\batik-parser-1.17.jar;FOP\batik-script-1.17.jar;FOP\batik-shared-resources-1.17.jar;FOP\batik-svg-dom-1.17.jar;FOP\batik-svggen-1.17.jar;FOP\batik-transcoder-1.17.jar;FOP\batik-util-1.17.jar;FOP\batik-xml-1.17.jar;FOP\commons-io-2.11.0.jar;FOP\commons-logging-1.0.4.jar;FOP\fontbox-2.0.27.jar;FOP\fop-core-2.9.jar;FOP\fop-events-2.9.jar;FOP\fop-util-2.9.jar;FOP\xml-apis-1.4.01.jar;FOP\xml-apis-ext-1.3.04.jar;FOP\xmlgraphics-commons-2.9.jar</Compile>

@shankargv87

It is best you provide more information (e.g. the csproj), not sure where you go wrong

GeorgeS2019 avatar Mar 08 '24 21:03 GeorgeS2019

@GeorgeS2019

I attached my sample project.

IkvmFop.zip

shankargv87 avatar Mar 08 '24 22:03 shankargv87

@shankargv87 The file is not downloadable

Just the csproj file will do

GeorgeS2019 avatar Mar 08 '24 22:03 GeorgeS2019

@GeorgeS2019

I attached my csproj file

IkvmFop.csproj.zip

shankargv87 avatar Mar 08 '24 22:03 shankargv87

It seems You are missing the crucial one. Now I have gathered the information in one place for further discussion. Hopefully Jeorome could guide U.

image

image

image

GeorgeS2019 avatar Mar 08 '24 22:03 GeorgeS2019

I count like 20 IkvmReferences, which will produce like 20 assemblies. Again, a single IkvmReference produces a single assembly.

AssemblyName is largely irrelevent to the question asked, though might be relevant later if you want to customize the produced assembly name.

wasabii avatar Mar 08 '24 22:03 wasabii

I removed the dependency IkvmReference elements and kept only the IkvmReference for fop-2.9.jar and included the dependency jars in Compile element. Now I'm getting the dependencies combined into one assembly.

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net8.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup>

<ItemGroup> <PackageReference Include="IKVM" Version="8.7.5" /> <PackageReference Include="IKVM.Image.JRE" Version="8.7.5" /> </ItemGroup> <ItemGroup> <IkvmReference Include="FOP\fop-2.9.jar"> <Compile>FOP\batik-anim-1.17.jar;FOP\batik-awt-util-1.17.jar;FOP\batik-bridge-1.17.jar;FOP\batik-codec-1.17.jar;FOP\batik-constants-1.17.jar;FOP\batik-css-1.17.jar;FOP\batik-dom-1.17.jar;FOP\batik-ext-1.17.jar;FOP\batik-extension-1.17.jar;FOP\batik-gvt-1.17.jar;FOP\batik-i18n-1.17.jar;FOP\batik-parser-1.17.jar;FOP\batik-script-1.17.jar;FOP\batik-shared-resources-1.17.jar;FOP\batik-svg-dom-1.17.jar;FOP\batik-svggen-1.17.jar;FOP\batik-transcoder-1.17.jar;FOP\batik-util-1.17.jar;FOP\batik-xml-1.17.jar;FOP\commons-io-2.11.0.jar;FOP\commons-logging-1.0.4.jar;FOP\fontbox-2.0.27.jar;FOP\fop-core-2.9.jar;FOP\fop-events-2.9.jar;FOP\fop-util-2.9.jar;FOP\xml-apis-1.4.01.jar;FOP\xml-apis-ext-1.3.04.jar;FOP\xmlgraphics-commons-2.9.jar</Compile> </IkvmReference> </ItemGroup> </Project>

Thank you @GeorgeS2019 and @wasabii

shankargv87 avatar Mar 08 '24 22:03 shankargv87

@shankargv87

AssemblyName is largely irrelevent to the question asked, though might be relevant later if you want to customize the produced assembly name.

Have you figured out why it is relevant later?

GeorgeS2019 avatar Mar 09 '24 09:03 GeorgeS2019

@shankargv87

have you seen this post, it seems to work with fop-core https://github.com/sorcerdon/FOP.NetCore/issues/1

GeorgeS2019 avatar Mar 09 '24 09:03 GeorgeS2019

@shankargv87

AssemblyName is largely irrelevent to the question asked, though might be relevant later if you want to customize the produced assembly name.

Have you figured out why it is relevant later?

@GeorgeS2019, yes.

shankargv87 avatar Mar 11 '24 17:03 shankargv87

@shankargv87

Now you have one FOP.dll, do you still need ikvm.maven?

GeorgeS2019 avatar Mar 11 '24 17:03 GeorgeS2019

@shankargv87

Now you have one FOP.dll, do you still need ikvm.maven?

@GeorgeS2019

No, but I'm going to try ikvm.maven to see how it works.

shankargv87 avatar Mar 11 '24 18:03 shankargv87