natocesarrego / slider

0 stars 6 forks source link

soy compilation error #3

Closed alaagamalkhattab closed 3 years ago

alaagamalkhattab commented 4 years ago

i tried to deploy this module but it failed with this:

Compiling soy Error in plugin 'metal-tools-soy' Message: Compile error: errors during Soy compilation Finished compiling soy src\main\resources\META-INF\resources\Slider\Slider.soy:17: error: Undefined template 'FieldBase.render'. {call FieldBase.render} ^ 1 error

so any help??

natocesarrego commented 4 years ago

Hi @alaagamalkhattab,

Can you please describe the steps that you did to get this error?

Thanks.

evaldeslacasa commented 3 years ago

Greetings!

Thank you for the module.

Unfortunately I'm experiencing the same exact issue as alaagamalkhattab.

> Task :transpileJS
Running 'build'...
Compiling soy
Error in plugin 'metal-tools-soy'
Message:
    Compile error:
errors during Soy compilation
Slider\Slider.soy:17: error: Undefined template 'FieldBase.render'.
    {call FieldBase.render}
    ^
1 error

Any feedback would be greatly appreciated. I'm not sure how to build and deploy it.

Cheers!

evaldeslacasa commented 3 years ago

I see the Soy template render defined in /node_modules/com.liferay.dynamic.data.mapping.form.field.type/META-INF/resources/FieldBase/FieldBase.soy...so I'm not sure why it complains.

(I am new to Soy and wanted to just try out your plugin in Liferay 7.2 to see how custom form field types work)

natocesarrego commented 3 years ago

Hi @evaldeslacasa,

The FieldBase.soy is a file provided by another module listed as a dependency here on build.gradle, can you double check if this dependency is available on your environment?

Besides, can you please describe which steps have you taken to reproduce this issue?

Thanks in advance.

evaldeslacasa commented 3 years ago

Thanks for the answer @natocesarrego!

First of all, I tried to follow the documentation in the Liferay website: https://help.liferay.com/hc/en-us/articles/360019073791-Creating-Form-Field-Types. Unfortunately, that is for Liferay 7.1, and I'm on 7.2 (Windows 10). Regardless, I tried to tweak it for version 7.2. Unfortunately, I wasn't able to deploy successfully, it throws an error around com.liferay.frontend.js.loader.modules.extender.internal.npm.flat.FlatNPMBundleProcessor.process(FlatNPMBundleProcessor.java:169)...so I felt discouraged by this.

After some research, I stumbled upon this answer in Stack Overflow, where your project is mentioned: https://stackoverflow.com/a/60721179/1679112. So I thought deploying your Slider would be the best way to go to customize a custom form field data type.

I'm a newbie in Gradle but have good experience with Maven...and the Slider is in Gradle, but that's okay if I get it working.

So I cloned your repo, and tried to do /gradlew build. I got this first:

* What went wrong:
A problem occurred evaluating root project 'dynamic-data-mapping-form-field-type-slider'.
> Could not find method jsCompile() for arguments [{group=com.liferay, name=com.liferay.dynamic.data.mapping.form.field.type, version=4.0.25}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s

I thought some configuration was needed so I tweaked your build.gradle to this: https://gist.github.com/evaldeslacasa/b13ca2b7453361e957053b7eefd40b5c. After that, /gradle build runs and progresses until the issue I mentioned in my frist message above (transpileJS Gradle task).

The NPM build commands actually work fine https://github.com/natocesarrego/slider/blob/master/slider/package.json#L12-L14...and to answer your question, I see within my /slider/node_modules a com.liferay.dynamic.data.mapping.form.field.type directory...which I assume is the dependency? I notice though that within the /slider/build/node_modules the dependency is missing (from the research I made, /build is the folder where the module is adapted to OSGi).

I notice how your .npmbundlerrc mentions this:

https://github.com/natocesarrego/slider/blob/master/slider/.npmbundlerrc#L4

That line has me in suspense...I know that this file is used by the liferay-npm-bundler to produce an OSGi bundle containing the needed npm dependencies so that it can be run when deployed to the Portal...so for some reason the dependency is in /slider/node_modules folder...but not in /slider/build/node_modules.

Am I building correctly at all? I feel like I'm not building this the way I should.

Thanks a ton!!!

evaldeslacasa commented 3 years ago

If it's easier for you I'll share my code, I could fork the project and push to my GitHub.

evaldeslacasa commented 3 years ago

Something I forgot to mention: I'm trying to build the module on its own, outside of a Gradle Liferay workspace...I wonder if that could be an issue.

evaldeslacasa commented 3 years ago

Oh, man, that seemed to be the problem. I built it in a separate Liferay (Gradle) workspace, and it built successfully. It probably was the same issue @alaagamalkhattab was having. Thanks for reaching out and for the slider @natocesarrego!

natocesarrego commented 3 years ago

Hey @evaldeslacasa, I'm glad you could overcome the building issue. 😄

In addition, I'd like to let you know that the documentation which teaches how to create a custom field on 7.2 and 7.3 is on the queue to be published, meanwhile please check its draft.

Cheers!

natocesarrego commented 3 years ago

Hey @rbohl,

Please check this discussion above. 😉