Skip to content

Commit 5eedf76

Browse files
add CONTRIBUTING.md
1 parent 7a010b0 commit 5eedf76

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contributing
2+
3+
Thank you for your interest in contributing to Quilt Enigma Plugin!
4+
5+
We recommend discussing your contribution with other members of the community - either directly in your pull request,
6+
or in our other community spaces. We're always happy to help if you need us!
7+
8+
### Proposers
9+
10+
Proposers should generate names that
11+
- follow [Quilt Mappings conventions](https://github.com/QuiltMC/quilt-mappings/blob/25w06a/CONVENTIONS.md)
12+
- consistently generate high-quality names
13+
14+
Proposed names contribute to mapping stats, so it's better to leave things unmapped and easier to find
15+
than to propose names that need to be manually overriden.
16+
17+
### Tests
18+
19+
All proposers should be tested by an independent test class in `src/test/` in the same package as the proposer class.
20+
21+
Most tests will require an obfuscated jar as input. *Do not* use other tests' jars or input classes;
22+
each test should be completely independent.
23+
24+
To create the source for your obfuscated jar, create a directory under `src/testInputs/` named after your
25+
proposer class converted to `lowerCamelCase`, for example `MyNameProposer` -> `myNameProposer`.
26+
27+
Gradle will automatically create a source set from your directory and setup task dependencies to ensure your obfuscated
28+
jar is present for tests.
29+
30+
Create input classes in your new test input source set,
31+
for example `src/testInputs/myNameProposer/java/com/example/MyProposerTestInput.java`
32+
33+
Now on your test class in `src/test/`, implement `ConventionalNameProposerTest` and implement its
34+
`getTarget()` and `getTargetId()` methods so that they return the class and identifier of your proposer.
35+
36+
Finally, in each test method, use `createAsserter()` to create a `ProposalAsserter` for your obfuscated jar.
37+
Use the asserter to assert the presence/absence of mappings, and use its `remapper()` if you need to manually
38+
insert mappings in your test.
39+
40+
### Descriptors, entries, and keeping track of obfuscated names
41+
When asserting mappings, you'll need to create obfuscated `Entry`s representing the obfuscated name of the
42+
class/member you're checking.
43+
`TestUtil` has factory methods to streamline this process, and `CommonDescriptors` has reusable descriptors to pass to them.
44+
45+
You'll also likely need some of the obfuscated names of your test input classes. You can find them in the txt mapping file in
46+
`build/test-obf/` which is created by your test input obf task
47+
(ex: `myNameProposerTestObf` would create `myNameProposer-test-obf.txt`).
48+
49+
However if you add or edit test input classes, obfuscated names may need to be updated.
50+
Use variable names and comments to make it easier to track obfuscated names in your test class back to their test input sources.
51+
For example, you might create a constant `private static final String MY_PROPOSER_TEST_INPUT_NAME = "a/a/a";` where the field name
52+
makes it clear that it represents the obfuscated name of `MyProposerTestInput`.

0 commit comments

Comments
 (0)