This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 791e7e6f0 Build: Add iceberg-build.properties to Jars and release 
process (#5236)
791e7e6f0 is described below

commit 791e7e6f0031606843a802e1931a94b6c1e9d751
Author: Ryan Blue <b...@apache.org>
AuthorDate: Sun Jul 10 14:54:35 2022 -0700

    Build: Add iceberg-build.properties to Jars and release process (#5236)
---
 build.gradle          |  2 +-
 deploy.gradle         |  4 ++++
 dev/source-release.sh | 17 +++++++++++------
 tasks.gradle          | 12 ++++++++++++
 4 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/build.gradle b/build.gradle
index 5d244e896..c8f88ff80 100644
--- a/build.gradle
+++ b/build.gradle
@@ -51,7 +51,7 @@ try {
     gitPropertiesName = 'iceberg-build.properties'
     gitPropertiesResourceDir = file("${rootDir}/build")
     extProperty = 'gitProps'
-    failOnNoGitDirectory = false
+    failOnNoGitDirectory = true
   }
   generateGitProperties.outputs.upToDateWhen { false }
 } catch (Exception e) {
diff --git a/deploy.gradle b/deploy.gradle
index 0101d9a2d..8e0d43fe0 100644
--- a/deploy.gradle
+++ b/deploy.gradle
@@ -52,6 +52,10 @@ subprojects {
 
     // add LICENSE and NOTICE
     [jar, sourceJar, javadocJar, testJar].each { task ->
+      task.dependsOn rootProject.tasks.buildInfo
+      task.from("${rootDir}/build") {
+        include 'iceberg-build.properties'
+      }
       task.from(rootDir) {
         include 'LICENSE'
         include 'NOTICE'
diff --git a/dev/source-release.sh b/dev/source-release.sh
index 5f145f357..3ec2dd92d 100755
--- a/dev/source-release.sh
+++ b/dev/source-release.sh
@@ -87,11 +87,7 @@ tagrc="${tag}-rc${rc}"
 
 echo "Preparing source for $tagrc"
 
-echo "Adding version.txt and tagging release..."
-echo $version > $projectdir/version.txt
-git add $projectdir/version.txt
-git commit -m "Add version.txt for release $version" $projectdir/version.txt
-
+echo "Creating release candidate tag: $tagrc..."
 set_version_hash=`git rev-list HEAD 2> /dev/null | head -n 1 `
 git tag -am "Apache Iceberg $version" $tagrc $set_version_hash
 
@@ -105,11 +101,20 @@ if [ -z "$release_hash" ]; then
   exit
 fi
 
+echo "Generating version.txt and iceberg-build.properties..."
+echo $version > $projectdir/version.txt
+./gradlew generateGitProperties
+cp $projectdir/build/iceberg-build.properties 
$projectdir/iceberg-build.properties
+
 # be conservative and use the release hash, even though git produces the same
 # archive (identical hashes) using the scm tag
 echo "Creating tarball ${tarball} using commit $release_hash"
 tarball=$tag.tar.gz
-git archive $release_hash --worktree-attributes --prefix $tag/ -o 
$projectdir/$tarball
+git archive $release_hash --worktree-attributes --prefix $tag/ --add-file 
$projectdir/version.txt --add-file $projectdir/iceberg-build.properties -o 
$projectdir/$tarball
+
+# remove the uncommitted build files so they don't affect the current working 
copy
+rm $projectdir/version.txt
+rm $projectdir/iceberg-build.properties
 
 echo "Signing the tarball..."
 [[ -n "$keyid" ]] && keyopt="-u $keyid"
diff --git a/tasks.gradle b/tasks.gradle
index ff5022e93..d3739b082 100644
--- a/tasks.gradle
+++ b/tasks.gradle
@@ -54,3 +54,15 @@ task deploySite(type: Exec) {
   workingDir 'site'
   commandLine('./deploy.sh')
 }
+
+if (file("${rootDir}/iceberg-build.properties").exists()) {
+  tasks.register('buildInfo', Exec) {
+    project.logger.info('Using build info from iceberg-build.properties')
+    commandLine 'cp', "${rootDir}/iceberg-build.properties", 
'build/iceberg-build.properties'
+  }
+} else {
+  tasks.register('buildInfo') {
+    project.logger.info('Generating iceberg-build.properties from git')
+    dependsOn generateGitProperties
+  }
+}

Reply via email to