1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id "java-library"
id "com.adarshr.test-logger" version "4.0.0"
id "com.vanniktech.maven.publish" version "0.34.0"
id "biz.aQute.bnd.builder" version "7.0.0"
}
version = '4.2.1'
group = 'com.github.tschoonj'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
libsDirName = '..'
repositories {
mavenCentral()
}
dependencies {
api 'org.apache.commons:commons-numbers-complex:1.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
}
sourceSets {
main {
java {
srcDir '@srcdir@'
exclude 'tests/**'
exclude 'gradle/**'
}
resources {
srcDir '@builddir@'
include 'xraylib.dat'
}
}
test {
java {
srcDir '@srcdir@/tests'
}
}
}
jar {
manifest {
attributes('Bundle-Vendor': 'Tom Schoonjans',
'Bundle-SymbolicName': 'com.github.tschoonj.xraylib',
'Automatic-Module-Name': 'com.github.tschoonj.xraylib',
'Bundle-Name': project.name,
'Export-Package': 'com.github.tschoonj.xraylib',
'-noee': true
)
}
}
task checkCompile(type: JavaCompile) {
source = fileTree('@top_srcdir@/example/')
include 'xrlexample7.java'
classpath = sourceSets.main.runtimeClasspath
options.sourcepath = files('@top_srcdir@/example')
destinationDir = file('.')
}
task checkRun(dependsOn: 'checkCompile', type: JavaExec) {
main = 'xrlexample7'
classpath = sourceSets.main.runtimeClasspath + files('.')
}
test {
useJUnitPlatform()
}
// based on https://blog.benoitblanchon.fr/gradle-how-to-make-a-flat-source-jar/
task flatSources(type: Copy) {
from sourceSets.main.allJava
into "$buildDir/flatSrc/com/github/tschoonj/xraylib"
}
task sourcesJar(type: Jar, dependsOn: flatSources) {
from "$buildDir/flatSrc"
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
// Maven Central Publishing Configuration using vanniktech plugin
// Updated for Central Publisher Portal (OSSRH EOL as of June 30, 2025)
// This plugin handles all the complexity of Central Portal publishing
// Requires Portal User Token (mavenCentralUsername/mavenCentralPassword)
// and GPG signing configuration
//
// Publishing workflow:
// 1. For snapshots: ./gradlew publishToMavenCentral
// 2. For releases: ./gradlew publishToMavenCentral (then manually publish in Portal)
// OR: ./gradlew publishAndReleaseToMavenCentral (automatic release)
//
// Login to https://central.sonatype.com/publishing to review deployments
mavenPublishing {
// Configure for Central Portal publishing
publishToMavenCentral()
// Enable GPG signing (required for Maven Central)
signAllPublications()
// Configure POM metadata
coordinates(group, 'xraylib', version)
pom {
name = 'xraylib'
description = 'A library for X-ray matter interaction cross sections for X-ray fluorescence applications'
inceptionYear = '2009'
url = 'https://github.com/tschoonj/xraylib'
licenses {
license {
name = '3-Clause BSD License'
url = 'https://opensource.org/licenses/BSD-3-Clause'
distribution = 'https://opensource.org/licenses/BSD-3-Clause'
}
}
developers {
developer {
id = 'tschoonj'
name = 'Tom Schoonjans'
email = 'Tom.Schoonjans@gmail.com'
url = 'https://github.com/tschoonj'
}
}
scm {
url = 'https://github.com/tschoonj/xraylib'
connection = 'scm:git:git://github.com/tschoonj/xraylib.git'
developerConnection = 'scm:git:ssh://git@github.com/tschoonj/xraylib.git'
}
}
}
|