Skip to content
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

Add new IDE Debugging tag (solves #311) #312

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/com/gradle/CustomBuildScanEnhancements.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ final class CustomBuildScanEnhancements {
private static final String PROJECT_PROP_ANDROID_STUDIO_VERSION = "android.studio.version";
private static final String SYSTEM_PROP_ECLIPSE_BUILD_ID = "eclipse.buildId";
private static final String SYSTEM_PROP_IDEA_SYNC_ACTIVE = "idea.sync.active";
private static final String SYSTEM_PROP_IDEA_DEBUGGER_PORT = "idea.debugger.dispatch.port";

private final DevelocityAdapter develocity;
private final BuildScanAdapter buildScan;
Expand Down Expand Up @@ -98,6 +99,7 @@ private void captureIde() {
ideProperties.put(PROJECT_PROP_ANDROID_STUDIO_VERSION, firstOrElseSecond(providers, gradlePropertyProvider(PROJECT_PROP_ANDROID_STUDIO_VERSION, gradle, providers), gradlePropertyProvider(PROJECT_PROP_ANDROID_STUDIO_VERSION_LEGACY, gradle, providers)));
ideProperties.put(SYSTEM_PROP_ECLIPSE_BUILD_ID, systemPropertyProvider(SYSTEM_PROP_ECLIPSE_BUILD_ID, providers));
ideProperties.put(SYSTEM_PROP_IDEA_SYNC_ACTIVE, systemPropertyProvider(SYSTEM_PROP_IDEA_SYNC_ACTIVE, providers));
ideProperties.put(SYSTEM_PROP_IDEA_DEBUGGER_PORT, systemPropertyProvider(SYSTEM_PROP_IDEA_DEBUGGER_PORT, providers));

// Process data at execution time to ensure property initialization
buildScan.buildFinished(new CaptureIdeMetadataAction(buildScan, ideProperties));
Expand Down Expand Up @@ -139,6 +141,10 @@ public void execute(BuildResultAdapter buildResult) {
if (props.get(SYSTEM_PROP_IDEA_SYNC_ACTIVE).isPresent()) {
buildScan.tag("IDE sync");
}

if (props.get(SYSTEM_PROP_IDEA_DEBUGGER_PORT).isPresent()) {
buildScan.tag("IDE debugging");
}
}

private String getOrEmpty(Provider<String> p) {
Expand Down