Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
DEMO
spring-boot
Commits
1e100677
Commit
1e100677
authored
Nov 05, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce scope of META-INF customizations to main, source, and javadoc jars
Closes gh-23955
parent
49ea023a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
JavaConventions.java
.../java/org/springframework/boot/build/JavaConventions.java
+20
-13
No files found.
buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java
View file @
1e100677
...
@@ -18,6 +18,7 @@ package org.springframework.boot.build;
...
@@ -18,6 +18,7 @@ package org.springframework.boot.build;
import
java.io.File
;
import
java.io.File
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -106,19 +107,25 @@ class JavaConventions {
...
@@ -106,19 +107,25 @@ class JavaConventions {
.
collect
(
Collectors
.
toSet
());
.
collect
(
Collectors
.
toSet
());
Set
<
String
>
javadocJarTaskNames
=
sourceSets
.
stream
().
map
(
SourceSet:
:
getJavadocJarTaskName
)
Set
<
String
>
javadocJarTaskNames
=
sourceSets
.
stream
().
map
(
SourceSet:
:
getJavadocJarTaskName
)
.
collect
(
Collectors
.
toSet
());
.
collect
(
Collectors
.
toSet
());
project
.
getTasks
().
withType
(
Jar
.
class
,
(
jar
)
->
project
.
afterEvaluate
((
evaluated
)
->
{
Set
<
String
>
jarTaskNames
=
sourceSets
.
stream
().
map
(
SourceSet:
:
getJarTaskName
).
collect
(
Collectors
.
toSet
());
jar
.
metaInf
((
metaInf
)
->
metaInf
.
from
(
extractLegalResources
));
Set
<
String
>
jarTasksOfInterest
=
new
HashSet
<
String
>();
jar
.
manifest
((
manifest
)
->
{
jarTasksOfInterest
.
addAll
(
sourceJarTaskNames
);
Map
<
String
,
Object
>
attributes
=
new
TreeMap
<>();
jarTasksOfInterest
.
addAll
(
javadocJarTaskNames
);
attributes
.
put
(
"Automatic-Module-Name"
,
project
.
getName
().
replace
(
"-"
,
"."
));
jarTasksOfInterest
.
addAll
(
jarTaskNames
);
attributes
.
put
(
"Build-Jdk-Spec"
,
project
.
property
(
"sourceCompatibility"
));
project
.
getTasks
().
matching
((
task
)
->
jarTasksOfInterest
.
contains
(
task
.
getName
())).
withType
(
Jar
.
class
,
attributes
.
put
(
"Built-By"
,
"Spring"
);
(
jar
)
->
project
.
afterEvaluate
((
evaluated
)
->
{
attributes
.
put
(
"Implementation-Title"
,
jar
.
metaInf
((
metaInf
)
->
metaInf
.
from
(
extractLegalResources
));
determineImplementationTitle
(
project
,
sourceJarTaskNames
,
javadocJarTaskNames
,
jar
));
jar
.
manifest
((
manifest
)
->
{
attributes
.
put
(
"Implementation-Version"
,
project
.
getVersion
());
Map
<
String
,
Object
>
attributes
=
new
TreeMap
<>();
manifest
.
attributes
(
attributes
);
attributes
.
put
(
"Automatic-Module-Name"
,
project
.
getName
().
replace
(
"-"
,
"."
));
});
attributes
.
put
(
"Build-Jdk-Spec"
,
project
.
property
(
"sourceCompatibility"
));
}));
attributes
.
put
(
"Built-By"
,
"Spring"
);
attributes
.
put
(
"Implementation-Title"
,
determineImplementationTitle
(
project
,
sourceJarTaskNames
,
javadocJarTaskNames
,
jar
));
attributes
.
put
(
"Implementation-Version"
,
project
.
getVersion
());
manifest
.
attributes
(
attributes
);
});
}));
}
}
private
String
determineImplementationTitle
(
Project
project
,
Set
<
String
>
sourceJarTaskNames
,
private
String
determineImplementationTitle
(
Project
project
,
Set
<
String
>
sourceJarTaskNames
,
...
...
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