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

Updating project #16

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ target/
build/
!**/src/main/**/build/
!**/src/test/**/build/
/Resources/

### VS Code ###
.vscode/
Expand Down
61 changes: 1 addition & 60 deletions src/main/java/se/kth/breaking_changes/Main.java
Original file line number Diff line number Diff line change
@@ -1,67 +1,8 @@
package se.kth.breaking_changes;

import se.kth.japianalysis.BreakingChange;

import java.nio.file.Path;
import java.util.List;
import java.util.Set;

public class Main {

public static void main(String[] args) {

ApiMetadata apiMetadata = new ApiMetadata(Path.of("/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/0abf7148300f40a1da0538ab060552bca4a2f1d8/jasperreports-6.18.1.jar"));
ApiMetadata apiMetadata1 = new ApiMetadata(Path.of("/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/0abf7148300f40a1da0538ab060552bca4a2f1d8/jasperreports-6.19.1.jar"));


JApiCmpAnalyze jApiCmpAnalyze = new JApiCmpAnalyze(
apiMetadata,
apiMetadata1
);


// Set<ApiChange> apiChanges = jApiCmpAnalyze.useJApiCmp();

List<BreakingChange> apiChanges = jApiCmpAnalyze.useJApiCmp_v2();



System.out.println("Number of changes: " + apiChanges.size());

// for (ApiChange apiChange : apiChanges) {
// System.out.println(apiChange);
// }


// List<BreakingUpdateMetadata> list =
// getBreakingCommit(Path.of("/Users/frank/Documents/Work/PHD/chains-project/paper/bump/data/benchmark"));
//
//
// for (BreakingUpdateMetadata breakingUpdate : list) {
// boolean result = ApiMetadata.download(breakingUpdate.updatedDependency().dependencyGroupID(),
// breakingUpdate.updatedDependency().dependencyArtifactID(),
// breakingUpdate.updatedDependency().newVersion());
//
// if (result) {
// System.out.println("Downloaded " + breakingUpdate.updatedDependency().dependencyArtifactID() + "-" + breakingUpdate.updatedDependency().newVersion());
// } else {
// System.out.println("Failed to download " + breakingUpdate.updatedDependency().dependencyArtifactID() + "-" + breakingUpdate.updatedDependency().newVersion());
// }
//
// result = ApiMetadata.download(breakingUpdate.updatedDependency().dependencyGroupID(),
// breakingUpdate.updatedDependency().dependencyArtifactID(),
// breakingUpdate.updatedDependency().previousVersion());
//
// if (result) {
// System.out.println("Downloaded " + breakingUpdate.updatedDependency().dependencyArtifactID() + "-" + breakingUpdate.updatedDependency().newVersion());
// } else {
// System.out.println("Failed to download " + breakingUpdate.updatedDependency().dependencyArtifactID() + "-" + breakingUpdate.updatedDependency().newVersion());
// }

// }


System.out.println("Hello World");
}


}
51 changes: 1 addition & 50 deletions src/main/java/se/kth/core/Main.java
Original file line number Diff line number Diff line change
@@ -1,58 +1,9 @@
package se.kth.core;

import se.kth.breaking_changes.ApiChange;
import se.kth.breaking_changes.ApiMetadata;
import se.kth.breaking_changes.JApiCmpAnalyze;
import se.kth.explaining.CompilationErrorTemplate;
import se.kth.explaining.ExplanationTemplate;
import se.kth.log_Analyzer.MavenErrorLog;
import se.kth.log_Analyzer.MavenLogAnalyzer;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Set;

public class Main {


public static void main(String[] args) {

Path oldDependency = Path.of("/Users/frank/Downloads/Test_Failures/log4j-api-2.16.0.jar");
Path newDependency = Path.of("/Users/frank/Downloads/Test_Failures/log4j-api-2.18.0.jar");

ApiMetadata apiMetadata = new ApiMetadata(oldDependency);
ApiMetadata apiMetadata1 = new ApiMetadata(newDependency);

JApiCmpAnalyze jApiCmpAnalyze = new JApiCmpAnalyze(
apiMetadata,
apiMetadata1
);

Set<ApiChange> apiChanges = jApiCmpAnalyze.useJApiCmp();
try {
MavenErrorLog errorLog = new MavenLogAnalyzer(new File("/Users/frank/Downloads/Test_Failures/webapp/1eb6d9d5b2a07720a0839457cee81e066dd932f2.log")).analyzeCompilationErrors();

ApiMetadata newApiVersion = new ApiMetadata(newDependency.toFile().getName(), newDependency);
ApiMetadata oldApiVersion = new ApiMetadata(oldDependency.toFile().getName(), oldDependency);

CombineResults combineResults = new CombineResults(apiChanges, newApiVersion, oldApiVersion, errorLog,null);

combineResults.setDependencyGroupID("org.apache.logging.log4j");

combineResults.setProject("/Users/frank/Downloads/Test_Failures");

Changes changes = combineResults.analyze();
changes.changes().forEach(change -> {
// ExplanationTemplate explanationTemplate = new CompilationErrorTemplate(changes, "change");
// explanationTemplate.generateTemplate();
}
);


} catch (IOException e) {
throw new RuntimeException(e);
}

System.out.println("Hello World");
}
}
11 changes: 1 addition & 10 deletions src/main/java/se/kth/java_version/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,7 @@
public class Main {

public static void main(String[] args) throws IOException {

String projectPath = "/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/11be71ab8713fe987785e9e25e4f3e410e709ab9/camunda-platform-7-mockito";
String logFile = "/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/bad55510363bde900a60f13ecc744e0c244397d4/micronaut-openapi-codegen/bad55510363bde900a60f13ecc744e0c244397d4.log";
Changes_V2 changes = new Changes_V2(
new ApiMetadata("1.0.0", Path.of("path/to/old/Oldapi.jar")),
new ApiMetadata("1.0.1", Path.of("path/to/new/Newapi.jar")
));
generateVersionExplanation(changes, projectPath, logFile);


System.out.println("Hello World");
}


Expand Down
21 changes: 1 addition & 20 deletions src/main/java/se/kth/log_Analyzer/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,6 @@

public class Main {
public static void main(String[] args) {

MavenLogAnalyzer mavenLog = new MavenLogAnalyzer(new File("/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/10d7545c5771b03dd9f6122bd5973a759eb2cd03/lithium/10d7545c5771b03dd9f6122bd5973a759eb2cd03.log"));

try {
MavenErrorLog mavenErrorLog = mavenLog.analyzeCompilationErrors();

mavenErrorLog.getErrorInfo().forEach((k, v) -> {
v.forEach(errorInfo -> {
System.out.println("Line: " + errorInfo.getClientLinePosition());
System.out.println("Error: " + errorInfo.getErrorMessage());
System.out.println(errorInfo.getAdditionalInfo());
System.out.println("***");
});
});

} catch (IOException e) {
throw new RuntimeException(e);
}


System.out.println("Hello World");
}
}
36 changes: 1 addition & 35 deletions src/main/java/se/kth/spoon_compare/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,7 @@ public class Main {


public static void main(String[] args) {

MavenLogAnalyzer mavenLog = new MavenLogAnalyzer(new File("/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/5cf5a482bd430d81257b4ecd85b3d4f7da911621/jakartaee-mvc-sample/5cf5a482bd430d81257b4ecd85b3d4f7da911621.log"));


try {

ApiMetadata apiMetadata = new ApiMetadata(Path.of("/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/5cf5a482bd430d81257b4ecd85b3d4f7da911621/jakarta.mvc-api-1.1.0.jar"));
ApiMetadata apiMetadata1 = new ApiMetadata(Path.of("/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/5cf5a482bd430d81257b4ecd85b3d4f7da911621/jakarta.mvc-api-2.0.1.jar"));

JApiCmpAnalyze jApiCmpAnalyze = new JApiCmpAnalyze(
apiMetadata,
apiMetadata1
);


Set<ApiChange> apiChanges = jApiCmpAnalyze.useJApiCmp();


MavenErrorLog log = mavenLog.analyzeCompilationErrors();
String project = "/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/5cf5a482bd430d81257b4ecd85b3d4f7da911621";

log.getErrorInfo().forEach((k, v) -> {
System.out.println(k);
// v.forEach(System.out::println);
SpoonAnalyzer spoonAnalyzer = new SpoonAnalyzer(v, apiChanges,null);
List<SpoonResults> results = spoonAnalyzer.applySpoon(project + k);

System.out.println("Amount of instructions: " + results.size());
});


} catch (IOException e) {
throw new RuntimeException(e);
}

System.out.println("Hello World");
}

}
24 changes: 1 addition & 23 deletions src/main/java/se/kth/transitive_changes/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,7 @@ public class Main {


public static void main(String[] args) {

ApiMetadata apiMetadata = new ApiMetadata(Path.of("/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/0a11c04038eae517540051dbf51f7f26b7221f20/snakeyaml-1.24.jar"));
ApiMetadata apiMetadata2 = new ApiMetadata(Path.of("/Users/frank/Documents/Work/PHD/Explaining/breaking-good/projects/0a11c04038eae517540051dbf51f7f26b7221f20/snakeyaml-2.0.jar"));

Set<Dependency> v1 = MavenTree.read(apiMetadata);
Set<Dependency> v2 = MavenTree.read(apiMetadata2);

Set<PairTransitiveDependency> transitiveDependencies = MavenTree.diff(v1, v2);

for (PairTransitiveDependency pair : transitiveDependencies) {
try {
System.out.println("Comparing " + pair.newVersion() + " and " + pair.oldVersion());
CompareTransitiveDependency compareTransitiveDependency = new CompareTransitiveDependency(pair.newVersion(), pair.oldVersion());
compareTransitiveDependency.compareDependency();
System.out.println("Breaking changes for " + pair.newVersion() + " and " + pair.oldVersion());
System.out.println("Breaking Changes amount: " + compareTransitiveDependency.getBreakingChanges().size());

JsonUtils.writeToFile(Path.of("breaking-changes-%s.json".formatted(pair.oldVersion().getArtifactId())),compareTransitiveDependency);

} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println("Hello World");
}


Expand Down
Loading