Skip to content
Snippets Groups Projects
Commit da37197a authored by Greg DiCristofaro's avatar Greg DiCristofaro
Browse files

fixes

parent d8869c68
No related branches found
No related tags found
No related merge requests found
/* /*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Autopsy Forensic Browser
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template *
* 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; package org.sleuthkit.autopsy.apiupdate;
...@@ -26,6 +40,7 @@ ...@@ -26,6 +40,7 @@
import java.io.FileFilter; import java.io.FileFilter;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
...@@ -126,6 +141,8 @@ static ComparisonRecord getComparison(String prevVersion, String curVersion, Fil ...@@ -126,6 +141,8 @@ static ComparisonRecord getComparison(String prevVersion, String curVersion, Fil
PublicApiChangeType changeType = getChangeType(jApiClasses); PublicApiChangeType changeType = getChangeType(jApiClasses);
Options options = Options.newDefault(); Options options = Options.newDefault();
options.setOldArchives(Arrays.asList(new JApiCmpArchive(prevJar, prevVersion)));
options.setNewArchives(Arrays.asList(new JApiCmpArchive(curJar, curVersion)));
options.setOutputOnlyModifications(true); options.setOutputOnlyModifications(true);
StdoutOutputGenerator stdoutOutputGenerator = new StdoutOutputGenerator(options, jApiClasses); StdoutOutputGenerator stdoutOutputGenerator = new StdoutOutputGenerator(options, jApiClasses);
......
...@@ -38,7 +38,7 @@ public class Main { ...@@ -38,7 +38,7 @@ public class Main {
private static final Logger LOGGER = Logger.getLogger(Main.class.getName()); private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
public static void main(String[] args) { 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; CLIArgs cliArgs;
try { try {
cliArgs = CLIProcessor.parseCli(args); cliArgs = CLIProcessor.parseCli(args);
...@@ -68,7 +68,7 @@ public static void main(String[] args) { ...@@ -68,7 +68,7 @@ public static void main(String[] args) {
outputDiff(commonJarFileName, record, prevVersionNums, projectedVersionNums); outputDiff(commonJarFileName, record, prevVersionNums, projectedVersionNums);
newVersionNumMapping.put(commonJarFileName, projectedVersionNums); newVersionNumMapping.put(projectedVersionNums.getRelease().getModuleName(), projectedVersionNums);
} catch (IOException ex) { } catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} }
......
...@@ -25,8 +25,10 @@ ...@@ -25,8 +25,10 @@
import java.nio.file.Files; import java.nio.file.Files;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.jar.Attributes; import java.util.jar.Attributes;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
...@@ -61,10 +63,6 @@ public class ModuleUpdates { ...@@ -61,10 +63,6 @@ public class ModuleUpdates {
private static final Logger LOGGER = Logger.getLogger(ModuleUpdates.class.getName()); 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 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); 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) ...@@ -236,6 +234,14 @@ static void setVersions(File srcDir, Map<String, ModuleVersionNumbers> versNums)
return; 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()) { for (Entry<String, File> moduleNameDir : moduleDirs.entrySet()) {
String moduleName = moduleNameDir.getKey(); String moduleName = moduleNameDir.getKey();
File moduleDir = moduleNameDir.getValue(); File moduleDir = moduleNameDir.getValue();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment