Author: fanningpj
Date: Sat Jun 17 14:49:54 2023
New Revision: 1910471

URL: http://svn.apache.org/viewvc?rev=1910471&view=rev
Log:
produce buildinfo file as part of Maven publish

Modified:
    xmlbeans/trunk/build.gradle

Modified: xmlbeans/trunk/build.gradle
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/build.gradle?rev=1910471&r1=1910470&r2=1910471&view=diff
==============================================================================
--- xmlbeans/trunk/build.gradle (original)
+++ xmlbeans/trunk/build.gradle Sat Jun 17 14:49:54 2023
@@ -392,12 +392,6 @@ jar {
                 'Implementation-Version': XMLBeansVersion,
                 'Implementation-Vendor': 'org.apache.xmlbeans',
                 'Implementation-Vendor-Id': 'The Apache Software Foundation',
-                'Built-By': System.properties['user.name'],
-                'Build-Timestamp': new 
java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
-                //'Build-Revision': versioning.info.commit,
-                'Created-By': "Gradle ${gradle.gradleVersion}",
-                'Build-Jdk': "${System.properties['java.version']} 
(${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
-                'Build-OS': "${System.properties['os.name']} 
${System.properties['os.arch']} ${System.properties['os.version']}"
         ], 'org/apache/xmlbeans/'
         )
     }
@@ -428,6 +422,26 @@ tasks.withType(AbstractArchiveTask).conf
     reproducibleFileOrder = true
 }
 
+def buildInfoFile = 
layout.buildDirectory.file("buildinfo/xmlbeans-${XMLBeansVersion}.buildinfo")
+
+task writeBuildInfo(type: WriteProperties) {
+    outputFile buildInfoFile
+    property 'Built-By', System.properties['user.name']
+    property 'Build-Timestamp', new 
java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date())
+    property 'Created-By', "Gradle ${gradle.gradleVersion}"
+    property 'Build-Jdk', "${System.properties['java.version']}, 
(${System.properties['java.vendor']} ${System.properties['java.vm.version']})"
+    property 'Build-OS', "${System.properties['os.name']} 
${System.properties['os.arch']} ${System.properties['os.version']}"
+}
+
+jar.dependsOn 'writeBuildInfo'
+project.afterEvaluate {
+    tasks.findAll { it.name.startsWith('publish') 
}*.dependsOn('writeBuildInfo')
+}
+
+def buildInfoArtifact = artifacts.add('archives', buildInfoFile.get().asFile) {
+    type 'buildinfo'
+}
+
 rat {
     dependsOn 'cacheJava9'
 
@@ -546,6 +560,10 @@ distributions {
 
 publishing {
     publications {
+        maven(MavenPublication) {
+            artifact buildInfoArtifact
+            version XMLBeansVersion
+        }
         POI(MavenPublication) {
             groupId 'org.apache.xmlbeans'
             artifactId project.archivesBaseName



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to