-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/main' into bump-ehc…
…ache # Conflicts: # project/BuildSettings.scala
- Loading branch information
Showing
19 changed files
with
327 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:recommended" | ||
], | ||
"enabledManagers": ["gradle-wrapper"], | ||
"labels": [ | ||
"type:updates" | ||
], | ||
"commitMessageTopic": "`{{depName}}`", | ||
"commitMessageExtra": "to `{{#if isPinDigest}}{{{newDigestShort}}}{{else}}{{#if isMajor}}v{{{newMajor}}}{{else}}{{#if isSingleVersion}}v{{{newVersion}}}{{else}}{{#if newValue}}{{{newValue}}}{{else}}{{{newDigestShort}}}{{/if}}{{/if}}{{/if}}{{/if}}` (was `{{currentVersion}}`)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
dev-mode/gradle-plugin/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionSha256Sum=f2b9ed0faf8472cbe469255ae6c86eddb77076c75191741b4a462f33128dd419 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip | ||
distributionSha256Sum=194717442575a6f96e1c1befa2c30e9a4fc90f701d7aee33eb879b79e7ff05c0 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
dev-mode/gradle-plugin/src/test/java/play/gradle/PlayPluginTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
package play.gradle; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.gradle.api.Project; | ||
import org.gradle.testfixtures.ProjectBuilder; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** A simple unit test to check a Play Gradle Plugin */ | ||
class PlayPluginTest { | ||
|
||
private Project project; | ||
|
||
@BeforeEach | ||
void init() { | ||
project = ProjectBuilder.builder().build(); | ||
project.getPluginManager().apply("application"); | ||
project.getPluginManager().apply("org.playframework.play"); | ||
} | ||
|
||
@Test | ||
@DisplayName("Play extension should be registered") | ||
void extensionShouldBeRegistered() { | ||
PlayExtension ext = (PlayExtension) project.getExtensions().findByName("play"); | ||
assertThat(ext).isNotNull(); | ||
assertThat((ext).getLang().getOrNull()).isEqualTo(Language.JAVA); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
dev-mode/gradle-plugin/src/test/java/play/gradle/PlayRoutesPluginTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
package play.gradle; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static play.gradle.internal.Utils.javaPluginExtension; | ||
|
||
import org.gradle.api.Project; | ||
import org.gradle.api.artifacts.Configuration; | ||
import org.gradle.api.file.SourceDirectorySet; | ||
import org.gradle.api.internal.artifacts.configurations.DefaultConfiguration; | ||
import org.gradle.api.tasks.SourceSet; | ||
import org.gradle.testfixtures.ProjectBuilder; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import play.gradle.plugin.PlayPlugin; | ||
|
||
/** A simple unit test to check a Play Routes Plugin */ | ||
class PlayRoutesPluginTest { | ||
|
||
private Project project; | ||
|
||
@BeforeEach | ||
void init() { | ||
project = ProjectBuilder.builder().build(); | ||
project.getPluginManager().apply("application"); | ||
project.getPluginManager().apply("org.playframework.play"); | ||
} | ||
|
||
@Test | ||
@DisplayName("Play Routes configuration should be registered") | ||
void routesConfigurationShouldBeRegistered() { | ||
Configuration conf = project.getConfigurations().findByName("playRoutes"); | ||
assertThat(conf).isNotNull(); | ||
assertThat(conf.isTransitive()).isTrue(); | ||
assertThat(conf.isVisible()).isFalse(); | ||
((DefaultConfiguration) conf).runDependencyActions(); | ||
assertThat(conf.getDependencies()) | ||
.anyMatch( | ||
dependency -> | ||
PlayPlugin.PLAY_GROUP_ID.equals(dependency.getGroup()) | ||
&& dependency.getName().startsWith("play-routes-compiler")); | ||
} | ||
|
||
@Test | ||
@DisplayName("Routes source directory set should be registered for main source set") | ||
void routesSourceDirectorySetShouldBeRegisteredForMainSourceSet() { | ||
checkRoutesSourceDirectorySet(javaPluginExtension(project).getSourceSets().getByName("main")); | ||
} | ||
|
||
@Test | ||
@DisplayName("Routes source directory set should be registered for test source set") | ||
void routesSourceDirectorySetShouldBeRegisteredForTestSourceSet() { | ||
checkRoutesSourceDirectorySet(javaPluginExtension(project).getSourceSets().getByName("test")); | ||
} | ||
|
||
@Test | ||
@DisplayName("Routes compile task should be registered for main/test source sets") | ||
void compileTasksShouldBeRegistered() { | ||
assertThat(project.getTasks().findByName("compilePlayRoutes")).isNotNull(); | ||
assertThat(project.getTasks().findByName("compileTestPlayRoutes")).isNotNull(); | ||
} | ||
|
||
private void checkRoutesSourceDirectorySet(SourceSet sourceSet) { | ||
assertThat(sourceSet).isNotNull(); | ||
SourceDirectorySet routesSourceSet = | ||
(SourceDirectorySet) sourceSet.getExtensions().findByName("routes"); | ||
assertThat(routesSourceSet).isNotNull(); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
dev-mode/gradle-plugin/src/test/java/play/gradle/PlayRunPluginTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
package play.gradle; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.io.File; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.internal.SettingsInternal; | ||
import org.gradle.api.internal.project.DefaultProject; | ||
import org.gradle.groovy.scripts.ScriptSource; | ||
import org.gradle.initialization.SettingsState; | ||
import org.gradle.internal.resource.ResourceLocation; | ||
import org.gradle.internal.resource.TextResource; | ||
import org.gradle.invocation.DefaultGradle; | ||
import org.gradle.testfixtures.ProjectBuilder; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import play.gradle.task.PlayRun; | ||
|
||
/** A simple unit test to check a Play Run Plugin */ | ||
class PlayRunPluginTest { | ||
|
||
private Project project; | ||
|
||
@BeforeEach | ||
void init() { | ||
project = ProjectBuilder.builder().build(); | ||
project.getPluginManager().apply("application"); | ||
project.getPluginManager().apply("org.playframework.play"); | ||
((DefaultGradle) project.getGradle()).attachSettings(mockSettings()); | ||
} | ||
|
||
/** Workaround <a href="https://github.com/gradle/gradle/issues/20301">gradle#20301</a> */ | ||
private SettingsState mockSettings() { | ||
var locationMock = mock(ResourceLocation.class); | ||
when(locationMock.getFile()).thenReturn(new File(".")); | ||
var resourcesMock = mock(TextResource.class); | ||
when(resourcesMock.getLocation()).thenReturn(locationMock); | ||
var settingsScriptMock = mock(ScriptSource.class); | ||
when(settingsScriptMock.getResource()).thenReturn(resourcesMock); | ||
var settingsInternal = mock(SettingsInternal.class); | ||
when(settingsInternal.getSettingsScript()).thenReturn(settingsScriptMock); | ||
SettingsState settings = mock(SettingsState.class); | ||
when(settings.getSettings()).thenReturn(settingsInternal); | ||
return settings; | ||
} | ||
|
||
@Test | ||
@DisplayName("Check classpath with submodules") | ||
void checkClasspathWithSubmodules() { | ||
Project javaLib = ProjectBuilder.builder().withParent(project).withName("java-lib").build(); | ||
javaLib.getPluginManager().apply("java"); | ||
|
||
Project scalaLib = ProjectBuilder.builder().withParent(project).withName("scala-lib").build(); | ||
scalaLib.getPluginManager().apply("scala"); | ||
|
||
project.getRepositories().add(project.getRepositories().mavenCentral()); | ||
project.getDependencies().add("implementation", javaLib); | ||
project.getDependencies().add("implementation", scalaLib); | ||
|
||
((DefaultProject) project).evaluate(); | ||
|
||
assertThat(((PlayRun) project.getTasks().findByName("playRun")).getClasses()) | ||
.contains( | ||
project.getLayout().getBuildDirectory().file("classes/scala/main").get().getAsFile(), | ||
project.getLayout().getBuildDirectory().file("classes/java/main").get().getAsFile(), | ||
project.getLayout().getBuildDirectory().file("resources/main").get().getAsFile(), | ||
javaLib.getLayout().getBuildDirectory().file("classes/java/main").get().getAsFile(), | ||
javaLib.getLayout().getBuildDirectory().file("resources/main").get().getAsFile(), | ||
scalaLib.getLayout().getBuildDirectory().file("classes/scala/main").get().getAsFile(), | ||
scalaLib.getLayout().getBuildDirectory().file("classes/java/main").get().getAsFile(), | ||
scalaLib.getLayout().getBuildDirectory().file("resources/main").get().getAsFile()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.