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

Extension Codestarts are now "really" meant to start coding with an extension #16692

Merged
merged 2 commits into from
Apr 23, 2021

Conversation

ia3andy
Copy link
Contributor

@ia3andy ia3andy commented Apr 21, 2021

  • Change from --no-examples to --no-code in Create command for Maven Plugin and CLI
  • Change from --examples to --example in Create command for Maven Plugin and CLI (only one example can be selected at a time)
  • some example are moved to extension-codestarts and rewritten to be starters (almost no logic): funqy-http, resteasy-qute, picocli, config-yaml and resteasy, resteasy-reactive, spring-web
  • All singleton-example become example, only one can be activated for an app, they disable extension-codestarts
  • providesExample becomes providesCode in ExtensionProcessor
  • Remove resteasy-jackson and logging-json examples which are not really useful for now

THIS IS MEANT FOR 2.0 AS IT BREAKS COMPAT

Fixes #15997 (config-yaml is not using resteasy anymore, it just creates a GreetingConfig)

Generated code:

resteasy, resteasy-reactive and spring-web are not changed.

RESTEasy Qute

package org.acme;

import ...

@Path("/some-page")
public class SomePage {

    @Inject
    Template page;

    @GET
    @Produces(MediaType.TEXT_HTML)
    public TemplateInstance get(@QueryParam("name") String name) {
        return page.data("name", name);
    }

}

YAML Config

You have to bind it yourself somewhere to actually use it (command line, resteasy, resteasy-reactive)

package org.acme;

import ...

@ConfigProperties(prefix = "greeting")
public interface GreetingConfig {

    @ConfigProperty(name = "message")
    String message();

}

picocli

package org.acme;

import ...

@Command(name = "greeting", mixinStandardHelpOptions = true)
public class GreetingCommand implements Runnable {

    @Parameters(paramLabel = "<name>", defaultValue = "picocli",
        description = "Your name.")
    String name;

    @Override
    public void run() {
        System.out.printf("Hello %s, go go commando!\n", name);
    }

}

Funqy HTTP

package org.acme;

import io.quarkus.funqy.Funq;

public class MyFunctions {

    @Funq
    public String greeting(GreetingInput input) {
        return String.format("Hello %s!", input != null ? input.name : "Funqy");
    }


    public static class GreetingInput {
        public String name;
    }

}

@quarkus-bot quarkus-bot bot added area/cli Related to quarkus cli (not maven/gradle/etc.) area/codestarts area/config area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/funqy area/jbang Issues related to when using jbang.dev with Quarkus area/logging area/maven area/platform Issues related to definition and interaction with Quarkus Platform area/rest area/spring Issues relating to the Spring integration labels Apr 21, 2021
@ia3andy ia3andy changed the title Pivot to extension codestarts instead of examples Pivot to "extension codestarts" instead of "examples" Apr 21, 2021
@ia3andy ia3andy force-pushed the extension-codestarts branch from f6361c1 to 4780e55 Compare April 21, 2021 14:35
@ia3andy ia3andy changed the title Pivot to "extension codestarts" instead of "examples" Extension Codestarts are now "really" meant to start coding with an extension Apr 21, 2021
@ia3andy ia3andy force-pushed the extension-codestarts branch 2 times, most recently from 15f0f3c to 74a6857 Compare April 21, 2021 14:56
@FroMage
Copy link
Member

FroMage commented Apr 21, 2021

In the case of Qute, there's also the template file, right? In the case of YAML, there's also the YAML config file, right?

Otherwise, looks like the right move :)

@ia3andy
Copy link
Contributor Author

ia3andy commented Apr 21, 2021

In the case of Qute, there's also the template file, right? In the case of YAML, there's also the YAML config file, right?

Otherwise, looks like the right move :)

@FroMage

Yes and yes! :)

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Hello {name ?: "Qute"}</title>
    <style>
        body {
            background-color: #000;
            color: #fff;
        }
        h1 {
            color: #4695EB;
            font-size: 6vw;
        }

        h1 b {
            color: #be9100;
        }

        p {
            font-size: 2vw;
        }
    </style>
</head>
<body>
<h1>Hello <b>{name ?: "Qute"}</b></h1>

<p>Create your web page using Quarkus RESTEasy & Qute</p>
</body>
</html>

and

greeting:
  message: "hello"

@ia3andy
Copy link
Contributor Author

ia3andy commented Apr 21, 2021

@FroMage
image

@ia3andy ia3andy force-pushed the extension-codestarts branch 7 times, most recently from 8a0ade6 to 392f012 Compare April 22, 2021 09:13
@ia3andy ia3andy marked this pull request as ready for review April 22, 2021 12:19
@ia3andy ia3andy requested review from aloubyansky and glefloch April 22, 2021 12:19
@ia3andy ia3andy force-pushed the extension-codestarts branch from 8ad17c9 to 3655b97 Compare April 22, 2021 12:21
@quarkusio quarkusio deleted a comment from quarkus-bot bot Apr 22, 2021
@ia3andy ia3andy force-pushed the extension-codestarts branch 2 times, most recently from 660da8a to c8d3a8c Compare April 22, 2021 13:50
@@ -46,10 +46,22 @@ public static void deepMerge(Map left, Map right) {
c.addAll((Collection) leftValue);
c.addAll((Collection) rightValue);
left.put(key, c);
} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aloubyansky I found this nasty bug (from myself) while using a static codestart catalog from the tests 😱 the codestart catalog data was muted when generating a project (luckily in prod it's read at each generation).. This is not very optimized, at some point I will probably cache it. So better it be fixed :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI in this deepMerge, it's ok to mutate left, but not right so I added some safety..

@quarkusio quarkusio deleted a comment from quarkus-bot bot Apr 22, 2021
@quarkusio quarkusio deleted a comment from quarkus-bot bot Apr 22, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 22, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building c8d3a8c

Status Name Step Test failures Logs Raw logs
JVM Tests - JDK 11 Build Test failures Logs Raw logs
JVM Tests - JDK 11 Windows Build ⚠️ Check → Logs Raw logs
✔️ JVM Tests - JDK 15

Full information is available in the Build summary check run.

Test Failures

⚙️ JVM Tests - JDK 11 #

📦 extensions/jdbc/jdbc-mysql/deployment

io.quarkus.jdbc.mysql.deployment.DevServicesMySQLDatasourceTestCase.testDatasource - More details - Source on GitHub

@ia3andy ia3andy force-pushed the extension-codestarts branch from c8d3a8c to b632482 Compare April 22, 2021 18:15
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 22, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building b632482

Status Name Step Test failures Logs Raw logs
Gradle Tests - JDK 11 Windows Build Test failures Logs Raw logs
JVM Tests - JDK 11 Build Test failures Logs Raw logs
JVM Tests - JDK 11 Windows Build ⚠️ Check → Logs Raw logs
✔️ JVM Tests - JDK 15

Full information is available in the Build summary check run.

Test Failures

⚙️ Gradle Tests - JDK 11 Windows #

📦 integration-tests/gradle

io.quarkus.gradle.devmode.JandexMultiModuleProjectDevModeTest.main() line 21 - More details - Source on GitHub


⚙️ JVM Tests - JDK 11 #

📦 extensions/jdbc/jdbc-mysql/deployment

io.quarkus.jdbc.mysql.deployment.DevServicesMySQLDatasourceTestCase.testDatasource - More details - Source on GitHub

@ia3andy
Copy link
Contributor Author

ia3andy commented Apr 23, 2021

@gsmet each new rebase, I get some new CI errors... I think it's time to do another pass like we did a few months ago, it's been a while the CI haven't been stable.. wdyt?

@ia3andy ia3andy force-pushed the extension-codestarts branch from b632482 to c635100 Compare April 23, 2021 05:30
Copy link
Member

@aloubyansky aloubyansky left a comment

Choose a reason for hiding this comment

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

I have some concerns using 999-SNAPSHOT in the tests that don't actually rely on the actual Quarkus version being built. It'd be good to change it to some unrelated version in a subsequent PR.

@ia3andy ia3andy merged commit e3fc195 into quarkusio:main Apr 23, 2021
@ia3andy ia3andy deleted the extension-codestarts branch April 23, 2021 09:29
@quarkus-bot quarkus-bot bot added this to the 2.0 - main milestone Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/codestarts area/config area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/funqy area/jbang Issues related to when using jbang.dev with Quarkus area/logging area/maven area/platform Issues related to definition and interaction with Quarkus Platform area/rest area/spring Issues relating to the Spring integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

quarkus-maven-plugin create adds conflicting extensions: config-yaml adds quarkus-resteasy
4 participants