Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
maven-thrift-plugin
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
maven-thrift-plugin
Commits
e9d4a01b
Commit
e9d4a01b
authored
Mar 14, 2011
by
David Trott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grabbed staleness check from maven-protoc-plugin.
parent
fe80dbd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletion
+34
-1
src/main/java/org/apache/thrift/maven/AbstractThriftMojo.java
...main/java/org/apache/thrift/maven/AbstractThriftMojo.java
+34
-1
No files found.
src/main/java/org/apache/thrift/maven/AbstractThriftMojo.java
View file @
e9d4a01b
...
...
@@ -128,6 +128,16 @@ abstract class AbstractThriftMojo extends AbstractMojo {
*/
private
Set
<
String
>
excludes
=
ImmutableSet
.
of
();
/**
* @parameter
*/
private
long
staleMillis
=
0
;
/**
* @parameter
*/
private
boolean
checkStaleness
=
false
;
/**
* Executes the mojo.
*/
...
...
@@ -137,12 +147,16 @@ abstract class AbstractThriftMojo extends AbstractMojo {
if
(
thriftSourceRoot
.
exists
())
{
try
{
ImmutableSet
<
File
>
thriftFiles
=
findThriftFilesInDirectory
(
thriftSourceRoot
);
final
File
outputDirectory
=
getOutputDirectory
();
ImmutableSet
<
File
>
outputFiles
=
findGeneratedFilesInDirectory
(
getOutputDirectory
());
if
(
thriftFiles
.
isEmpty
())
{
getLog
().
info
(
"No thrift files to compile."
);
}
else
if
(
checkStaleness
&&
((
lastModified
(
thriftFiles
)
+
staleMillis
)
<
lastModified
(
outputFiles
)))
{
getLog
().
info
(
"Skipping compilation because target directory newer than sources."
);
}
else
{
ImmutableSet
<
File
>
derivedThriftPathElements
=
makeThriftPathFromJars
(
temporaryThriftFileDirectory
,
getDependencyArtifactFiles
());
final
File
outputDirectory
=
getOutputDirectory
();
outputDirectory
.
mkdirs
();
// Quick fix to fix issues with two mvn installs in a row (ie no clean)
...
...
@@ -177,6 +191,25 @@ abstract class AbstractThriftMojo extends AbstractMojo {
}
}
ImmutableSet
<
File
>
findGeneratedFilesInDirectory
(
File
directory
)
throws
IOException
{
if
(
directory
==
null
||
!
directory
.
isDirectory
())
return
ImmutableSet
.
of
();
// TODO(gak): plexus-utils needs generics
@SuppressWarnings
(
"unchecked"
)
List
<
File
>
javaFilesInDirectory
=
getFiles
(
directory
,
"**/*.java"
,
null
);
return
ImmutableSet
.
copyOf
(
javaFilesInDirectory
);
}
private
long
lastModified
(
ImmutableSet
<
File
>
files
)
{
long
result
=
0
;
for
(
File
file
:
files
)
{
if
(
file
.
lastModified
()
>
result
)
result
=
file
.
lastModified
();
}
return
result
;
}
private
void
checkParameters
()
{
checkNotNull
(
project
,
"project"
);
checkNotNull
(
projectHelper
,
"projectHelper"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment