Skip to content

Commit

Permalink
[build] Uploading edge repo to cloudflare R2 bucket straight from ant…
Browse files Browse the repository at this point in the history
… now possible
  • Loading branch information
rzwitserloot committed Feb 3, 2023
1 parent 930cc24 commit 756f001
Show file tree
Hide file tree
Showing 9 changed files with 246 additions and 87 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/google.properties
/debug
/*.launch
/ssh.configuration
/findbugsReport.html
/lib
/.settings
Expand All @@ -24,4 +23,5 @@
/website/lombokSupporters
/pom.xml
/jvm.locations
/testenv
/testenv
/gpg.keyring
2 changes: 1 addition & 1 deletion buildScripts/eclipse-p2.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ This buildfile is part of projectlombok.org. It is responsible for building the
</tar>
</target>

<target name="eclipsep2.publish" depends="setup.ssh, eclipsep2.pack">
<target name="eclipsep2.publish" depends="eclipsep2.pack">
<ivy:scpUpload
from="dist/eclipse-p2.tar.bz2"
to="/data/lombok/staging"
Expand Down
1 change: 1 addition & 0 deletions buildScripts/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<dependency org="de.java2html" name="java2html" rev="5.0" conf="buildtools->default" />
<dependency org="org.freemarker" name="freemarker" rev="2.3.28" conf="buildtools->default" />
<dependency org="com.sparkjava" name="spark-core" rev="2.9.2" conf="buildtools->default" />
<dependency org="software.amazon.awssdk" name="s3" rev="2.19.29" conf="buildtools->default" />

<dependency org="org.eclipse.jgit" name="org.eclipse.jgit.ant" rev="5.2.0.201812061821-r" conf="supporters->default" />
<dependency org="org.eclipse.jgit" name="org.eclipse.jgit" rev="5.2.0.201812061821-r" conf="supporters->default" />
Expand Down
2 changes: 1 addition & 1 deletion buildScripts/mapstructBinding.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ exists as a separate dependency solely because it is itself dependent on both lo
<target name="mapstructBinding.pack" depends="dist,-mapstructBinding.jar,-mapstructBinding.doc,-mapstructBinding.src">
</target>

<target name="mapstructBinding.publish" depends="mapstructBinding.pack, setup.ssh">
<target name="mapstructBinding.publish" depends="mapstructBinding.pack">
<tar destfile="dist/mavenPublish-mapstructBinding.tar.bz2" compression="bzip2">
<tarfileset dir="dist">
<include name="lombok-mapstruct-binding-${mapstruct-binding.version}.jar" />
Expand Down
93 changes: 65 additions & 28 deletions buildScripts/maven.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,37 +65,61 @@ This buildfile is part of projectlombok.org. It makes maven-compatible repositor
<mkdir dir="dist" />

<maven.make version-name="${lombok.version}" />
<tar destfile="dist/mavenPublish.tar.bz2" compression="bzip2">
<tarfileset dir="dist">
</target>

<target name="maven.publish" depends="maven, -setup.ossrh">
<fail>
Your lombok clone does not include the OSSRH deployment keys. Contact the core maintainers for these keys;
place them in ${gpg.keyrings} to continue.

<condition>
<not><available file="${gpg.keyrings}" /></not>
</condition>
</fail>

<fail unless="ossrh.password">
Your lombok clone does not include the OSSRH (sonatype maven central) password, needed to upload and deploy to maven central. Contact the core maintainers.
</fail>

<delete quiet="true" dir="build/maven-publish" />
<mkdir dir="build/maven-publish" />
<copy todir="build/maven-publish">
<fileset dir="dist">
<include name="lombok-${lombok.version}.jar" />
<include name="lombok-${lombok.version}-sources.jar" />
<include name="lombok-${lombok.version}-javadoc.jar" />
</tarfileset>
<tarfileset dir="build" includes="pom.xml" />
</tar>
</target>

<target name="maven.publish" depends="maven, setup.ssh">
<ivy:scpUpload
from="dist/mavenPublish.tar.bz2"
to="/data/lombok/staging"
server="projectlombok.org"
username="${ssh.username}"
keyfile="${ssh.keyfile}"
knownHosts="ssh.knownHosts" />
<ivy:sshExec
cmd="/data/lombok/stagingCmd/publishToMavenCentral"
server="projectlombok.org"
username="${ssh.username}"
keyfile="${ssh.keyfile}"
knownHosts="ssh.knownHosts" />
</fileset>
<fileset dir="build" includes="pom.xml" />
</copy>

<apply executable="${exe.gpg}" failifexecutionfails="false" resultproperty="gpg.result">
<arg value="-ab" />
<arg value="--batch" />
<arg value="--yes" />
<arg value="--homedir" />
<arg value="${gpg.keyrings}" />
<fileset dir="build/maven-publish" />
</apply>

<fail>
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.
<condition>
<not><isset property="gpg.result" /></not>
</condition>
</fail>

<jar destfile="build/maven-publish/lombok-bundle.jar">
<fileset dir="build/maven-publish" />
</jar>

<exec executable="${exe.curl}" failifexecutionfails="false" resultproperty="curl.result">
<arg value="-u" />
<arg value="${ossrh.username}:${ossrh.password}" />
<arg value="-F" />
<arg value="file=@build/maven-publish/lombok-bundle.jar;type=application/java-archive" />
<arg value="https://oss.sonatype.org/service/local/staging/bundle_upload" />
</exec>
<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>
<ivy:sshExec
cmd="/data/lombok/stagingCmd/showMavenCentralPassword"
server="projectlombok.org"
username="${ssh.username}"
keyfile="${ssh.keyfile}"
knownHosts="ssh.knownHosts" />
</target>

<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.">
Expand All @@ -116,12 +140,25 @@ This buildfile is part of projectlombok.org. It makes maven-compatible repositor
<arg value="-DpomFile=build/pom.xml" />
<arg value="-Durl=file://${basedir}/build/edge-releases" />
</exec>

<fail>
mvn is not on your path and/or MAVEN_HOME is not set. Add mvn to your path or set MAVEN_HOME to continue.
<condition>
<not><isset property="mvn.result" /></not>
</condition>
</fail>
<copy file="dist/lombok-${lombok.version}.jar" tofile="build/edge-releases/lombok-edge.jar" />
</target>

<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">
<java classname="lombok.publish.PublishToBucket" failonerror="true">
<classpath>
<path refid="cp.buildtools" />
<pathelement location="build/support" />
</classpath>
<arg value="${gpg.keyrings}/s3_creds.txt" />
<arg value="build/edge-releases" />
<arg value="edge" />
<arg value="true" />
</java>
</target>
</project>
62 changes: 13 additions & 49 deletions buildScripts/setup.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
<available file="${rtstubs18.loc}" property="rtstubs18.available" />
<property name="ssh.configuration.file" location="ssh.configuration" />

<property name="gpg.keyrings" location="gpg.keyring" />
<property name="exe.gpg" value="gpg" />
<property name="exe.curl" value="curl" />

<condition property="os.specific.native-swt-lib" value="org.eclipse.swt.gtk.linux.aarch64">
<os name="Linux" arch="aarch64" />
</condition>
Expand All @@ -60,55 +64,6 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
</condition>
<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>

<target name="-setup.ssh.ask">
<property file="${ssh.configuration.file}" />
<fail>
Your ssh.configuration file is corrupted; delete it and rerun this script.
<condition>
<or>
<and>
<isset property="ssh.username" />
<equals arg1="" arg2="${ssh.username}" />
</and>
<and>
<isset property="ssh.keyfile" />
<equals arg1="" arg2="${ssh.keyfile}" />
</and>
</or>
</condition>
</fail>
<fail>
The keyfile configured in your ${ssh.configuration.file} file does not exist.
<condition>
<and>
<isset property="ssh.keyfile" />
<not><available file="${ssh.keyfile}" /></not>
</and>
</condition>
</fail>

<condition property="ssh.configuration.write">
<or>
<not><isset property="ssh.username" /></not>
<not><isset property="ssh.keyfile" /></not>
</or>
</condition>
<input message="What is your SSH username on the projectlombok.org server? (Enter to abort)." addproperty="ssh.username" />
<fail>Aborted<condition><equals arg1="" arg2="${ssh.username}" /></condition></fail>
<input message="Where is your ssh keyfile located? (Enter to abort)." addproperty="ssh.keyfile" defaultvalue="${user.home}/.ssh/id_rsa" />
<fail>File ${ssh.keyfile} does not exist<condition><not><available file="${ssh.keyfile}" /></not></condition></fail>
</target>

<target name="-setup.ssh.save" if="ssh.configuration.write">
<propertyfile file="${ssh.configuration.file}" comment="SSH connect info for projectlombok.org.">
<entry key="ssh.username" value="${ssh.username}" />
<entry key="ssh.keyfile" value="${ssh.keyfile}" />
</propertyfile>
<echo>Your connection info has been written to ${ssh.configuration.file} and will be remembered for future invocations.</echo>
</target>

<target name="setup.ssh" depends="-setup.ssh.ask, -setup.ssh.save" />

<target name="-autoclean.check">
<available type="dir" file="build" property="existingbuild.present" />
<loadresource property="existingbuild.ver">
Expand Down Expand Up @@ -371,6 +326,15 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
<ivy:cachepath pathid="cp.test" conf="test" />
</target>

<target name="-setup.ossrh">
<loadfile quiet="true" failonerror="false" encoding="UTF-8" property="ossrh.password" srcfile="${gpg.keyrings}/ossrh.password">
<filterchain>
<striplinebreaks />
</filterchain>
</loadfile>
<property name="ossrh.username" value="rzwitserloot" />
</target>

<fail>ant needs to be at least v1.10.0 or higher to build lombok. Your version is: ${ant.version}
<condition>
<not><antversion atleast="1.10.0" /></not>
Expand Down
8 changes: 4 additions & 4 deletions buildScripts/website.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ such as applying the templates to produce the website, converting the changelog
</tar>
</target>

<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">
<target name="website.publish" depends="website.pack" description="Builds the website, compresses it, sends it to the projectlombok.org server and deploys it">
<ivy:scpUpload
from="dist/website.tar.bz2"
to="/data/lombok/staging"
Expand Down Expand Up @@ -215,7 +215,7 @@ such as applying the templates to produce the website, converting the changelog
<echo>File dist/javadoc.tar.bz2 is available</echo>
</target>

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

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

<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">
<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">
<ivy:scpUpload
from="dist/website-edge.tar.bz2"
to="/data/lombok/staging"
Expand Down
Loading

0 comments on commit 756f001

Please sign in to comment.