Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate redundant/out-of-sync version from BeamModulePlugin.groovy #28750

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build_release_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Configure git
run: git config credential.helper store
- name: Stage Java Artifacts into Maven
run: ./gradlew publish -Psigning.gnupg.keyName=${{steps.import_gpg.outputs.fingerprint}} -PisRelease --no-daemon --no-parallel
run: ./gradlew publish -Psigning.gnupg.keyName=${{steps.import_gpg.outputs.fingerprint}} --no-daemon --no-parallel


stage_java_source:
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push docker images
run: ./gradlew :pushAllDockerImages -PisRelease -Pdocker-pull-licenses -Pprune-images -Pdocker-tag=${{ github.event.inputs.RELEASE }}rc${{ github.event.inputs.RC }} -Pjava11Home=${{steps.export-java11.outputs.JAVA11_HOME}} --no-daemon --no-parallel
run: ./gradlew :pushAllDockerImages -Pdocker-pull-licenses -Pprune-images -Pdocker-tag=${{ github.event.inputs.RELEASE }}rc${{ github.event.inputs.RC }} -Pjava11Home=${{steps.export-java11.outputs.JAVA11_HOME}} --no-daemon --no-parallel


beam_site_pr:
Expand Down Expand Up @@ -253,7 +253,7 @@ jobs:
- name: Build Java Docs
working-directory: beam
run: |
./gradlew :sdks:java:javadoc:aggregateJavadoc -PisRelease --no-daemon --no-parallel
./gradlew :sdks:java:javadoc:aggregateJavadoc --no-daemon --no-parallel
- name: Consolidate Release Docs to beam-site branch with symlinks
working-directory: beam-site
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,6 @@ class BeamModulePlugin implements Plugin<Project> {
String collectMarker
}

def isRelease(Project project) {
return parseBooleanProperty(project, 'isRelease');
}
/**
* Parses -Pprop as true for use as a flag, and otherwise uses Groovy's toBoolean
*/
Expand Down Expand Up @@ -488,12 +485,7 @@ class BeamModulePlugin implements Plugin<Project> {

project.ext.mavenGroupId = 'org.apache.beam'

// Automatically use the official release version if we are performing a release
// otherwise append '-SNAPSHOT'
project.version = '2.52.0'
if (!isRelease(project)) {
project.version += '-SNAPSHOT'
}
project.ext.isRelease = !project.version.endsWith('-SNAPSHOT')

// Default to dash-separated directories for artifact base name,
// which will also be the default artifactId for maven publications
Expand Down Expand Up @@ -548,7 +540,7 @@ class BeamModulePlugin implements Plugin<Project> {
}

project.ext.containerArchitectures = {
if (isRelease(project)) {
if (project.isRelease) {
// Ensure we always publish the expected containers.
return ["amd64", "arm64"];
} else if (project.rootProject.findProperty("container-architecture-list") != null) {
Expand Down Expand Up @@ -959,10 +951,10 @@ class BeamModulePlugin implements Plugin<Project> {
url "file://${project.rootProject.projectDir}/testPublication/"
}
maven {
url(project.properties['distMgmtSnapshotsUrl'] ?: isRelease(project)
url(project.properties['distMgmtSnapshotsUrl'] ?: project.isRelease
? 'https://repository.apache.org/service/local/staging/deploy/maven2'
: 'https://repository.apache.org/content/repositories/snapshots')
name(project.properties['distMgmtServerId'] ?: isRelease(project)
name(project.properties['distMgmtServerId'] ?: project.isRelease
? 'apache.releases.https' : 'apache.snapshots.https')
// The maven settings plugin will load credentials from ~/.m2/settings.xml file that a user
// has configured with the Apache release and snapshot staging credentials.
Expand Down Expand Up @@ -1736,7 +1728,7 @@ class BeamModulePlugin implements Plugin<Project> {
project.ext.includeInJavaBom = configuration.publish
project.ext.exportJavadoc = configuration.exportJavadoc

if ((isRelease(project) || project.hasProperty('publishing')) &&
if ((project.isRelease || project.hasProperty('publishing')) &&
configuration.publish) {
project.apply plugin: "maven-publish"

Expand Down Expand Up @@ -2006,7 +1998,7 @@ class BeamModulePlugin implements Plugin<Project> {
}
}
// Only sign artifacts if we are performing a release
if (isRelease(project) && !project.hasProperty('noSigning')) {
if (project.isRelease && !project.hasProperty('noSigning')) {
project.apply plugin: "signing"
project.signing {
useGpgCmd()
Expand Down
2 changes: 1 addition & 1 deletion contributor-docs/release-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ versions to run Python tests. See Python installation tips in [Developer Wiki](h

3. Run build command
```
./gradlew build -PisRelease --no-parallel --scan --stacktrace --continue
./gradlew build --no-parallel --scan --stacktrace --continue
```

To speed things up locally you might want to omit `--no-parallel`. You can also omit `--continue`
Expand Down
2 changes: 1 addition & 1 deletion release/src/main/scripts/build_release_candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ if [[ $confirmation = "y" ]]; then
cd ${BEAM_ROOT_DIR}
git checkout ${RC_TAG}

./gradlew :pushAllDockerImages -PisRelease -Pdocker-pull-licenses -Pdocker-tag=${RELEASE}rc${RC_NUM} -Pjava11Home=${JAVA11_HOME} --no-daemon --no-parallel
./gradlew :pushAllDockerImages -Pdocker-pull-licenses -Pdocker-tag=${RELEASE}rc${RC_NUM} -Pjava11Home=${JAVA11_HOME} --no-daemon --no-parallel

wipe_local_clone_dir
fi
Expand Down
4 changes: 0 additions & 4 deletions release/src/main/scripts/set_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,16 @@ fi
if [[ -z "$IS_SNAPSHOT_VERSION" ]] ; then
# Fixing a release version
sed -i -e "s/version=.*/version=$TARGET_VERSION/" gradle.properties
sed -i -e "s/project.version = .*/project.version = '$TARGET_VERSION'/" buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
sed -i -e "s/^__version__ = .*/__version__ = '${TARGET_VERSION}'/" sdks/python/apache_beam/version.py
sed -i -e "s/sdk_version=.*/sdk_version=$TARGET_VERSION/" gradle.properties
sed -i -e "s/SdkVersion = .*/SdkVersion = \"$TARGET_VERSION\"/" sdks/go/pkg/beam/core/core.go
sed -i -e "s/\"version\": .*/\"version\": \"$TARGET_VERSION\",/" sdks/typescript/package.json
else
# For snapshot version:
# Java/gradle appends -SNAPSHOT
# In the Gradle plugin, the -SNAPSHOT is dynamic so we don't add it here
# Python appends .dev
# The Dataflow container remains unchanged as in this case it is beam-master-<date> form
sed -i -e "s/version=.*/version=$TARGET_VERSION-SNAPSHOT/" gradle.properties
sed -i -e "s/project.version = .*/project.version = '$TARGET_VERSION'/" buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
sed -i -e "s/^__version__ = .*/__version__ = '${TARGET_VERSION}.dev'/" sdks/python/apache_beam/version.py
sed -i -e "s/sdk_version=.*/sdk_version=$TARGET_VERSION.dev/" gradle.properties
sed -i -e "s/SdkVersion = .*/SdkVersion = \"${TARGET_VERSION}.dev\"/" sdks/go/pkg/beam/core/core.go
Expand All @@ -93,7 +90,6 @@ fi

if [[ "$GIT_ADD" == yes ]] ; then
git add gradle.properties
git add buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
git add sdks/python/apache_beam/version.py
git add sdks/go/pkg/beam/core/core.go
git add runners/google-cloud-dataflow-java/build.gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ task copyDockerfileDependencies(type: Copy) {
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ task copyDockerfileDependencies(type: Copy) {
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(name: project.docker_image_default_repo_prefix + spark_job_server_image,
Expand Down
4 changes: 2 additions & 2 deletions sdks/go/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ goBuild {
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(
Expand All @@ -40,7 +40,7 @@ docker {
tags containerImageTags()
files "./build/"
buildArgs(['pull_licenses': project.rootProject.hasProperty(["docker-pull-licenses"]) ||
project.rootProject.hasProperty(["isRelease"])])
project.rootProject.isRelease])
buildx useBuildx
platform(*project.containerPlatforms())
load useBuildx && !pushContainers
Expand Down
6 changes: 1 addition & 5 deletions sdks/java/bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ plugins {
id 'net.linguica.maven-settings'
}

def isRelease(Project project) {
return project.hasProperty('isRelease')
}

ext {
mavenJavaDir = "$project.buildDir/publications/mavenJava"
mavenJavaBomOutputFile = file(mavenJavaDir + "/pom-default.xml")
Expand Down Expand Up @@ -135,7 +131,7 @@ afterEvaluate {
}

// Only sign artifacts if we are performing a release
if (isRelease(project) && !project.hasProperty('noSigning')) {
if (project.isRelease && !project.hasProperty('noSigning')) {
apply plugin: "signing"
signing {
useGpgCmd()
Expand Down
6 changes: 1 addition & 5 deletions sdks/java/bom/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ javaPlatform {
allowDependencies()
}

def isRelease(Project project) {
return project.hasProperty('isRelease')
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down Expand Up @@ -122,7 +118,7 @@ publishing {
}

// Only sign artifacts if we are performing a release
if (isRelease(project) && !project.hasProperty('noSigning')) {
if (project.isRelease && !project.hasProperty('noSigning')) {
apply plugin: "signing"
signing {
useGpgCmd()
Expand Down
6 changes: 3 additions & 3 deletions sdks/java/container/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ task validateJavaHome {
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am honestly baffled as to why this causes the error

sdks/java/container/common.gradle': 112: Unexpected input: '{' @ line 112, column 8.
     docker {
            ^

  1 error


docker {
name containerImageName(
Expand All @@ -123,7 +123,7 @@ docker {
files "./build/"
buildArgs([
'pull_licenses': project.rootProject.hasProperty(["docker-pull-licenses"]) ||
project.rootProject.hasProperty(["isRelease"]),
project.rootProject.isRelease),
'java_version': imageJavaVersion,
])
buildx useBuildx
Expand All @@ -133,7 +133,7 @@ docker {
}

if (project.rootProject.hasProperty(["docker-pull-licenses"]) ||
project.rootProject.hasProperty(["isRelease"])) {
project.rootProject.isRelease) {
project.logger.lifecycle('docker-pull-licenses set, creating go-licenses')
dockerPrepare.dependsOn copyJavaThirdPartyLicenses
dockerPrepare.dependsOn copyGolangLicenses
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/expansion-service/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ task copyConfigFile(type: Copy) {
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ task copyConfigFile(type: Copy) {
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/container/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def copyLauncherDependencies = tasks.register("copyLauncherDependencies", Copy)
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(
Expand All @@ -82,7 +82,7 @@ docker {
files "../Dockerfile", "./build"
buildArgs(['py_version': "${project.ext.pythonVersion}",
'pull_licenses': project.rootProject.hasProperty(["docker-pull-licenses"]) ||
project.rootProject.hasProperty(["isRelease"])])
project.rootProject.isRelease])
buildx useBuildx
platform(*project.containerPlatforms())
load useBuildx && !pushContainers
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/expansion-service-container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def copyLicenseScripts = tasks.register("copyLicenseScripts", Copy){
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(
Expand Down
2 changes: 1 addition & 1 deletion sdks/typescript/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def copyDockerfileDependencies = tasks.register("copyDockerfileDependencies", Co
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
def pushContainers = project.rootProject.isRelease || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(
Expand Down
Loading