Skip to content

Commit

Permalink
Makefile: add GRADLE argument (#218)
Browse files Browse the repository at this point in the history
Minor change: this just makes it possible to more easily use an external
installation of gradle. In some cases, this will be preferable.
  • Loading branch information
jchadwick-buf authored Dec 17, 2024
1 parent b440503 commit d311c75
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ SHELL := bash
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-print-directory
GRADLE ?= ./gradlew

.PHONY: all
all: lint generate build docs conformance ## Run all tests and lint (default)

.PHONY: build
build: ## Build the entire project.
./gradlew build
$(GRADLE) build

.PHONY: docs
docs: ## Build javadocs for the project.
./gradlew javadoc
$(GRADLE) javadoc

.PHONY: checkgenerate
checkgenerate: generate ## Checks if `make generate` produces a diff.
Expand All @@ -25,37 +26,37 @@ checkgenerate: generate ## Checks if `make generate` produces a diff.

.PHONY: clean
clean: ## Delete intermediate build artifacts
./gradlew clean
$(GRADLE) clean

.PHONY: conformance
conformance: ## Execute conformance tests.
./gradlew conformance:conformance
$(GRADLE) conformance:conformance

.PHONY: help
help: ## Describe useful make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-15s %s\n", $$1, $$2}'

.PHONY: generate
generate: ## Regenerate code and license headers
./gradlew generate
$(GRADLE) generate

.PHONY: lint
lint: ## Lint code
./gradlew spotlessCheck
$(GRADLE) spotlessCheck

.PHONY: lintfix
lintfix: ## Applies the lint changes.
./gradlew spotlessApply
$(GRADLE) spotlessApply

.PHONY: release
release: ## Upload artifacts to Sonatype Nexus.
./gradlew --info publish --stacktrace --no-daemon --no-parallel
./gradlew --info releaseRepository
$(GRADLE) --info publish --stacktrace --no-daemon --no-parallel
$(GRADLE) --info releaseRepository

.PHONY: releaselocal
releaselocal: ## Release artifacts to local maven repository.
./gradlew --info publishToMavenLocal
$(GRADLE) --info publishToMavenLocal

.PHONY: test
test: ## Run all tests.
./gradlew test
$(GRADLE) test

0 comments on commit d311c75

Please sign in to comment.