Skip to content

Commit

Permalink
Introspection for task properties is only available from Gradle 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sdedic committed Nov 14, 2023
1 parent eb760ff commit 1061236
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public ValueAndType(Class type) {

public NbProjectInfo buildAll() {
adapter.setModel(model);

runAndRegisterPerf(model, "meta", this::detectProjectMetadata);
detectProps(model);
detectLicense(model);
Expand All @@ -239,15 +240,13 @@ public NbProjectInfo buildAll() {
// introspection is only allowed for gradle 7.4 and above.
// TODO: investigate if some of the instrospection could be done for earlier Gradles.
sinceGradle("7.0", () -> {
initIntrospection();

runAndRegisterPerf(model, "detectExtensions", this::detectExtensions);
});
sinceGradle("7.0", () -> {
runAndRegisterPerf(model, "detectPlugins2", this::detectAdditionalPlugins);
});
sinceGradle("7.0", () -> {
runAndRegisterPerf(model, "taskDependencies", this::detectTaskDependencies);
runAndRegisterPerf(model, "taskProperties", this::detectTaskProperties);
});
runAndRegisterPerf(model, "taskProperties", this::detectTaskProperties);
runAndRegisterPerf(model, "artifacts", this::detectConfigurationArtifacts);
storeGlobalTypes(model);
return model;
Expand Down Expand Up @@ -446,7 +445,7 @@ private void storeGlobalTypes(NbProjectInfoModel model) {
model.getInfo().put("extensions.globalTypes", globalTypes); // NOI18N
}

private void detectExtensions(NbProjectInfoModel model) {
private void initIntrospection() {
StringBuilder sb = new StringBuilder();
for (String s : IGNORED_SYSTEM_CLASSES_REGEXP) {
if (sb.length() > 0) {
Expand All @@ -455,7 +454,9 @@ private void detectExtensions(NbProjectInfoModel model) {
sb.append(s);
}
ignoreClassesPattern = Pattern.compile(sb.toString());

}

private void detectExtensions(NbProjectInfoModel model) {
inspectExtensions("", project.getExtensions());
model.getInfo().put("extensions.propertyTypes", propertyTypes); // NOI18N
model.getInfo().put("extensions.propertyValues", values); // NOI18N
Expand Down

0 comments on commit 1061236

Please sign in to comment.