Skip to content

Commit

Permalink
plugin to the scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pallavit committed Jul 6, 2021
1 parent 9c4eaac commit 6a72bac
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
4 changes: 4 additions & 0 deletions eng/bomgenerator/buildAndRun.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set "versioningClientFileLocation=%~dp0..\versioning\version_client.txt"
set "bomPomFileLocation=%~dp0..\..\sdk\boms\azure-sdk-bom\pom.xml"
set "outputFileLocation=%~dp0..\..\sdk\boms\azure-sdk-bom\newpom.xml"
mvn clean install && mvn exec:java -Dexec.args="-inputFile=%versioningClientFileLocation% -outputFile=%outputFileLocation% -pomFile=%bomPomFileLocation%"
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
import static com.azure.tools.bomgenerator.Utils.AZURE_PERF_LIBRARY_IDENTIFIER;
import static com.azure.tools.bomgenerator.Utils.AZURE_TEST_LIBRARY_IDENTIFIER;
import static com.azure.tools.bomgenerator.Utils.EXCLUSION_LIST;
import static com.azure.tools.bomgenerator.Utils.EXTERNAL_BOM_DEPENDENCIES;
import static com.azure.tools.bomgenerator.Utils.POM_TYPE;
import static com.azure.tools.bomgenerator.Utils.RESOLVED_EXCLUSION_LIST;
import static com.azure.tools.bomgenerator.Utils.SDK_DEPENDENCY_PATTERN;
import static com.azure.tools.bomgenerator.Utils.SDK_NON_GA_PATTERN;

Expand Down Expand Up @@ -126,7 +128,7 @@ private void filterConflicts() {
// We have multiple versions of this coming up, we will let the latest version win.
List<String> versionList = versionToDependency.keySet().stream().sorted(new DependencyVersionComparator()).collect(Collectors.toList());
String latestVersion = versionList.get(versionList.size() - 1);
System.out.printf("Multiple version of the dependency %s included. Picking the latest version for BOM: %s", key, latestVersion);
System.out.printf("Multiple version of the dependency %s included. Picking the latest version for BOM: %s\r\n", key, latestVersion);
bomEligibleDependencies.add(new BomDependency(key.getGroupId(), key.getArtifactId(), latestVersion));
for (int index = 0; index < versionList.size() - 1; index++) {
String version = versionList.get(index);
Expand Down Expand Up @@ -177,7 +179,7 @@ private void writeBom() {
try {
Model model = reader.read(new FileReader(this.pomFileName));
DependencyManagement management = model.getDependencyManagement();
List<Dependency> externalBomDependencies = management.getDependencies().stream().filter(dependency -> dependency.getType() == POM_TYPE).collect(Collectors.toList());
List<Dependency> externalBomDependencies = management.getDependencies().stream().filter(dependency -> dependency.getType().equals(POM_TYPE)).collect(Collectors.toList());

List<Dependency> dependencies = bomEligibleDependencies.stream().map(bomDependency -> {
Dependency dependency = new Dependency();
Expand Down Expand Up @@ -217,6 +219,11 @@ public void resolveTree() {
if (dependency.getScope() == ScopeType.TEST) {
continue;
}
if(/*EXTERNAL_BOM_DEPENDENCIES.contains(dependency.getCoordinate().getGroupId())
|| */RESOLVED_EXCLUSION_LIST.contains(dependency.getCoordinate().getArtifactId())) {
// This is coming from the BOM, we may not include this.
continue;
}

BomDependency childDependency = new BomDependency(dependency.getCoordinate());
addDependencyToDependencyTree(childDependency, parentDependency, nameToVersionToChildrenDependencyTree);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Main {

public static void main(String[] args) {
BomGenerator generator = new BomGenerator();
generator.setGroupId(AZURE_CORE_GROUPID);
parseCommandLine(args, generator);
generator.generate();
}
Expand All @@ -37,15 +38,15 @@ private static void parseCommandLine(String[] args, BomGenerator generator) {
generator.setPomFile(argValue);
break;

case COMMANDLINE_GROUPID:
switch(argValue) {
case AZURE_CORE_GROUPID:
generator.setGroupId(AZURE_CORE_GROUPID);
break;

default:
throw new UnsupportedOperationException();
}
// case COMMANDLINE_GROUPID:
// switch(argValue) {
// case AZURE_CORE_GROUPID:
// generator.setGroupId(AZURE_CORE_GROUPID);
// break;
//
// default:
// throw new UnsupportedOperationException();
// }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ public class Utils {
public static final HashSet<String> EXTERNAL_BOM_DEPENDENCIES = new HashSet<String>(Arrays.asList(
"io.projectreactor",
"com.fasterxml.jackson",
"io.netty"
"io.netty",
"io.projectreactor.netty"
));

public static final HashSet<String> RESOLVED_EXCLUSION_LIST = new HashSet<>(Arrays.asList(
"junit-jupiter-api"
));

public static final String POM_TYPE = "pom";
Expand Down

0 comments on commit 6a72bac

Please sign in to comment.