-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Remove deprecation warnings to prepare for Gradle 5 (sourceSets.main.output.classesDirs) #30389
Changes from all commits
8b1affc
684234b
9bd9389
a7e641c
2149a16
b8bf651
f9bf8fa
af3ac3e
f514cc8
c0bf1af
32a6438
202f8f7
a2800c0
3bb77ff
9f56f93
8265b0b
cb11667
a1f93cf
4b6cb42
ced99bf
a3f1cfc
b7f8a1a
c179844
1712976
9578cb8
72fb7a9
572dbe8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.elasticsearch.gradle; | ||
|
||
import groovy.lang.Closure; | ||
import org.gradle.api.GradleException; | ||
import org.gradle.api.Task; | ||
import org.gradle.api.tasks.Exec; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* A wrapper around gradle's Exec task to capture output and log on error. | ||
*/ | ||
public class LoggedExec extends Exec { | ||
|
||
protected ByteArrayOutputStream output = new ByteArrayOutputStream(); | ||
|
||
public LoggedExec() { | ||
if (getLogger().isInfoEnabled() == false) { | ||
setStandardOutput(output); | ||
setErrorOutput(output); | ||
setIgnoreExitValue(true); | ||
doLast(new Closure<Void>(this, this) { | ||
public void doCall(Task it) throws IOException { | ||
if (getExecResult().getExitValue() != 0) { | ||
for (String line : output.toString("UTF-8").split("\\R")) { | ||
getLogger().error(line); | ||
} | ||
throw new GradleException( | ||
"Process \'" + getExecutable() + " " + | ||
getArgs().stream().collect(Collectors.joining(" "))+ | ||
"\' finished with non-zero exit value " + | ||
String.valueOf(getExecResult().getExitValue()) | ||
); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.elasticsearch.gradle; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
|
||
/** | ||
* Accessor for shared dependency versions used by elasticsearch, namely the elasticsearch and lucene versions. | ||
*/ | ||
public class VersionProperties { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears this is being moved to a java file, but it is still under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. That is because the Groovy compiler knows how to deal with this and delegate these files to the Java compiler. The reason these can't move to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sounds like a great plan! |
||
public static Version getElasticsearch() { | ||
return elasticsearch; | ||
} | ||
|
||
public static String getLucene() { | ||
return lucene; | ||
} | ||
|
||
public static Map<String, String> getVersions() { | ||
return versions; | ||
} | ||
|
||
private static final Version elasticsearch; | ||
private static final String lucene; | ||
private static final Map<String, String> versions = new HashMap<String, String>(); | ||
static { | ||
Properties props = getVersionProperties(); | ||
elasticsearch = Version.fromString(props.getProperty("elasticsearch")); | ||
lucene = props.getProperty("lucene"); | ||
for (String property : props.stringPropertyNames()) { | ||
versions.put(property, props.getProperty(property)); | ||
} | ||
} | ||
|
||
private static Properties getVersionProperties() { | ||
Properties props = new Properties(); | ||
InputStream propsStream = VersionProperties.class.getResourceAsStream("/version.properties"); | ||
if (propsStream == null) { | ||
throw new RuntimeException("/version.properties resource missing"); | ||
} | ||
try { | ||
props.load(propsStream); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return props; | ||
} | ||
} |
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 appears to be moved to a java file, but still exists under
src/main/groovy
?