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
70c4baee
Commit
70c4baee
authored
May 06, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-21341
parents
1560c667
386d678d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
16 deletions
+26
-16
ApplicationPluginAction.java
...framework/boot/gradle/plugin/ApplicationPluginAction.java
+12
-2
ApplicationPluginActionIntegrationTests.java
...radle/plugin/ApplicationPluginActionIntegrationTests.java
+12
-12
ApplicationPluginActionIntegrationTests.gradle
...dle/plugin/ApplicationPluginActionIntegrationTests.gradle
+2
-2
No files found.
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java
View file @
70c4baee
...
...
@@ -36,6 +36,8 @@ import org.gradle.api.plugins.ApplicationPluginConvention;
import
org.gradle.api.provider.Property
;
import
org.gradle.api.provider.Provider
;
import
org.gradle.jvm.application.scripts.TemplateBasedScriptGenerator
;
import
org.gradle.jvm.application.tasks.CreateStartScripts
;
import
org.gradle.util.GradleVersion
;
import
org.springframework.boot.gradle.tasks.application.CreateBootStartScripts
;
...
...
@@ -53,8 +55,8 @@ final class ApplicationPluginAction implements PluginApplicationAction {
DistributionContainer
distributions
=
project
.
getExtensions
().
getByType
(
DistributionContainer
.
class
);
Distribution
distribution
=
distributions
.
create
(
"boot"
);
configureBaseNameConvention
(
project
,
applicationConvention
,
distribution
);
Create
Boot
StartScripts
bootStartScripts
=
project
.
getTasks
().
create
(
"bootStartScripts"
,
CreateBootStartScripts
.
class
);
CreateStartScripts
bootStartScripts
=
project
.
getTasks
().
create
(
"bootStartScripts"
,
determineCreateStartScriptsClass
()
);
bootStartScripts
.
setDescription
(
"Generates OS-specific start scripts to run the project as a Spring Boot application."
);
((
TemplateBasedScriptGenerator
)
bootStartScripts
.
getUnixStartScriptGenerator
())
...
...
@@ -79,6 +81,14 @@ final class ApplicationPluginAction implements PluginApplicationAction {
distribution
.
getContents
().
with
(
binCopySpec
);
}
private
Class
<?
extends
CreateStartScripts
>
determineCreateStartScriptsClass
()
{
return
isGradle64OrLater
()
?
CreateStartScripts
.
class
:
CreateBootStartScripts
.
class
;
}
private
boolean
isGradle64OrLater
()
{
return
GradleVersion
.
current
().
getBaseVersion
().
compareTo
(
GradleVersion
.
version
(
"6.4"
))
>=
0
;
}
@SuppressWarnings
(
"unchecked"
)
private
void
configureBaseNameConvention
(
Project
project
,
ApplicationPluginConvention
applicationConvention
,
Distribution
distribution
)
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java
View file @
70c4baee
...
...
@@ -79,8 +79,8 @@ class ApplicationPluginActionIntegrationTests {
@TestTemplate
void
zipDistributionForJarCanBeBuilt
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.4"
).
build
(
"bootDistZip"
)
.
task
(
":bootDistZip"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistZip"
).
task
(
":bootDistZip"
).
getOutcome
()
)
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
File
distribution
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/distributions/"
+
name
+
"-boot.zip"
);
assertThat
(
distribution
).
isFile
();
...
...
@@ -91,8 +91,8 @@ class ApplicationPluginActionIntegrationTests {
@TestTemplate
void
tarDistributionForJarCanBeBuilt
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.4"
).
build
(
"bootDistTar"
)
.
task
(
":bootDistTar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
()
)
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
File
distribution
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/distributions/"
+
name
+
"-boot.tar"
);
assertThat
(
distribution
).
isFile
();
...
...
@@ -103,8 +103,8 @@ class ApplicationPluginActionIntegrationTests {
@TestTemplate
void
zipDistributionForWarCanBeBuilt
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.4"
).
build
(
"bootDistZip"
)
.
task
(
":bootDistZip"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistZip"
).
task
(
":bootDistZip"
).
getOutcome
()
)
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
File
distribution
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/distributions/"
+
name
+
"-boot.zip"
);
assertThat
(
distribution
).
isFile
();
...
...
@@ -115,8 +115,8 @@ class ApplicationPluginActionIntegrationTests {
@TestTemplate
void
tarDistributionForWarCanBeBuilt
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.4"
).
build
(
"bootDistTar"
)
.
task
(
":bootDistTar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
()
)
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
File
distribution
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/distributions/"
+
name
+
"-boot.tar"
);
assertThat
(
distribution
).
isFile
();
...
...
@@ -127,8 +127,8 @@ class ApplicationPluginActionIntegrationTests {
@TestTemplate
void
applicationNameCanBeUsedToCustomizeDistributionName
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.4"
).
build
(
"bootDistTar"
)
.
task
(
":bootDistTar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
()
)
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
File
distribution
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/distributions/custom-boot.tar"
);
assertThat
(
distribution
).
isFile
();
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
...
...
@@ -139,8 +139,8 @@ class ApplicationPluginActionIntegrationTests {
@TestTemplate
void
scriptsHaveCorrectPermissions
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.4"
).
build
(
"bootDistTar"
)
.
task
(
":bootDistTar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
()
)
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
File
distribution
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/distributions/"
+
name
+
"-boot.tar"
);
assertThat
(
distribution
).
isFile
();
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.gradle
View file @
70c4baee
...
...
@@ -31,8 +31,8 @@ task('javaCompileEncoding') {
task
(
'startScriptsDefaultJvmOpts'
)
{
doFirst
{
tasks
.
withType
(
org
.
springframework
.
boot
.
gradle
.
tasks
.
application
.
CreateBootStartScripts
)
{
println
"$
{name} defaultJvmOpts = ${defaultJvmOpts}
"
tasks
.
getByName
(
"bootStartScripts"
)
{
println
"$
name defaultJvmOpts = $defaultJvmOpts
"
}
}
}
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