Skip to content

Commit

Permalink
Fixes #920 and #895, logging in tests and dev mode was not working co…
Browse files Browse the repository at this point in the history
…rrectly
  • Loading branch information
stuartwdouglas committed Feb 19, 2019
1 parent 93b51ef commit 71c0fab
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,37 +232,40 @@ private void doProcess(CurateOutcome appState) throws AppCreatorException {
continue;
}
try (ZipFile zip = openZipFile(resolvedDep)) {
if (!appDep.getScope().equals(PROVIDED) && zip.getEntry("META-INF/services/org.jboss.shamrock.deployment.ShamrockSetup") != null) {
boolean deploymentArtifact = zip.getEntry("META-INF/shamrock-build-steps.list") != null;
if (!appDep.getScope().equals(PROVIDED) && deploymentArtifact) {
if(problems == null) {
problems = new ArrayList<>();
}
problems.add("Artifact " + appDep + " is a deployment artifact, however it does not have scope required. This will result in unnecessary jars being included in the final image");
}
ZipEntry entry = zip.getEntry(DEPENDENCIES_RUNTIME);
if (entry != null) {
whitelist.add(getDependencyConflictId(appDep.getArtifact()));
try (InputStream in = zip.getInputStream(entry)) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
String[] parts = line.trim().split(":");
if (parts.length < 5) {
continue;
}
String scope = parts[4];
if(scope.equals("test")) {
continue;
}
StringBuilder sb = new StringBuilder();
//the last two bits are version and scope
//which we don't want
for (int i = 0; i < parts.length - 2; ++i) {
if (i > 0) {
sb.append(':');
if(!deploymentArtifact) {
ZipEntry entry = zip.getEntry(DEPENDENCIES_RUNTIME);
if (entry != null) {
whitelist.add(getDependencyConflictId(appDep.getArtifact()));
try (InputStream in = zip.getInputStream(entry)) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
String[] parts = line.trim().split(":");
if (parts.length < 5) {
continue;
}
String scope = parts[4];
if (scope.equals("test")) {
continue;
}
StringBuilder sb = new StringBuilder();
//the last two bits are version and scope
//which we don't want
for (int i = 0; i < parts.length - 2; ++i) {
if (i > 0) {
sb.append(':');
}
sb.append(parts[i]);
}
sb.append(parts[i]);
whitelist.add(sb.toString());
}
whitelist.add(sb.toString());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,12 @@ void setUpDefaultLevels(List<LogCategoryBuildItem> categories, Consumer<RunTimeC
@BuildStep
void miscSetup(
Consumer<RuntimeInitializedClassBuildItem> runtimeInit,
Consumer<GeneratedResourceBuildItem> generatedResource,
Consumer<SubstrateSystemPropertyBuildItem> systemProp,
Consumer<ServiceProviderBuildItem> provider
) {
runtimeInit.accept(new RuntimeInitializedClassBuildItem("org.jboss.logmanager.formatters.TrueColorHolder"));
systemProp.accept(new SubstrateSystemPropertyBuildItem("java.util.logging.manager", "org.jboss.logmanager.LogManager"));
provider.accept(new ServiceProviderBuildItem(EmbeddedConfigurator.class.getName(), InitialConfigurator.class.getName()));
generatedResource.accept(
new GeneratedResourceBuildItem(
"META-INF/services/org.jboss.logmanager.EmbeddedConfigurator",
InitialConfigurator.class.getName().getBytes(StandardCharsets.UTF_8)
)
);
}

@BuildStep
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.jboss.shamrock.runtime.logging.InitialConfigurator
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public void execute() throws MojoFailureException {
addToClassPaths(classPathManifest, classPath, artifact.getFile());
}
args.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager");
File wiringClassesDirectory = new File(buildDir, "wiring-classes");
File wiringClassesDirectory = new File(buildDir, "wiring-devmode");
wiringClassesDirectory.mkdirs();

addToClassPaths(classPathManifest, classPath, wiringClassesDirectory);
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 71c0fab

Please sign in to comment.