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
c14a5506
Commit
c14a5506
authored
Feb 08, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
fbf493b1
b931f564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
5 deletions
+62
-5
ProjectLibraries.java
...ringframework/boot/gradle/repackage/ProjectLibraries.java
+62
-5
No files found.
spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java
View file @
c14a5506
...
@@ -18,6 +18,7 @@ package org.springframework.boot.gradle.repackage;
...
@@ -18,6 +18,7 @@ package org.springframework.boot.gradle.repackage;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Method
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -50,6 +51,8 @@ class ProjectLibraries implements Libraries {
...
@@ -50,6 +51,8 @@ class ProjectLibraries implements Libraries {
private
final
boolean
excludeDevtools
;
private
final
boolean
excludeDevtools
;
private
final
TargetConfigurationResolver
targetConfigurationResolver
;
private
String
providedConfigurationName
=
"providedRuntime"
;
private
String
providedConfigurationName
=
"providedRuntime"
;
private
String
customConfigurationName
=
null
;
private
String
customConfigurationName
=
null
;
...
@@ -65,6 +68,17 @@ class ProjectLibraries implements Libraries {
...
@@ -65,6 +68,17 @@ class ProjectLibraries implements Libraries {
this
.
project
=
project
;
this
.
project
=
project
;
this
.
extension
=
extension
;
this
.
extension
=
extension
;
this
.
excludeDevtools
=
excludeDevTools
;
this
.
excludeDevtools
=
excludeDevTools
;
this
.
targetConfigurationResolver
=
createTargetConfigurationResolver
();
}
private
static
TargetConfigurationResolver
createTargetConfigurationResolver
()
{
try
{
return
new
Gradle3TargetConfigurationResolver
(
ProjectDependency
.
class
.
getMethod
(
"getTargetConfiguration"
));
}
catch
(
Exception
ex
)
{
return
new
Gradle2TargetConfigurationResolver
();
}
}
}
/**
/**
...
@@ -127,11 +141,11 @@ class ProjectLibraries implements Libraries {
...
@@ -127,11 +141,11 @@ class ProjectLibraries implements Libraries {
}
}
else
if
(
dependency
instanceof
ProjectDependency
)
{
else
if
(
dependency
instanceof
ProjectDependency
)
{
ProjectDependency
projectDependency
=
(
ProjectDependency
)
dependency
;
ProjectDependency
projectDependency
=
(
ProjectDependency
)
dependency
;
Configuration
dependencyConfiguration
=
projectDependency
libraries
.
getDependencyProject
().
getConfigurations
()
.
addAll
(
getLibrariesForFileDependencies
(
.
getByName
(
projectDependency
.
getConfiguration
());
this
.
targetConfigurationResolver
libraries
.
addAll
(
.
resolveTargetConfiguration
(
projectDependency
),
getLibrariesForFileDependencies
(
dependencyConfiguration
,
scope
));
scope
));
}
}
}
}
return
libraries
;
return
libraries
;
...
@@ -264,4 +278,47 @@ class ProjectLibraries implements Libraries {
...
@@ -264,4 +278,47 @@ class ProjectLibraries implements Libraries {
}
}
private
interface
TargetConfigurationResolver
{
Configuration
resolveTargetConfiguration
(
ProjectDependency
projectDependency
);
}
private
static
final
class
Gradle2TargetConfigurationResolver
implements
TargetConfigurationResolver
{
@Override
public
Configuration
resolveTargetConfiguration
(
ProjectDependency
projectDependency
)
{
return
projectDependency
.
getProjectConfiguration
();
}
}
private
static
final
class
Gradle3TargetConfigurationResolver
implements
TargetConfigurationResolver
{
private
final
Method
getTargetConfiguration
;
private
Gradle3TargetConfigurationResolver
(
Method
getTargetConfiguration
)
{
this
.
getTargetConfiguration
=
getTargetConfiguration
;
}
@Override
public
Configuration
resolveTargetConfiguration
(
ProjectDependency
projectDependency
)
{
try
{
String
configurationName
=
(
String
)
this
.
getTargetConfiguration
.
invoke
(
projectDependency
);
return
projectDependency
.
getDependencyProject
().
getConfigurations
()
.
getByName
(
configurationName
==
null
?
Dependency
.
DEFAULT_CONFIGURATION
:
configurationName
);
}
catch
(
Exception
ex
)
{
throw
new
RuntimeException
(
"Failed to get target configuration"
,
ex
);
}
}
}
}
}
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