-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
62 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
|
@@ -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") | ||
} | ||
} | ||
} | ||
} |