+++ /dev/null
-/*
- * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang2sources.plugin;
-
-import java.io.File;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Utility to obtain the correct path to generated directories.
- * It's important that this does not hard-code "target/" anywhere, but uses
- * ${project.build.directory}/, to make target-ide/ possible.
- *
- * @author Michael Vorburger.ch
- */
-class GeneratedDirectories {
-
- private final File targetGeneratedSources;
-
- GeneratedDirectories(MavenProject project) {
- this.targetGeneratedSources = new File(project.getBuild().getDirectory(), "generated-sources");
- }
-
- public File getYangServicesDir() {
- return new File(targetGeneratedSources, "spi");
- }
-
- public File getYangDir() {
- return new File(targetGeneratedSources, "yang");
- }
-
-}
Collection<FileState> addYangsToMetaInf(final MavenProject project,
final Collection<YangTextSchemaSource> modelsInProject) throws IOException {
- final File generatedYangDir = new GeneratedDirectories(project).getYangDir();
+ final File generatedYangDir =
+ // FIXME: why are we generating these in "generated-sources"? At the end of the day YANG files are more
+ // resources (except we do not them to be subject to filtering)
+ new File(new File(project.getBuild().getDirectory(), "generated-sources"), "yang");
LOG.debug("Generated dir {}", generatedYangDir);
// copy project's src/main/yang/*.yang to ${project.builddir}/generated-sources/yang/META-INF/yang/
}
// add META_INF/services
- File generatedServicesDir = new GeneratedDirectories(project).getYangServicesDir();
+ File generatedServicesDir = new File(new File(project.getBuild().getDirectory(), "generated-sources"), "spi");
YangProvider.setResource(generatedServicesDir, project);
LOG.debug("{} Yang services files from: {} marked as resources: {}", LOG_PREFIX, generatedServicesDir,
META_INF_YANG_SERVICES_STRING_JAR);