Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit fe8456b

Browse files
committed
[MSHARED-638] use script description instead of hardcoded "script" in messages
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1797598 13f79535-47bb-0310-9956-ffa450edef68
1 parent d11e7c3 commit fe8456b

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • maven-script-interpreter/src/main/java/org/apache/maven/shared/scriptinterpreter

maven-script-interpreter/src/main/java/org/apache/maven/shared/scriptinterpreter/ScriptRunner.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ public void setScriptEncoding( String encoding )
138138
}
139139

140140
/**
141-
* Runs the specified hook script.
141+
* Runs the specified hook script (after resolution).
142142
*
143143
* @param scriptDescription The description of the script to use for logging, must not be <code>null</code>.
144144
* @param basedir The base directory of the project, must not be <code>null</code>.
145145
* @param relativeScriptPath The path to the script relative to the project base directory, may be <code>null</code>
146-
* to skip the script execution.
146+
* to skip the script execution and may not have extensions (resolution will search).
147147
* @param context The key-value storage used to share information between hook scripts, may be <code>null</code>.
148148
* @param logger The logger to redirect the script output to, may be <code>null</code> to use stdout/stderr.
149149
* @param stage The stage of the build job the script is invoked in, must not be <code>null</code>. This is for
@@ -161,20 +161,21 @@ public void run( final String scriptDescription, final File basedir, final Strin
161161
{
162162
if ( relativeScriptPath == null )
163163
{
164-
getLog().debug( "relativeScriptPath is null: not executing script" );
164+
getLog().debug( scriptDescription + ": relativeScriptPath is null, not executing script" );
165165
return;
166166
}
167167

168168
final File scriptFile = resolveScript( new File( basedir, relativeScriptPath ) );
169169

170170
if ( !scriptFile.exists() )
171171
{
172-
getLog().debug( "no script found in directory: " + basedir.getAbsolutePath() );
172+
getLog().debug( scriptDescription + ": no script '" + relativeScriptPath + "' found in directory "
173+
+ basedir.getAbsolutePath() );
173174
return;
174175
}
175176

176-
String path = scriptFile.getAbsolutePath();
177-
getLog().info( "run script " + relativeScriptPath + path.substring( path.lastIndexOf( '.' ) ) );
177+
getLog().info( "run " + scriptDescription + ' ' + relativeScriptPath + '.'
178+
+ FileUtils.extension( scriptFile.getAbsolutePath() ) );
178179

179180
executeRun( scriptDescription, scriptFile, context, logger, stage, failOnException );
180181
}
@@ -201,11 +202,12 @@ public void run( final String scriptDescription, File scriptFile, final Map<Stri
201202

202203
if ( !scriptFile.exists() )
203204
{
204-
getLog().debug( "scriptFile not found in directory: " + scriptFile.getAbsolutePath() );
205+
getLog().debug( scriptDescription + ": script file not found in directory "
206+
+ scriptFile.getAbsolutePath() );
205207
return;
206208
}
207209

208-
getLog().info( "run script " + scriptFile.getAbsolutePath() );
210+
getLog().info( "run " + scriptDescription + ' ' + scriptFile.getAbsolutePath() );
209211

210212
executeRun( scriptDescription, scriptFile, context, logger, stage, failOnException );
211213
}

0 commit comments

Comments
 (0)