Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log version and capabilities when starting up #457

Merged
merged 1 commit into from
Jan 11, 2019

Conversation

mkouba
Copy link
Contributor

@mkouba mkouba commented Jan 9, 2019

Also adds optional build item - @dmlloyd I know that the impl is probably not good but I needed something that works (or at least seem to work). Feel free to replace the code with something more robust.

@mkouba
Copy link
Contributor Author

mkouba commented Jan 9, 2019

Oh and the output looks like:

INFO  [o.j.shamrock] (main) Shamrock 1.0.0.Alpha1-SNAPSHOT started in 212.043ms. Server running: http://localhost:8080
INFO  [o.j.shamrock] (main) Installed capabilities: [cdi, jax-rs, websocket]

I've also changed the level of Starting Undertow on port... message to FINE. So it should not be logged by default.

@gsmet
Copy link
Member

gsmet commented Jan 9, 2019

Do we want to log the extensions or the capabilities? I might have misunderstood but I thought that there wasn't a 1-1 mapping for them.

Copy link
Member

@dmlloyd dmlloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already an optional mechanism; it should be used instead of this approach to optionality.

@@ -683,6 +686,9 @@ private void generateFieldInjection(String processorClassName, MethodCreator bui
} else if (field.injectionType == InjectionType.LIST) {
ResultHandle val = buildStepMc.invokeVirtualMethod(ofMethod(BuildContext.class, "consumeMulti", List.class, Class.class), buildStepMc.getMethodParam(0), buildStepMc.loadClass(field.consumedTypeName));
buildStepMc.writeInstanceField(FieldDescriptor.of(processorClassName, field.element.getSimpleName().toString(), List.class), p, val);
} else if (field.injectionType == InjectionType.OPTIONAL) {
ResultHandle val = buildStepMc.invokeVirtualMethod(ofMethod(BuildContext.class, "consumeOptional", Optional.class, Class.class), buildStepMc.getMethodParam(0), buildStepMc.loadClass(field.consumedTypeName));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to just call consume and wrap the result in Optional.ofNullable instead. This should be done in conjunction with the (existing) OPTIONAL flag in org.jboss.builder.ConsumeFlag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, what is org.jboss.builder.ConsumeFlag do? How is it used?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You specify it on the consumes method of the build chain builder, when the generated code is declaring the items that it consumes. Note that the new reflection-based processor already supports optional items in this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a branch with this new reflection-based processor? I'm still lost..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's obviously not ready yet but getting closer every day.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's the right one, and you'll see that the other handlers are right below it.

/**
* An optional build item that may be consumed as an {@code Optional}.
*/
public abstract class OptionalBuildItem extends SimpleBuildItem {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so should I remove this completely and make use of the ConsumeFlag somehow? This builder is getting quite complex and it's hard to know where to start...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, see the above comment for info.

@mkouba
Copy link
Contributor Author

mkouba commented Jan 9, 2019

@gsmet Well, from user POV we should probably log capabilities because users don't care about extensions. And you're right extension != capability.

@mkouba
Copy link
Contributor Author

mkouba commented Jan 9, 2019

@dmlloyd Oh, I didn't know about org.jboss.builder.Version... I should probably use this one instead of shamrock-build.properties.

@mkouba mkouba force-pushed the issue-283-versionandcapabilities branch 2 times, most recently from 492acaf to 98156d8 Compare January 9, 2019 16:28
@mkouba
Copy link
Contributor Author

mkouba commented Jan 9, 2019

@dmlloyd Second attempt, pls review ;-)

@dmlloyd
Copy link
Member

dmlloyd commented Jan 9, 2019

TBH I don't like the approach of having to declare every extension as a capability. I wonder if there's some way to do it automatically?

@mkouba
Copy link
Contributor Author

mkouba commented Jan 9, 2019

Hm, I think that an extension may bring in zero or more capabilities. Capabilities.isCapabilityPresent() is also very useful. The current solution is not ideal but we have other tasks with higher priority to do.

@stuartwdouglas
Copy link
Member

I think we should be listing extensions not capabilities. Capabilities were intended to be internal, and could represent some internal feature that is not particularly useful to users.

@mkouba
Copy link
Contributor Author

mkouba commented Jan 10, 2019

@stuartwdouglas @dmlloyd Ok. So if capabilities are designed to be internal we should introduce a new build item, maybe "feature" and list the features? Re automation - extensions don't have any descriptor yet and as I said I think that an extension may register zero or more features (from user POV).

@mkouba mkouba force-pushed the issue-283-versionandcapabilities branch from 98156d8 to 51aa65b Compare January 10, 2019 10:33
- also make it possible to inject optional build item
- improve ServiceStartBuildItem javadoc
- resolves #283
@mkouba mkouba force-pushed the issue-283-versionandcapabilities branch from 51aa65b to 225b58f Compare January 10, 2019 10:35
@mkouba
Copy link
Contributor Author

mkouba commented Jan 10, 2019

Introduced FeatureBuildItem - still produced manually. I don't think we should spend more time with this minor (yet imho nice and practical from user POV) feature for now.

@mkouba
Copy link
Contributor Author

mkouba commented Jan 11, 2019

If there are no objections I'd like to merge this today. We can revisit the automatic registration later.

@mkouba mkouba merged commit 6fc37f9 into quarkusio:master Jan 11, 2019
@cescoffier cescoffier added this to the 0.6.0 milestone Jan 16, 2019
maxandersen pushed a commit to maxandersen/quarkus that referenced this pull request Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants