ws.epigraph.scala.mojo.MainCodegenMojo.java Source code

Java tutorial

Introduction

Here is the source code for ws.epigraph.scala.mojo.MainCodegenMojo.java

Source

/*
 * Copyright 2016 Sumo Logic
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* Created by yegor on 7/6/16. */

package ws.epigraph.scala.mojo;

import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;

import java.io.File;

/**
 * Compile Epigraph source files (.epigraph)
 */
@Mojo(name = "generate-sources", defaultPhase = LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
public class MainCodegenMojo extends BaseCodegenMojo {

    /**
     * A set of Ant-like inclusion patterns used to select files from the source
     * directory for processing. By default, the pattern
     * <code>**&#47;*.epigraph</code> is used to select epigraph Schema files.
     */
    @Parameter
    private String[] includes = { "**/*.epigraph" };

    /**
     * A set of Ant-like exclusion patterns used to prevent certain files from
     * being processed. By default, this set is empty such that no files are
     * excluded.
     */
    @Parameter
    private String[] excludes = {};

    @Override
    protected File getSourceDirectory() {
        return sourceDirectory;
    }

    @Override
    protected String[] getIncludes() {
        return includes;
    }

    @Override
    protected String[] getExcludes() {
        return excludes;
    }

    @Override
    protected void addGeneratedSourcesToProject(MavenProject project, String path) {
        project.addCompileSourceRoot(path);
    }

}