-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add Rule Logger #1040
Merged
joelittlejohn
merged 32 commits into
joelittlejohn:master
from
ddcruver:feature/add-rule-logger
Nov 19, 2019
Merged
Add Rule Logger #1040
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
ed63237
#113 Create RuleLogger interface and implementations.
ddcruver b92a9ab
#113 Create RuleLogger implementation for each factory and assign the…
ddcruver c4ffa94
#113 Move some test dependencies out of the compile scope.
ddcruver 8365804
#113 Fix an issue where script/jar/lib were assumed to be all togethe…
ddcruver 71c4632
#113 Add RuleLogger mocking to some tests.
ddcruver e8f542c
#113 Add SLF4J binding for gradle plugin tests.
ddcruver 82c04fd
#1040 Remove explicit scope in test dependencies that are already set…
ddcruver fc3e4da
#1040 Use slf4j instead of gradle logger
ddcruver ab83f5c
#1040 Use slf4j instead of gradle logger - fix log statement
ddcruver 1cb089f
#1040 Move simplelogger.properties to classpath.
ddcruver 5867a0e
#1040 Try to get CI Build working.
ddcruver c272508
#1040 Try to get CI Build working. Upgrade Groovy version.
ddcruver 34a6888
#1040 Remove pushd/popd to not mess with current working directory. …
ddcruver 1772deb
#1040 Try deleting gradle-2.3-bin to fix org.gradle.tooling.GradleCon…
ddcruver bd6c9a0
#1040 Fix outdated references and spelling errors.
ddcruver 2faea92
#1040 Try to get CI Build working.
ddcruver f70d0cf
#1040 Try to get CI Build working. Using eclipse plugin.
ddcruver 2ad7943
#1040 Try to get CI Build working. Force it to use https.
ddcruver 268ff15
#1040 Switch back to using Gradle framework logger.
ddcruver 4e8933c
#1040 Try build without to maven builds.
ddcruver 1605a54
#1040 Remove switch in AntRuleLogger to address PR comment.
ddcruver 6328cdb
#1040 Revert changes to jars classpath and scripts to avoid breaking …
ddcruver eb612ac
#1040 Remove SLFJ from CLI module.
ddcruver a6174e1
#1040 Add is enable checks to RuleLogger interface to mimic what SLFJ…
ddcruver 154b3db
#1040 Fix some instances of hardcoded "UTF-8"
ddcruver 156f35e
#1040 Cleanup Travis CI integration since we resolve the Gradle downl…
ddcruver d363ccc
#1040 Convert bat file back to Windows line endings.
ddcruver a069661
#1040 Add note in description that if print-log-levels option is choo…
ddcruver 63a1a70
#1040 Add Batch files to .gitattributes so it is always treated as CRLF.
ddcruver 44472e8
#1040 Remove simplelogger.properties because we are just going to use…
ddcruver 222d2fb
#1040 Renormalize jsonschema2pojo.bat
ddcruver 646d9f8
#1040 Remove .gitattributes and revert jsonschema2pojo.bat.
ddcruver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
# Batch Scripts should always be using Windows line endings. | ||
*.bat text eol=crlf | ||
|
||
# Shell Scripts should always be using Linux line endings. | ||
*.sh text eol=lf |
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 |
---|---|---|
@@ -1,7 +1,18 @@ | ||
language: java | ||
script: "mvn verify" | ||
jdk: | ||
- openjdk8 | ||
os: linux | ||
|
||
jdk: openjdk8 | ||
|
||
before_cache: | ||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock | ||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ | ||
- rm -fr $HOME/.gradle/caches/*/scripts/ | ||
|
||
cache: | ||
directories: | ||
- "$HOME/.m2" | ||
- "$HOME/.gradle/caches/" | ||
- "$HOME/.gradle/wrapper/" | ||
|
||
script: | ||
- mvn verify | ||
90 changes: 90 additions & 0 deletions
90
jsonschema2pojo-ant/src/main/java/org/jsonschema2pojo/ant/AntRuleLogger.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,90 @@ | ||
/* | ||
* Copyright © 2010-2017 Nokia | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jsonschema2pojo.ant; | ||
|
||
import org.apache.tools.ant.Project; | ||
import org.jsonschema2pojo.AbstractRuleLogger; | ||
|
||
public class AntRuleLogger extends AbstractRuleLogger { | ||
|
||
private static final String LEVEL_PREFIX = "["; | ||
private static final String LEVEL_SUFFIX = "] "; | ||
private static final String DEBUG_LEVEL_PREFIX = LEVEL_PREFIX + "DEBUG" + LEVEL_SUFFIX; | ||
private static final String ERROR_LEVEL_PREFIX = LEVEL_PREFIX + "ERROR" + LEVEL_SUFFIX; | ||
private static final String INFO_LEVEL_PREFIX = LEVEL_PREFIX + "INFO" + LEVEL_SUFFIX; | ||
private static final String TRACE_LEVEL_PREFIX = LEVEL_PREFIX + "TRACE" + LEVEL_SUFFIX; | ||
private static final String WARN_LEVEL_PREFIX = LEVEL_PREFIX + "WARN" + LEVEL_SUFFIX; | ||
|
||
private final Jsonschema2PojoTask task; | ||
|
||
public AntRuleLogger(Jsonschema2PojoTask jsonschema2PojoTask) { | ||
this.task = jsonschema2PojoTask; | ||
} | ||
|
||
@Override | ||
public boolean isDebugEnabled() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isErrorEnabled() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isInfoEnabled() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isTraceEnabled() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isWarnEnabled() { | ||
return true; | ||
} | ||
|
||
protected void doDebug(String msg) { | ||
log(msg, Project.MSG_DEBUG, DEBUG_LEVEL_PREFIX); | ||
} | ||
|
||
protected void doError(String msg) { | ||
log(msg, Project.MSG_ERR, ERROR_LEVEL_PREFIX); | ||
} | ||
|
||
protected void doInfo(String msg) { | ||
log(msg, Project.MSG_INFO, INFO_LEVEL_PREFIX); | ||
} | ||
|
||
protected void doTrace(String msg) { | ||
log(msg, Project.MSG_VERBOSE, TRACE_LEVEL_PREFIX); | ||
} | ||
|
||
protected void doWarn(String msg) { | ||
log(msg, Project.MSG_WARN, WARN_LEVEL_PREFIX); | ||
} | ||
|
||
private void log(String msg, int level, String levelPrefix) { | ||
if (task != null && task.getProject() != null) { | ||
task.getProject().log(msg, level); | ||
} else { | ||
System.err.println(levelPrefix + msg); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for
install
thenverify
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to resolve the build issues and found this commit (81adfe7) and it mentioned that CI tests might be broken unless do a build then do a test build.
@ben-manes Is this unnecessary now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be necessary with the eclipse-groovy-compiler. I will try removing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That commit comment wrt CI failure was a one-time breakage and no longer relevant. Just required a clean if I recall correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joelittlejohn I have already removed the extra build and haven't notice any problems.
@ben-manes Thanks for your input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think all the changes in this file can be reverted, is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the hacky gradle bin and double building stuff from Travis CI configuration but left in the caching.