Skip to content

Commit

Permalink
Updated build.gradle.kts
Browse files Browse the repository at this point in the history
  • Loading branch information
vsnappy1 committed Oct 31, 2024
1 parent 04ead31 commit b9f34da
Showing 1 changed file with 62 additions and 37 deletions.
99 changes: 62 additions & 37 deletions resourcemanager/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ tasks.register<GenerateMavenPom>("generatePom") {
tasks.register("generateArtifacts") {
group = "build"
description = "Generates base JAR, javadoc JAR, sources JAR, and POM file."
dependsOn("build", "generateJavadocJar", "generateSourcesJar", "generatePom")
dependsOn(":resourcemanager:build", "generateJavadocJar", "generateSourcesJar", "generatePom")
doLast {
println("Generated file: ${fullArtifactName}.jar")
println("Generated file: ${fullArtifactName}-javadoc.jar")
Expand Down Expand Up @@ -252,48 +252,73 @@ tasks.register<Zip>("createBundle") {

/* ----------------- Maven Publish (Meta data) ----------------- */

afterEvaluate {
publishing {
publications {
create<MavenPublication>("java") {
from(components["java"])
groupId = "dev.randos"
artifactId = "resourcemanager"
version = "1.0.0"

val bundle = file(layout.buildDirectory.dir("zip/bundle.zip"))
artifact(bundle)

pom {
name = "${groupId}:${artifactId}"
description =
"An Android library that simplifies accessing Android resources (strings, colors, drawables, etc.) in both Android and non-Android components (e.g. ViewModel) using generated code."
url = "https://github.com/vsnappy1/ResourceManager"

licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
publishing {
publications {
create<MavenPublication>("java") {
from(components["java"])
groupId = "dev.randos"
artifactId = "resourcemanager"
version = "1.0.0"

val bundle = file(layout.buildDirectory.dir("zip/bundle.zip"))
artifact(bundle)

pom {
name = "${groupId}:${artifactId}"
description =
"An Android library that simplifies accessing Android resources (strings, colors, drawables, etc.) in both Android and non-Android components (e.g. ViewModel) using generated code."
url = "https://github.com/vsnappy1/ResourceManager"

licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

developers {
developer {
name = "Vishal Kumar"
email = "[email protected]"
organization = "Randos"
organizationUrl = "https://www.randos.dev"
}
developers {
developer {
name = "Vishal Kumar"
email = "[email protected]"
organization = "Randos"
organizationUrl = "https://www.randos.dev"
}
}

scm {
connection = "scm:git:git://github.com/vsnappy1/ResourceManager.git"
developerConnection =
"scm:git:ssh://github.com/vsnappy1/ResourceManager.git"
url = "https://github.com/vsnappy1/ResourceManager"
}
scm {
connection = "scm:git:git://github.com/vsnappy1/ResourceManager.git"
developerConnection =
"scm:git:ssh://github.com/vsnappy1/ResourceManager.git"
url = "https://github.com/vsnappy1/ResourceManager"
}
}
}
}
repositories {
maven {
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")

// Load passphrase from local.properties or environment variable
val properties = Properties()
val localPropertiesFile = project.rootProject.file("local.properties")

// Check if local.properties exists
if (localPropertiesFile.exists()) {
properties.load(localPropertiesFile.inputStream())
}

val username = properties.getProperty("SONATYPE_USERNAME_TOKEN") ?: System.getenv("SONATYPE_USERNAME_TOKEN")
?: throw GradleException("GPG_PASSPHRASE not found in local.properties or environment variables.")
val password = properties.getProperty("SONATYPE_PASSWORD_TOKEN") ?: System.getenv("SONATYPE_PASSWORD_TOKEN")
?: throw GradleException("GPG_PASSPHRASE not found in local.properties or environment variables.")

credentials {
this.username = username
this.password = password
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
}

0 comments on commit b9f34da

Please sign in to comment.