Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUILD : Gradle fixes after upgrade #357

Merged
merged 7 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/common/common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ repositories {
ext.kiitSetupViaBinary = System.getenv('KIIT_PROJECT_MODE') != 'sources'

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile 'org.threeten:threetenbp:1.3.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.threeten:threetenbp:1.3.8'

// /* <slatekit_local>
if (kiitSetupViaBinary) {
compile "dev.kiit:kiit-results:$kiit_version"
implementation "dev.kiit:kiit-results:$kiit_version"
} else {
// */
compile project(":kiit-result")
implementation project(":kiit-result")
} //</slatekit_local>
}

Expand All @@ -80,12 +80,12 @@ def kiitComponentVersion = ext.kiit_version
// Slate Kit Setup mode: defaults to maven vs loading project sources
// ==================================================================
task info {
println('slatekit.setup : ' + System.getenv('KIIT_PROJECT_MODE'))
println('slatekit.maven : ' + kiitSetupViaBinary)
println('slatekit.comp.id : ' + kiitComponentId)
println('slatekit.comp.name : ' + kiitComponentName)
println('slatekit.comp.desc : ' + kiitComponentDesc)
println('slatekit.comp.vers : ' + kiitComponentVersion)
println('kiit.setup : ' + System.getenv('KIIT_PROJECT_MODE'))
println('kiit.maven : ' + kiitSetupViaBinary)
println('kiit.comp.id : ' + kiitComponentId)
println('kiit.comp.name : ' + kiitComponentName)
println('kiit.comp.desc : ' + kiitComponentDesc)
println('kiit.comp.vers : ' + kiitComponentVersion)
println()
println('project.name : ' + project.name)
println('project.path : ' + project.path)
Expand Down
146 changes: 72 additions & 74 deletions src/common/common/src/main/kotlin/kiit/common/Identity.kt
Original file line number Diff line number Diff line change
@@ -1,61 +1,19 @@
package kiit.common

import kiit.common.envs.EnvMode
import kiit.common.ext.toIdent
import kiit.common.ids.ULIDs
import java.util.*

/**
* Used to identity services / components
* form = area.service.agent.env.instance
* name = signup.alerts.job.qat
* full = signup.alerts.job.qat.4a3b300b-d0ac-4776-8a9c-31aa75e412b3
*/
interface Identity {

val id: String
val name: String
val fullname: String
val idWithTags: String

val area: String
val service: String
val agent: Agent
val env: String
val version: String
val desc: String
val instance: String
val tags: List<String>

fun newInstance(): Identity
fun with(inst: String? = null, tags: List<String>): Identity

companion object {

val empty = SimpleIdentity("empty", "empty", Agent.Test, "empty")

fun app(area: String, service: String, env: EnvMode = EnvMode.Dev): Identity {
return SimpleIdentity(area, service, Agent.App, env.name)
}

fun api(area: String, service: String, env: EnvMode = EnvMode.Dev): Identity {
return SimpleIdentity(area, service, Agent.API, env.name)
}

fun cli(area: String, service: String, env: EnvMode = EnvMode.Dev): Identity {
return SimpleIdentity(area, service, Agent.CLI, env.name)
}

fun job(area: String, service: String, env: EnvMode = EnvMode.Dev): Identity {
return SimpleIdentity(area, service, Agent.Job, env.name)
}

fun test(name: String): Identity {
return SimpleIdentity("tests", name, Agent.Test, EnvMode.Dev.name)
}
}
}

/**
* Simple Identity used to identity services / components
* Identity used to identity services / components
*
* form = company.area.service.agent.env.version.instance
* name = app1.accounts.signup.alerts.job.qat
* vers = app1.accounts.signup.alerts.job.qat.1_0_2_3
* full = app1.accounts.signup.alerts.job.qat.1_0_2_3.4a3b300b-d0ac-4776-8a9c-31aa75e412b3
*
* @param company : app1 | jetbrains - company name/origin
* @param area : area | dept | org - logical group
* @param service : user1 | job | svc - to distinguish multiple agents/users
* @param agent : api | app | job - environment
Expand All @@ -66,48 +24,88 @@ interface Identity {
* name = signup.alerts.job.qat
* full = signup.alerts.job.qat.4a3b300b-d0ac-4776-8a9c-31aa75e412b3
*/
data class SimpleIdentity(
override val area: String,
override val service: String,
override val agent: Agent,
override val env: String,
override val instance: String = ULIDs.create().value,
override val version: String = "LATEST",
override val desc: String = "",
override val tags: List<String> = listOf()
) : Identity {
data class Identity(
val company: String,
val area: String,
val service: String,
val agent: Agent,
val env: String,
val instance: String = ULIDs.create().value,
val version: String = "latest",
val desc: String = "",
val tags: List<String> = listOf()
) {
private val tagged = tags.joinToString()

/**
* Enforced naming convention for an application's name ( simple name )
* {AREA}.{SERVICE}
* @sample: signup.alerts
* {COMPANY}.{AREA}.{SERVICE}.{AGENT}
* @sample: app1.signup.alerts.job
*/
override val name = "$area.$service"
val name = "$company.$area.$service.${agent.name.lowercase(Locale.getDefault())}"

/**
* Enforced naming convention for application's full name with agent and env
* {AREA}.{SERVICE}.{AGENT}.{ENV}
* signup.alerts.job.qat
* {COMPANY}.{AREA}.{SERVICE}.{AGENT}.{ENV}.{VERSION}
* app1.signup.alerts.job.qat.
*/
override val fullname: String =
"$name.${agent.name.lowercase()}.${env.lowercase()}.${version.replace(".", "_")}"
val full: String =
"$name.${env.lowercase()}.${version.replace(".", "_")}"

/**
* The id contains the instance name
* @sample: signup.alerts.job.qat.4a3b300b-d0ac-4776-8a9c-31aa75e412b3
* @sample: app1.signup.alerts.job.qat.4a3b300b-d0ac-4776-8a9c-31aa75e412b3
*
*/
override val id: String = "$fullname.$instance"
val id: String = "$full.$instance"

/**
* The id contains the instance name
* @sample: signup.alerts.job.qat.4a3b300b-d0ac-4776-8a9c-31aa75e412b3.a1,b2,c3
*
*/
override val idWithTags: String = "$fullname.$instance" + if (tagged.isNullOrEmpty()) "" else ".$tagged"
val idWithTags: String = "$full.$instance" + if (tagged.isEmpty()) "" else ".$tagged"

override fun newInstance(): Identity = this.copy(instance = ULIDs.create().value)
override fun with(inst: String?, tags: List<String>): Identity =
fun newInstance(): Identity = this.copy(instance = ULIDs.create().value)

fun with(inst: String?, tags: List<String>): Identity =
this.copy(instance = inst ?: ULIDs.create().value, tags = tags)


companion object {

val empty = Identity("", "empty", "empty", Agent.Test, "empty")

fun app(company:String, area: String, service: String, env: EnvMode = EnvMode.Dev): Identity {
return of(company, area, service, Agent.App, env)
}

fun api(company:String, area: String, service: String, env: EnvMode = EnvMode.Dev): Identity {
return of(company, area, service, Agent.API, env)
}

fun cli(company:String, area: String, service: String, env: EnvMode = EnvMode.Dev): Identity {
return of(company, area, service, Agent.CLI, env)
}

fun job(company:String, area: String, service: String, env: EnvMode = EnvMode.Dev): Identity {
return of(company, area, service, Agent.Job, env)
}

fun test(company:String, name: String): Identity {
return of(company, "tests", name, Agent.Test, EnvMode.Dev)
}

fun of(company:String, area: String, service: String, agent:Agent, env: EnvMode = EnvMode.Dev, version: String? = null, desc:String? = null, instance:String? = null): Identity {
return Identity(
company.toIdent(),
area.toIdent(),
service.toIdent(),
agent,
env.name.lowercase(Locale.getDefault()),
instance = instance ?: ULIDs.create().value,
version = version ?: "latest",
desc = desc ?: "")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ data class About(
fun dir(): String = company.orElse(name).replace(" ", "-")


fun toId(): Identity = SimpleIdentity(area, name, Agent.App, EnvMode.Dev.name)
fun toId(): Identity = Identity.of(company, area, name, Agent.App, EnvMode.Dev)

companion object {
@JvmStatic
Expand Down
28 changes: 14 additions & 14 deletions src/common/context/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ repositories {
ext.kiitSetupViaBinary = System.getenv('KIIT_PROJECT_MODE') != 'sources'

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile 'org.threeten:threetenbp:1.3.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'org.threeten:threetenbp:1.3.8'

// /* <slatekit_local>
if (kiitSetupViaBinary) {
compile "dev.kiit:kiit-results:$kiit_version"
compile "dev.kiit:kiit-common:$kiit_version"
implementation "dev.kiit:kiit-results:$kiit_version"
implementation "dev.kiit:kiit-common:$kiit_version"
} else {
// */
compile project(":kiit-result")
compile project(":kiit-common")
implementation project(":kiit-result")
implementation project(":kiit-common")
} //</slatekit_local>
}

Expand All @@ -81,12 +81,12 @@ def kiitComponentVersion = ext.kiit_version
// Slate Kit Setup mode: defaults to maven vs loading project sources
// ==================================================================
task info {
println('slatekit.setup : ' + System.getenv('KIIT_PROJECT_MODE'))
println('slatekit.maven : ' + kiitSetupViaBinary)
println('slatekit.comp.id : ' + kiitComponentId)
println('slatekit.comp.name : ' + kiitComponentName)
println('slatekit.comp.desc : ' + kiitComponentDesc)
println('slatekit.comp.vers : ' + kiitComponentVersion)
println('kiit.setup : ' + System.getenv('KIIT_PROJECT_MODE'))
println('kiit.maven : ' + kiitSetupViaBinary)
println('kiit.comp.id : ' + kiitComponentId)
println('kiit.comp.name : ' + kiitComponentName)
println('kiit.comp.desc : ' + kiitComponentDesc)
println('kiit.comp.vers : ' + kiitComponentVersion)
println()
println('project.name : ' + project.name)
println('project.path : ' + project.path)
Expand Down
6 changes: 3 additions & 3 deletions src/common/context/src/main/kotlin/kiit/context/Context.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kiit.context

import kiit.common.Agent
import kiit.common.Identity
import kiit.common.SimpleIdentity
import kiit.common.args.Args
import kiit.common.conf.Conf
import kiit.common.crypto.Encryptor
Expand Down Expand Up @@ -34,11 +33,12 @@ interface Context {

companion object {
fun identity(info: Info, envs: Envs): Identity {
return SimpleIdentity(
return Identity.of(
info.about.company,
info.about.area,
info.about.name,
Agent.App,
envs.name,
envs.current.mode,
version = info.build.version,
desc = info.about.desc
)
Expand Down
31 changes: 16 additions & 15 deletions src/common/requests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,21 @@ repositories {
ext.kiitSetupViaBinary = System.getenv('KIIT_PROJECT_MODE') != 'sources'

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.0'
compile 'com.squareup.okhttp3:okhttp:3.9.0'
compile 'org.threeten:threetenbp:1.3.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.0'
implementation "com.googlecode.json-simple:json-simple:1.1"
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation 'org.threeten:threetenbp:1.3.8'

// /* <slatekit_local>
if( kiitSetupViaBinary ) {
compile "dev.kiit:kiit-results:$kiit_version"
compile "dev.kiit:kiit-common:$kiit_version"
implementation "dev.kiit:kiit-results:$kiit_version"
implementation "dev.kiit:kiit-common:$kiit_version"
} else {
// */
compile project(":kiit-result")
compile project(":kiit-common")
implementation project(":kiit-result")
implementation project(":kiit-common")
} //</slatekit_local>
}

Expand All @@ -83,12 +84,12 @@ def kiitComponentVersion = ext.kiit_version
// Slate Kit Setup mode: defaults to maven vs loading project sources
// ==================================================================
task info {
println('slatekit.setup : ' + System.getenv('KIIT_PROJECT_MODE'))
println('slatekit.maven : ' + kiitSetupViaBinary)
println('slatekit.comp.id : ' + kiitComponentId)
println('slatekit.comp.name : ' + kiitComponentName)
println('slatekit.comp.desc : ' + kiitComponentDesc)
println('slatekit.comp.vers : ' + kiitComponentVersion)
println('kiit.setup : ' + System.getenv('KIIT_PROJECT_MODE'))
println('kiit.maven : ' + kiitSetupViaBinary)
println('kiit.comp.id : ' + kiitComponentId)
println('kiit.comp.name : ' + kiitComponentName)
println('kiit.comp.desc : ' + kiitComponentDesc)
println('kiit.comp.vers : ' + kiitComponentVersion)
println()
println('project.name : ' + project.name)
println('project.path : ' + project.path)
Expand Down
18 changes: 9 additions & 9 deletions src/common/result/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile 'junit:junit:4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation 'junit:junit:4.12'
}

// ==================================================================
Expand All @@ -70,12 +70,12 @@ def kiitComponentVersion = ext.kiit_version
ext.kiitSetupViaBinary = System.getenv('KIIT_PROJECT_MODE') != 'sources'
task info {
doLast {
println('slatekit.setup : ' + System.getenv('KIIT_PROJECT_MODE'))
println('slatekit.maven : ' + kiitSetupViaBinary)
println('slatekit.comp.id : ' + kiitComponentId)
println('slatekit.comp.name : ' + kiitComponentName)
println('slatekit.comp.desc : ' + kiitComponentDesc)
println('slatekit.comp.vers : ' + kiitComponentVersion)
println('kiit.setup : ' + System.getenv('KIIT_PROJECT_MODE'))
println('kiit.maven : ' + kiitSetupViaBinary)
println('kiit.comp.id : ' + kiitComponentId)
println('kiit.comp.name : ' + kiitComponentName)
println('kiit.comp.desc : ' + kiitComponentDesc)
println('kiit.comp.vers : ' + kiitComponentVersion)
println()
println('project.name : ' + project.name)
println('project.path : ' + project.path)
Expand Down
Loading