Skip to content

Commit

Permalink
patch: rename some old domains to cl.franciscosolis
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Solis <30329003+Im-Fran@users.noreply.github.com>
  • Loading branch information
Im-Fran committed Mar 16, 2024
1 parent a605c8f commit e00fbde
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 21 deletions.
15 changes: 15 additions & 0 deletions LICENSE-HEADER
@@ -0,0 +1,15 @@
SimpleCoreAPI - Kotlin Project Library
Copyright (C) 2024 Francisco Solís

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
60 changes: 39 additions & 21 deletions build.gradle.kts
Expand Up @@ -7,24 +7,37 @@ import java.util.*
plugins {
`maven-publish`

id("com.github.johnrengelman.shadow") version "8.1.1" // ShadowJar
id("cl.franciscosolis.gradledotenv") version "1.0.1" // .env support
kotlin("jvm") version "1.9.22" // Kotlin
id("org.jetbrains.dokka") version "1.9.10" // Dokka (Kotlin Docs)
id("cl.franciscosolis.sonatype-central-upload") version "1.0.2" // Sonatype Central Upload
id("com.github.johnrengelman.shadow") version "8.1.1" // ShadowJar
id("cl.franciscosolis.gradledotenv") version "1.0.1" // .env support
kotlin("jvm") version "1.9.22" // Kotlin
id("org.jetbrains.dokka") version "1.9.10" // Dokka (Kotlin Docs)
id("cl.franciscosolis.sonatype-central-upload") version "1.0.2" // Sonatype Central Upload
id("org.cadixdev.licenser") version "0.6.1" // License Header

}

/*
The project version can be:
- environment variable VERSION or the manually added version
- If the environment variable ENV is set to dev, the project
version will have appended the git commit short hash + SNAPSHOT
*/
val projectVersion = (env["VERSION"] ?: "1.0.0") + (if (env["ENV"] == "dev") "-${env["GIT_COMMIT_SHORT_HASH"] ?: UUID.randomUUID().toString().replace("-", "").split("").shuffled().joinToString("").substring(0, 8)}" else "")
/* Project Build ID is based on GIT_COMMIT_SHORT_HASH if any,
* otherwise we generate an UUIDv4 that will randomize its
* contents and get the first 8 characters.
*/
val projectBuildId = env["GIT_COMMIT_SHORT_HASH"] ?: UUID.randomUUID().toString().replace("-", "").split("").shuffled().joinToString("").substring(0, 8)

/* Project Version will be the environment variable version (or the one specified by us) if it's production,
* otherwise it will be added '$projectBuildId'
* (no snapshot because maven central does not support it)
*/
val projectVersion = "${env["VERSION"] ?: "1.0.0"}${if (env["ENV"] != "prod") "-$projectBuildId" else ""}";
/* Print out the current version */
println("This build version was '$projectVersion'")

val repo = "https://github.com/TheProgramSrc/SimpleCoreAPI"
val groupId = "cl.franciscosolis"
val repo = "https://github.com/Im-Fran/SimpleCoreAPI"

/*
* The groupId will be the package name in lowercase
* if the environment is not production, we will add the environment name
* (or 'dev' if it's not specified)
*/
val groupId = "cl.franciscosolis${if(env["ENV"] != "prod") ".${env["ENV"] ?: "dev"}" else ""}".lowercase()

group = groupId
version = projectVersion.replaceFirst("v", "").replace("/", "")
Expand All @@ -36,6 +49,7 @@ allprojects {
plugin("cl.franciscosolis.gradledotenv")
plugin("org.jetbrains.kotlin.jvm")
plugin("org.jetbrains.dokka")
plugin("org.cadixdev.licenser")
}

group = rootProject.group
Expand Down Expand Up @@ -70,13 +84,17 @@ subprojects {

named<DokkaTaskPartial>("dokkaHtmlPartial") {
outputDirectory = layout.buildDirectory.dir("dokka")
val dokkaCache = file("${System.getProperty("user.home")}/.cache/dokka")
if (!dokkaCache.exists()) {
dokkaCache.mkdirs()
cacheRoot = file("${System.getProperty("user.home")}/.cache/dokka").apply {
if(!exists()) mkdirs()
}
cacheRoot.set(dokkaCache)
}
}

license {
header(rootProject.file("LICENSE-HEADER"))
include("**/*.kt", "**/*.java")
newLine(true)
}
}

dependencies {
Expand All @@ -87,7 +105,7 @@ dependencies {
tasks {
named<ShadowJar>("shadowJar") {
manifest {
attributes["Main-Class"] = "xyz.theprogramsrc.simplecoreapi.standalone.StandaloneLoaderKt"
attributes["Main-Class"] = "cl.franciscosolis.simplecoreapi.standalone.StandaloneLoaderKt"
}

mergeServiceFiles()
Expand Down Expand Up @@ -171,7 +189,7 @@ publishing {
if (env["GITHUB_ACTOR"] != null && env["GITHUB_TOKEN"] != null) {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/TheProgramSrc/SimpleCoreAPI")
url = uri("https://maven.pkg.github.com/Im-Fran/SimpleCoreAPI")
credentials {
username = env["GITHUB_ACTOR"]
password = env["GITHUB_TOKEN"]
Expand Down Expand Up @@ -214,7 +232,7 @@ publishing {
}

scm {
url = repo
url = "$repo${if(repo.endsWith(".git")) "" else ".git"}"
}
}
}
Expand Down

0 comments on commit e00fbde

Please sign in to comment.