erlang / erlide_eclipse

Eclipse IDE for Erlang

Home Page:http://erlide.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Erlide with parse transforms

acarstoiu opened this issue · comments

I have tried a lot to make an existing project that uses lager to compile just fine under Erlide, but to no avail. Mind that I am not too savvy in Erlang, so there might actually be a documentation problem.

All modules that have a -compile([{parse_transform, lager_transform}]). line (indirectly, by inclusion) simply fail to be built with the "undefined parse transform 'lager_transform'" dreadful error.

  • I know about this build option, but I do get how to use it
  • I also know about #250, but that's a wish for now
  • I tried placing the lager_transform.beam file in ebin - completely ignored
  • I tried placing lager_transform.erl and lager.hrl in a folder listed before src among the source folders - it is compiled, but the errors stay the same

I also noticed that the build process is flaky: without lager being present whatsoever, if I delete ebin, everything is compiled just fine or so it seems (I only get a bunch of "behaviour xyz is undefined").
Help me please! Mulţumesc.

I forgot to mention I'm using the last version (0.32.0)

Thank you for the feedback. This is a problem that I am painfully aware of, but I don't have a good solution at the moment.

There is a way to handle it, that is not documented yet and needs manual configuration, but I think it should work. Instead of the erlide builder, use rebar. If you have rebar in your $PATH, edit .settings/org.erlide.model.prefs and replace 'INTERNAL' with 'REBAR'. Restart Eclipse. Make sure to keep your rebar.config updated.

Please let me know how it works.
You're welcome! Cu plăcere! :-)

Well, not a winner, as the log is full with:

!ENTRY org.eclipse.ui.navigator 4 0 2016-04-18 16:07:30.409
!MESSAGE com.ericsson.otp.erlang.OtpErlangAtom cannot be cast to com.ericsson.otp.erlang.OtpErlangString
!STACK 0
java.lang.ClassCastException: com.ericsson.otp.erlang.OtpErlangAtom cannot be cast to com.ericsson.otp.erlang.OtpErlangString
    at org.erlide.engine.internal.model.root.RebarConfigurationSerializer$2.apply(RebarConfigurationSerializer.java:109)
    at org.erlide.engine.internal.model.root.RebarConfigurationSerializer$2.apply(RebarConfigurationSerializer.java:1)
    at org.eclipse.xtext.xbase.lib.internal.FunctionDelegate.apply(FunctionDelegate.java:42)
    at com.google.common.collect.Iterators$8.transform(Iterators.java:794)
    at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
    at com.google.common.collect.Iterators.addAll(Iterators.java:357)
    at com.google.common.collect.Lists.newArrayList(Lists.java:147)
    at com.google.common.collect.Iterables.toCollection(Iterables.java:337)
    at com.google.common.collect.Iterables.toArray(Iterables.java:315)
    at org.eclipse.xtext.xbase.lib.Conversions.unwrapArray(Conversions.java:96)
    at org.erlide.engine.internal.model.root.RebarConfigurationSerializer.parseOption(RebarConfigurationSerializer.java:116)
    at org.erlide.engine.internal.model.root.RebarConfigurationSerializer$1$1.apply(RebarConfigurationSerializer.java:59)
    at org.erlide.engine.internal.model.root.RebarConfigurationSerializer$1$1.apply(RebarConfigurationSerializer.java:1)
    at org.eclipse.xtext.xbase.lib.IteratorExtensions.forEach(IteratorExtensions.java:363)
    at org.eclipse.xtext.xbase.lib.IterableExtensions.forEach(IterableExtensions.java:333)
    at org.erlide.engine.internal.model.root.RebarConfigurationSerializer$1.apply(RebarConfigurationSerializer.java:66)
    at org.erlide.engine.internal.model.root.RebarConfigurationSerializer$1.apply(RebarConfigurationSerializer.java:1)
    at org.eclipse.xtext.xbase.lib.IteratorExtensions.forEach(IteratorExtensions.java:363)
    at org.eclipse.xtext.xbase.lib.IterableExtensions.forEach(IterableExtensions.java:333)
    at org.erlide.engine.internal.model.root.RebarConfigurationSerializer.decodeConfig(RebarConfigurationSerializer.java:74)
    at org.erlide.engine.internal.model.root.FileProjectConfigurator.getRawConfig(FileProjectConfigurator.java:63)
    at org.erlide.engine.internal.model.root.FileProjectConfigurator.getConfiguration(FileProjectConfigurator.java:52)
    at org.erlide.engine.internal.model.root.ErlProject.loadProperties(ErlProject.java:717)
    at org.erlide.engine.internal.model.root.ErlProject.loadAllProperties(ErlProject.java:748)
    at org.erlide.engine.internal.model.root.ErlProject.configurationChanged(ErlProject.java:739)
    at org.erlide.engine.internal.model.root.ErlProject.getProperties(ErlProject.java:470)
    at org.erlide.engine.internal.model.root.ErlProject.addExternals(ErlProject.java:175)
    at org.erlide.engine.internal.model.root.ErlProject.buildStructure(ErlProject.java:135)
    at org.erlide.engine.internal.model.root.Openable.open(Openable.java:80)
    at org.erlide.engine.internal.model.ErlModel.findElement(ErlModel.java:271)
    at org.erlide.engine.internal.model.ErlModel.findModule(ErlModel.java:314)
    at org.erlide.ui.util.ErlModelUtils.getModule(ErlModelUtils.java:112)
    at org.erlide.ui.actions.ErlangLinkHelperAction.findSelection(ErlangLinkHelperAction.java:59)
    at org.eclipse.ui.navigator.LinkHelperService.getSelectionFor(LinkHelperService.java:126)
    at org.eclipse.ui.internal.navigator.actions.LinkEditorAction$2$1.run(LinkEditorAction.java:110)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.navigator.actions.LinkEditorAction$2.runInUIThread(LinkEditorAction.java:100)
    at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:97)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4155)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3772)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1488)

The contents of org.erlide.model.prefs is

builderData=REBAR|compile|clean|test|
configType=REBAR
eclipse.preferences.version=1

I also tried with configType set to INTERNAL: no more errors in the Eclipse log file, but the compile errors remain the same.

Is there any way to state to the compiler that some other path with compiled files should be considered along with ebin? There must be a way to say something equivalent to --classpath for javac.

Is your project rebar-based? Can I see your rebar.config? Can you build your project with rebar from the command line?

Yes, it compiles just fine with rebar on a system with already installed dependencies (not the development system). Is there any setting akin --classpath that I can use?

No, there isn't such an option yet. I've got work in progress, but it's not working yet.

Does it build with rebar on the development system? If it doesn't maybe that's the issuer from within Eclipse too.