Skip to content
Snippets Groups Projects
Commit 4dc6033c authored by michaelyoukeim's avatar michaelyoukeim
Browse files

Now using java8 for older builds

parent 6f92465e
No related branches found
No related tags found
No related merge requests found
Showing
with 20703 additions and 20671 deletions
File added
File added
......@@ -8,6 +8,29 @@ import json
from java_version_manager import switch_java_version
def create_maven_settings(repo_path):
"""Create or modify Maven settings to enforce HTTPS."""
settings_path = os.path.join(repo_path, "settings.xml")
settings_content = f"""
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>central-https</id>
<mirrorOf>central</mirrorOf>
<name>Maven Central mirror over HTTPS</name>
<url>https://repo.maven.apache.org/maven2</url>
</mirror>
</mirrors>
</settings>
"""
with open(settings_path, "w") as file:
file.write(settings_content)
return settings_path
def parse_pom_xml(file_path):
tree = ET.parse(file_path)
root = tree.getroot()
......@@ -69,7 +92,8 @@ def version_is_compatible(required_version_range, installed_version):
try:
normalized_installed_version = normalize_version(installed_version)
if "," in required_version_range:
lower_bound = required_version_range.strip("[]()").split(",")[0].strip()
lower_bound = required_version_range.strip("[]()").split(",")[
0].strip()
if version.parse(normalized_installed_version) >= version.parse(
lower_bound
):
......@@ -110,11 +134,13 @@ def process_commit_hashes(commit_hashes, repo_path, output_dir):
for hash in commit_hashes:
hash = hash.strip()
try:
subprocess.run(["git", "reset", "--hard"], cwd=repo_path, check=True)
subprocess.run(["git", "reset", "--hard"],
cwd=repo_path, check=True)
subprocess.run(["git", "clean", "-fdx"], cwd=repo_path, check=True)
# Checkout the specified hash
subprocess.run(["git", "checkout", hash], cwd=repo_path, check=True)
subprocess.run(["git", "checkout", hash],
cwd=repo_path, check=True)
print(f"Checked out {hash}")
# Get repo requirements
......@@ -162,16 +188,21 @@ def process_commit_hashes(commit_hashes, repo_path, output_dir):
)
print("=" * 10)
is_version_compatible = version_is_compatible(java_required, java_installed)
is_version_compatible = version_is_compatible(
java_required, java_installed)
java_versions[hash]["compatible"] = is_version_compatible
is_version_compatible = True # Temporarily skipping checking compatible versions
# Proceed if versions are compatible
if (
is_version_compatible
): # and version_is_compatible(maven_required, maven_installed):
# Run Maven to build the project
settings_path = create_maven_settings(repo_path)
subprocess.run(
f"cd {repo_path} && mvn clean package --projects :hadoop-common --also-make -DskipTests",
f"cd {repo_path} && mvn --settings {settings_path} clean package -Dhttps.protocols=TLSv1.2 --projects :hadoop-common --also-make -DskipTests \
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true",
shell=True,
check=True,
)
......
......@@ -20,15 +20,15 @@ def switch_java_version(java_version):
java_version (str): The name of the Java version to switch to, as listed by 'update-java-alternatives --list'.
"""
version_map = {
"1.6": "jdk1.6.0_45",
"1.7": "java-se-7u75-ri",
"1.6": "temurin-8-jdk-amd64",
"1.7": "temurin-8-jdk-amd64",
"1.8": "temurin-8-jdk-amd64",
"11": "temurin-11-jdk-amd64",
"21": "temurin-21-jdk-amd64"
}
maven_map = {
"1.6": "/opt/maven/apache-maven-3.0.5",
"1.6": "/opt/maven/apache-maven-3.6.3",
"1.7": "/opt/maven/apache-maven-3.6.3",
"1.8": "/opt/maven/apache-maven-3.6.3",
"11": "/opt/maven/apache-maven-3.6.3",
......
......@@ -10,7 +10,7 @@ from visualization import create_charts
from java_version_manager import switch_java_version
from dependency_analyzer import analyze_dependencies, get_rsf_file_paths
from clustering import run_pkg, run_acdc, run_clusterer
from clustering import RepoClusterer
from clustering_result_analyzer import analyze_clustering_results
# Define default paths for input and output directories
......@@ -57,9 +57,10 @@ def main():
analyze_dependencies(output_dir)
# Clustering
run_pkg(output_dir)
run_acdc(output_dir)
run_clusterer(output_dir)
clusterer = RepoClusterer(output_dir)
clusterer.run_pkg()
clusterer.run_acdc()
clusterer.run_clusterer()
# Analyzing the clustering results
analyze_clustering_results(output_dir)
......
......@@ -40,7 +40,7 @@ def perform_statistical_analysis(commit_info_file_path, output_dir):
for decision_type in decision_types:
for attribute in attributes:
decision_df = df[df[f"is{decision_type}Decision"]]
output_file = os.path.join(output_dir, f"{decision_type.lower()}_decision_{attribute}_vs_a2a.pdf")
output_file = os.path.join(output_dir, '_statistical_analysis', f"{decision_type.lower()}_decision_{attribute}_vs_a2a.pdf")
plot_scatterplot_and_correlation(
decision_df,
attribute,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment