-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into rename-security-policy-file
- Loading branch information
Showing
67 changed files
with
1,802 additions
and
967 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...deployment/src/main/java/io/quarkus/caffeine/deployment/devui/CaffeineDevUIProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.quarkiverse.caffeine.deployment.devui; | ||
|
||
import java.io.InputStream; | ||
import java.net.URL; | ||
import java.util.jar.Manifest; | ||
|
||
import com.github.benmanes.caffeine.cache.Caffeine; | ||
|
||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.devui.spi.page.CardPageBuildItem; | ||
import io.quarkus.devui.spi.page.Page; | ||
import io.quarkus.devui.spi.page.PageBuilder; | ||
|
||
/** | ||
* Dev UI card for displaying important details such as the Caffeine library version. | ||
*/ | ||
public class CaffeineDevUIProcessor { | ||
|
||
@BuildStep(onlyIf = IsDevelopment.class) | ||
void createCard(BuildProducer<CardPageBuildItem> cardPageBuildItemBuildProducer) { | ||
final CardPageBuildItem card = new CardPageBuildItem("Caffeine"); | ||
|
||
final PageBuilder versionPage = Page.externalPageBuilder("Version") | ||
.icon("font-awesome-solid:mug-hot") | ||
.url("https://github.com/ben-manes/caffeine") | ||
.doNotEmbed() | ||
.staticLabel(getManifest(Caffeine.class).getMainAttributes().getValue("Bundle-Version")); | ||
card.addPage(versionPage); | ||
|
||
card.setCustomCard("qwc-caffeine-card.js"); | ||
|
||
cardPageBuildItemBuildProducer.produce(card); | ||
} | ||
|
||
public static Manifest getManifest(Class<?> clz) { | ||
String resource = "/" + clz.getName().replace(".", "/") + ".class"; | ||
String fullPath = clz.getResource(resource).toString(); | ||
String archivePath = fullPath.substring(0, fullPath.length() - resource.length()); | ||
|
||
try (InputStream input = new URL(archivePath + "/META-INF/MANIFEST.MF").openStream()) { | ||
return new Manifest(input); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Loading MANIFEST for class " + clz + " failed!", e); | ||
} | ||
} | ||
} |
Oops, something went wrong.