cps-org / cps

Common Package Specification — A cross-tool mechanism for locating software dependencies
https://cps-org.github.io/cps/
Other
91 stars 8 forks source link

Make compile definitions key/value #59

Closed mwoehlke closed 2 months ago

mwoehlke commented 3 months ago

Rewrite the specification of definitions to separate the definition name and value. In order to keep things sane for parsers, this necessitates always specifying definitions as a language-specific map. Also add an explicit 'all languages' key (which we probably should have had all along).

In theory, this makes it easier for consumers to perform certain operations such as querying whether a particular symbol is defined. It should also slightly simplify combining definitions from multiple components, or language-specific definitions with non-language-specific definitions (although, in practice, redefinitions on the command line are likely to be harmless).

Note that one potential complication of this approach is that it requires null values to be handled specially. This is required because we need a way to distinguish between -Dfoo and -Dfoo=, which may have different effects.

At least for now, the ability to specify explicitly undefined symbols has been dropped. Besides being rare, and potentially problematic for users, it turns out that tools may not support these either. (At least in theory, compile_flags can be used if necessary.)

Fixes #42.

bretbrownjr commented 2 months ago

@mwoehlke Who's the second reviewer in cases like this?

mwoehlke commented 2 months ago

Who's the second reviewer in cases like this?

Me. :slightly_smiling_face:

The intent of the rules is that changes are "signed off" by at least two authorized reviewers, with self-review allowed. That leaves a hole that I don't know how to "fix" in that a PR from an authorized reviewer needs a maintainer or third authorized reviewer, but the intent is to enforce that a change from some random contributor needs two sign-offs.

If I could, I'd tell GitHub to allow the author to approve their own PR and to count that against the two-person rule, but AFAIK there's no way to do that. That being the case, it's intended that maintainers (i.e. me) will override the rule in most cases.


FYI, the force push was just this trivial typo fix:

diff --git a/schema.rst b/schema.rst
index 8c6b829..8e56a06 100644
--- a/schema.rst
+++ b/schema.rst
@@ -286,7 +286,7 @@ Each key in the inner map(s) is the name of a compile definition,
 such that e.g. ``-Dkey=value`` is passed to the compiler.
 A value may be |null|, indicating a definition with no value
 (e.g. ``-Dkey`` is passed to the compiler).
-Note that an *empty* string indicated ``-Dkey=``,
+Note that an *empty* string indicates ``-Dkey=``,
 which may have a different effect than ``-Dkey``.

 The outer map is used to describe

(Note "indicates" vs. "indicated".)