portfolio-performance / portfolio

Track and evaluate the performance of your investment portfolio across stocks, cryptocurrencies, and other assets.
http://www.portfolio-performance.info
Eclipse Public License 1.0
2.77k stars 580 forks source link

Porting Portfolio Performance to FreeBSD #3250

Open reinboldg opened 1 year ago

reinboldg commented 1 year ago

Hello

I'm trying to port Portfolio Performance on FreeBSD.

So the first step is trying to build it.

I installed these prerequisites

pkg install maven openjdk17

Then, I cloned the repo

git clone git@github.com:buchen/portfolio.git

Finally, I followed the first steps according the doc https://github.com/buchen/portfolio/blob/master/CONTRIBUTING.md#build-with-maven

export MAVEN_OPTS="-Xmx4g"
JAVA_VERSION=17 mvn -f portfolio-app/pom.xml clean verify

The process failed on this error

protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/github/os72/protoc/3.17.3/protoc-3.17.3-freebsd-x86_64.exe
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Portfolio Performance 0.61.5-SNAPSHOT:
[INFO] 
[INFO] Portfolio Performance .............................. SUCCESS [  8.951 s]
[INFO] portfolio-target-definition ........................ SUCCESS [  0.227 s]
[INFO] name.abuchen.portfolio ............................. FAILURE [05:32 min]
[INFO] name.abuchen.portfolio.junit ....................... SKIPPED
[INFO] name.abuchen.portfolio.tests ....................... SKIPPED
[INFO] name.abuchen.portfolio.ui .......................... SKIPPED
[INFO] name.abuchen.portfolio.ui.tests .................... SKIPPED
[INFO] name.abuchen.portfolio.bootstrap ................... SKIPPED
[INFO] name.abuchen.portfolio.feature ..................... SKIPPED
[INFO] portfolio.product .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11:17 min
[INFO] Finished at: 2023-03-29T21:58:20+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.os72:protoc-jar-maven-plugin:3.11.4:run (default) on project name.abuchen.portfolio: Error extracting protoc for version 3.17.3: Unsupported platform: protoc-3.17.3-freebsd-x86_64.exe -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :name.abuchen.portfolio

I understand that here is no protoc-3.17.3-freebsd-x86_64.exe binary for this version 3.17.3 for FreeBSD.

The last version for FreeBSD is 3.7.0 https://repo.maven.apache.org/maven2/com/github/os72/protoc/3.7.0/

The protoc-jar and protoc-jar-maven-plugin repositories seem very outdated.

Also I have not found the GitHub repository for protoc from os72

https://repo.maven.apache.org/maven2/com/github/os72/protoc/

I'm not a Java developer but I think, maybe there is another way to import protobuf binary in the project?

Building a new maven plugin?

However, we have already packages for protobuf and protobuf-java on FreeBSD

Is there any way to import the binary installed on the system into the project?

Best regards

buchen commented 1 year ago

First, if you want to continue, you can remove the protobuf plugin. The generated java code is already submitted to the project. It is just a "safeguard" to make sure the definition file fits to the code. I am happy to merge a PR that makes skipping this plugin configurable (the default should be to run it).

Second, on the plugin page, it says:

Support for FreeBSD on x86 platform (freebsd-x86_64)

But apparently this is only true for the protobuf versions hosted by the plugin themselves - but I am using the protobuf compiler published by Google, then it does not include FreeBSD 😒

Building a new maven plugin?

If you build one, I am happy to use it. There are few - and none seems to be actively maintained. Maybe it is easier if you contribute to the existing plugin some capability to either use a local installation or download protoc from other sources.

reinboldg commented 1 year ago

I removed the plugin from name.abuchen.portfolio/pom.xml

                   <plugin>
                       <groupId>com.github.os72</groupId>
                       <artifactId>protoc-jar-maven-plugin</artifactId>
                       <version>3.11.4</version>
                       <executions>
                           <execution>
                               <phase>generate-sources</phase>
                               <goals>
                                   <goal>run</goal>
                               </goals>
                                                       <configuration>
                                                                       <protocVersion>3.17.3</protocVersion>
                                       <addProtoSources>all</addProtoSources>
                                       <includeMavenTypes>direct</includeMavenTypes>
                                       <outputDirectory>protos</outputDirectory>
                                       <inputDirectories>
                                               <include>src</include>
                                       </inputDirectories>
                               </configuration>
                           </execution>
                       </executions>
                   </plugin>

Then, I restarted the process.

It now fails on the Taxonomy tests

Results:

Errors: 
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages:46 » NoClassDefFound
  ColorConversionTest.testBrighterRGB:99 NoClassDefFound org/eclipse/swt/graphic...
  ColorConversionTest.testBrighterString:110 NoClassDefFound org/eclipse/swt/gra...
  ColorConversionTest.testHex2RGB:38 NoClassDefFound org/eclipse/swt/graphics/RG...
  ColorConversionTest.testHex2RGBA:47 NoClassDefFound org/eclipse/swt/graphics/R...
  ColorConversionTest.testInvalidRGB:18 » NoClassDefFound org/eclipse/swt/graphi...
  ColorConversionTest.testToHSB:56 » NoClassDefFound org/eclipse/swt/graphics/RG...
  ColorConversionTest.testToHexFloatFloatFloat:92 » NoClassDefFound org/eclipse/...
  ColorConversionTest.testToHexRGB:66 NoClassDefFound org/eclipse/swt/graphics/R...
  ColorConversionTest.testToHexRGBA:75 NoClassDefFound org/eclipse/swt/graphics/...
  ColorConversionTest.testToRGB:28 » NoClassDefFound org/eclipse/swt/graphics/RG...

Tests run: 2276, Failures: 0, Errors: 23, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Portfolio Performance 0.61.5-SNAPSHOT:
[INFO] 
[INFO] Portfolio Performance .............................. SUCCESS [  0.274 s]
[INFO] portfolio-target-definition ........................ SUCCESS [  0.343 s]
[INFO] name.abuchen.portfolio ............................. SUCCESS [ 13.015 s]
[INFO] name.abuchen.portfolio.junit ....................... SUCCESS [  0.702 s]
[INFO] name.abuchen.portfolio.tests ....................... FAILURE [ 38.085 s]
[INFO] name.abuchen.portfolio.ui .......................... SKIPPED
[INFO] name.abuchen.portfolio.ui.tests .................... SKIPPED
[INFO] name.abuchen.portfolio.bootstrap ................... SKIPPED
[INFO] name.abuchen.portfolio.feature ..................... SKIPPED
[INFO] portfolio.product .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:25 min
[INFO] Finished at: 2023-04-01T10:05:50+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:3.0.1:test (default-test) on project name.abuchen.portfolio.tests: There are test failures.
[ERROR] 
[ERROR] Please refer to /usr/home/gregory/portfolio/name.abuchen.portfolio.tests/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :name.abuchen.portfolio.tests

In name.abuchen.portfolio.tests/target/surefire-reports/name.abuchen.portfolio.model.TaxonomyLoadingTest.txt I can see 13 errors like

name.abuchen.portfolio.model.TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages[0: ]  Time elapsed: 0.02 s  <<< ERROR!
java.lang.NoClassDefFoundError: org/eclipse/swt/graphics/RGB
    at name.abuchen.portfolio.util.ColorConversion.toHex(ColorConversion.java:61)
    at name.abuchen.portfolio.model.Classification.assignRandomColors(Classification.java:467)
    at name.abuchen.portfolio.model.TaxonomyTemplate.buildFromTemplate(TaxonomyTemplate.java:124)
    at name.abuchen.portfolio.model.TaxonomyTemplate.build(TaxonomyTemplate.java:69)
    at name.abuchen.portfolio.model.TaxonomyLoadingTest.loadTaxonomyDefinitionsInAllLanguages(TaxonomyLoadingTest.java:46)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:364)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:237)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:158)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:167)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:161)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:84)
    at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:142)
    at org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.start(HeadlessTestApplication.java:28)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.graphics.RGB cannot be found by name.abuchen.portfolio_0.61.5.202304010804
    at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:541)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:487)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 56 more

Is Eclipse necessary? org.eclipse.swt.graphics.RGB cannot be found by

Regards

buchen commented 1 year ago

Is Eclipse necessary?

Yes. PP uses - among other things from Eclipse - also the SWT (Standard Windowing Toolkit from Eclipse.

I have no knowledge on FreeBSD, but I think you would need to get the FreeBSD build for the Eclipse platform (if there is one in the FreeBSD community) and then update the target platform which pulls in the SWT dependencies eventually.

I googled some messages - maybe they can point you to the right direction: https://www.eclipse.org/lists/buildship-dev/msg00026.html https://github.com/daemonblade/freebsd-eclipse

reinboldg commented 1 year ago

We have these FreeBSD packages for Eclipse

[@X270 ~]$ pkg search eclipse
eclipse-4.24                   Eclipse IDE 2022-06
eclipse-EPIC-0.6.35_3          EPIC adds Perl support to the Eclipse IDE Framework
eclipse-ShellEd-1.0.2a_4       Shell script editor for Eclipse
eclipse-cdt-9.0.1              C/C++ plugin for Eclipse IDE
eclipse-drjava-0.9.8_6         DrJava plugin for Eclipse
eclipse-ecj-4.4.2_1            Eclipse Java Compiler
eclipse-findbugs-3.0.1.20150306.5.a4.d1 Eclipse plug-in that provides FindBugs support
eclipse-glassfish-5.1.0_1      Eclipse Jakarta EE Platform
eclipse-pydev-10.0.2           Eclipse plugin for Python and Jython development
phpeclipse-1.2.3_6             PHP Eclipse adds PHP support to the Eclipse IDE Framework
redeclipse-2.0.0_1             Single-player and multi-player first-person ego-shooter
redeclipse-data-2.0.0          Data files for Red Eclipse first-person shooter
redeclipse-data16-1.6.0        Data files for Red Eclipse first-person shooter
redeclipse16-1.6.0_1           Single-player and multi-player first-person ego-shooter

I installed eclipse-4.24 and eclipse-ecj-4.4.2_1

Also I seen that the porter of Eclipse in FreeBSD disabled the following modules

https://github.com/daemonblade/freebsd-eclipse#notes

The main issue now is that we don't have the package Eclipse IDE for RCP and RAP Developers.

So, we don't have these items

Is there any way to import RCP on Eclipse IDE? or should we consider to build Eclipse IDE for RCP and RAP Developers package for FreeBSD?

buchen commented 1 year ago

Is there any way to import RCP on Eclipse IDE? or should we consider to build Eclipse IDE for RCP and RAP Developers package for FreeBSD?

I have to admit I just do not know enough details on these base packages nor how they are ported to FreeBSD or how other RCP applications are doing this. And I have to say I also do not have the time to research this at the moment. Sorry.

reinboldg commented 1 year ago

No worry, I understand. I'm digging about a workaround based on the linux virtualization layer of FreeBSD.