Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 05950200D34 for ; Tue, 26 Sep 2017 00:21:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 042681609BB; Mon, 25 Sep 2017 22:21:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 16D7B1609EE for ; Tue, 26 Sep 2017 00:21:44 +0200 (CEST) Received: (qmail 56263 invoked by uid 500); 25 Sep 2017 22:21:42 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 55644 invoked by uid 99); 25 Sep 2017 22:21:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Sep 2017 22:21:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 03572F5B1B; Mon, 25 Sep 2017 22:21:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: hboutemy@apache.org To: commits@maven.apache.org Date: Mon, 25 Sep 2017 22:22:03 -0000 Message-Id: <94a6cbaad0924934a0e104a7a9b33be3@git.apache.org> In-Reply-To: <57b30b9dfa894f8088f1adbf36ea6981@git.apache.org> References: <57b30b9dfa894f8088f1adbf36ea6981@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [23/23] maven git commit: [MNG-6196] removed remaining Monkey patching, not really necessary archived-at: Mon, 25 Sep 2017 22:21:46 -0000 [MNG-6196] removed remaining Monkey patching, not really necessary done after Emmanuel Bourg #118 PR idea Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/4f530c4f Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/4f530c4f Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/4f530c4f Branch: refs/heads/MNG-6196_slf4j Commit: 4f530c4f006b8d22da90d968a1d32797280804b9 Parents: eb2db7b Author: Hervé Boutemy Authored: Sun May 21 19:02:46 2017 +0200 Committer: Hervé Boutemy Committed: Tue Sep 26 00:19:57 2017 +0200 ---------------------------------------------------------------------- maven-slf4j-provider/pom.xml | 20 +---- .../java/org/slf4j/impl/StaticLoggerBinder.java | 89 ++++++++++++++++++++ .../src/main/script/patch-slf4j-simple.groovy | 36 -------- 3 files changed, 91 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/4f530c4f/maven-slf4j-provider/pom.xml ---------------------------------------------------------------------- diff --git a/maven-slf4j-provider/pom.xml b/maven-slf4j-provider/pom.xml index 68912f5..4bb0b2a 100644 --- a/maven-slf4j-provider/pom.xml +++ b/maven-slf4j-provider/pom.xml @@ -32,7 +32,7 @@ under the License. Maven SLF4J Simple Provider - Maven SLF4J provider based on SLF4J's simple provider, monkey-patched to support Maven styled colors + Maven SLF4J provider based on SLF4J's simple provider, extended to support Maven styled colors for levels and stacktraces rendering. @@ -63,6 +63,7 @@ under the License. false ${project.build.directory}/generated-sources/slf4j-simple org/slf4j/impl/*.java + org/slf4j/impl/StaticLoggerBinder* @@ -94,23 +95,6 @@ under the License. - - org.codehaus.gmaven - groovy-maven-plugin - 2.0 - - - patch-slf4j-simple - process-sources - - execute - - - ${project.basedir}/src/main/script/patch-slf4j-simple.groovy - - - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven/blob/4f530c4f/maven-slf4j-provider/src/main/java/org/slf4j/impl/StaticLoggerBinder.java ---------------------------------------------------------------------- diff --git a/maven-slf4j-provider/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/maven-slf4j-provider/src/main/java/org/slf4j/impl/StaticLoggerBinder.java new file mode 100644 index 0000000..ba01d83 --- /dev/null +++ b/maven-slf4j-provider/src/main/java/org/slf4j/impl/StaticLoggerBinder.java @@ -0,0 +1,89 @@ +package org.slf4j.impl; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +import org.slf4j.ILoggerFactory; +import org.slf4j.spi.LoggerFactoryBinder; + +/** + * SLF4J LoggerFactoryBinder implementation using MavenSimpleLogger. + * This class is part of the required classes used to specify an + * SLF4J logger provider implementation. + * + * @since 3.5.1 + */ +public final class StaticLoggerBinder + implements LoggerFactoryBinder +{ + /** + * Declare the version of the SLF4J API this implementation is compiled + * against. The value of this field is usually modified with each release. + */ + // to avoid constant folding by the compiler, this field must *not* be final + @SuppressWarnings( { "checkstyle:staticvariablename", "checkstyle:visibilitymodifier" } ) + public static String REQUESTED_API_VERSION = "1.7.25"; // !final + + private static final String LOGGER_FACTORY_CLASS_STR = MavenSimpleLoggerFactory.class.getName(); + + /** + * The unique instance of this class. + */ + private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder(); + + /** + * The ILoggerFactory instance returned by the {@link #getLoggerFactory} + * method should always be the same object + */ + private final ILoggerFactory loggerFactory; + + /** + * Private constructor to prevent instantiation + */ + private StaticLoggerBinder() + { + loggerFactory = new MavenSimpleLoggerFactory(); + } + + /** + * Returns the singleton of this class. + */ + public static StaticLoggerBinder getSingleton() + { + return SINGLETON; + } + + /** + * Returns the factory. + */ + @Override + public ILoggerFactory getLoggerFactory() + { + return loggerFactory; + } + + /** + * Returns the class name. + */ + @Override + public String getLoggerFactoryClassStr() + { + return LOGGER_FACTORY_CLASS_STR; + } +} http://git-wip-us.apache.org/repos/asf/maven/blob/4f530c4f/maven-slf4j-provider/src/main/script/patch-slf4j-simple.groovy ---------------------------------------------------------------------- diff --git a/maven-slf4j-provider/src/main/script/patch-slf4j-simple.groovy b/maven-slf4j-provider/src/main/script/patch-slf4j-simple.groovy deleted file mode 100644 index 9865625..0000000 --- a/maven-slf4j-provider/src/main/script/patch-slf4j-simple.groovy +++ /dev/null @@ -1,36 +0,0 @@ - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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. - */ - -dir = new File( basedir, 'target/generated-sources/slf4j-simple/org/slf4j/impl' ); - -file = new File( dir, 'StaticLoggerBinder.java' ); -content = file.text; - -// check if already patched -if ( content.contains( 'MavenSimpleLoggerFactory' ) ) -{ - println ' slf4j-simple already patched'; - return; -} - - -println ' patching StaticLoggerBinder.java'; -content = content.replaceAll( 'SimpleLoggerFactory', 'MavenSimpleLoggerFactory' ); -file.write( content );