-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #11758: Separate scala plugin makefiles from generic plugin mak…
…efiles
- Loading branch information
Showing
7 changed files
with
127 additions
and
97 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
# | ||
# make all will build node-external-reports.rpkg. | ||
# make demo will build a license limited version of the plugin | ||
# make all : will build node-external-reports.rpkg. | ||
# make licensed : will build a license limited version of the plugin | ||
# | ||
|
||
include ../common-scala-plugin.mk | ||
include ../makefiles/common-scala-plugin.mk | ||
|
||
plugin: all | ||
FILES += $(NAME)/datasources-schema.sql | ||
|
||
plugin-resources: | ||
target/$(NAME)/datasources-schema.sql: | ||
cp ./src/main/resources/datasources-schema.sql target/$(NAME)/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
# | ||
# make all will build node-external-reports.rpkg. | ||
# make demo will build a license limited version of the plugin | ||
# make all : will build helloworld.rpkg. | ||
# make license : will build a license limited version of the plugin | ||
# | ||
|
||
include ../common-scala-plugin.mk | ||
# Use this one for a Scala plugin | ||
include ../makefiles/common-scala-plugin.mk | ||
|
||
plugin: all | ||
# Uncomment this one for a non scala plugin | ||
#include ../makefiles/common-plugin.mk | ||
|
||
# this plugin has no resources to install | ||
plugin-resources: | ||
# nothing to cp into target$(NAME) | ||
# example could be: | ||
# Uncomment to add files to include in the plugin's main directory | ||
# Those files are relative to the target/ directory | ||
#FILES += $(NAME)/helloworld.properties | ||
#target/$(NAME)/helloworld.properties: | ||
#cp src/main/resources/helloworld.properties target/$(NAME)/ | ||
|
||
# Uncomment to add scripts to the plugin (default is to have only postinst) | ||
# Those files are relative to the packaging directory | ||
#SCRIPTS += preinst | ||
|
||
# Add another archive to the plugin (files.txz is the first one) | ||
#OTHER_ARCHIVES += target/other.txz | ||
#target/other.txz: | ||
#tar cJ -C packaging -f target/other.txz file1 file2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Common make directives for all plugins not based on a jar. | ||
# make all : will build $(NAME).rpkg. | ||
# make licensed : is not yet supported | ||
# | ||
|
||
include ../makefiles/common.mk | ||
|
||
std-files: | ||
|
||
licensed-files: | ||
echo "License not supported for this kind of plugin" && /bin/false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Common make directives for all plugins based on a jar. | ||
# make all : will build $(NAME).rpkg. | ||
# make licensed : will build a license limited version of the plugin | ||
# | ||
|
||
include ../makefiles/common.mk | ||
|
||
MAVEN_OPTS = --batch-mode -U | ||
|
||
## For licensed plugins | ||
# standard destination path for the license file is in module directory, "license.sign" | ||
TARGET_LICENSE_PATH = /opt/rudder/share/plugins/$(NAME)/license | ||
# standard destination path for the key is at JAR root, name: license.pubkey | ||
TARGET_KEY_CLASSPATH = license.pubkey | ||
# SIGNED_LICENSE_PATH: path towards the license file to embed | ||
# PUBLIC_KEY_PATH: path towards the public key to embed | ||
|
||
# Files to add to the plugin content (from the target directory) | ||
# By default this is a directory containing the plugin jar | ||
FILES = $(NAME) | ||
|
||
std-files: | ||
mvn $(MAVEN_OPTS) package | ||
mkdir -p target/$(NAME) | ||
mv target/$(NAME)-*-plugin-with-own-dependencies.jar target/$(NAME)/$(NAME).jar | ||
|
||
licensed-files: check-license | ||
mvn $(MAVEN_OPTS) -Dlimited -Dplugin-resource-publickey=$(TARGET_KEY_CLASSPATH) -Dplugin-resource-license=$(TARGET_LICENSE_PATH) -Dplugin-declared-version=$(VERSION) package | ||
mkdir -p target/$(NAME) | ||
mv target/$(NAME)-*-plugin-with-own-dependencies.jar target/$(NAME)/$(NAME).jar | ||
jar -uf target/$(NAME)/$(NAME).jar -C target $(TARGET_KEY_CLASSPATH) | ||
# embed the license | ||
cp $(SIGNED_LICENSE_PATH) target/$(NAME)/license | ||
|
||
check-license: | ||
test -n "$(SIGNED_LICENSE_PATH)" # $$SIGNED_LICENSE_PATH must be defined | ||
test -n "$(PUBLIC_KEY_PATH)" # $$PUBLIC_KEY_PATH must be defined | ||
|
||
.PHONY: std-files licensed-files check-license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Common make directives for all plugins based on a jar. | ||
# make all will build $(NAME).rpkg. | ||
# make licensed will build a license limited version of the plugin | ||
# | ||
|
||
.DEFAULT_GOAL := all | ||
|
||
# Available variables for override from makefiles | ||
OTHER_ARCHIVES = | ||
SCRIPTS = postinst | ||
FILES = | ||
|
||
RUDDER_BRANCH = $(shell sed -ne '/^rudder-branch=/s/rudder-branch=//p' build.conf) | ||
PLUGIN_BRANCH = $(shell sed -ne '/^plugin-branch=/s/plugin-branch=//p' build.conf) | ||
VERSION = $(RUDDER_BRANCH)-$(PLUGIN_BRANCH) | ||
FULL_NAME = $(shell sed -ne '/^plugin-id=/s/plugin-id=//p' build.conf) | ||
NAME = $(shell echo $(FULL_NAME) | sed -ne 's/rudder-plugin-//p') | ||
COMMIT_ID = $(shell git rev-parse HEAD 2>/dev/null || true) | ||
BUILD_TIMESTAMP = $(shell date --iso-8601=seconds) | ||
|
||
# build the default oss version of the package | ||
all: std-files $(FULL_NAME)-$(VERSION).rpkg | ||
|
||
# build a "licensed" version of the plugin, limited by a license file and verified by a public key | ||
licensed: licensed-files $(FULL_NAME)-$(VERSION).rpkg | ||
|
||
$(FULL_NAME)-$(VERSION).rpkg: target/metadata target/files.txz target/scripts.txz $(OTHER_ARCHIVES) | ||
ar r $(FULL_NAME)-$(VERSION).rpkg target/metadata target/files.txz target/scripts.txz $(OTHER_ARCHIVES) | ||
|
||
target/scripts.txz: $(addprefix packaging/,$(SCRIPTS)) | ||
tar cJ -C packaging -f target/scripts.txz $(SCRIPTS) | ||
|
||
target/files.txz: $(addprefix target/,$(FILES)) | ||
test [ -n "$(FILES)" ] # you must define the FILES variable in your Makefile | ||
tar cJ -C target -f target/files.txz $(FILES) | ||
|
||
target/metadata: | ||
mkdir -p target | ||
cp packaging/metadata target/metadata | ||
sed -i -e "s/\$${plugin-id}/$(FULL_NAME)/g" target/metadata | ||
sed -i -e "s/\$${plugin-version}/$(VERSION)/g" target/metadata | ||
sed -i -e "s/\$${maven.build.timestamp}/$(BUILD_TIMESTAMP)/g" target/metadata | ||
sed -i -e "s/\$${commit-id}/$(COMMIT_ID)/g" target/metadata | ||
sed -i -e "s/\$${plugin-name}/$(NAME)/g" target/metadata | ||
|
||
clean: | ||
rm -f $(FULL_NAME)-$(VERSION).rpkg | ||
rm -rf target | ||
|
||
|
||
.PHONY: all licensed clean std-files licensed-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters