Skip to content

Commit

Permalink
Update standalone build process to cleanup mutated files. Closes #406
Browse files Browse the repository at this point in the history
  • Loading branch information
pskrbasu committed Jan 3, 2024
1 parent 939dc2b commit 77f4f61
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,33 @@ install: build
# build standalone
standalone: validate_plugin prebuild.go
@echo "Building standalone FDW for plugin: $(plugin)"
go run generate/generator.go templates . $(plugin) $(plugin_github_url)
go mod tidy
$(MAKE) -C ./fdw clean
$(MAKE) -C ./fdw go
$(MAKE) -C ./fdw

# Create a new directory for the build process
mkdir -p render

# Copy the entire source tree, excluding .git directory, into the new directory
rsync -a --exclude='.git' . render/ >/dev/null 2>&1

# Change to the new directory to perform operations
cd render && \
go run generate/generator.go templates . $(plugin) $(plugin_github_url) && \
go mod tidy && \
$(MAKE) -C ./fdw clean && \
$(MAKE) -C ./fdw go && \
$(MAKE) -C ./fdw && \
$(MAKE) -C ./fdw standalone

rm -f prebuild.go

# Delete existing build-${PLATFORM} and copy the binaries to the actual
# build-${PLATFORM} folder
rm -rf build-${PLATFORM} && \
mkdir -p build-${PLATFORM} && \
cp -a render/build-${PLATFORM}/* build-${PLATFORM}/

# Clean up the render directory
rm -rf render

# Note: The render directory will contain the full code tree with changes,
# binaries will be copied to build-${PLATFORM}, and then render will be deleted

validate_plugin:
ifndef plugin
Expand Down

0 comments on commit 77f4f61

Please sign in to comment.