Add task to read source files

This commit is contained in:
Norbi Peti 2021-04-05 02:45:28 +02:00
parent efa1dcfc8f
commit 860dd66431
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
4 changed files with 44 additions and 36 deletions

View file

@ -1,6 +1,9 @@
import scala.io.Source
import scala.util.Using
name := "Chroma-Discord"
version := "0.1"
version := "1.1"
scalaVersion := "2.13.5"
@ -25,45 +28,13 @@ libraryDependencies ++= Seq(
"com.github.lucko.LuckPerms" % "bukkit" % "master-SNAPSHOT" % Provided,
)
/*val myAssemblySettings = inTask(assembly)(
Seq(
assemblyShadeRules := libraryDependencies.value.filter(!_.configurations.exists(_ contains "provided"))
.map { _.organization }
.map { p =>
ShadeRule.rename(s"$p.**" -> "btndvtm.dp.@0").inAll
},
assemblyMergeStrategy := {
case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.concat
// https://stackoverflow.com/a/55557287/457612
case "module-info.class" => MergeStrategy.discard
case x => assemblyMergeStrategy.value(x)
},
/*shadeResourceTransformers ++= Seq(
Rename(
"libnetty_tcnative_linux_x86_64.so" -> "libcom_couchbase_client_core_deps_netty_tcnative_linux_x86_64.so",
"libnetty_tcnative_osx_x86_64.jnilib" -> "libcom_couchbase_client_core_deps_netty_tcnative_osx_x86_64.jnilib",
"netty_tcnative_windows_x86_64.dll" -> "com_couchbase_client_core_deps_netty_tcnative_windows_x86_64.dll"
).inDir("META-INF/native"),
Discard(
"com.fasterxml.jackson.core.JsonFactory",
"com.fasterxml.jackson.core.ObjectCodec",
"com.fasterxml.jackson.databind.Module"
).inDir("META-INF/services")
)*/
)
)*/
assemblyJarName in assembly := "Chroma-Discord.jar"
//assemblyShadeRules in assembly := libraryDependencies.value.filter(!_.configurations.exists(_ contains "provided"))
assemblyShadeRules in assembly := Seq(
"io.netty", "com.fasterxml", "org.mockito", "org.slf4j"
).map { p =>
ShadeRule.rename(s"$p.**" -> "btndvtm.dp.@0").inAll
}
//logLevel in assembly := Level.Debug
assemblyMergeStrategy in assembly := {
case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.concat
// https://stackoverflow.com/a/55557287/457612
@ -71,4 +42,22 @@ assemblyMergeStrategy in assembly := {
case x => (assemblyMergeStrategy in assembly).value(x)
}
//lazy val `Chroma-Discord` = project.settings(myAssemblySettings)
lazy val commenter = project.settings(Seq(
name := "Chroma-Commenter",
version := "1.0",
organization := "com.github.TBMCPlugins"
))
val teszt = TaskKey[Unit]("teszt")
teszt := {
//val tv = target.value
val sv = (Compile / sources).value
for (file <- sv) {
Using(Source.fromFile(file)) { src =>
for (line <- src.getLines) {
if (line.contains("class"))
println(line)
}
}.recover[Unit]({ case t => t.printStackTrace() })
}
}

View file

@ -0,0 +1,3 @@
class Commenter {
}

View file

@ -1,2 +1,18 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
//addSbtPlugin("com.sandinh" % "sbt-shade" % "0.1.2")
/*lazy val commenter = project.settings(Seq(
name := "Chroma-Commenter",
version := "1.0",
organization := "com.github.TBMCPlugins"
))
lazy val root = (project in file(".")).dependsOn(commenter)*/
//addSbtPlugin("com.github.TBMCPlugins" % "Chroma-Commenter" % "1.0")
/*val Teszt = config("teszt").extend(Compile)
val teszt = TaskKey[Unit]("teszt")
teszt := target map { target => //teszt := { x.value }
println("Teszt: " + target)
}*/

View file

@ -70,7 +70,7 @@ class VanillaCommandListener14[T <: DiscordSenderBase with IMCPlayer[T]] extends
if (bukkitplayer != null && !bukkitplayer.isInstanceOf[CraftPlayer]) throw new ClassCastException("bukkitplayer must be a Bukkit player!")
}
override def sendMessage(arg0: IChatBaseComponent): Unit = {
override def sendMessage(arg0: IChatBaseComponent): scala.Unit = {
player.sendMessage(arg0.getString)
if (bukkitplayer != null) bukkitplayer.asInstanceOf[CraftPlayer].getHandle.sendMessage(arg0)
}