Files
bstore-j/extra.gradle

35 lines
1.1 KiB
Groovy

/** Extra tasks and configuration for BStore-j */
// Load .env settings - mostly secrets
task dotenv {
def ef = file('.env');
if (!ef.exists()) ef = file('../.env');
if (ef.exists()) {
ef.readLines().each() {
if (it.isEmpty() || it.startsWith("#")) return true;
def (key, value) = it.tokenize('=')
project.ext.set(key, value)
}
} else {
// Set defaults if .env doesn't exist (for CI/CD)
project.ext.set('repo_url', 'https://repo.reliancy.com/repository/maven-')
project.ext.set('repo_user', System.getenv('NEXUS_USER') ?: '')
project.ext.set('repo_pwd', System.getenv('NEXUS_PASSWORD') ?: '')
project.ext.set('db_url', System.getenv('DB_URL') ?: '')
}
}
task packageJavadoc(type: Jar, dependsOn: 'javadoc') {
from javadoc
archiveClassifier = 'javadoc'
}
task packageSources(type: Jar, dependsOn: 'classes') {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
// Ensure dotenv runs before any task that needs repo credentials
tasks.matching { it.name.contains('publish') }.all { it.dependsOn dotenv }