Skip to content

Commit 2d2d731

Browse files
authored
Merge pull request #4 from perl-actions/haarg/add-omit-core-option
add omit-core option
2 parents 9527137 + cc28a26 commit 2d2d731

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ Defaults to `MYMETA.json MYMETA.yml META.json META.yml Makefile _build/params cp
7171

7272
A list of regular expressions of prerequisites to exclude. One pattern per line.
7373

74+
### `omit-core`
75+
76+
A boolean value to exclude core only modules from the output. Enabled by
77+
default.
78+
7479
## Outputs
7580

7681
### `perl`

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ inputs:
2929
description: 'Include prerequisites from all sources rather than only the first'
3030
required: false
3131
default: false
32+
omit-core:
33+
description: 'Omit core-only prerequisites'
34+
required: false
35+
default: true
3236

3337
outputs:
3438
perl:

src/cli.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const run = async (argv) => {
2121
boolean: [
2222
'perl',
2323
'allSources',
24+
'omitCore',
2425
],
2526
string: [
2627
'phases',
@@ -35,6 +36,7 @@ export const run = async (argv) => {
3536
features: 'feature',
3637
sources: 'source',
3738
allSources: ['all-sources', 'all'],
39+
omitCore: ['omit-core'],
3840
},
3941
}),
4042
).map(([k, v]) => {

src/get-prereqs.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,35 @@ const parsers = [
4040
[/Makefile.PL$/i, parseMakefilePL],
4141
];
4242

43+
const coreModules = [
44+
'B',
45+
'B::Deparse',
46+
'Config',
47+
'DynaLoader',
48+
'English',
49+
'POSIX',
50+
'Symbol',
51+
'UNIVERSAL',
52+
'blib',
53+
'bytes',
54+
'charnames',
55+
'deprecate',
56+
'feature',
57+
'integer',
58+
'lib',
59+
'open',
60+
'overload',
61+
'overloading',
62+
're',
63+
'sort',
64+
'strict',
65+
'utf8',
66+
'vars',
67+
'warnings',
68+
];
69+
70+
const coreMatch = new RegExp(`^(?:${coreModules.join('|')})$`);
71+
4372
const parserFor = (file) => {
4473
for (const [pattern, parser] of parsers) {
4574
if (file.match(pattern)) {
@@ -74,9 +103,14 @@ export const getPrereqs = async ({
74103
],
75104
excludes = [],
76105
allSources = false,
106+
omitCore = true,
77107
}) => {
78108
const prereqs = {};
79109

110+
if (omitCore) {
111+
excludes = [...excludes, coreMatch];
112+
}
113+
80114
for (const source of sources) {
81115
const parser = parserFor(source);
82116

src/main.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const run = async () => {
99
const sourcesInput = core.getInput('sources');
1010
const excludeInput = core.getMultilineInput('exclude');
1111
const allSources = core.getBooleanInput('all-sources');
12+
const omitCore = core.getBooleanInput('omit-core');
1213

1314
const phases = new Set(phasesInput.split(/\s+/));
1415
const relationships = new Set(relationshipsInput.split(/\s+/));
@@ -23,6 +24,7 @@ export const run = async () => {
2324
sources,
2425
excludes,
2526
allSources,
27+
omitCore,
2628
});
2729

2830
if (perl) {

0 commit comments

Comments
 (0)