Skip to content

Commit e0d2db0

Browse files
committed
PLUGINAPI-162 New API to store the analysis context
1 parent 1da2c85 commit e0d2db0

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 13.4
4+
* Add `org.sonar.api.a3s.A3SContextCollector` (internal SonarSource usage)
5+
36
## 13.3
47
* Introduce support for feature availability checks:
58
* Introduce `org.sonar.api.batch.sensor.SensorContext.isFeatureAvailable`.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Sonar Plugin API
3+
* Copyright (C) 2009-2025 SonarSource SA
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
package org.sonar.api.a3s;
21+
22+
import java.nio.file.Path;
23+
import java.util.Collection;
24+
import org.sonar.api.Beta;
25+
import org.sonar.api.scanner.ScannerSide;
26+
27+
/**
28+
* Reserved for SonarSource internal usage.
29+
* @since 13.4
30+
*/
31+
@Beta
32+
@ScannerSide
33+
public interface A3SContextCollector {
34+
35+
/**
36+
* Check if the A3S context collector is enabled.
37+
*/
38+
boolean isEnabled();
39+
40+
/**
41+
* Collect a context for the current analysis. If called multiple times with the same kind, the behavior is unspecified.
42+
*
43+
* @param kind a unique identifier in case there are multiple contexts for the same project. Can be used to retrieve this specific context later.
44+
* @param metadata opaque metadata (for example in JSON format) describing the project
45+
* @param items attachments to the context, for more efficient storage. Currently only file items are supported.
46+
*/
47+
void collect(String kind, String metadata, Collection<Item> items);
48+
49+
Item newFileItem(String id, Path path);
50+
51+
interface Item {
52+
53+
String id();
54+
55+
}
56+
57+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Sonar Plugin API
3+
* Copyright (C) 2009-2025 SonarSource SA
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
@javax.annotation.ParametersAreNonnullByDefault
21+
package org.sonar.api.a3s;

0 commit comments

Comments
 (0)