summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-07-10 15:03:37 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-07-11 08:35:48 +0000
commit61cdce72f65954d7f01a773c0540c01ca6f77838 (patch)
treee3da5b95fa6cebf8e2dbcf844a44c32e4093e14d /common
parent379679d04913c2c779847016508f54e912a80ed2 (diff)
HONEYCOMB-373 - Remove local module mapping
Change-Id: Ic3a8a843168baed85cc31e0a09f9aa21cf691d1a Signed-off-by: Jan Srnicek <jsrnicek@cisco.com> (cherry picked from commit f6a03970c2e59d040012b6a457997361a318e8b2)
Diffstat (limited to 'common')
-rw-r--r--common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModuleYangIndexGenerator.groovy49
1 files changed, 3 insertions, 46 deletions
diff --git a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModuleYangIndexGenerator.groovy b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModuleYangIndexGenerator.groovy
index 21877c51c..042ce6132 100644
--- a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModuleYangIndexGenerator.groovy
+++ b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModuleYangIndexGenerator.groovy
@@ -91,21 +91,10 @@ class ModuleYangIndexGenerator {
log.info "Pairing distribution modules ${modules} to yang modules"
def moduleToYangModulesIndex = new HashMap<String, String>()
- def outputDir = project.getBuild().getOutputDirectory()
- // TODO - HONEYCOMB-373 - eliminate local matching after distribution modules are moved to separate project
- // first ,matches modules against local files, helps to filter local classpath modules, to reduce scope
- // of dependency scanning that is more performance heavy
- log.info "Pairing against local classpath"
- pairAgainsLocalFiles(outputDir, modules, moduleToYangModulesIndex, log)
-
- // go to dependencies only if some modules are left. this occurs for modules
- // started by distribution that are not part of its classpath(basically all plugin modules)
- if (!modules.isEmpty()) {
- log.info "Pairing against dependencies"
- // The rest of the modules is looked up in dependencies
- pairAgainsDependencyArtifacts(project, modules, log, moduleToYangModulesIndex)
- }
+ log.info "Pairing against dependencies"
+ // The rest of the modules is looked up in dependencies
+ pairAgainsDependencyArtifacts(project, modules, log, moduleToYangModulesIndex)
// for ex.: /target/honeycomb-minimal-resources/yang-mapping
def yangMappingFolder = Paths.get(project.getBuild().getOutputDirectory(), StartupScriptGenerator.MINIMAL_RESOURCES_FOLDER, YANG_MAPPING_FOLDER).toFile()
@@ -180,38 +169,6 @@ class ModuleYangIndexGenerator {
log.info "Modules left after dependency pairing $modules"
}
- // TODO - HONEYCOMB-373 - eliminate local matching
- private static void pairAgainsLocalFiles(outputDir, modules, HashMap<String, String> index, log) {
- // Pairs modules that are part of distribution classpath
- def yangModulesLocalConfig = Paths.get(outputDir, YANG_MODULES_FOLDER, YANG_MODULES_FILE_NAME).toFile()
- if (!yangModulesLocalConfig.exists()) {
- log.debug "Local configuration for yang modules does not exist, skiping local matching"
- return
- }
-
- log.info "Local file ${yangModulesLocalConfig}"
- def localYangModules = fixDelimiters(FileUtils.readFileToString(yangModulesLocalConfig, StandardCharsets.UTF_8))
-
- log.info "Output dir $outputDir"
- FileUtils.listFiles(Paths.get(outputDir).toFile(), EXTENSIONS, true)
- .stream()
- .map { file -> file.getPath() }
- .map { path -> relativizePath(path, outputDir) }
- .forEach { path ->
- for (String module : modules) {
- if (path.equals(classNameToPath(module))) {
- log.info "Module $module found in local classpath"
- // mapping by standard class name
- index.put(module, localYangModules)
- }
- }
- }
-
- // remove all matching modules to reduce scope of search
- modules.removeAll(index.keySet());
- log.info "Modules left after local classpath pairing $modules"
- }
-
private static String relativizePath(String path, String outputDir) {
return path.replace(outputDir, "").substring(1).trim();
}