Git Product home page Git Product logo

Comments (11)

VaughnVernon avatar VaughnVernon commented on June 7, 2024 1

@aleixmorgadas @d-led I implemented this as I stated above. It's all pushed to vlingo-actors master and vlingo-http master. Here are the two sets of configurations:

# vlingo-actors.properties
proxy.generated.sources.main = target/generated-sources/
proxy.generated.sources.test = target/generated-test-sources/
proxy.generated.classes.main = target/classes/
proxy.generated.classes.test = target/test-classes/
----------------------------
# vlingo-http.properties
resource.dispatcher.generated.sources.main = target/generated-sources/
resource.dispatcher.generated.sources.test = target/generated-test-sources/
resource.dispatcher.generated.classes.main = target/classes/
resource.dispatcher.generated.classes.test = target/test-classes/

from xoom-common.

d-led avatar d-led commented on June 7, 2024

while the target directories are indeed based on the Maven convention, as the classes are loaded at run-time, the code generation and caching logic works in gradle or a fat jar context just as well. Check out this project: https://github.com/d-led/hello_vlingo (all 3 version run in CI)

from xoom-common.

 avatar commented on June 7, 2024

from xoom-common.

VaughnVernon avatar VaughnVernon commented on June 7, 2024

In the Gradle docs I can't find an explicit and official generated source location for Gradle or how to determine at runtime which environment is in use. I could use help here, if even making it a configuration.

from xoom-common.

d-led avatar d-led commented on June 7, 2024

That would be indeed helpful to know which context you are talking about exactly, e.g. IntellJ or Eclipse and what difference you mean between release and development. Just bumped the vlingo-actors version to see if it still works. It does: https://travis-ci.org/d-led/hello_vlingo/builds/404155607

from xoom-common.

d-led avatar d-led commented on June 7, 2024

@aleixmorgadas it would be nice if you could set up an example project that could be to debug

from xoom-common.

 avatar commented on June 7, 2024

I created the vlingo-http-gradle-issue-4 repository with the minimum code to throw the error.

The IDE used is IntelliJ & I started the application in the same IDE. The same structure with Maven works.

Here some stack trace (skipped some lines)

vlingo/http: Generating handler dispatcher for main: com.github.aleixmorgadas.vlingohttpgradle.HelloWorldResource
vlingo/http: Generating handler dispatcher for test: com.github.aleixmorgadas.vlingohttpgradle.HelloWorldResource
vlingo/http: Failed to load resource: hello because: Resource cannot be created for: com.github.aleixmorgadas.vlingohttpgradle.HelloWorldResource
java.lang.IllegalArgumentException: Resource instance with dispatcher for com.github.aleixmorgadas.vlingohttpgradle.HelloWorldResource not created because: Cannot generate resource dispatcher class for com.github.aleixmorgadas.vlingohttpgradle.HelloWorldResource because there is no corresponding:
target/test-classes/com/github/aleixmorgadas/vlingohttpgradle/HelloWorldResource.class
	at io.vlingo.http.resource.Resource.tryGenerateCompile(Resource.java:127)
//. ......
	at com.github.aleixmorgadas.vlingohttpgradle.Application.main(Application.java:10)
Caused by: java.lang.IllegalArgumentException: Cannot generate resource dispatcher class for com.github.aleixmorgadas.vlingohttpgradle.HelloWorldResource because there is no corresponding:
target/test-classes/com/github/aleixmorgadas/vlingohttpgradle/HelloWorldResource.class
	at io.vlingo.http.resource.ResourceDispatcherGenerator.generateFor(ResourceDispatcherGenerator.java:87)
	at io.vlingo.http.resource.Resource.tryGenerateCompile(Resource.java:122)
	... 8 more
Exception in thread "main" java.lang.IllegalStateException: Resource cannot be created for: com.github.aleixmorgadas.vlingohttpgradle.HelloWorldResource
	at io.vlingo.http.resource.Loader.resourceFor(Loader.java:79)

from xoom-common.

VaughnVernon avatar VaughnVernon commented on June 7, 2024

@aleixmorgadas Thanks for the stack trace and sample project. I have struggled to find anything specific in Gradle docs and various forum discussions regarding where generated source should be located. Can you make a recommendation based on your experience with Gradle and IntelliJ? My thought is to provide a configuration root for both main and test. The following is an example for vlingo-http.properties, or would be included in your DSL configuration.

#=====================================
# generated resource dispatchers
#=====================================

resource.dispatcher.generated.sources.main = target/generated-sources/
resource.dispatcher.generated.sources.test = target/generated-test-sources/
resource.dispatcher.generated.classes.main = target/classes/
resource.dispatcher.generated.classes.test = target/test-classes/

The values would be replaced for Gradle and/or IntelliJ. Please provide your thoughts.

from xoom-common.

 avatar commented on June 7, 2024

Unrelated to the issue per se, why do you need to compile the classes at run time?

Regarding the solution by configuration, it works, but I think vlingo is relying a lot to configuration files, it should provide better error reporting to help the developer find the issues/solutions earlier. En example is that, if vlingo-actors.properties file isn't present, it throws a NullPointerException and should throw something more descriptive, my 5 cents.

from xoom-common.

 avatar commented on June 7, 2024

Checked. Working with the latest version 0.4.0

from xoom-common.

VaughnVernon avatar VaughnVernon commented on June 7, 2024

@aleixmorgadas Thanks. I answer your questions here.

  1. We don't require runtime code generation and compilation unless the developer has not arranged for proxies to be pre-generated. For vlingo-actors you can use the vlingo-maven-plugin. See the vlingo-maven-plugin-test for usage. For vlingo-http the vlingo-maven-plugin has not yet been enabled for dispatcher proxy generation support. Still, using runtime dynamically generated proxies is nice for testing, because you can quickly change/refactor the tested and test code before it is well-designed green.

  2. There are configuration files now, but very minimal configuration is required. It has always been my intention to support fluent configuration APIs, but right now I am focused on more important features/functionality. As you can see most of the projects are at 0.5.0 or less. This is something that developers of the tools should be willing to work with for a short time until there is time to make it more seamless. If you can't live with that right now for some reason please change it.

  3. The configuration is minimal, and in vlingo-actors there is no consumer-programmer configuration necessary for reasonable default behavior (remove vlingo-actors.properties and use World.start("worldname" true) and see). Yes, current default behavior for proxy generation is for Maven, not Gradle, but it's simple to understand why when considering overall industry usage of Maven. It's not a judgment as to which build tool is better, it's just a matter of numbers of projects/users.

from xoom-common.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.