8000 Use saker.sdk.support for SDK pinning, additional build trace infos · sakerbuild/saker.java.compiler@ed6e074 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed6e074

Browse files
committed
Use saker.sdk.support for SDK pinning, additional build trace infos
1 parent e4edcb4 commit ed6e074

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

api/resources/META-INF/nest/dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ saker.java.compiler-impl
44
saker.standard-api
55
classpath: [0)
66
saker.sdk.support-api
7-
classpath: [0.8.2)
7+
classpath: [0.8.3)

api/src/main/saker/java/compiler/api/compile/SakerJavaCompilerUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ public final class SakerJavaCompilerUtils {
7676
* @see SDKReference#getPath(String)
7777
*/
7878
public static final String JAVASDK_PATH_INSTALL_LOCATION = "install.location";
79+
/**
80+
* Java SDK path identifier for the install location.
81+
* <p>
82+
* Points to the install directory. E.g. <code>c:\Program Files\Java\jdk1.8.0_221</code>
83+
* <p>
84+
* Same as {@link #JAVASDK_PATH_INSTALL_LOCATION}.
85+
*
86+
* @since saker.java.compiler 0.8.7
87+
*/
88+
public static final String JAVASDK_PATH_HOME = "home";
7989
/**
8090
* Java SDK path identifier for the <code>java</code> executable.
8191
* <p>

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.IOException;
2020
imp 8000 ort java.io.ObjectInput;
2121
import java.io.ObjectOutput;
22+
import java.util.LinkedHashMap;
23+
import java.util.Map;
2224
import java.util.Set;
2325

2426
import saker.build.runtime.execution.ExecutionContext;
@@ -31,14 +33,14 @@
3133
import saker.build.task.utils.SimpleStructuredObjectTaskResult;
3234
import saker.build.task.utils.dependencies.EqualityTaskOutputChangeDetector;
3335
import saker.build.thirdparty.saker.util.ImmutableUtils;
36+
import saker.build.thirdparty.saker.util.ObjectUtils;
3437
import saker.build.thirdparty.saker.util.io.SerialUtils;
3538
import saker.build.thirdparty.saker.util.thread.ThreadUtils;
3639
import saker.build.thirdparty.saker.util.thread.ThreadUtils.ThreadWorkPool;
3740
import saker.build.trace.BuildTrace;
3841
import saker.build.util.property.IDEConfigurationRequiredExecutionProperty;
3942
import saker.java.compiler.api.classpath.ClassPathReference;
4043
import saker.java.compiler.main.classpath.bundle.BundleClassPathTaskFactory;
41-
import saker.java.compiler.main.processor.BundleProcessorTaskFactory;
4244
import saker.nest.bundle.BundleIdentifier;
4345
import saker.nest.bundle.BundleKey;
4446
import saker.nest.bundle.storage.StorageViewKey;
@@ -68,6 +70,14 @@ public BundleClassPathWorkerTaskFactory(Set<BundleKey> bundles) {
6870
public ClassPathReference run(TaskContext taskcontext) throws Exception {
6971
if (saker.build.meta.Versions.VERSION_FULL_COMPOUND >= 8_006) {
7072
BuildTrace.classifyTask(BuildTrace.CLASSIFICATION_WORKER);
73+
if (saker.build.meta.Versions.VERSION_FULL_COMPOUND >= 8_009) {
74+
Map<String, Object> valmap = new LinkedHashMap<>();
75+
if (!ObjectUtils.isNullOrEmpty(bundles)) {
76+
valmap.put("Bundles",
77+
bundles.stream().map(BundleKey::getBundleIdentifier).map(Object::toString).toArray());
78+
}
79+
BuildTrace.setValues(valmap, BuildTrace.VALUE_CATEGORY_TASK);
80+
}
7181
}
7282
taskcontext.setStandardOutDisplayIdentifier(BundleClassPathTaskFactory.TASK_NAME);
7383

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import java.util.NavigableMap;
2323
import java.util.Objects;
2424
import java.util.Set;
25-
import java.util.TreeMap;
26-
import java.util.Map.Entry;
2725

2826
import saker.build.file.SakerDirectory;
2927
import saker.build.file.SakerFile;
@@ -43,7 +41,6 @@
4341
import saker.java.compiler.impl.JavaTaskUtils;
4442
import saker.java.compiler.impl.compile.handler.full.FullCompilationHandler;
4543
import saker.java.compiler.impl.sdk.JavaSDKReference;
46-
import saker.sdk.support.api.IndeterminateSDKDescription;
4744
import saker.sdk.support.api.SDKDescription;
4845
import saker.sdk.support.api.SDKReference;
4946
import saker.sdk.support.api.SDKSupportUtils;
@@ -109,15 +106,7 @@ private InternalJavaCompilerOutput compile(TaskContext taskcontext) throws IOExc
109106
throw new SDKNotFoundException("No SDK found with name: " + JavaSDKReference.DEFAULT_SDK_NAME);
110107
}
111108

112-
NavigableMap<String, SDKDescription> pinnedsdks = new TreeMap<>(SDKSupportUtils.getSDKNameComparator());
113-
for (Entry<String, SDKReference> entry : sdkrefs.entrySet()) {
114-
String sdkname = entry.getKey();
115-
SDKDescription desc = sdks.get(sdkname);
116-
if (desc instanceof IndeterminateSDKDescription) {
117-
desc = ((IndeterminateSDKDescription) desc).pinSDKDescription(entry.getValue());
118-
}
119-
pinnedsdks.put(sdkname, desc);
120-
}
109+
NavigableMap<String, SDKDescription> pinnedsdks = SDKSupportUtils.pinSDKSelection(sdks, sdkrefs);
121110

122111
String modulename;
123112
try {

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.NavigableMap;
2626
import java.util.Objects;
2727
import java.util.Set;
28-
import java.util.TreeMap;
2928

3029
import javax.annotation.processing.Processor;
3130

@@ -66,7 +65,6 @@
6665
import saker.java.compiler.impl.options.SimpleAnnotationProcessorReferenceOption;
6766
import saker.java.compiler.impl.options.SimpleProcessorConfiguration;
6867
import saker.java.compiler.impl.sdk.JavaSDKReference;
69-
import saker.sdk.support.api.IndeterminateSDKDescription;
7068
import saker.sdk.support.api.SDKDescription;
7169
import saker.sdk.support.api.SDKReference;
7270
import saker.sdk.support.api.SDKSupportUtils;
@@ -142,15 +140,7 @@ private InternalJavaCompilerOutput compile(TaskContext taskcontext) throws IOExc
142140
throw new SDKNotFoundException("No SDK found with name: " + JavaSDKReference.DEFAULT_SDK_NAME);
143141
}
144142

145-
NavigableMap<String, SDKDescription> pinnedsdks = new TreeMap<>(SDKSupportUtils.getSDKNameComparator());
146-
for (Entry<String, SDKReference> entry : sdkrefs.entrySet()) {
147-
String sdkname = entry.getKey();
148-
SDKDescription desc = sdks.get(sdkname);
149-
if (desc instanceof IndeterminateSDKDescription) {
150-
desc = ((IndeterminateSDKDescription) desc).pinSDKDescription(entry.getValue());
151-
}
152-
pinnedsdks.put(sdkname, desc);
153-
}
143+
NavigableMap<String, SDKDescription> pinnedsdks = SDKSupportUtils.pinSDKSelection(sdks, sdkrefs);
154144

155145
String modulename;
156146
try {

main/src/main/saker/java/compiler/main/classpath/bundle/BundleClassPathTaskFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
+ "appropriate source bundles and reports the accordingly.\n"
5858
+ "This task doesn't perform any dependency resolution for the specified bundles.")
5959
@NestParameterInformation(value = "Bundles",
60+
aliases = { "", "Bundle" },
6061
required = true,
6162
type = @NestTypeUsage(value = Collection.class, elementTypes = BundleIdentifier.class),
6263
info = @NestInformation("Specifies the bundles to create the class path for.\n"

0 commit comments

Comments
 (0)
0