Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Commit

Permalink
Making usage report more accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
velo committed May 25, 2010
1 parent 6f8a422 commit dcd31bc
Show file tree
Hide file tree
Showing 11 changed files with 1,272 additions and 1,110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Build;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand All @@ -42,16 +43,18 @@
*/
public abstract class AbstractIrvinMojo
extends AbstractMojo
implements MavenMojo
{

/**
* The maven project.
*
* @parameter expression="${project}"
* @required
* @readonly
* @component
*/
protected MavenProject project;
protected ArtifactFactory artifactFactory;

/**
* @component
*/
protected ArtifactMetadataSource artifactMetadataSource;

/**
* @parameter expression="${project.build}"
Expand All @@ -61,36 +64,47 @@ public abstract class AbstractIrvinMojo
protected Build build;

/**
* @component
* LW : needed for expression evaluation The maven MojoExecution needed for ExpressionEvaluation
*
* @parameter expression="${session}"
* @required
* @readonly
*/
protected MavenProjectHelper projectHelper;
protected MavenSession context;

// dependency artifactes
private Set<Artifact> dependencyArtifacts;

/**
* @component
* Local repository to be used by the plugin to resolve dependencies.
*
* @parameter expression="${localRepository}"
*/
protected ArtifactFactory artifactFactory;
protected ArtifactRepository localRepository;

/**
* @component
*/
protected ArtifactResolver resolver;
protected MavenProjectBuilder mavenProjectBuilder;

/**
* @component
* @parameter expression="${plugin.artifacts}"
*/
protected ArtifactMetadataSource artifactMetadataSource;
protected List<Artifact> pluginArtifacts;

/**
* @component
* The maven project.
*
* @parameter expression="${project}"
* @required
* @readonly
*/
protected MavenProjectBuilder mavenProjectBuilder;
protected MavenProject project;

/**
* Local repository to be used by the plugin to resolve dependencies.
*
* @parameter expression="${localRepository}"
* @component
*/
protected ArtifactRepository localRepository;
protected MavenProjectHelper projectHelper;

/**
* List of remote repositories to be used by the plugin to resolve dependencies.
Expand All @@ -101,9 +115,9 @@ public abstract class AbstractIrvinMojo
protected List remoteRepositories;

/**
* @parameter expression="${plugin.artifacts}"
* @component
*/
protected List<Artifact> pluginArtifacts;
protected ArtifactResolver resolver;

/**
* @parameter default-value="false" expression="${flexmojos.skip}"
Expand All @@ -118,8 +132,22 @@ public AbstractIrvinMojo()
super();
}

// dependency artifactes
private Set<Artifact> dependencyArtifacts;
/**
* Executes plugin
*/
public void execute()
throws MojoExecutionException, MojoFailureException
{
if ( skip )
{
getLog().info( "Skipping Flexmojos execution" );
return;
}

setUp();
run();
tearDown();
}

/**
* Returns Set of dependency artifacts which are resolved for the project.
Expand Down Expand Up @@ -177,39 +205,27 @@ protected List<Artifact> getDependencyArtifacts( String... scopes )
return artifacts;
}

/**
* Executes plugin
*/
public void execute()
throws MojoExecutionException, MojoFailureException
public MavenSession getSession()
{
if ( skip )
{
getLog().info( "Skipping Flexmojos execution" );
return;
}

setUp();
run();
tearDown();
return context;
}

/**
* Perform setup before plugin is run.
* Perform plugin functionality
*
* @throws MojoExecutionException
* @throws MojoFailureException
*/
protected abstract void setUp()
protected abstract void run()
throws MojoExecutionException, MojoFailureException;

/**
* Perform plugin functionality
* Perform setup before plugin is run.
*
* @throws MojoExecutionException
* @throws MojoFailureException
*/
protected abstract void run()
protected abstract void setUp()
throws MojoExecutionException, MojoFailureException;

/**
Expand All @@ -220,5 +236,4 @@ protected abstract void run()
*/
protected abstract void tearDown()
throws MojoExecutionException, MojoFailureException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Flexmojos is a set of maven goals to allow maven users to compile, optimize and test Flex SWF, Flex SWC, Air SWF and Air SWC.
* Copyright (C) 2008-2012 Marvin Froeder <marvin@flexmojos.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sonatype.flexmojos;

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.Mojo;

public interface MavenMojo
extends Mojo
{
MavenSession getSession();
}

0 comments on commit dcd31bc

Please sign in to comment.