Skip to content

Commit

Permalink
Merge pull request #4 from alyssaburlton/bump-versions
Browse files Browse the repository at this point in the history
Upgrade Gradle, Kotlin and dependencies
  • Loading branch information
alyssaruth authored Feb 22, 2023
2 parents 5c2dd56 + c7adf0a commit b946c57
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 91 deletions.
85 changes: 40 additions & 45 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
id 'org.jetbrains.kotlin.jvm' version '1.8.0'
id "maven-publish"
id 'java-library'
id 'signing'
id 'org.jetbrains.dokka' version '0.10.1'
}

apply plugin: 'maven'
apply plugin: 'signing'

group 'com.github.alyssaburlton'
group 'com.github.alexburlton'
version '2.0.0'

repositories {
mavenCentral()
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "io.kotlintest:kotlintest-assertions:3.4.2"
implementation "org.junit.jupiter:junit-jupiter-api:5.1.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0"
implementation 'io.kotest:kotest-assertions-core:5.5.4'
implementation "org.junit.jupiter:junit-jupiter-api:5.9.2"

testImplementation "io.mockk:mockk:1.9.3"
testImplementation "io.kotlintest:kotlintest-assertions:3.4.2"
testImplementation "io.mockk:mockk:1.13.4"
testImplementation 'org.mockito:mockito-core:3.3.3'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.1.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.1.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.2"
}

compileKotlin {
Expand Down Expand Up @@ -63,44 +60,23 @@ artifacts {
archives javadocJar, sourcesJar
}

signing {
sign configurations.archives
}

java {
withJavadocJar()
withSourcesJar()
}

ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'swing-test'
packaging 'jar'
description 'Kotlin swing testing library'
url 'https://github.com/alyssaburlton/swing-test'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'com.github.alexburlton'
artifactId = 'swing-test'
version = '2.0.0'
from components.java

scm {
url = "https://github.com/alyssaburlton/swing-test"
}
pom {
name = 'swing-test'
description = 'Kotlin swing testing library'
url = 'https://github.com/alyssaburlton/swing-test'

licenses {
license {
Expand All @@ -115,7 +91,26 @@ uploadArchives {
name = 'Alyssa Burlton'
}
}

scm {
url = "https://github.com/alyssaburlton/swing-test"
}
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = project.ossrhUsername
password = project.ossrhPassword
}
}
}
}

signing {
sign publishing.publications.mavenJava
}
8 changes: 7 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
kotlin.code.style=official
kotlin.code.style=official

signing.keyId=
signing.password=
signing.secretKeyRingFile=
ossrhUsername=
ossrhPassword=
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
51 changes: 31 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$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"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down Expand Up @@ -138,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -159,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

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

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.alyssaburlton.swingtest

import io.kotlintest.shouldBe
import io.kotest.matchers.shouldBe
import java.awt.Component

fun Component.shouldBeEnabled() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.github.alyssaburlton.swingtest

import io.kotlintest.fail
import io.kotlintest.shouldBe
import io.kotest.assertions.fail
import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.Assumptions
import java.awt.Point
import java.awt.image.BufferedImage
import java.io.File
import java.util.*
import javax.imageio.ImageIO
import javax.swing.Icon
import javax.swing.JComponent
Expand Down Expand Up @@ -81,9 +80,9 @@ fun JComponent.shouldMatchImage(imageName: String) {
}

private fun verifyOs() {
val osForScreenshots = (System.getProperty(ENV_SCREENSHOT_OS) ?: "").toLowerCase(Locale.ENGLISH)
val osForScreenshots = (System.getProperty(ENV_SCREENSHOT_OS) ?: "").lowercase()

val os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH)
val os = System.getProperty("os.name").lowercase()
if (osForScreenshots.isNotEmpty()) {
Assumptions.assumeTrue(os.contains(osForScreenshots),
"Wrong OS for screenshot tests (wanted $osForScreenshots, found $os)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.alyssaburlton.swingtest

import io.kotlintest.shouldNotThrowAny
import io.kotlintest.shouldThrow
import io.kotest.assertions.throwables.shouldNotThrowAny
import io.kotest.assertions.throwables.shouldThrow
import org.junit.jupiter.api.Test
import javax.swing.JLabel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.alyssaburlton.swingtest

import io.kotlintest.matchers.collections.shouldContainExactly
import io.kotlintest.matchers.types.shouldBeNull
import io.kotlintest.shouldBe
import io.kotlintest.shouldThrow
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.matchers.collections.shouldContainExactly
import io.kotest.matchers.nulls.shouldBeNull
import io.kotest.matchers.shouldBe
import io.mockk.mockk
import io.mockk.verify
import org.junit.jupiter.api.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.alyssaburlton.swingtest

import io.kotlintest.shouldBe
import io.kotest.matchers.shouldBe
import io.mockk.MockKMatcherScope
import io.mockk.mockk
import io.mockk.verify
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.github.alyssaburlton.swingtest

import io.kotlintest.matchers.collections.shouldContainExactly
import io.kotlintest.matchers.file.shouldExist
import io.kotlintest.matchers.file.shouldNotExist
import io.kotlintest.shouldBe
import io.kotlintest.shouldNotThrowAny
import io.kotlintest.shouldThrow
import io.kotest.assertions.throwables.shouldNotThrowAny
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.matchers.collections.shouldContainExactly
import io.kotest.matchers.file.shouldExist
import io.kotest.matchers.file.shouldNotExist
import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
Expand All @@ -15,7 +15,6 @@ import java.awt.Dimension
import java.awt.Point
import java.awt.image.BufferedImage
import java.io.File
import java.util.*
import javax.imageio.ImageIO
import javax.swing.ImageIcon
import javax.swing.JComponent
Expand All @@ -24,7 +23,7 @@ import javax.swing.JLabel
class SwingSnapshotsTest {
private val resourceLocation =
"src/test/resources/__snapshots__/com.github.alyssaburlton.swingtest.SwingSnapshotsTest"
private val os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH)
private val os = System.getProperty("os.name").lowercase()

@BeforeEach
fun before() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.alyssaburlton.swingtest

import io.kotlintest.shouldNotThrowAny
import io.kotlintest.shouldThrow
import io.kotest.assertions.throwables.shouldNotThrowAny
import io.kotest.assertions.throwables.shouldThrow
import io.mockk.mockk
import io.mockk.verify
import org.junit.jupiter.api.Test
Expand Down

0 comments on commit b946c57

Please sign in to comment.