8000 Build trace classifications · sakerbuild/saker.java.compiler@62f511f · GitHub
[go: up one dir, main page]

Skip to content

Commit 62f511f

Browse files
committed
Build trace classifications
2 parents f813d41 + f813d41 commit 62f511f

14 files changed

+412
-222
lines changed

impl/src/main/saker/java/compiler/impl/JavaUtil.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ private JavaUtil() {
9999
}
100100
}
101101

102+
public static String getClassSimpleNameFromBinaryName(String binaryname) {
103+
if (binaryname == null) {
104+
return null;
105+
}
106+
int dotidx = binaryname.lastIndexOf('.');
107+
int dollaridx = binaryname.lastIndexOf('$', dotidx);
108+
return binaryname.substring(Math.max(dotidx, dollaridx) + 1);
109+
}
110+
102111
public static boolean isValidProcessorInputLocationName(String name) {
103112
return !INVALID_PROCESSOR_INPUT_LOCATION_NAMES.contains(name);
104113
}

impl/src/main/saker/java/compiler/impl/classpath/bundle/BundleClassPathWorkerTaskFactory.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434
import saker.build.thirdparty.saker.util.io.SerialUtils;
3535
import saker.build.thirdparty.saker.util.thread.ThreadUtils;
3636
import saker.build.thirdparty.saker.util.thread.ThreadUtils.ThreadWorkPool;
37+
import saker.build.trace.BuildTrace;
3738
import saker.build.util.property.IDEConfigurationRequiredExecutionProperty;
3839
import saker.java.compiler.api.classpath.ClassPathReference;
40+
import saker.java.compiler.main.classpath.bundle.BundleClassPathTaskFactory;
41+
import saker.java.compiler.main.processor.BundleProcessorTaskFactory;
3942
import saker.nest.bundle.BundleIdentifier;
4043
import saker.nest.bundle.BundleKey;
4144
import saker.nest.bundle.storage.StorageViewKey;
@@ -63,6 +66,9 @@ public BundleClassPathWorkerTaskFactory(Set<BundleKey> bundles) {
6366

6467
@Override
6568
public ClassPathReference run(TaskContext taskcontext) throws Exception {
69+
BuildTrace.classifyTask(BuildTrace.CLASSIFICATION_WORKER);
70+
taskcontext.setStandardOutDisplayIdentifier(BundleClassPathTaskFactory.TASK_NAME);
71+
6672
BundleClassPathEntry[] entries = new BundleClassPathEntry[bundles.size()];
6773
try (ThreadWorkPool workpool = ThreadUtils.newDynamicWorkPool()) {
6874
int i = 0;
@@ -76,13 +82,14 @@ public ClassPathReference run(TaskContext taskcontext) throws Exception {
7682

7783
BundleClassPathEntry entry = new BundleClassPathEntry(bk, bundlecdpropval.getContentDescriptor());
7884

79-
BundleClassPathWorkerTaskFactory.AttachmentIDEConfigurationBundlePathTaskFactory docattachmenttask = new AttachmentIDEConfigurationBundlePathTaskFactory(
80-
bk.getStorageViewKey(), BundlePropertyUtils.documentationAttachmentExecutionProperty(bk));
85+
StorageViewKey storageviewkey = bk.getStorageViewKey();
86+
AttachmentIDEConfigurationBundlePathTaskFactory docattachmenttask = new AttachmentIDEConfigurationBundlePathTaskFactory(
87+
storageviewkey, BundlePropertyUtils.documentationAttachmentExecutionProperty(bk));
8188
taskcontext.startTask(docattachmenttask, docattachmenttask, null);
8289
entry.setDocumentationAttachment(new SimpleStructuredObjectTaskResult(docattachmenttask));
8390

84-
BundleClassPathWorkerTaskFactory.AttachmentIDEConfigurationBundlePathTaskFactory sourceattachmenttask = new AttachmentIDEConfigurationBundlePathTaskFactory(
85-
bk.getStorageViewKey(), BundlePropertyUtils.sourceAttachmentExecutionProperty(bk));
91+
AttachmentIDEConfigurationBundlePathTaskFactory sourceattachmenttask = new AttachmentIDEConfigurationBundlePathTaskFactory(
92+
storageviewkey, BundlePropertyUtils.sourceAttachmentExecutionProperty(bk));
8693
taskcontext.startTask(sourceattachmenttask, sourceattachmenttask, null);
8794
entry.setSourceAttachment(new SimpleStructuredObjectTaskResult(sourceattachmenttask));
8895

@@ -160,6 +167,7 @@ public AttachmentIDEConfigurationBundlePathTaskFactory(StorageViewKey storageVie
160167

161168
@Override
162169
public FileLocation run(TaskContext taskcontext) throws Exception {
170+
BuildTrace.classifyTask(BuildTrace.CLASSIFICATION_META);
163171
if (!taskcontext.getTaskUtilities()
164172
.getReportExecutionDependency(IDEConfigurationRequiredExecutionProperty.INSTANCE)) {
165173
return null;

impl/src/main/saker/java/compiler/impl/compile/FullWorkerJavaCompilerTaskFactory.java

-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package saker.java.compiler.impl.compile;
1717

1818
import java.io.Externalizable;
19+
import java.io.IOException;
1920
import java.util.Collection;
2021
import java.util.Collections;
2122
import java.util.NavigableMap;
@@ -34,6 +35,7 @@
3435
import saker.build.task.dependencies.FileCollectionStrategy;
3536
import saker.build.task.identifier.TaskIdentifier;
3637
import saker.build.thirdparty.saker.util.ObjectUtils;
38+
import saker.build.trace.BuildTrace;
3739
import saker.java.compiler.api.compile.JavaCompilationWorkerTaskIdentifier;
3840
import saker.java.compiler.api.compile.SakerJavaCompilerUtils;
3941
import saker.java.compiler.impl.JavaTaskUtils;
@@ -53,9 +55,16 @@ public FullWorkerJavaCompilerTaskFactory() {
5355

5456
@Override
5557
public InternalJavaCompilerOutput run(TaskContext taskcontext) throws Exception {
58+
return compile(taskcontext);
59+
}
60+
61+
private InternalJavaCompilerOutput compile(TaskContext taskcontext) throws IOException, Exception {
62+
BuildTrace.classifyTask(BuildTrace.CLASSIFICATION_WORKER);
5663
JavaCompilationWorkerTaskIdentifier taskid = (JavaCompilationWorkerTaskIdentifier) taskcontext.getTaskId();
57-
taskcontext.setStandardOutDisplayIdentifier(
58-
SakerJavaCompilerUtils.TASK_NAME_SAKER_JAVA_COMPILE + ":" + taskid.getPassIdentifier());
64+
String stdoutid = SakerJavaCompilerUtils.TASK_NAME_SAKER_JAVA_COMPILE + ":" + taskid.getPassIdentifier();
65+
taskcontext.setStandardOutDisplayIdentifier(stdoutid);
66+
BuildTrace.setDisplayInformation("java:" + taskid.getPassIdentifier(), stdoutid);
67+
5968
if (TestFlag.ENABLED) {
6069
TestFlag.metric().javacCompilingPass(taskid.getPassIdentifier());
6170
}

impl/src/main/saker/java/compiler/impl/compile/IncrementalWorkerJavaCompilerTaskFactory.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import saker.build.thirdparty.saker.util.io.SerialUtils;
4747
import saker.build.thirdparty.saker.util.thread.ThreadUtils;
4848
import saker.build.thirdparty.saker.util.thread.ThreadUtils.ThreadWorkPool;
49+
import saker.build.trace.BuildTrace;
4950
import saker.java.compiler.api.compile.JavaAnnotationProcessor;
5051
import saker.java.compiler.api.compile.JavaCompilationWorkerTaskIdentifier;
5152
import saker.java.compiler.api.compile.JavaCompilerWarningType;
@@ -98,9 +99,11 @@ public InternalJavaCompilerOutput run(TaskContext taskcontext) throws Exception
9899
}
99100

100101
private InternalJavaCompilerOutput compile(TaskContext taskcontext) throws IOException, Exception {
102+
BuildTrace.classifyTask(BuildTrace.CLASSIFICATION_WORKER);
101103
JavaCompilationWorkerTaskIdentifier taskid = (JavaCompilationWorkerTaskIdentifier) taskcontext.getTaskId();
102-
taskcontext.setStandardOutDisplayIdentifier(
103-
SakerJavaCompilerUtils.TASK_NAME_SAKER_JAVA_COMPILE + ":" + taskid.getPassIdentifier());
104+
String stdoutid = SakerJavaCompilerUtils.TASK_NAME_SAKER_JAVA_COMPILE + ":" + taskid.getPassIdentifier();
105+
taskcontext.setStandardOutDisplayIdentifier(stdoutid);
106+
BuildTrace.setDisplayInformation("java:" + taskid.getPassIdentifier(), stdoutid);
104107

105108
if (TestFlag.ENABLED) {
106109
TestFlag.metric().javacCompilingPass(taskid.getPassIdentifier());

impl/src/main/saker/java/compiler/impl/compile/JavaCompilationConfigFailedTaskFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import saker.build.task.TaskContext;
2626
import saker.build.task.TaskFactory;
2727
import saker.build.task.identifier.TaskIdentifier;
28+
import saker.build.trace.BuildTrace;
2829
import saker.java.compiler.api.compile.JavaCompilationConfigurationOutput;
2930

3031
public class JavaCompilationConfigFailedTaskFactory implements TaskFactory<JavaCompilationConfigurationOutput>,
@@ -45,6 +46,7 @@ public JavaCompilationConfigFailedTaskFactory(TaskIdentifier compilationTaskId)
4546

4647
@Override
4748
public JavaCompilationConfigurationOutput run(TaskContext taskcontext) throws Exception {
49+
BuildTrace.classifyTask(BuildTrace.CLASSIFICATION_META);
4850
//just get the result. it should throw a task execution failure exception right away
4951
taskcontext.getTaskResult(compilationTaskId);
5052
//the following assertion shouldn't be reachable, as the task result retrieval must throw

impl/src/main/saker/java/compiler/impl/compile/JavaCompilationConfigLiteralTaskFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import saker.build.task.TaskContext;
2828
import saker.build.task.TaskFactory;
2929
import saker.build.task.utils.dependencies.EqualityTaskOutputChangeDetector;
30+
import saker.build.trace.BuildTrace;
3031
import saker.java.compiler.api.compile.JavaCompilationConfigurationOutput;
3132

3233
public class JavaCompilationConfigLiteralTaskFactory implements TaskFactory<JavaCompilationConfigurationOutput>,
@@ -57,6 +58,7 @@ public Task<? extends JavaCompilationConfigurationOutput> createTask(ExecutionCo
5758

5859
@Override
5960
public JavaCompilationConfigurationOutput run(TaskContext taskcontext) throws Exception {
61+
BuildTrace.classifyTask(BuildTrace.CLASSIFICATION_META);
6062
taskcontext.reportSelfTaskOutputChangeDetector(new EqualityTaskOutputChangeDetector(outputConfiguration));
6163
return outputConfiguration;
6264
}

impl/src/main/saker/java/compiler/impl/compile/JavaIDEConfigurationReportingTaskFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import saker.build.thirdparty.saker.util.ImmutableUtils;
4040
import saker.build.thirdparty.saker.util.ObjectUtils;
4141
import saker.build.thirdparty.saker.util.io.SerialUtils;
42+
import saker.build.trace.BuildTrace;
4243
import saker.build.util.property.IDEConfigurationRequiredExecutionProperty;
4344
import saker.java.compiler.api.classpath.JavaSourceDirectory;
4445
import saker.java.compiler.api.option.JavaAddExports;
@@ -121,6 +122,7 @@ public void setModulePathEntries(Collection<? extends ModulePathIDEConfiguration
121122

122123
@Override
123124
public Void run(TaskContext taskcontext) throws Exception {
125+
BuildTrace.classifyTask(BuildTrace.CLASSIFICATION_META);
124126
if (!taskcontext.getTaskUtilities()
125127
.getReportExecutionDependency(IDEConfigurationRequiredExecutionProperty.INSTANCE)) {
126128
return null;

0 commit comments

Comments
 (0)
0