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

Change gradle copy to sync to clear old jars #609

Merged
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
2 changes: 1 addition & 1 deletion RFS/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ task demoPrintOutSnapshot (type: JavaExec) {
mainClass = 'com.rfs.DemoPrintOutSnapshot'
}

task copyDockerRuntimeJars (type: Copy) {
task copyDockerRuntimeJars (type: Sync) {
description = 'Copy runtime JARs and app jar to docker build directory'

// Define the destination directory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.opensearch.migrations.common

import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.Sync
import org.gradle.api.Project
import com.bmuschko.gradle.docker.tasks.image.Dockerfile

Expand All @@ -27,7 +27,9 @@ class CommonUtils {
copyArtifact(project, projectName, projectName, destDir)
}
static def copyArtifact(Project project, String artifactProjectName, String destProjectName, String destDir) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it posible to rename this to syncArtifact? It would be great to modernize that too!

project.task("copyArtifact_${destProjectName}", type: Copy) {
// Sync performs a copy, while also deleting items from the destination directory that are not in the source directory
// In our case, jars of old versions were getting "stuck" and causing conflicts when the program was run
project.task("copyArtifact_${destProjectName}", type: Sync) {
dependsOn ":${artifactProjectName}:build"
dependsOn ":${artifactProjectName}:jar"
if (destProjectName == "trafficCaptureProxyServerTest") {
Expand Down