mirror of
https://github.com/tribufu/tribufu-java
synced 2026-05-06 06:47:27 +00:00
Migrate bindings to scala
This commit is contained in:
parent
f2d04bfd4d
commit
4c02add6f3
9 changed files with 131 additions and 115 deletions
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,5 +1,6 @@
|
|||
#Tue Jun 14 20:30:35 BRT 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
plugins {
|
||||
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
// Apply the scala Plugin to add support for Scala.
|
||||
id "scala"
|
||||
|
||||
// Apply the java-library plugin for API and implementation separation.
|
||||
id "java-library"
|
||||
|
|
@ -15,20 +15,19 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
// Align versions of all Kotlin components
|
||||
implementation platform("org.jetbrains.kotlin:kotlin-bom")
|
||||
|
||||
// Use the Kotlin JDK 8 standard library.
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
// Use Scala 2.13 in our library project
|
||||
implementation "org.scala-lang:scala-library:2.13.3"
|
||||
|
||||
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
|
||||
implementation "com.google.guava:guava:30.0-jre"
|
||||
|
||||
// Use the Kotlin test library.
|
||||
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
||||
// Use Scalatest for testing our library
|
||||
testImplementation "junit:junit:4.13.1"
|
||||
testImplementation "org.scalatest:scalatest_2.13:3.2.3"
|
||||
testImplementation "org.scalatestplus:junit-4-13_2.13:3.2.2.0"
|
||||
|
||||
// Use the Kotlin JUnit integration.
|
||||
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||
// Need scala-xml at test runtime
|
||||
testRuntimeOnly "org.scala-lang.modules:scala-xml_2.13:1.2.0"
|
||||
|
||||
// This dependency is exported to consumers, that is to say found on their compile classpath.
|
||||
api "org.apache.commons:commons-math3:3.6.1"
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
package com.tribufu.sdk
|
||||
|
||||
class TribuFu {
|
||||
// Used to load the 'TribuFu' library on application startup.
|
||||
init {
|
||||
System.loadLibrary("TribuFu_Jvm")
|
||||
}
|
||||
|
||||
/** A native method that is implemented by the 'TribuFu' native library. */
|
||||
external fun getVersion(): String
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
package com.tribufu.sdk.models
|
||||
|
||||
class Email {
|
||||
var address = ""
|
||||
var user_id = "1"
|
||||
var confirmed = false
|
||||
var primary = true
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
package com.tribufu.sdk.models
|
||||
|
||||
class User {
|
||||
var id = ""
|
||||
var name = ""
|
||||
var display_name = ""
|
||||
var password_hash = ""
|
||||
var role = Role.User
|
||||
var confirmed = false
|
||||
var two_factor_enabled = false
|
||||
var first_name = ""
|
||||
var last_name = ""
|
||||
var verified = false
|
||||
var parental_control = false
|
||||
var profile_url = ""
|
||||
var public_birthday = false
|
||||
var Birthday = ""
|
||||
var location = ""
|
||||
var timezone = ""
|
||||
var language = ""
|
||||
var currency = ""
|
||||
var theme = Theme.Light
|
||||
var ip_address = ""
|
||||
var registration_ip_address = ""
|
||||
var Joined = ""
|
||||
var Updated = ""
|
||||
var failed_logins = 0
|
||||
var about = ""
|
||||
var profile_views = 0
|
||||
var content = 0
|
||||
var avatar_url = ""
|
||||
var background_url = ""
|
||||
var status = Status.Offline
|
||||
var LastOnline = ""
|
||||
var LastActivity = ""
|
||||
var LastPost = ""
|
||||
var warnings = 0
|
||||
var LastWarn = ""
|
||||
}
|
||||
|
||||
enum class Role {
|
||||
User,
|
||||
Bot,
|
||||
Helper,
|
||||
Tester,
|
||||
Developer,
|
||||
Moderator,
|
||||
Admin,
|
||||
Root
|
||||
}
|
||||
|
||||
enum class Theme {
|
||||
Light,
|
||||
Dark
|
||||
}
|
||||
|
||||
enum class Status {
|
||||
Offline,
|
||||
Away,
|
||||
Disturb,
|
||||
Online,
|
||||
Playing
|
||||
}
|
||||
102
library/src/main/scala/com/tribufu/sdk/Library.scala
Normal file
102
library/src/main/scala/com/tribufu/sdk/Library.scala
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
package com.tribufu.sdk
|
||||
|
||||
class Library {
|
||||
def alive(): Boolean = true
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
package com.tribufu.sdk
|
||||
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class TribuFuTest {
|
||||
@Test fun testSomeLibraryMethod() {
|
||||
//val library = TribuFu()
|
||||
assertTrue(true, "someLibraryMethod should return 'true'")
|
||||
}
|
||||
}
|
||||
15
library/src/test/scala/library/kotlin/LibrarySuite.scala
Normal file
15
library/src/test/scala/library/kotlin/LibrarySuite.scala
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
package com.tribufu.sdk
|
||||
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
import org.junit.runner.RunWith
|
||||
import org.scalatestplus.junit.JUnitRunner
|
||||
|
||||
@RunWith(classOf[JUnitRunner])
|
||||
class LibrarySuite extends AnyFunSuite {
|
||||
test("someLibraryMethod is always true") {
|
||||
def library = new Library()
|
||||
assert(library.alive())
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
include("library")
|
||||
include("android")
|
||||
//include("android")
|
||||
rootProject.name = "DevKit"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue