Skip to content

Commit

Permalink
feat: add abstract Platform inputs and update taskContext
Browse files Browse the repository at this point in the history
  • Loading branch information
shblue21 committed Apr 7, 2023
1 parent 4483cfa commit 2f28ee0
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 6 deletions.
1 change: 1 addition & 0 deletions tasks/JReleaserTask/commands/abstractModelCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export abstract class AbstractModelCommand extends AbstractLoggingCommand {
this.buildOptions(ctx, {
gitRootSearch: '--git-root-search',
strict: '--strict',
configFile: '--config-file ${configFile}',
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ export abstract class AbstractPlatformAwareModelCommand extends AbstractModelCom
public initialize(ctx: ITaskContext): void {
super.initialize(ctx);
this.buildOptions(ctx, {
gitRootSearch: '--git-root-search',
strict: '--strict',
selectCurrentPlatform: '--select-current-platform',
selectPlatforms: '--select-platforms ${selectPlatforms}',
rejectPlatforms: '--reject-platforms ${rejectPlatforms}',
});
}
}
8 changes: 6 additions & 2 deletions tasks/JReleaserTask/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ export interface ITaskContext {
logLevel: string;
customArguments: string;

configFile: String;
strict: boolean;
gitRootSearch: boolean;
strict: boolean;
// configFile: string;

selectCurrentPlatform: boolean;
selectPlatforms: string[];
rejectPlatforms: string[];
dryRun: boolean;

initFormat: string;
Expand Down
17 changes: 16 additions & 1 deletion tasks/JReleaserTask/context/taskContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default class TaskContext implements ITaskContext {
tasks.getInput
);
this.getBoolInput = tasks.getBoolInput;

this.getVariable = tasks.getVariable;
this.setVariable = tasks.setVariable;
}
Expand All @@ -29,6 +28,10 @@ export default class TaskContext implements ITaskContext {
return this.getInput('command');
}

get configFile() {
return this.getInput('configFile');
}

// Advanced Arguments
get baseDirectory() {
return this.getInput('baseDirectory');
Expand All @@ -46,6 +49,18 @@ export default class TaskContext implements ITaskContext {
return this.getBoolInput('strict');
}

get selectCurrentPlatform() {
return this.getBoolInput('selectCurrentPlatform');
}

get selectPlatforms() {
return this.getInput('selectPlatforms').split(',');
}

get rejectPlatforms() {
return this.getInput('rejectPlatforms').split(',');
}

get dryRun() {
return this.getBoolInput('dryRun');
}
Expand Down
59 changes: 58 additions & 1 deletion tasks/JReleaserTask/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,64 @@
"visibleRule": "command = config",
"required": false
},

{
"name": "configFile",
"type": "filePath",
"label": "Config file",
"defaultValue": "$(System.DefaultWorkingDirectory)/jreleaser.yml",
"helpMarkDown": "Path to the JReleaser config file. The default value is $(System.DefaultWorkingDirectory)/jreleaser.yml",
"visibleRule": "command != env || command != template || command != json-schema || command != init, || command != templateGenerate",
"groupName": "advancedArguments",
"required": false
},
{
"name": "strict",
"type": "boolean",
"label": "Strict",
"defaultValue": "false",
"helpMarkDown": "Enable strict mode.",
"visibleRule": "command != env || command != template || command != json-schema || command != init, || command != templateGenerate",
"groupName": "advancedArguments",
"required": false
},
{
"name": "gitRootSearch",
"type": "boolean",
"label": "Git root search",
"helpMarkDown": "Searches for the Git root.",
"visibleRule": "command != env || command != template || command != json-schema || command != init, || command != templateGenerate",
"defaultValue": "false",
"groupName": "advancedArguments",
"required": false
},
{
"name": "selectCurrentPlatform",
"type": "boolean",
"label": "Select current platform",
"helpMarkDown": "Activates paths matching the current platform.",
"visibleRule": "command != env || command != template || command != json-schema || command != init, || command != templateGenerate || command != announce || command != changelog || command != deploy || command != download ",
"defaultValue": "false",
"groupName": "advancedArguments",
"required": false
},
{
"name": "selectPlatform",
"type": "string",
"label": "Select platform",
"helpMarkDown": "Activates paths matching the given platform. separate multiple platforms with a comma.",
"visibleRule": "command != env || command != template || command != json-schema || command != init, || command != templateGenerate || command != announce || command != changelog || command != deploy || command != download ",
"groupName": "advancedArguments",
"required": false
},
{
"name": "rejectPlatform",
"type": "string",
"label": "Reject platform",
"helpMarkDown": "Activates paths not matching the given platform. separate multiple platforms with a comma.",
"visibleRule": "command != env || command != template || command != json-schema || command != init, || command != templateGenerate || command != announce || command != changelog || command != deploy || command != download ",
"groupName": "advancedArguments",
"required": false
},
{
"name": "baseDirectory",
"type": "filePath",
Expand Down

0 comments on commit 2f28ee0

Please sign in to comment.