[Pkg-mozext-commits] [requestpolicy] 01/280: change from ant to make
David Prévot
taffit at moszumanska.debian.org
Sat May 2 20:29:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit f6e539a67ecaacbe9056a9a9bedc5276c2a8efd7
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Nov 25 01:02:42 2014 +0100
change from ant to make
---
.gitignore | 4 ++
Makefile | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/build.xml | 81 ----------------------------
3 files changed, 172 insertions(+), 81 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1b01239..6c8f857 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,7 @@
*.xpi
*.bak*
*.orig
+
+# build and dist directories in the root folder
+/build/
+/dist/
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2fae39a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,168 @@
+# NOTE: in this file tab indentation is used.
+# Otherwise .RECIPEPREFIX would have to be set.
+
+#
+# create variables
+#
+
+extension_name := requestpolicy
+extension_uuid := requestpolicy at requestpolicy.com
+
+# The zip application to be used.
+ZIP := zip
+
+source_dirname := src
+build_dirname := build
+dist_dirname := dist
+
+source_path := $(source_dirname)/
+build_path := $(build_dirname)/
+dist_path := $(dist_dirname)/
+
+jar_file := $(build_path)chrome/$(extension_name).jar
+
+# the path of the target XPI file
+xpi_file := $(dist_path)$(extension_name).xpi
+
+# collect files that are part of the source code
+source_files := $(shell find $(source_dirname) -type f -regex ".*\.jsm?") \
+ $(source_dirname)/chrome.manifest \
+ $(source_dirname)/install.rdf \
+ $(source_dirname)/LICENSE \
+ $(source_dirname)/README \
+ $(wildcard $(source_dirname)/content/settings/*.css) \
+ $(wildcard $(source_dirname)/content/settings/*.html) \
+ $(wildcard $(source_dirname)/content/*.xul) \
+ $(wildcard $(source_dirname)/locale/*/*.dtd) \
+ $(wildcard $(source_dirname)/locale/*/*.properties) \
+ $(wildcard $(source_dirname)/skin/*.css) \
+ $(wildcard $(source_dirname)/skin/*.png) \
+ $(wildcard $(source_dirname)/skin/*.svg)
+# take all files from above and create their paths in the "build" directory
+all_files := $(patsubst $(source_path)%,$(build_path)%,$(source_files))
+
+javascript_files := $(filter %.js %.jsm,$(all_files))
+chrome_manifest := $(filter %chrome.manifest,$(all_files))
+other_files := $(filter-out $(javascript_files) $(chrome_manifest),$(all_files))
+
+all_files_inside_jar := $(filter $(build_path)content/% $(build_path)locale/% $(build_path)skin/%,$(all_files))
+all_files_outside_jar := $(filter-out $(all_files_inside_jar),$(all_files))
+
+# detect deleted files and empty directories
+deleted_files :=
+empty_dirs :=
+ifneq "$(wildcard $(build_path))" ""
+# files that have been deleted but still exist in the build directory.
+deleted_files := $(shell find $(build_path) -type f | grep -F -v $(addprefix -e ,$(all_files) $(jar_file)))
+# empty directories. -mindepth 1 to exclude the build directory itself.
+empty_dirs := $(shell find $(build_path) -mindepth 1 -type d -empty)
+endif
+
+
+
+
+#
+# define targets
+#
+
+# set "all" to be the default target
+.DEFAULT_GOAL := all
+
+# build and create XPI file
+.PHONY: all
+all: $(xpi_file)
+ @echo "Build finished successfully."
+
+# Building means processing all source files and eventually delete
+# empty directories and deleted files from the build directory.
+.PHONY: build
+build: $(build_path)
+$(build_path): $(all_files) $(deleted_files) $(empty_dirs)
+
+
+# create the dist directory
+$(dist_path):
+ @mkdir -p $(dist_path)
+
+# "dist" means packaging to a XPI file
+.PHONY: dist
+dist: $(xpi_file)
+# Note: We add the build path as a prerequisite, not the phony "build" target.
+# This way we avoid re-packaging in case nothing has changed.
+$(xpi_file): $(build_path) $(jar_file) | $(dist_path)
+ @rm -f $(xpi_file)
+ @echo "Creating XPI file."
+ @cd $(build_path) && \
+ $(ZIP) $(abspath $(xpi_file)) $(patsubst $(build_path)%,%,$(jar_file) $(all_files_outside_jar))
+ @echo "Creating XPI file: Done!"
+
+$(jar_file): $(all_files_inside_jar)
+ @mkdir -p $(dir $(jar_file))
+ @rm -f $(jar_file)
+ @cd $(build_path) && \
+ $(ZIP) $(abspath $(jar_file)) $(patsubst $(build_path)%,%,$(all_files_inside_jar))
+
+# ___________________
+# processing of files
+#
+
+$(javascript_files): $(patsubst $(build_path)%,$(source_path)%,$@)
+ @mkdir -p $(dir $@)
+ cp $(patsubst $(build_path)%,$(source_path)%,$@) $@
+ @# In case javascript files should be processed, it should be done here.
+
+# Copy chrome.manifest.packaging (src) to chrome.manifest (build).
+$(chrome_manifest): $(source_path)chrome.manifest.packaging
+ @mkdir -p $(dir $@)
+ cp $(source_path)chrome.manifest.packaging $@
+
+$(other_files): $(patsubst $(build_path)%,$(source_path)%,$@)
+ @mkdir -p $(dir $@)
+ cp $(patsubst $(build_path)%,$(source_path)%,$@) $@
+
+# __________________
+# "cleaning" targets
+#
+
+# This cleans all temporary files and directories created by 'make'.
+.PHONY: clean
+clean:
+ @rm -rf $(xpi_file) $(jar_file) $(build_path)*
+ @echo "Cleanup is done."
+
+# remove empty directories
+$(empty_dirs): FORCE
+ rmdir $@
+
+# delete deleted files that still exist in the build directory.
+# this target should be forced
+$(deleted_files): FORCE
+ @# delete:
+ rm $@
+ @# delete parent dirs if empty:
+ @rmdir --parents --ignore-fail-on-non-empty $(dir $@)
+
+# ____________
+# unit testing
+#
+
+# Note: currently you have to do some setup before this will work.
+# see https://github.com/RequestPolicyContinued/requestpolicy/wiki/Setting-up-a-development-environment#unit-tests-for-requestpolicy
+
+firefox_bin := /moz/firefox/nightly/firefox
+mozmill_tests_path := /moz/mozmill-tests/
+mozmill_manifest := $(mozmill_tests_path)firefox/tests/addons/$(extension_uuid)/manifest.ini
+
+.PHONY: check test mozmill
+check test: mozmill
+
+mozmill: $(xpi_file)
+ mozmill -a $(xpi_file) -b $(firefox_bin) -m $(mozmill_manifest)
+
+
+# ________________
+# "helper" targets
+#
+
+.PHONY: FORCE
+FORCE:
diff --git a/src/build.xml b/src/build.xml
deleted file mode 100644
index 9cdef18..0000000
--- a/src/build.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" ?>
-
-<project name="requestpolicy" default="dist">
- <property name="src.dir" value="." />
- <property name="dist.dir" value="dist" />
- <property name="app.name" value="requestpolicy" />
- <property name="app.id" value="requestpolicy at requestpolicy.com" />
- <!-- extension id like: xxx at xxx.com -->
- <property name="ff.dir" value="" />
-
- <condition property="ff.present">
- <and>
- <isset property="ff.dir" />
- <available file="${ff.dir}" type="dir" />
- </and>
- </condition>
-
- <target name="chrome">
- <mkdir dir="${dist.dir}" />
- <delete file="${dist.dir}/${app.name}.jar" />
- <zip destfile="${dist.dir}/${app.name}.jar">
- <fileset dir="${src.dir}">
- <include name="content/**" />
- <include name="locale/**" />
- <include name="skin/**" />
- <exclude name="**/.*" />
- <exclude name="**/CVS/**" />
- <exclude name="**/Copy *" />
- </fileset>
- </zip>
- </target>
-
- <target name="test.chrome" depends="chrome" if="ff.present">
- <!-- copy to chrome directory -->
- <copy file="${dist.dir}/${app.name}.jar" todir="${ff.dir}/chrome/chrome" overwrite="true" />
- <copy file="${src.dir}/chrome.manifest.packaging" tofile="${ff.dir}/chrome/${app.name}.manifest" overwrite="true" />
- </target>
-
- <!-- copy to extensions directory -->
- <!--
- <target name="test.ext" depends="chrome" if="ff.present">
- <copy file="${dist.dir}/${app.name}.jar" todir="${ff.dir}/extensions/${app.id}/chrome" overwrite="true" />
- <copy file="${src.dir}/chrome.manifest" todir="${ff.dir}/extensions/${app.id}" overwrite="true" />
- </target>
- -->
-
- <target name="dist" depends="chrome">
- <copy file="chrome.manifest.packaging" tofile="chrome.manifest" overwrite="true" />
- <delete file="${dist.dir}/${app.name}.xpi" />
- <zip destfile="${dist.dir}/${app.name}.xpi">
- <zipfileset file="${dist.dir}/${app.name}.jar" prefix="chrome" />
- <fileset dir="${src.dir}">
- <include name="LICENSE" />
- <include name="README" />
- <include name="chrome.manifest" />
- <include name="install.rdf" />
- <include name="components/**" />
- <include name="defaults/**" />
- <include name="modules/**" />
- <exclude name="**/Makefile" />
- <exclude name="**/.*" />
- <exclude name="**/CVS/**" />
- <exclude name="**/Copy *" />
- <exclude name="**/*.bak" />
- <exclude name="**/*.orig" />
- </fileset>
- </zip>
- <copy file="chrome.manifest.devel" tofile="chrome.manifest" overwrite="true" />
- </target>
-
- <target name="clean">
- <delete dir="${dist.dir}" />
- </target>
-
- <target name="clean.ff" if="ff.present">
- <delete dir="${ff.dir}/extensions/${app.id}" failonerror="false" />
- <delete file="${ff.dir}/chrome/${app.name}.manifest" failonerror="false" />
- <delete file="${ff.dir}/chrome/chrome/${app.name}.jar" failonerror="false" />
- </target>
-
-</project>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list