-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #206 from gradle/eskatos/cc/update
Update the gradle-profiler for Gradle 6.5-rc-1 and the configuration cache
- Loading branch information
Showing
5 changed files
with
44 additions
and
40 deletions.
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
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
14 changes: 2 additions & 12 deletions
14
subprojects/build-operations/src/main/java/org/gradle/trace/pid/PidCollector.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 |
---|---|---|
@@ -1,25 +1,15 @@ | ||
package org.gradle.trace.pid; | ||
|
||
import org.gradle.BuildAdapter; | ||
import org.gradle.BuildResult; | ||
import org.gradle.api.internal.GradleInternal; | ||
import org.gradle.internal.nativeintegration.ProcessEnvironment; | ||
import org.gradle.trace.stream.AsyncWriter; | ||
import org.gradle.util.GFileUtils; | ||
|
||
import java.io.File; | ||
|
||
@SuppressWarnings("unused") | ||
public class PidCollector { | ||
public static void collect(GradleInternal gradle, File outFile) { | ||
ProcessEnvironment processEnvironment = gradle.getServices().get(ProcessEnvironment.class); | ||
AsyncWriter<Long> writer = new AsyncWriter<>(outFile, (l, w) -> w.print(l)); | ||
writer.append(processEnvironment.getPid()); | ||
writer.finished(); | ||
gradle.addBuildListener(new BuildAdapter(){ | ||
@Override | ||
public void buildFinished(BuildResult result) { | ||
writer.stop(); | ||
} | ||
}); | ||
GFileUtils.writeFile(processEnvironment.getPid().toString(), outFile); | ||
} | ||
} |