Skip to content

Commit

Permalink
add member and change to list
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jul 8, 2024
1 parent 9615916 commit 16bfc46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package xyz.wagyourtail.jvmdg.gradle.flags

import org.gradle.api.JavaVersion
import org.gradle.api.artifacts.transform.TransformParameters
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.Input
Expand Down Expand Up @@ -63,7 +64,7 @@ interface DowngradeFlags : TransformParameters {
*/
@get:Input
@get:Optional
val ignoreWarningsIn: SetProperty<String>
val ignoreWarningsIn: ListProperty<String>

/**
* sets if the logger should print debug messages
Expand Down Expand Up @@ -101,8 +102,8 @@ fun DowngradeFlags.toFlags(): Flags {
flags.logLevel = Logger.Level.valueOf(logLevel.getOrElse("INFO").uppercase())
flags.printDebug = debug.getOrElse(false)
flags.classVersion = downgradeTo.getOrElse(JavaVersion.VERSION_1_8).toOpcode()
flags.debugSkipStubs = debugSkipStubs.getOrElse(emptySet()).map { it.toOpcode() }.toSet()
ignoreWarningsIn.getOrElse(emptySet()).forEach { flags.addIgnore(it) }
flags.debugSkipStubs = debugSkipStubs.getOrElse(emptyList()).map { it.toOpcode() }.toSet()
ignoreWarningsIn.getOrElse(emptyList()).forEach { flags.addIgnore(it) }
flags.debugDumpClasses = debugDumpClasses.getOrElse(false)
return flags
}
11 changes: 7 additions & 4 deletions src/main/java/xyz/wagyourtail/jvmdg/version/VersionProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ public void stub(Class<?> clazz) {
logger.warn("failed to create stub(s) for " + clazz.getName(), e);
}
if (!warnings.isEmpty() && logger.is(Logger.Level.WARN)) {
if (downgrader.flags.checkInIgnoreWarnings(clazz.getName())) return;
StringBuilder sb = new StringBuilder();
for (String warning : warnings) {
sb.append(" ").append(warning).append("\n");
Expand Down Expand Up @@ -420,11 +421,13 @@ public ClassNode stubMethods(ClassNode owner, Set<ClassNode> extra, boolean enab
owner.methods.set(owner.methods.indexOf(method), newMethod);
}
if (!warnings.isEmpty() && logger.is(Logger.Level.WARN)) {
StringBuilder sb = new StringBuilder();
for (String warning : warnings) {
sb.append(" ").append(warning).append("\n");
if (!downgrader.flags.checkInIgnoreWarnings(owner.name + "." + method.name)) {
StringBuilder sb = new StringBuilder();
for (String warning : warnings) {
sb.append(" ").append(warning).append("\n");
}
logger.warn("Warnings for " + owner.name + "." + method.name + method.desc + " (" + warnings.size() + ") : \n" + sb);
}
logger.warn("Warnings for " + owner.name + "." + method.name + method.desc + " (" + warnings.size() + ") : \n" + sb);
}
}
return owner;
Expand Down

0 comments on commit 16bfc46

Please sign in to comment.