Skip to content

Commit 4b7e93b

Browse files
authored
Merge pull request #17 from secure-software-engineering/maintenance
Maintenance
2 parents 902f124 + 64641e4 commit 4b7e93b

File tree

5 files changed

+89
-32
lines changed

5 files changed

+89
-32
lines changed

.github/workflows/maven.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ name: Java CI with Maven
1010

1111
on:
1212
push:
13-
branches: [ develop ]
13+
branches: [ main ]
1414
pull_request:
15-
branches: [ develop ]
15+
branches: [ main ]
1616

1717
jobs:
1818
build:
@@ -36,7 +36,13 @@ jobs:
3636
"id": "github-anddann",
3737
"username": "${{ secrets.ACTOR }}",
3838
"password": "${{ secrets.DEPLOY_GITHUB_TOKEN }}"
39-
}]
39+
},
40+
{
41+
"id": "github",
42+
"username": "${{ secrets.ACTOR }}",
43+
"password": "${{ secrets.DEPLOY_GITHUB_TOKEN }}"
44+
}
45+
]
4046
- name: Build with Maven
4147
run: mvn -B package --file pom.xml
4248
# Shared REPO requies different token <!-- https://dev.to/jakub_zalas/how-to-publish-maven-packages-to-a-single-github-repository-3lkc -->

pom.xml

Lines changed: 68 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@
1414
<enforced-maven-version>3.6.1</enforced-maven-version>
1515
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1616
<spotbugs-maven-plugin.version>4.0.0</spotbugs-maven-plugin.version>
17-
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
18-
<maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
19-
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
20-
<maven-source-plugin.version>3.2.0</maven-source-plugin.version>
21-
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
22-
<fmt-maven-plugin.version>2.9</fmt-maven-plugin.version>
23-
<maven-scm-plugin.version>1.11.2</maven-scm-plugin.version>
24-
<maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version>
17+
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
18+
<maven-surefire-plugin.version>3.5.1</maven-surefire-plugin.version>
19+
<maven-javadoc-plugin.version>3.10.1</maven-javadoc-plugin.version>
20+
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
21+
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
22+
<spotless.version>2.43.0</spotless.version>
23+
<maven-scm-plugin.version>2.1.0</maven-scm-plugin.version>
24+
<maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
2525
<skipFormatPlugin>true</skipFormatPlugin>
26-
<versions-maven-plugin.version>2.7</versions-maven-plugin.version>
26+
<versions-maven-plugin.version>2.17</versions-maven-plugin.version>
2727
<!-- dependency versions -->
28-
<slf4j.version>1.7.30</slf4j.version>
28+
<slf4j.version>2.0.16</slf4j.version>
2929
<junit.version>4.13</junit.version>
30+
<maven-release-plugin.version>3.0.0-M6</maven-release-plugin.version>
31+
<lombok.version>1.18.34</lombok.version>
3032
</properties>
3133

3234

@@ -60,7 +62,7 @@
6062
<plugin>
6163
<groupId>org.apache.maven.plugins</groupId>
6264
<artifactId>maven-release-plugin</artifactId>
63-
<version>3.0.0-M6</version>
65+
<version>${maven-release-plugin.version}</version>
6466
<configuration>
6567
<checkModificationExcludes>
6668
<checkModificationExclude>pom.xml</checkModificationExclude>
@@ -93,9 +95,18 @@
9395
<artifactId>maven-compiler-plugin</artifactId>
9496
<version>${maven-compiler-plugin.version}</version>
9597
<configuration>
96-
<source>1.8</source>
97-
<target>1.8</target>
98+
<source>11</source>
99+
<target>11</target>
100+
<release>11</release>
101+
<annotationProcessorPaths>
102+
<path>
103+
<groupId>org.projectlombok</groupId>
104+
<artifactId>lombok</artifactId>
105+
<version>${lombok.version}</version>
106+
</path>
107+
</annotationProcessorPaths>
98108
</configuration>
109+
99110
</plugin>
100111
<plugin>
101112
<groupId>org.apache.maven.plugins</groupId>
@@ -137,17 +148,49 @@
137148
</executions>
138149
</plugin>
139150
<plugin>
140-
<groupId>com.coveo</groupId>
141-
<artifactId>fmt-maven-plugin</artifactId>
142-
<version>${fmt-maven-plugin.version}</version>
143-
<executions>
144-
<execution>
145-
<id>format</id>
146-
<goals>
147-
<goal>format</goal>
148-
</goals>
149-
</execution>
150-
</executions>
151+
<groupId>com.diffplug.spotless</groupId>
152+
<artifactId>spotless-maven-plugin</artifactId>
153+
<version>${spotless.version}</version>
154+
<configuration>
155+
<!-- optional: limit format enforcement to just the files changed by this feature branch -->
156+
<ratchetFrom>origin/main</ratchetFrom>
157+
<formats>
158+
<!-- you can define as many formats as you want, each is independent -->
159+
<format>
160+
<!-- define the files to apply to -->
161+
<includes>
162+
<include>.gitattributes</include>
163+
<include>.gitignore</include>
164+
</includes>
165+
<!-- define the steps to apply to those files -->
166+
<trimTrailingWhitespace/>
167+
<endWithNewline/>
168+
<indent>
169+
<tabs>true</tabs>
170+
<spacesPerTab>4</spacesPerTab>
171+
</indent>
172+
</format>
173+
</formats>
174+
<!-- define a language-specific format -->
175+
<java>
176+
<!-- no need to specify files, inferred automatically, but you can if you want -->
177+
178+
<!-- apply a specific flavor of google-java-format and reflow long strings -->
179+
<googleJavaFormat>
180+
<version>1.8</version>
181+
<style>AOSP</style>
182+
<reflowLongStrings>true</reflowLongStrings>
183+
<formatJavadoc>false</formatJavadoc>
184+
</googleJavaFormat>
185+
186+
<!-- make sure every file has the following copyright header.
187+
optionally, Spotless can set copyright years by digging
188+
through git history (see "license" section below) -->
189+
<licenseHeader>
190+
<content>/* (C)$YEAR */</content> <!-- or <file>${project.basedir}/license-header</file> -->
191+
</licenseHeader>
192+
</java>
193+
</configuration>
151194
</plugin>
152195
<plugin>
153196
<groupId>org.apache.maven.plugins</groupId>
@@ -244,7 +287,7 @@
244287
<dependency>
245288
<groupId>org.projectlombok</groupId>
246289
<artifactId>lombok</artifactId>
247-
<version>1.18.8</version>
290+
<version>${lombok.version}</version>
248291
<scope>provided</scope>
249292
</dependency>
250293
<dependency>

src/main/java/de/upb/upcy/update/build/PipelineRunner.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.slf4j.LoggerFactory;
2424

2525
public class PipelineRunner {
26+
2627
private static final Logger LOGGER = LoggerFactory.getLogger(PipelineRunner.class);
2728
private final String projectName;
2829
private final Path projectPomFile;
@@ -54,7 +55,7 @@ public Map<String, MavenInvokerProject> run() {
5455
if (integerStringStringTriple.getLeft() != 0) {
5556
throw new MavenInvokerProject.BuildToolException(integerStringStringTriple.getRight());
5657
}
57-
LOGGER.info("Successfully build initial with clean compile install");
58+
LOGGER.info("Successfully initial build with clean compile install");
5859

5960
} catch (MavenInvokerProject.BuildToolException e) {
6061
LOGGER.error("Could not build pom file: {}", projectPomFile.toAbsolutePath());
@@ -103,7 +104,7 @@ public Map<String, MavenInvokerProject> run() {
103104

104105
List<Future<org.apache.commons.lang3.tuple.Pair<String, MavenInvokerProject>>> futures;
105106
try {
106-
LOGGER.info("Found #{} projects to build", tasks.size());
107+
LOGGER.info("Found #{} sub-modules to build", tasks.size());
107108
futures = executorService.invokeAll(tasks);
108109
for (Future<org.apache.commons.lang3.tuple.Pair<String, MavenInvokerProject>> future :
109110
futures) {
@@ -117,6 +118,7 @@ public Map<String, MavenInvokerProject> run() {
117118
}
118119

119120
// now invoke the root project pom
121+
LOGGER.info("Build root/main module #{}", projectPomFile.toAbsolutePath().toString());
120122
futures = executorService.invokeAll(rootProjectCallable);
121123
for (Future<org.apache.commons.lang3.tuple.Pair<String, MavenInvokerProject>> future :
122124
futures) {

src/main/java/de/upb/upcy/update/recommendation/RecommendationAlgorithm.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static boolean isRelevantCompileDependency(GraphModel.Artifact artifact)
101101
}
102102

103103
public Pair<DefaultDirectedGraph<GraphModel.Artifact, GraphModel.Dependency>, GraphModel>
104-
getDepGraph(Path jsonDepGraph) throws IOException {
104+
getDepGraph(Path jsonDepGraph) throws IOException {
105105
pairGraph = GraphParser.parseGraph(jsonDepGraph);
106106
return pairGraph;
107107
}
@@ -195,6 +195,11 @@ public List<UpdateSuggestion> run(String gavOfLibraryToUpdate, String targetGav)
195195
new IllegalStateException(
196196
"Cannot find library to update with gav: " + gavOfLibraryToUpdate));
197197

198+
if (isRelevantCompileDependency(libToUpdateInDepGraph)) {
199+
LOGGER.error("Only compile dependencies are currently supported");
200+
return Collections.emptyList();
201+
}
202+
198203
if (shrinkedCG == null || shrinkedCG.vertexSet().isEmpty() || shrinkedCG.edgeSet().isEmpty()) {
199204
LOGGER.error("Empty shrinked CG");
200205
}
@@ -214,7 +219,7 @@ public List<UpdateSuggestion> run(String gavOfLibraryToUpdate, String targetGav)
214219
// get the weight -- if weight 0-- we are done
215220
if (simpleUpdateSuggestion.getStatus() == UpdateSuggestion.SuggestionStatus.SUCCESS
216221
&& (simpleUpdateSuggestion.getViolations() == null
217-
|| simpleUpdateSuggestion.getViolations().isEmpty())) {
222+
|| simpleUpdateSuggestion.getViolations().isEmpty())) {
218223
LOGGER.info("Simple Update does not produce any violations, Done");
219224
return Collections.singletonList(simpleUpdateSuggestion);
220225
}

src/main/java/de/upb/upcy/update/recommendation/cypher/SinkRootQuery.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public String generateQuery(Collection<GraphModel.Artifact> boundNodes) {
6969
if (sinkRoots.size() == 1) {
7070

7171
GraphModel.Artifact rootNode = (GraphModel.Artifact) sinkRoots.keySet().toArray()[0];
72+
// if the root node is equal the library to update or both nodes belong to the same framework
7273
if ((rootNode == libToUpdateInDepGraph
7374
|| blossomGraphCreator.isBlossomNode(rootNode, sharedNode))
7475
&& sharedNode == libToUpdateInDepGraph) {

0 commit comments

Comments
 (0)