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
2d769e76
Commit
2d769e76
authored
Apr 29, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Stop limiting layer customization to external modules"
See gh-21207
parent
98644df6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
23 deletions
+13
-23
LayerResolver.java
...ngframework/boot/gradle/tasks/bundling/LayerResolver.java
+3
-13
BootJarIntegrationTests.java
...k/boot/gradle/tasks/bundling/BootJarIntegrationTests.java
+8
-8
BootJarIntegrationTests-multiModuleCustomLayers.gradle
...ng/BootJarIntegrationTests-multiModuleCustomLayers.gradle
+2
-2
No files found.
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LayerResolver.java
View file @
2d769e76
...
...
@@ -28,9 +28,6 @@ import org.gradle.api.artifacts.Configuration;
import
org.gradle.api.artifacts.ModuleVersionIdentifier
;
import
org.gradle.api.artifacts.ResolvedArtifact
;
import
org.gradle.api.artifacts.ResolvedConfiguration
;
import
org.gradle.api.artifacts.component.ComponentIdentifier
;
import
org.gradle.api.artifacts.component.ModuleComponentIdentifier
;
import
org.gradle.api.artifacts.component.ProjectComponentIdentifier
;
import
org.gradle.api.file.FileCopyDetails
;
import
org.gradle.api.specs.Spec
;
...
...
@@ -137,16 +134,9 @@ class LayerResolver {
private
final
Map
<
File
,
LibraryCoordinates
>
artifactCoordinates
=
new
LinkedHashMap
<>();
ResolvedConfigurationDependencies
(
ResolvedConfiguration
resolvedConfiguration
)
{
if
(
resolvedConfiguration
!=
null
)
{
for
(
ResolvedArtifact
resolvedArtifact
:
resolvedConfiguration
.
getResolvedArtifacts
())
{
ComponentIdentifier
identifier
=
resolvedArtifact
.
getId
().
getComponentIdentifier
();
if
(
identifier
instanceof
ModuleComponentIdentifier
||
identifier
instanceof
ProjectComponentIdentifier
)
{
this
.
artifactCoordinates
.
put
(
resolvedArtifact
.
getFile
(),
new
ModuleVersionIdentifierLibraryCoordinates
(
resolvedArtifact
.
getModuleVersion
().
getId
()));
}
}
for
(
ResolvedArtifact
resolvedArtifact
:
resolvedConfiguration
.
getResolvedArtifacts
())
{
this
.
artifactCoordinates
.
put
(
resolvedArtifact
.
getFile
(),
new
ModuleVersionIdentifierLibraryCoordinates
(
resolvedArtifact
.
getModuleVersion
().
getId
()));
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.java
View file @
2d769e76
...
...
@@ -178,7 +178,7 @@ class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
}
@TestTemplate
void
projectDependenciesCanBeIncludedInCustomLayer
()
throws
IOException
{
void
multiModuleCustomLayers
()
throws
IOException
{
writeSettingsGradle
();
writeMainClass
();
writeResource
();
...
...
@@ -188,8 +188,8 @@ class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
String
layerToolsJar
=
"BOOT-INF/lib/"
+
JarModeLibrary
.
LAYER_TOOLS
.
getName
();
try
(
JarFile
jarFile
=
new
JarFile
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs"
).
listFiles
()[
0
]))
{
assertThat
(
jarFile
.
getEntry
(
layerToolsJar
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
"BOOT-INF/lib/
foo
-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
"BOOT-INF/lib/b
ar
-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
"BOOT-INF/lib/
alpha
-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
"BOOT-INF/lib/b
ravo
-1.2.3.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
"BOOT-INF/lib/commons-lang3-3.9.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
"BOOT-INF/lib/spring-core-5.2.5.RELEASE.jar"
)).
isNotNull
();
assertThat
(
jarFile
.
getEntry
(
"BOOT-INF/lib/spring-jcl-5.2.5.RELEASE.jar"
)).
isNotNull
();
...
...
@@ -203,8 +203,8 @@ class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
"subproject-dependencies"
,
"static"
,
"app"
);
assertThat
(
indexedLayers
.
keySet
()).
containsExactlyElementsOf
(
layerNames
);
Set
<
String
>
expectedSubprojectDependencies
=
new
TreeSet
<>();
expectedSubprojectDependencies
.
add
(
"BOOT-INF/lib/
foo
-1.2.3.jar"
);
expectedSubprojectDependencies
.
add
(
"BOOT-INF/lib/b
ar
-1.2.3.jar"
);
expectedSubprojectDependencies
.
add
(
"BOOT-INF/lib/
alpha
-1.2.3.jar"
);
expectedSubprojectDependencies
.
add
(
"BOOT-INF/lib/b
ravo
-1.2.3.jar"
);
Set
<
String
>
expectedDependencies
=
new
TreeSet
<>();
expectedDependencies
.
add
(
"BOOT-INF/lib/spring-core-5.2.5.RELEASE.jar"
);
expectedDependencies
.
add
(
"BOOT-INF/lib/spring-jcl-5.2.5.RELEASE.jar"
);
...
...
@@ -261,9 +261,9 @@ class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
}
private
void
writeSettingsGradle
()
{
File
settings
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"settings.gradle"
);
try
(
PrintWriter
writer
=
new
PrintWriter
(
new
FileWriter
(
settings
)))
{
writer
.
println
(
"include '
foo', 'bar
'"
);
try
(
PrintWriter
writer
=
new
PrintWriter
(
new
FileWriter
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"settings.gradle"
)
)))
{
writer
.
println
(
"include '
alpha', 'bravo
'"
);
}
catch
(
IOException
ex
)
{
throw
new
RuntimeException
(
ex
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-
projectDependenciesCanBeIncludedInCustomLayer
.gradle
→
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-
multiModuleCustomLayers
.gradle
View file @
2d769e76
...
...
@@ -40,8 +40,8 @@ repositories {
}
dependencies
{
implementation
(
project
(
':
foo
'
))
implementation
(
project
(
':b
ar
'
))
implementation
(
project
(
':
alpha
'
))
implementation
(
project
(
':b
ravo
'
))
implementation
(
"commons-io:commons-io:2.7-SNAPSHOT"
)
implementation
(
"org.apache.commons:commons-lang3:3.9"
)
implementation
(
"org.springframework:spring-core:5.2.5.RELEASE"
)
...
...
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