Enforce checkstyle in maven-plugin
[yangtools.git] / yang / yang-maven-plugin / src / main / java / org / opendaylight / yangtools / yang2sources / plugin / GeneratedDirectories.java
1 /*
2  * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang2sources.plugin;
9
10 import java.io.File;
11 import org.apache.maven.project.MavenProject;
12
13 /**
14  * Utility to obtain the correct path to generated directories.
15  * It's important that this does not hard-code "target/" anywhere, but uses
16  * ${project.build.directory}/, to make target-ide/ possible.
17  *
18  * @author Michael Vorburger.ch
19  */
20 class GeneratedDirectories {
21
22     private final File targetGeneratedSources;
23
24     GeneratedDirectories(MavenProject project) {
25         this.targetGeneratedSources = new File(project.getBuild().getDirectory(), "generated-sources");
26     }
27
28     public File getYangServicesDir() {
29         return new File(targetGeneratedSources, "spi");
30     }
31
32     public File getYangDir() {
33         return new File(targetGeneratedSources, "yang");
34     }
35
36 }