Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellyrob99/2860847 to your computer and use it in GitHub Desktop.
Save kellyrob99/2860847 to your computer and use it in GitHub Desktop.
Patch file to enable building log4j12-bz53299 with Gradle. Still has some definite rough spots, including compile failures in both main and test and some failing tests(mostly due to classpath issues it seems)
Index: core/src/test/java/org/apache/log4j/util/JunitTestRunnerFilter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/src/test/java/org/apache/log4j/util/JunitTestRunnerFilter.java (revision 1345602)
+++ core/src/test/java/org/apache/log4j/util/JunitTestRunnerFilter.java (revision )
@@ -53,6 +53,13 @@
return null;
} else if(in.indexOf("JUnit4TestAdapter") >= 0) {
return null;
+ //BEGIN Gradle specific entries
+ } else if(in.indexOf("org.gradle") >= 0 || in.indexOf("$Proxy") >= 0 || in.indexOf("ThreadPoolExecutor") >= 0 ||
+ in.indexOf("java.lang.Thread.run") >= 0) {
+ return null;
+ } else if(in.indexOf("thread=\"Outgoing Connection") >= 0) {
+ return in.replaceAll("Outgoing Connection \\[.*worker", "main");
+ //END Gradle specific entries
} else if (util.match("/\\sat /", in)) {
return "\t" + in.trim();
} else {
Index: modules/lf5/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/lf5/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java (revision 1345602)
+++ modules/lf5/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java (revision )
@@ -22,6 +22,7 @@
import org.apache.log4j.spi.LoggerRepository;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
/**
@@ -87,9 +88,13 @@
resource);
}
+ }
+
+ public void doConfigure(InputStream inputStream, LoggerRepository repository) {
+ //To change body of implemented methods use File | Settings | File Templates.
- }
+ }
- /**
+ /**
* This is a dummy method that will throw an
* <code>IllegalStateException</code> if used.
*/
\ No newline at end of file
Index: build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- build.gradle (revision )
+++ build.gradle (revision )
@@ -0,0 +1,76 @@
+import static org.gradle.internal.os.OperatingSystem.current
+
+allprojects {
+ apply plugin: 'maven'
+ apply plugin: 'project-report'
+
+ group = 'org.apache.log4j'
+ version = '1.4.0-SNAPSHOT'
+}
+
+final Closure manifestAttributes = {
+ attributes('Implementation-Title': 'log4j', 'Implementation-Version': version, 'Implementation-Vendor': "Apache Software Foundation")
+}
+
+subprojects {
+ apply plugin: 'java'
+ apply plugin: 'findbugs'
+ apply plugin: 'jdepend'
+ apply plugin: 'pmd'
+
+ sourceCompatibility = 1.4
+ targetCompatibility = 1.4
+
+ repositories {
+ repositories {
+ maven {
+ url 'http://download.java.net/maven/2/'
+ }
+ maven {
+ url 'http://repo.maven.apache.org/maven2'
+ }
+ }
+ }
+
+ ext.'tools.jar' = current().isMacOsX() ? "${System.properties['java.home']}/../Classes/classes.jar" : "${System.properties['java.home']}/../lib/tools.jar"
+
+ dependencies {
+ compile "org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.0"
+ testCompile "oro:oro:2.0.8"
+ testCompile "junit:junit:3.8.2"
+ testRuntime files(project.'tools.jar')
+ }
+
+ jar {
+ manifest(manifestAttributes)
+ }
+
+ task sourcesJar(type: Jar, dependsOn: classes) {
+ manifest(manifestAttributes)
+ classifier = 'sources'
+ from sourceSets.main.allSource
+ }
+
+ task javadocJar(type: Jar, dependsOn: javadoc) {
+ manifest(manifestAttributes)
+ classifier = 'javadoc'
+ from javadoc.destinationDir
+ }
+
+ artifacts {
+ archives sourcesJar
+ archives javadocJar
+ }
+
+ [findbugsMain, findbugsTest, pmdMain, pmdTest].each {
+ it.ignoreFailures = true
+ it.reports.html.enabled = true
+ it.reports.xml.enabled = false
+ }
+
+ test {
+ ignoreFailures = true
+ }
+}
+
+dependsOnChildren()
Index: core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java (revision 1345602)
+++ core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java (revision )
@@ -23,6 +23,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.Properties;
import junit.framework.Test;
@@ -92,9 +93,7 @@
public
void varSubstTest3() {
- String r;
-
- r = OptionConverter.substVars(
+ String r = OptionConverter.substVars(
"Test3 ${unset} mid ${key1} end.", null);
assertEquals("Test3 mid value1 end.", r);
}
@@ -130,9 +129,7 @@
* @since 1.2.17
*/
public void testInputStream() throws IOException {
- File file = new File("input/filter1.properties");
- assertTrue(file.exists());
- FileInputStream inputStream = new FileInputStream(file);
+ InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("input/filter1.properties");
try {
OptionConverter.selectAndConfigure(inputStream, null, LogManager.getLoggerRepository());
} finally {
Index: modules/net/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/net/build.gradle (revision )
+++ modules/net/build.gradle (revision )
@@ -0,0 +1,6 @@
+description = 'Apache Log4j-Net'
+
+dependencies {
+ compile project(':log4j-core')
+ compile "javax.mail:mail:1.4.1"
+}
Index: modules/contribs/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/contribs/build.gradle (revision )
+++ modules/contribs/build.gradle (revision )
@@ -0,0 +1,6 @@
+description = 'Apache Log4j-Contribtutions'
+
+dependencies {
+ compile project(':log4j-core')
+ compile project(':log4j-modules:log4j-net')
+}
Index: modules/performance/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/performance/build.gradle (revision )
+++ modules/performance/build.gradle (revision )
@@ -0,0 +1,5 @@
+description = 'Apache Log4j-Performance Code'
+
+dependencies {
+ compile project(':log4j-core')
+}
Index: modules/lf5/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/lf5/build.gradle (revision )
+++ modules/lf5/build.gradle (revision )
@@ -0,0 +1,5 @@
+description = 'Apache Log4j-LF5'
+
+dependencies {
+ compile project(':log4j-core')
+}
Index: core/src/test/java/org/apache/log4j/varia/ErrorHandlerTestCase.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/src/test/java/org/apache/log4j/varia/ErrorHandlerTestCase.java (revision 1345602)
+++ core/src/test/java/org/apache/log4j/varia/ErrorHandlerTestCase.java (revision )
@@ -32,6 +32,8 @@
import org.apache.log4j.xml.DOMConfigurator;
import org.apache.log4j.PropertyConfigurator;
+import java.io.File;
+
public class ErrorHandlerTestCase extends TestCase {
static String TEMP = "output/temp";
Index: core/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/build.gradle (revision )
+++ core/build.gradle (revision )
@@ -0,0 +1,4 @@
+
+
+description = 'Apache Log4j-Core'
+
Index: modules/chainsaw/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/chainsaw/build.gradle (revision )
+++ modules/chainsaw/build.gradle (revision )
@@ -0,0 +1,5 @@
+description = 'Apache Log4j-Chainsaw V1'
+
+dependencies {
+ compile project(':log4j-core')
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment