Skip to content

Commit

Permalink
Switch to use Kotlin DSL for Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
ardetrick committed Jul 2, 2023
1 parent 240ab62 commit 14876c8
Show file tree
Hide file tree
Showing 16 changed files with 101 additions and 78 deletions.
21 changes: 0 additions & 21 deletions build.gradle

This file was deleted.

4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
allprojects {
group = "com.ardetrick"
version = "0.0.1-SNAPSHOT"
}
16 changes: 16 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal() // so that external plugins can be resolved in dependencies section
}

dependencies {
implementation("io.freefair.gradle:lombok-plugin:8.1.0")
implementation("io.spring.gradle:dependency-management-plugin:1.1.0")
}

kotlin {
jvmToolchain(17)
}
1 change: 1 addition & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "project-conventions"
15 changes: 15 additions & 0 deletions buildSrc/src/main/kotlin/project.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
java
id("io.freefair.lombok")
id("io.spring.dependency-management")
}

repositories {
mavenCentral()
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 12 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
35 changes: 0 additions & 35 deletions reference-app/build.gradle

This file was deleted.

36 changes: 36 additions & 0 deletions reference-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
id("org.springframework.boot") version "3.1.0"
id("project.java-conventions")
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-freemarker")
implementation("org.springframework.boot:spring-boot-starter-jersey")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.session:spring-session-core")
implementation("sh.ory.hydra:hydra-client:2.1.1")

testImplementation(project(":testcontainers-ory-hydra"))
testImplementation("com.auth0:java-jwt:4.2.1")
testImplementation("com.microsoft.playwright:playwright:1.28.1")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}

tasks.withType<Test> {
useJUnitPlatform()
}

// A way to run Playwright CLI commands using the Java source dependency.
// Particularly useful from within a CI context (see ./.github/workflows.gradle.yml).
// https://playwright.dev/docs/cli#install-system-dependencies
// https://github.com/microsoft/playwright-java/issues/571
// ./gradlew playwright --args="install-deps"
tasks.register<JavaExec>("playwright") {
classpath(sourceSets["test"].runtimeClasspath)
mainClass.set("com.microsoft.playwright.CLI")
if (project.hasProperty("args")) {
@Suppress("UNCHECKED_CAST")
args = project.property("args") as MutableList<String>?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public static void main(String[] args) {
SpringApplication.run(OryHydraReferenceApplication.class, args);
}


@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
// Don't use this configuration in production. Cookies should be set with http only, but is beyond
Expand Down
4 changes: 0 additions & 4 deletions settings.gradle

This file was deleted.

4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rootProject.name = "ory-hydra-reference"

include("reference-app")
include("testcontainers-ory-hydra")
9 changes: 0 additions & 9 deletions testcontainers-ory-hydra/build.gradle

This file was deleted.

10 changes: 10 additions & 0 deletions testcontainers-ory-hydra/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
id("project.java-conventions")
id("java-library")
}

dependencies {
api(platform("org.testcontainers:testcontainers-bom:1.17.6"))
api("org.testcontainers:testcontainers")
api("org.testcontainers:junit-jupiter")
}

0 comments on commit 14876c8

Please sign in to comment.