Upgrade to JDK 16, Kotlin 1.3.21 and Gradle 7.1.1
This commit is contained in:
parent
c8259385f3
commit
8c86509e62
18 changed files with 74 additions and 48 deletions
|
@ -30,11 +30,11 @@ defaults_gradle: &defaults_gradle
|
||||||
path: build/reports/
|
path: build/reports/
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_gradle_jdk14:
|
build_gradle_jdk16:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
- image: openjdk:14-jdk
|
- image: cimg/openjdk:16.0
|
||||||
|
|
||||||
<<: *defaults_gradle
|
<<: *defaults_gradle
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ jobs:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/openjdk:8-jdk
|
- image: cimg/openjdk:8.0
|
||||||
|
|
||||||
<<: *defaults_gradle
|
<<: *defaults_gradle
|
||||||
|
|
||||||
|
@ -51,4 +51,4 @@ workflows:
|
||||||
gradle:
|
gradle:
|
||||||
jobs:
|
jobs:
|
||||||
- build_gradle_jdk8
|
- build_gradle_jdk8
|
||||||
- build_gradle_jdk14
|
- build_gradle_jdk16
|
||||||
|
|
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [ 1.8, 11, 15 ]
|
java-version: [ 1.8, 11, 16 ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -47,6 +47,7 @@
|
||||||
/**/.idea/**/uiDesigner.xml
|
/**/.idea/**/uiDesigner.xml
|
||||||
/**/.idea/**/usage.statistics.xml
|
/**/.idea/**/usage.statistics.xml
|
||||||
/**/.idea/**/workspace.xml
|
/**/.idea/**/workspace.xml
|
||||||
|
/**/.idea/sonarlint*
|
||||||
/**/.idea_modules/
|
/**/.idea_modules/
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|
2
.idea/isgd-shorten.iml
generated
2
.idea/isgd-shorten.iml
generated
|
@ -1,2 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4" />
|
|
10
.idea/jarRepositories.xml
generated
10
.idea/jarRepositories.xml
generated
|
@ -26,5 +26,15 @@
|
||||||
<option name="name" value="MavenLocal" />
|
<option name="name" value="MavenLocal" />
|
||||||
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenRepo" />
|
||||||
|
<option name="name" value="MavenRepo" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven" />
|
||||||
|
<option name="name" value="maven" />
|
||||||
|
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
@ -4,7 +4,7 @@
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="15" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|
|
@ -4,17 +4,17 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.ben-manes.versions") version "0.39.0"
|
id("com.github.ben-manes.versions") version "0.39.0"
|
||||||
id("io.gitlab.arturbosch.detekt") version "1.17.1"
|
id("io.gitlab.arturbosch.detekt") version "1.18.0-RC2"
|
||||||
id("jacoco")
|
id("jacoco")
|
||||||
id("java")
|
id("java")
|
||||||
id("java-library")
|
id("java-library")
|
||||||
id("maven-publish")
|
id("maven-publish")
|
||||||
id("net.thauvin.erik.gradle.semver") version "1.0.4"
|
id("net.thauvin.erik.gradle.semver") version "1.0.4"
|
||||||
id("org.jetbrains.dokka") version "1.4.32"
|
id("org.jetbrains.dokka") version "1.5.0"
|
||||||
id("org.sonarqube") version "3.3"
|
id("org.sonarqube") version "3.3"
|
||||||
id("signing")
|
id("signing")
|
||||||
kotlin("jvm") version "1.5.10"
|
kotlin("jvm") version "1.5.21"
|
||||||
kotlin("kapt") version "1.5.10"
|
kotlin("kapt") version "1.5.21"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "net.thauvin.erik"
|
group = "net.thauvin.erik"
|
||||||
|
@ -98,8 +98,8 @@ tasks {
|
||||||
jacocoTestReport {
|
jacocoTestReport {
|
||||||
dependsOn(test)
|
dependsOn(test)
|
||||||
reports {
|
reports {
|
||||||
xml.isEnabled = true
|
xml.required.set(true)
|
||||||
html.isEnabled = true
|
html.required.set(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("application")
|
id("application")
|
||||||
id("com.github.ben-manes.versions") version "0.39.0"
|
id("com.github.ben-manes.versions") version "0.39.0"
|
||||||
kotlin("jvm") version "1.5.10"
|
kotlin("jvm") version "1.5.21"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew run --args='https://www.example.com https://is.gd/Pt2sET'
|
// ./gradlew run --args='https://www.example.com https://is.gd/Pt2sET'
|
||||||
|
@ -23,7 +23,7 @@ application {
|
||||||
tasks {
|
tasks {
|
||||||
register("runJava", JavaExec::class) {
|
register("runJava", JavaExec::class) {
|
||||||
group = "application"
|
group = "application"
|
||||||
main = "com.example.IsgdSample"
|
mainClass.set("com.example.IsgdSample")
|
||||||
classpath = sourceSets.main.get().runtimeClasspath
|
classpath = sourceSets.main.get().runtimeClasspath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
examples/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
examples/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
2
examples/gradlew
vendored
2
examples/gradlew
vendored
|
@ -72,7 +72,7 @@ case "`uname`" in
|
||||||
Darwin* )
|
Darwin* )
|
||||||
darwin=true
|
darwin=true
|
||||||
;;
|
;;
|
||||||
MINGW* )
|
MSYS* | MINGW* )
|
||||||
msys=true
|
msys=true
|
||||||
;;
|
;;
|
||||||
NONSTOP* )
|
NONSTOP* )
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
2
gradlew
vendored
2
gradlew
vendored
|
@ -72,7 +72,7 @@ case "`uname`" in
|
||||||
Darwin* )
|
Darwin* )
|
||||||
darwin=true
|
darwin=true
|
||||||
;;
|
;;
|
||||||
MINGW* )
|
MSYS* | MINGW* )
|
||||||
msys=true
|
msys=true
|
||||||
;;
|
;;
|
||||||
NONSTOP* )
|
NONSTOP* )
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -40,7 +40,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin-bom</artifactId>
|
<artifactId>kotlin-bom</artifactId>
|
||||||
<version>1.5.10</version>
|
<version>1.5.21</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||||
<version>1.5.10</version>
|
<version>1.5.21</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -1 +1,18 @@
|
||||||
|
plugins {
|
||||||
|
id("com.gradle.enterprise").version("3.6.3")
|
||||||
|
}
|
||||||
|
|
||||||
|
gradleEnterprise {
|
||||||
|
buildScan {
|
||||||
|
link("GitHub", "https://github.com/ethauvin/isgd-shorten/tree/master")
|
||||||
|
if (!System.getenv("CI").isNullOrEmpty()) {
|
||||||
|
isUploadInBackground = false
|
||||||
|
publishOnFailure()
|
||||||
|
tag("CI")
|
||||||
|
}
|
||||||
|
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||||
|
termsOfServiceAgree = "yes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rootProject.name = "isgd-shorten"
|
rootProject.name = "isgd-shorten"
|
||||||
|
|
|
@ -56,8 +56,8 @@ class Isgd private constructor() {
|
||||||
private fun callApi(url: String): String {
|
private fun callApi(url: String): String {
|
||||||
val connection = URL(url).openConnection() as HttpURLConnection
|
val connection = URL(url).openConnection() as HttpURLConnection
|
||||||
connection.setRequestProperty(
|
connection.setRequestProperty(
|
||||||
"User-Agent",
|
"User-Agent",
|
||||||
"Mozilla/5.0 (Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0"
|
"Mozilla/5.0 (Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0"
|
||||||
)
|
)
|
||||||
if (connection.responseCode in 200..399) {
|
if (connection.responseCode in 200..399) {
|
||||||
return connection.inputStream.bufferedReader().readText()
|
return connection.inputStream.bufferedReader().readText()
|
||||||
|
@ -77,10 +77,10 @@ class Isgd private constructor() {
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@Throws(IsgdException::class)
|
@Throws(IsgdException::class)
|
||||||
fun lookup(
|
fun lookup(
|
||||||
shorturl: String,
|
shorturl: String,
|
||||||
callback: String = "",
|
callback: String = "",
|
||||||
format: Format = Format.SIMPLE,
|
format: Format = Format.SIMPLE,
|
||||||
isVgd: Boolean = false
|
isVgd: Boolean = false
|
||||||
): String {
|
): String {
|
||||||
if (shorturl.isEmpty()) {
|
if (shorturl.isEmpty()) {
|
||||||
throw IllegalArgumentException("Please specify a valid short URL to lookup.")
|
throw IllegalArgumentException("Please specify a valid short URL to lookup.")
|
||||||
|
@ -104,12 +104,12 @@ class Isgd private constructor() {
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@Throws(IsgdException::class)
|
@Throws(IsgdException::class)
|
||||||
fun shorten(
|
fun shorten(
|
||||||
url: String,
|
url: String,
|
||||||
shorturl: String = "",
|
shorturl: String = "",
|
||||||
callback: String = "",
|
callback: String = "",
|
||||||
logstats: Boolean = false,
|
logstats: Boolean = false,
|
||||||
format: Format = Format.SIMPLE,
|
format: Format = Format.SIMPLE,
|
||||||
isVgd: Boolean = false
|
isVgd: Boolean = false
|
||||||
): String {
|
): String {
|
||||||
if (url.isEmpty()) {
|
if (url.isEmpty()) {
|
||||||
throw IllegalArgumentException("Please enter a valid URL to shorten.")
|
throw IllegalArgumentException("Please enter a valid URL to shorten.")
|
||||||
|
|
|
@ -45,9 +45,9 @@ class IsgdTest {
|
||||||
@Test
|
@Test
|
||||||
fun testException() {
|
fun testException() {
|
||||||
assertFailsWith(
|
assertFailsWith(
|
||||||
message = "URL is already shorten",
|
message = "URL is already shorten",
|
||||||
exceptionClass = IsgdException::class,
|
exceptionClass = IsgdException::class,
|
||||||
block = { Isgd.shorten(shortUrl) }
|
block = { Isgd.shorten(shortUrl) }
|
||||||
)
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -68,17 +68,17 @@ class IsgdTest {
|
||||||
fun testLookupJson() {
|
fun testLookupJson() {
|
||||||
assertEquals("{ \"url\": \"$url\" }", Isgd.lookup(shortUrl, format = Format.JSON))
|
assertEquals("{ \"url\": \"$url\" }", Isgd.lookup(shortUrl, format = Format.JSON))
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"test({ \"url\": \"$url\" });",
|
"test({ \"url\": \"$url\" });",
|
||||||
Isgd.lookup(shortUrl, callback = "test", format = Format.JSON),
|
Isgd.lookup(shortUrl, callback = "test", format = Format.JSON),
|
||||||
"with callback"
|
"with callback"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLookupXml() {
|
fun testLookupXml() {
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><output><url>$url</url></output>",
|
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><output><url>$url</url></output>",
|
||||||
Isgd.lookup(shortUrl, format = Format.XML)
|
Isgd.lookup(shortUrl, format = Format.XML)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,18 +92,18 @@ class IsgdTest {
|
||||||
fun testShortenJson() {
|
fun testShortenJson() {
|
||||||
assertEquals("{ \"shorturl\": \"$shortUrl\" }", Isgd.shorten(url, format = Format.JSON))
|
assertEquals("{ \"shorturl\": \"$shortUrl\" }", Isgd.shorten(url, format = Format.JSON))
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"test({ \"shorturl\": \"$shortUrl\" });",
|
"test({ \"shorturl\": \"$shortUrl\" });",
|
||||||
Isgd.shorten(url, callback = "test", format = Format.JSON),
|
Isgd.shorten(url, callback = "test", format = Format.JSON),
|
||||||
"with callback"
|
"with callback"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testShortenXml() {
|
fun testShortenXml() {
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
|
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
|
||||||
"<output><shorturl>$shortUrl</shorturl></output>",
|
"<output><shorturl>$shortUrl</shorturl></output>",
|
||||||
Isgd.shorten(url, format = Format.XML)
|
Isgd.shorten(url, format = Format.XML)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue