Skip to content

Commit 756f001

Browse files
committed
[build] Uploading edge repo to cloudflare R2 bucket straight from ant now possible
1 parent 930cc24 commit 756f001

9 files changed

+246
-87
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
/google.properties
77
/debug
88
/*.launch
9-
/ssh.configuration
109
/findbugsReport.html
1110
/lib
1211
/.settings
@@ -24,4 +23,5 @@
2423
/website/lombokSupporters
2524
/pom.xml
2625
/jvm.locations
27-
/testenv
26+
/testenv
27+
/gpg.keyring

buildScripts/eclipse-p2.ant.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ This buildfile is part of projectlombok.org. It is responsible for building the
115115
</tar>
116116
</target>
117117

118-
<target name="eclipsep2.publish" depends="setup.ssh, eclipsep2.pack">
118+
<target name="eclipsep2.publish" depends="eclipsep2.pack">
119119
<ivy:scpUpload
120120
from="dist/eclipse-p2.tar.bz2"
121121
to="/data/lombok/staging"

buildScripts/ivy.xml

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<dependency org="de.java2html" name="java2html" rev="5.0" conf="buildtools->default" />
6666
<dependency org="org.freemarker" name="freemarker" rev="2.3.28" conf="buildtools->default" />
6767
<dependency org="com.sparkjava" name="spark-core" rev="2.9.2" conf="buildtools->default" />
68+
<dependency org="software.amazon.awssdk" name="s3" rev="2.19.29" conf="buildtools->default" />
6869

6970
<dependency org="org.eclipse.jgit" name="org.eclipse.jgit.ant" rev="5.2.0.201812061821-r" conf="supporters->default" />
7071
<dependency org="org.eclipse.jgit" name="org.eclipse.jgit" rev="5.2.0.201812061821-r" conf="supporters->default" />

buildScripts/mapstructBinding.ant.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ exists as a separate dependency solely because it is itself dependent on both lo
9696
<target name="mapstructBinding.pack" depends="dist,-mapstructBinding.jar,-mapstructBinding.doc,-mapstructBinding.src">
9797
</target>
9898

99-
<target name="mapstructBinding.publish" depends="mapstructBinding.pack, setup.ssh">
99+
<target name="mapstructBinding.publish" depends="mapstructBinding.pack">
100100
<tar destfile="dist/mavenPublish-mapstructBinding.tar.bz2" compression="bzip2">
101101
<tarfileset dir="dist">
102102
<include name="lombok-mapstruct-binding-${mapstruct-binding.version}.jar" />

buildScripts/maven.ant.xml

+65-28
Original file line numberDiff line numberDiff line change
@@ -65,37 +65,61 @@ This buildfile is part of projectlombok.org. It makes maven-compatible repositor
6565
<mkdir dir="dist" />
6666

6767
<maven.make version-name="${lombok.version}" />
68-
<tar destfile="dist/mavenPublish.tar.bz2" compression="bzip2">
69-
<tarfileset dir="dist">
68+
</target>
69+
70+
<target name="maven.publish" depends="maven, -setup.ossrh">
71+
<fail>
72+
Your lombok clone does not include the OSSRH deployment keys. Contact the core maintainers for these keys;
73+
place them in ${gpg.keyrings} to continue.
74+
75+
<condition>
76+
<not><available file="${gpg.keyrings}" /></not>
77+
</condition>
78+
</fail>
79+
80+
<fail unless="ossrh.password">
81+
Your lombok clone does not include the OSSRH (sonatype maven central) password, needed to upload and deploy to maven central. Contact the core maintainers.
82+
</fail>
83+
84+
<delete quiet="true" dir="build/maven-publish" />
85+
<mkdir dir="build/maven-publish" />
86+
<copy todir="build/maven-publish">
87+
<fileset dir="dist">
7088
<include name="lombok-${lombok.version}.jar" />
7189
<include name="lombok-${lombok.version}-sources.jar" />
7290
<include name="lombok-${lombok.version}-javadoc.jar" />
73-
</tarfileset>
74-
<tarfileset dir="build" includes="pom.xml" />
75-
</tar>
76-
</target>
77-
78-
<target name="maven.publish" depends="maven, setup.ssh">
79-
<ivy:scpUpload
80-
from="dist/mavenPublish.tar.bz2"
81-
to="/data/lombok/staging"
82-
server="projectlombok.org"
83-
username="${ssh.username}"
84-
keyfile="${ssh.keyfile}"
85-
knownHosts="ssh.knownHosts" />
86-
<ivy:sshExec
87-
cmd="/data/lombok/stagingCmd/publishToMavenCentral"
88-
server="projectlombok.org"
89-
username="${ssh.username}"
90-
keyfile="${ssh.keyfile}"
91-
knownHosts="ssh.knownHosts" />
91+
</fileset>
92+
<fileset dir="build" includes="pom.xml" />
93+
</copy>
94+
95+
<apply executable="${exe.gpg}" failifexecutionfails="false" resultproperty="gpg.result">
96+
<arg value="-ab" />
97+
<arg value="--batch" />
98+
<arg value="--yes" />
99+
<arg value="--homedir" />
100+
<arg value="${gpg.keyrings}" />
101+
<fileset dir="build/maven-publish" />
102+
</apply>
103+
104+
<fail>
105+
gpg (Gnu Privacy Guard) is not on your path, or ant property exe.gpg is not properly set. Install gpg/add it to your PATH. Alternatively, run with ant -Dexe.gpg=/loc/to/gpg to continue.
106+
<condition>
107+
<not><isset property="gpg.result" /></not>
108+
</condition>
109+
</fail>
110+
111+
<jar destfile="build/maven-publish/lombok-bundle.jar">
112+
<fileset dir="build/maven-publish" />
113+
</jar>
114+
115+
<exec executable="${exe.curl}" failifexecutionfails="false" resultproperty="curl.result">
116+
<arg value="-u" />
117+
<arg value="${ossrh.username}:${ossrh.password}" />
118+
<arg value="-F" />
119+
<arg value="file=@build/maven-publish/lombok-bundle.jar;type=application/java-archive" />
120+
<arg value="https://oss.sonatype.org/service/local/staging/bundle_upload" />
121+
</exec>
92122
<echo>The artifact has been published to staging. Now go to https://oss.sonatype.org/ and log in as Reinier, then doublecheck if all is well and 'release' it.</echo>
93-
<ivy:sshExec
94-
cmd="/data/lombok/stagingCmd/showMavenCentralPassword"
95-
server="projectlombok.org"
96-
username="${ssh.username}"
97-
keyfile="${ssh.keyfile}"
98-
knownHosts="ssh.knownHosts" />
99123
</target>
100124

101125
<target name="maven.edge" depends="version, dist, javadoc.build" description="Create a maven repo for the current snapshot into a build dir. The intent is for you to put that on a server someplace. Will invoke your local mvn installation.">
@@ -116,12 +140,25 @@ This buildfile is part of projectlombok.org. It makes maven-compatible repositor
116140
<arg value="-DpomFile=build/pom.xml" />
117141
<arg value="-Durl=file://${basedir}/build/edge-releases" />
118142
</exec>
119-
120143
<fail>
121144
mvn is not on your path and/or MAVEN_HOME is not set. Add mvn to your path or set MAVEN_HOME to continue.
122145
<condition>
123146
<not><isset property="mvn.result" /></not>
124147
</condition>
125148
</fail>
149+
<copy file="dist/lombok-${lombok.version}.jar" tofile="build/edge-releases/lombok-edge.jar" />
150+
</target>
151+
152+
<target name="maven.edge.publish" depends="maven.edge, compile.support" description="Creates the maven repo for the snapshot build and publishes it to projectlombok.org">
153+
<java classname="lombok.publish.PublishToBucket" failonerror="true">
154+
<classpath>
155+
<path refid="cp.buildtools" />
156+
<pathelement location="build/support" />
157+
</classpath>
158+
<arg value="${gpg.keyrings}/s3_creds.txt" />
159+
<arg value="build/edge-releases" />
160+
<arg value="edge" />
161+
<arg value="true" />
162+
</java>
126163
</target>
127164
</project>

buildScripts/setup.ant.xml

+13-49
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
4040
<available file="${rtstubs18.loc}" property="rtstubs18.available" />
4141
<property name="ssh.configuration.file" location="ssh.configuration" />
4242

43+
<property name="gpg.keyrings" location="gpg.keyring" />
44+
<property name="exe.gpg" value="gpg" />
45+
<property name="exe.curl" value="curl" />
46+
4347
<condition property="os.specific.native-swt-lib" value="org.eclipse.swt.gtk.linux.aarch64">
4448
<os name="Linux" arch="aarch64" />
4549
</condition>
@@ -60,55 +64,6 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
6064
</condition>
6165
<fail unless="os.specific.native-swt-lib">Full eclipse testing requires downloading a native SWT binding. This script knows how to download for OS = [mac, linux, or windows] and architecture = [aarch64 or x86-64]. You have something different, you unique snowflake you. Your OS: "${os.name}", Your arch: "${os.arch}".</fail>
6266

63-
<target name="-setup.ssh.ask">
64-
<property file="${ssh.configuration.file}" />
65-
<fail>
66-
Your ssh.configuration file is corrupted; delete it and rerun this script.
67-
<condition>
68-
<or>
69-
<and>
70-
<isset property="ssh.username" />
71-
<equals arg1="" arg2="${ssh.username}" />
72-
</and>
73-
<and>
74-
<isset property="ssh.keyfile" />
75-
<equals arg1="" arg2="${ssh.keyfile}" />
76-
</and>
77-
</or>
78-
</condition>
79-
</fail>
80-
<fail>
81-
The keyfile configured in your ${ssh.configuration.file} file does not exist.
82-
<condition>
83-
<and>
84-
<isset property="ssh.keyfile" />
85-
<not><available file="${ssh.keyfile}" /></not>
86-
</and>
87-
</condition>
88-
</fail>
89-
90-
<condition property="ssh.configuration.write">
91-
<or>
92-
<not><isset property="ssh.username" /></not>
93-
<not><isset property="ssh.keyfile" /></not>
94-
</or>
95-
</condition>
96-
<input message="What is your SSH username on the projectlombok.org server? (Enter to abort)." addproperty="ssh.username" />
97-
<fail>Aborted<condition><equals arg1="" arg2="${ssh.username}" /></condition></fail>
98-
<input message="Where is your ssh keyfile located? (Enter to abort)." addproperty="ssh.keyfile" defaultvalue="${user.home}/.ssh/id_rsa" />
99-
<fail>File ${ssh.keyfile} does not exist<condition><not><available file="${ssh.keyfile}" /></not></condition></fail>
100-
</target>
101-
102-
<target name="-setup.ssh.save" if="ssh.configuration.write">
103-
<propertyfile file="${ssh.configuration.file}" comment="SSH connect info for projectlombok.org.">
104-
<entry key="ssh.username" value="${ssh.username}" />
105-
<entry key="ssh.keyfile" value="${ssh.keyfile}" />
106-
</propertyfile>
107-
<echo>Your connection info has been written to ${ssh.configuration.file} and will be remembered for future invocations.</echo>
108-
</target>
109-
110-
<target name="setup.ssh" depends="-setup.ssh.ask, -setup.ssh.save" />
111-
11267
<target name="-autoclean.check">
11368
<available type="dir" file="build" property="existingbuild.present" />
11469
<loadresource property="existingbuild.ver">
@@ -371,6 +326,15 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
371326
<ivy:cachepath pathid="cp.test" conf="test" />
372327
</target>
373328

329+
<target name="-setup.ossrh">
330+
<loadfile quiet="true" failonerror="false" encoding="UTF-8" property="ossrh.password" srcfile="${gpg.keyrings}/ossrh.password">
331+
<filterchain>
332+
<striplinebreaks />
333+
</filterchain>
334+
</loadfile>
335+
<property name="ossrh.username" value="rzwitserloot" />
336+
</target>
337+
374338
<fail>ant needs to be at least v1.10.0 or higher to build lombok. Your version is: ${ant.version}
375339
<condition>
376340
<not><antversion atleast="1.10.0" /></not>

buildScripts/website.ant.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ such as applying the templates to produce the website, converting the changelog
136136
</tar>
137137
</target>
138138

139-
<target name="website.publish" depends="setup.ssh, website.pack" description="Builds the website, compresses it, sends it to the projectlombok.org server and deploys it">
139+
<target name="website.publish" depends="website.pack" description="Builds the website, compresses it, sends it to the projectlombok.org server and deploys it">
140140
<ivy:scpUpload
141141
from="dist/website.tar.bz2"
142142
to="/data/lombok/staging"
@@ -215,7 +215,7 @@ such as applying the templates to produce the website, converting the changelog
215215
<echo>File dist/javadoc.tar.bz2 is available</echo>
216216
</target>
217217

218-
<target name="javadoc.publish" depends="setup.ssh, javadoc.pack">
218+
<target name="javadoc.publish" depends="javadoc.pack">
219219
<ivy:scpUpload
220220
from="dist/javadoc.tar.bz2"
221221
to="/data/lombok/staging"
@@ -256,7 +256,7 @@ such as applying the templates to produce the website, converting the changelog
256256
</tar>
257257
</target>
258258

259-
<target name="-release.publish.site" depends="setup.ssh, release.pack">
259+
<target name="-release.publish.site" depends="release.pack">
260260
<ivy:scpUpload
261261
from="dist/website-release.tar.bz2"
262262
to="/data/lombok/staging"
@@ -298,7 +298,7 @@ such as applying the templates to produce the website, converting the changelog
298298
</tar>
299299
</target>
300300

301-
<target name="edge.publish" depends="setup.ssh, edge.pack" description="Builds an edge release, sends it to the projectlombok.org server and deploys it by updating the download-edge link">
301+
<target name="edge.publish" depends="edge.pack" description="Builds an edge release, sends it to the projectlombok.org server and deploys it by updating the download-edge link">
302302
<ivy:scpUpload
303303
from="dist/website-edge.tar.bz2"
304304
to="/data/lombok/staging"

0 commit comments

Comments
 (0)