From: David ‘Bombe’ Roden Date: Wed, 10 Jul 2019 19:39:12 +0000 (+0200) Subject: 🐛 Fix version parsing in SoneModule X-Git-Tag: v81^2~197 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=562aaadc1d11a79f467189cff0a95a7d19d56e51;p=Sone.git 🐛 Fix version parsing in SoneModule --- diff --git a/build.gradle b/build.gradle index 0beb42a..dc7878c 100644 --- a/build.gradle +++ b/build.gradle @@ -20,8 +20,8 @@ repositories { apply plugin: 'java' -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' @@ -43,7 +43,7 @@ dependencies { provided group: 'org.freenetproject', name: 'freenet-ext', version: '29' provided group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.54' - compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib' + compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8' compile group: 'net.pterodactylus', name: 'utils', version: '0.12.4' compile group: 'com.google.inject', name: 'guice', version: '4.2.2' compile group: 'com.google.guava', name: 'guava', version: '27.0.1-android' diff --git a/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt b/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt index a3fe9be..6a349eb 100644 --- a/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/main/SoneModule.kt @@ -44,7 +44,7 @@ class SoneModule(private val sonePlugin: SonePlugin) : AbstractModule() { bind(Context::class.java).toInstance(context) bind(object : TypeLiteral>() {}).toInstance(Optional.of(context)) bind(SonePlugin::class.java).toInstance(sonePlugin) - bind(Version::class.java).toInstance(sonePlugin.version.parseVersion()) + bind(Version::class.java).toInstance(sonePlugin.version.drop(1).parseVersion()) bind(PluginVersion::class.java).toInstance(PluginVersion(sonePlugin.version)) bind(PluginYear::class.java).toInstance(PluginYear(sonePlugin.year)) bind(PluginHomepage::class.java).toInstance(PluginHomepage(sonePlugin.homepage)) diff --git a/src/test/kotlin/net/pterodactylus/sone/main/SoneModuleTest.kt b/src/test/kotlin/net/pterodactylus/sone/main/SoneModuleTest.kt index 83d3535..62f947c 100644 --- a/src/test/kotlin/net/pterodactylus/sone/main/SoneModuleTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/main/SoneModuleTest.kt @@ -16,14 +16,16 @@ import org.junit.* import java.io.* import java.util.concurrent.atomic.* +const val versionString = "v80" + class SoneModuleTest { private val currentDir: File = File(".") - private val pluginVersion = Version("", 0, 1, 2) + private val pluginVersion = Version("", 80) private val pluginYear = 2019 private val pluginHomepage = "home://page" private val sonePlugin = mock().apply { - whenever(version).thenReturn(pluginVersion.toString()) + whenever(version).thenReturn(versionString) whenever(year).thenReturn(pluginYear) whenever(homepage).thenReturn(pluginHomepage) } @@ -113,7 +115,7 @@ class SoneModuleTest { @Test fun `plugin version is bound`() { - assertThat(injector.getInstance(), equalTo(PluginVersion(pluginVersion.toString()))) + assertThat(injector.getInstance(), equalTo(PluginVersion(versionString))) } @Test