diff --git a/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/APIDiff.java b/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/APIDiff.java index 1affbd7c4ac9ab31d1e97a12f58a33811c467a17..b41cea00d6c376f5bd7b7b10aed2e7848b7292a5 100644 --- a/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/APIDiff.java +++ b/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/APIDiff.java @@ -1,6 +1,20 @@ /* - * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license - * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + * Autopsy Forensic Browser + * + * Copyright 2023 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.apiupdate; @@ -26,6 +40,7 @@ import java.io.FileFilter; import java.io.IOException; import java.text.MessageFormat; +import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -126,6 +141,8 @@ static ComparisonRecord getComparison(String prevVersion, String curVersion, Fil PublicApiChangeType changeType = getChangeType(jApiClasses); Options options = Options.newDefault(); + options.setOldArchives(Arrays.asList(new JApiCmpArchive(prevJar, prevVersion))); + options.setNewArchives(Arrays.asList(new JApiCmpArchive(curJar, curVersion))); options.setOutputOnlyModifications(true); StdoutOutputGenerator stdoutOutputGenerator = new StdoutOutputGenerator(options, jApiClasses); diff --git a/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/Main.java b/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/Main.java index d62162257348700a4b8ff9745d49ae12acda8a9c..39cd4262832681559eea107f72467ee09fef5ff3 100644 --- a/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/Main.java +++ b/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/Main.java @@ -38,7 +38,7 @@ public class Main { private static final Logger LOGGER = Logger.getLogger(Main.class.getName()); public static void main(String[] args) { - args = "-c C:\\Users\\gregd\\Desktop\\apidiff\\new -p C:\\Users\\gregd\\Desktop\\apidiff\\old -cv 4.21.0 -pv 4.20.0 -s C:\\Users\\gregd\\Documents\\Source\\autopsy".split(" "); + args = "-p C:\\Users\\gregd\\Desktop\\apidiff\\old -s C:\\Users\\gregd\\Documents\\Source\\autopsy".split(" "); CLIArgs cliArgs; try { cliArgs = CLIProcessor.parseCli(args); @@ -68,7 +68,7 @@ public static void main(String[] args) { outputDiff(commonJarFileName, record, prevVersionNums, projectedVersionNums); - newVersionNumMapping.put(commonJarFileName, projectedVersionNums); + newVersionNumMapping.put(projectedVersionNums.getRelease().getModuleName(), projectedVersionNums); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } diff --git a/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/ModuleUpdates.java b/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/ModuleUpdates.java index 7b8fd3f276e73758d7a36dbebf6b232ff56cfeb2..08c0c904af1e67c2b3a4801e2030dbb565d2d43a 100644 --- a/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/ModuleUpdates.java +++ b/release_scripts/APIUpdate/src/main/java/org/sleuthkit/autopsy/apiupdate/ModuleUpdates.java @@ -25,8 +25,10 @@ import java.nio.file.Files; import java.text.MessageFormat; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.jar.Attributes; import java.util.logging.Level; import java.util.logging.Logger; @@ -61,10 +63,6 @@ public class ModuleUpdates { private static final Logger LOGGER = Logger.getLogger(ModuleUpdates.class.getName()); - static { - LOGGER.addHandler(new StreamHandler(System.out, new SimpleFormatter())); - } - private static final Pattern SPEC_REGEX = Pattern.compile("^\\s*((?<major>\\d*)\\.)?(?<minor>\\d*)(\\.(?<patch>\\d*))?\\s*$"); private static final Pattern PROJECT_PROPS_SPEC_REGEX = Pattern.compile("^\\s*spec\\.version\\.base\\s*=.*$", Pattern.MULTILINE); @@ -236,6 +234,14 @@ static void setVersions(File srcDir, Map<String, ModuleVersionNumbers> versNums) return; } + Set<String> notFoundModules = new HashSet<>(versNums.keySet()); + notFoundModules.removeAll(moduleDirs.keySet()); + if (!notFoundModules.isEmpty()) { + LOGGER.log(Level.SEVERE, MessageFormat.format("The following modules were not found in {0}: {1}. Aborting...", srcDir, notFoundModules)); + return; + } + + for (Entry<String, File> moduleNameDir : moduleDirs.entrySet()) { String moduleName = moduleNameDir.getKey(); File moduleDir = moduleNameDir.getValue();