Skip to content

Commit

Permalink
[Gradle] Change groupId to org.playframework.twirl
Browse files Browse the repository at this point in the history
  • Loading branch information
ihostage committed Oct 6, 2023
1 parent d3c9c40 commit 83d5770
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@ Compile / TwirlKeys.compileTemplates / sourceDirectories := (Compile / unmanaged

## gradle-twirl

⚠️ `com.typesafe.play.twirl` plugin requires Gradle 7.1 or higher.
⚠️ `org.playframework.twirl` plugin requires Gradle 7.1 or higher.

To use the Twirl plugin in your project add the gradle plugin and
Twirl API as a dependency into `build.gradle.kts`:

```kotlin
plugins {
...
id("com.typesafe.play.twirl") version "LATEST_VERSION"
id("org.playframework.twirl") version "LATEST_VERSION"
}

dependencies {
implementation("com.typesafe.play", "twirl-api_${scalaVersion}", "LATEST_VERSION")
implementation("org.playframework.twirl", "twirl-api_${scalaVersion}", "LATEST_VERSION")
}
```

Expand Down Expand Up @@ -180,7 +180,7 @@ sourceSets {

### Snapshots

To use a snapshot version add the [Sonatype Snapshot repository](https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/play/twirl/com.typesafe.play.twirl.gradle.plugin/) into `settings.gradle.kts`:
To use a snapshot version add the [Sonatype Snapshot repository](https://oss.sonatype.org/content/repositories/snapshots/org/playframework/twirl/org.playframework.twirl.gradle.plugin/) into `settings.gradle.kts`:

```kotlin
pluginManagement {
Expand Down
7 changes: 3 additions & 4 deletions gradle-twirl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ val compilerVersion: String =
if (this.getProperty("twirl.compiler.version").isNullOrEmpty()) throw GradleException("`twirl.compiler.version` key didn't find in ${file.absolutePath}")
}.getProperty("twirl.compiler.version")

// group = "org.playframework" // group and plugin id must use same top level namespace
group = "com.typesafe.play" // TODO: uncomment line above and remove this
group = "org.playframework.twirl"
version = compilerVersion

repositories {
Expand All @@ -31,7 +30,7 @@ repositories {
}

dependencies {
compileOnly("com.typesafe.play:twirl-compiler_2.13:$compilerVersion")
compileOnly("org.playframework.twirl:twirl-compiler_2.13:$compilerVersion")
testImplementation(libs.assertj)
testImplementation(libs.commons.io)
testImplementation(libs.freemarker)
Expand Down Expand Up @@ -82,7 +81,7 @@ gradlePlugin {
website.set("https://www.playframework.com/documentation/latest/ScalaTemplates")
vcsUrl.set("https://github.com/playframework/twirl")
val twirl by plugins.creating {
id = "com.typesafe.play.twirl" // TODO: rename to "org.playframework.twirl"
id = "org.playframework.twirl"
displayName = "Twirl Plugin"
description = "A Gradle plugin to compile Twirl templates"
tags.set(listOf("playframework", "web", "template", "java", "scala"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private Configuration createDefaultTwirlConfiguration(
.getDependencies()
.create(
String.format(
"com.typesafe.play:twirl-compiler_%s:%s",
"org.playframework.twirl:twirl-compiler_%s:%s",
twirlExtension.getScalaVersion().get(), getDefaultTwirlVersion()));
dependencies.add(twirlCompiler);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ protected BuildResult build(String gradleVersion, String... args) {
static Stream<String> gradleVersions() {
// https://docs.gradle.org/current/userguide/scala_plugin.html#sec:configure_zinc_compiler
if (getScalaVersion().equals("3")) { // Gradle 7.5+
return Stream.of("7.6.2", "8.0.2", "8.3");
return Stream.of("7.6.2", "8.0.2", "8.4");
}
// https://docs.gradle.org/current/userguide/compatibility.html
if (JavaVersion.current().compareTo(JavaVersion.VERSION_17) >= 0) { // Gradle 7.3+
return Stream.of("7.6.2", "8.0.2", "8.3");
return Stream.of("7.6.2", "8.0.2", "8.4");
}
return Stream.of("7.1.1", "7.6.2", "8.0.2", "8.3");
return Stream.of("7.1.1", "7.6.2", "8.0.2", "8.4");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TwirlPluginTest {
void init() {
project = ProjectBuilder.builder().build();
project.getPluginManager().apply("application");
project.getPluginManager().apply("com.typesafe.play.twirl");
project.getPluginManager().apply("org.playframework.twirl");
}

@Test
Expand All @@ -47,7 +47,7 @@ void configurationShouldBeRegistered() {
assertThat(conf.getDependencies())
.anyMatch(
dependency ->
"com.typesafe.play".equals(dependency.getGroup())
"org.playframework.twirl".equals(dependency.getGroup())
&& dependency.getName().startsWith("twirl-compiler"));
}

Expand Down
4 changes: 2 additions & 2 deletions gradle-twirl/src/test/resources/simple/build.gradle.kts.ftlh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
application
id("com.typesafe.play.twirl")
id("org.playframework.twirl")
}

repositories {
Expand All @@ -9,7 +9,7 @@ repositories {
}

dependencies {
implementation("com.typesafe.play:twirl-api_${scalaVersion}:${twirlVersion}")
implementation("org.playframework.twirl:twirl-api_${scalaVersion}:${twirlVersion}")
}

twirl {
Expand Down

0 comments on commit 83d5770

Please sign in to comment.