Skip to content

Commit

Permalink
Update visibility of logging methods
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrigos committed Feb 16, 2022
1 parent 6463484 commit b54e088
Showing 1 changed file with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,16 @@ public static void syncReportsMetadata(BenchmarkOverviewReport report, Benchmark
}

if (benchmarkReport.getCategory().equals("CUSTOM")) {
int index = benchmarkReport.getName().lastIndexOf(".");
if (index > 0) {
benchmarkReport.setCategory(benchmarkReport.getName().substring(0, index));
int classIndex = benchmarkReport.getName().lastIndexOf(".");
if (classIndex > 0) {
String pckgAndClass = benchmarkReport.getName().substring(0, classIndex);
int pckgIndex = pckgAndClass.lastIndexOf(".");
if (pckgIndex > 0) {
String pckg = pckgAndClass.substring(0, pckgIndex);
benchmarkReport.setCategory(pckg);
} else {
benchmarkReport.setCategory(pckgAndClass);
}
}
}
} catch (Exception e) {
Expand Down Expand Up @@ -723,7 +730,6 @@ public static boolean checkValidMetadata(String prop) {
File pomCheck = new File(userDir + "/pom.xml");

if (!pomCheck.exists()) {
System.out.println("No pom.xml file detected, checking for Gradle files..");
tempProp = getMetadataFromGradle(prop);
if(isPropUnspecified(tempProp)) {
return false;
Expand Down Expand Up @@ -894,15 +900,15 @@ private static boolean isPropUnspecified(String prop) {
return StringUtils.isBlank(prop) || "unspecified".equals(prop);
}

private static void failBuildFromMissingMetadata(String metadata) {
public static void failBuildFromMissingMetadata(String metadata) {
LOG.error("* ===[Build failed from lack of metadata: ("+ metadata + ")]===");
LOG.error("* CyBench runner is unable to continue due to missing crucial metadata.");
if (metadata.contains("Version")) {
LOG.error("* Project version metadata was unable to be processed.");
LOG.info("* Project version can be set or parsed dynamically a few different ways: \n");
LOG.info("*** The quickest and easiest (Gradle) solution is by adding an Ant task to 'build.gradle'"
LOG.warn("* Project version can be set or parsed dynamically a few different ways: \n");
LOG.warn("*** The quickest and easiest (Gradle) solution is by adding an Ant task to 'build.gradle'"
+ " to generate 'project.properties' file.");
LOG.info("*** This Ant task can be found in the README for CyBench Gradle Plugin"
LOG.warn("*** This Ant task can be found in the README for CyBench Gradle Plugin"
+ " (https://github.com/K2NIO/gocypher-cybench-gradle/blob/master/README.md) \n");
LOG.info("*** For Gradle (groovy) projects, please set 'version = \"<yourProjectVersionNumber>\"' in either "
+ "'build.gradle' or 'version.gradle'.");
Expand All @@ -915,15 +921,15 @@ private static void failBuildFromMissingMetadata(String metadata) {
LOG.info("* Project version can also be detected from 'metadata.properties' in your project's 'config' folder.");
LOG.info("* If setting project version via 'metadata.properties', please add the following: ");
LOG.info("* 'class.version=<yourProjectVersionNumber>'\n");
LOG.info("* For more information and instructions on this process, please visit the CyBench wiki at "
LOG.warn("* For more information and instructions on this process, please visit the CyBench wiki at "
+ "https://github.com/K2NIO/gocypher-cybench-java/wiki/Getting-started-with-CyBench-annotations");
System.exit(1);
} else if (metadata.contains("Project")) {
LOG.error("* Project name metadata was unable to be processed.");
LOG.info("* Project name can be set or parsed dynamically a few different ways: \n");
LOG.info("*** The quickest and easiest (Gradle) solution is by adding an Ant task to 'build.gradle'"
LOG.warn("* Project name can be set or parsed dynamically a few different ways: \n");
LOG.warn("*** The quickest and easiest (Gradle) solution is by adding an Ant task to 'build.gradle'"
+ " to generate 'project.properties' file.");
LOG.info("*** This Ant task can be found in the README for CyBench Gradle Plugin"
LOG.warn("*** This Ant task can be found in the README for CyBench Gradle Plugin"
+ " (https://github.com/K2NIO/gocypher-cybench-gradle/blob/master/README.md) \n");
LOG.info("*** For Gradle (groovy) projects, please set 'rootProject.name = \"<yourProjectName>\"' in 'settings.gradle'.");
LOG.info("*** For Gradle (kotlin) projects, please set 'rootProject.name = \"<yourProjectName>\"' in 'settings.gradle.kts'.");
Expand All @@ -936,13 +942,13 @@ private static void failBuildFromMissingMetadata(String metadata) {
LOG.info("*** Project version can also be detected from 'metadata.properties' in your project's 'config' folder.");
LOG.info("*** If setting project version via 'metadata.properties', please add the following: ");
LOG.info("*** 'class.project=<yourProjectName>'\n");
LOG.info("* For more information and instructions on this process, please visit the CyBench wiki at "
LOG.warn("* For more information and instructions on this process, please visit the CyBench wiki at "
+ "https://github.com/K2NIO/gocypher-cybench-java/wiki/Getting-started-with-CyBench-annotations");
System.exit(1);
}
}

private static void failBuildFromMissingMetadata() {
public static void failBuildFromMissingMetadata() {
LOG.error("* ===[Build failed from lack of metadata]===");
LOG.error("* CyBench runner is unable to continue due to missing crucial metadata.");
LOG.error("* Error while parsing Maven project's 'pom.xml' file.");
Expand Down

0 comments on commit b54e088

Please sign in to comment.