summaryrefslogtreecommitdiff
path: root/testsuite/tests/plugins/Makefile
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-12-18 18:29:52 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-12-22 14:23:16 -0800
commit1faf1fcaebb2871f8085b01d0c6d19eec11dc808 (patch)
treeff61505ef4e115f5b13933b5e05a574d507629f5 /testsuite/tests/plugins/Makefile
parent998739df630cbee7d006329a76786239e3e2c0be (diff)
downloadhaskell-1faf1fcaebb2871f8085b01d0c6d19eec11dc808.tar.gz
Implement -hide-all-plugin-packages and -plugin-package(-id), fixing #11244
Summary: The basic idea is that we have a new set of "exposed modules" which are /only/ used for plugins, i.e. -fplugin Foo and --frontend Foo. You can interact with this namespace using the flags -plugin-package-id and -plugin-package. By default, this namespace contains all modules in the user namespace (as before), but you can toggle that using -hide-all-plugin-packages. There is one nasty hack: GhcMake respects -fplugin in GHC_OPTIONS to make local plugins work correctly. It also bails out of you have an import of a module which doesn't exist locally or in the package database. The upshot is that we need to be sure to check in the plugin modules too, so we don't give a spurious failure when a plugin is in the plugin namespace but not the main namespace. A better way to fix this would be to distinguish between plugin and normal dependencies in ModSummary. I cheated a little and tweaked a few existing plugins tests to exercise the new code paths. TODO: Documentation Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: bgamari, austin, simonpj, duncan Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1661 GHC Trac Issues: #11244
Diffstat (limited to 'testsuite/tests/plugins/Makefile')
-rw-r--r--testsuite/tests/plugins/Makefile16
1 files changed, 13 insertions, 3 deletions
diff --git a/testsuite/tests/plugins/Makefile b/testsuite/tests/plugins/Makefile
index c12c33c9c7..28d3ae8aa7 100644
--- a/testsuite/tests/plugins/Makefile
+++ b/testsuite/tests/plugins/Makefile
@@ -2,19 +2,24 @@ TOP=../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
+# Each of the tests also exercise the various ways to bring plugins into scope
+
+# -hide-all-plugin-packages + -plugin-package
.PHONY: plugins01
plugins01:
- "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 plugins01.hs -package-db simple-plugin/pkg.plugins01/local.package.conf -fplugin Simple.Plugin -fplugin-opt Simple.Plugin:Irrelevant_Option -package simple-plugin
+ "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 plugins01.hs -package-db simple-plugin/pkg.plugins01/local.package.conf -fplugin Simple.Plugin -fplugin-opt Simple.Plugin:Irrelevant_Option -hide-all-plugin-packages -plugin-package simple-plugin
./plugins01
+# -hide-all-packages + -plugin-package
.PHONY: plugins07
plugins07:
- "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 -O plugins07.hs -package-db rule-defining-plugin/pkg.plugins07/local.package.conf -package rule-defining-plugin -fplugin=RuleDefiningPlugin
+ "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 -O plugins07.hs -package-db rule-defining-plugin/pkg.plugins07/local.package.conf -hide-all-packages -package base -plugin-package rule-defining-plugin -fplugin=RuleDefiningPlugin
./plugins07
+# -package (should work for backwards compatibility)
.PHONY: T10420
T10420:
- "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 -O T10420.hs -package-db rule-defining-plugin/pkg.T10420/local.package.conf -package rule-defining-plugin
+ "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 -O T10420.hs -package-db rule-defining-plugin/pkg.T10420/local.package.conf -hide-all-packages -package base -package rule-defining-plugin
./T10420
.PHONY: T10294
@@ -31,3 +36,8 @@ frontend01:
"$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -Wall -package ghc -c FrontendPlugin.hs
"$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --frontend FrontendPlugin -ffrontend-opt foobar frontend01
./frontend01
+
+# -hide-all-plugin-packages + -package (this should not work!)
+.PHONY: T11244
+T11244:
+ ! "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 -O T11244.hs -package-db rule-defining-plugin/pkg.T11244/local.package.conf -hide-all-plugin-packages -package rule-defining-plugin -fplugin=RuleDefiningPlugin