feat(gradle): add help metadata (#26810)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
638647d77c
commit
fc1c04918b
@ -74,9 +74,9 @@ export default function TargetConfigurationDetails({
|
||||
getDisplayHeaderFromTargetConfiguration(targetConfiguration);
|
||||
const configurations = targetConfiguration.configurations;
|
||||
|
||||
const shouldRenderOptions =
|
||||
const shouldRenderOptions: boolean =
|
||||
options &&
|
||||
(typeof options === 'object' ? Object.keys(options).length : true);
|
||||
(typeof options === 'object' ? Object.keys(options).length > 0 : true);
|
||||
|
||||
const shouldRenderConfigurations =
|
||||
configurations &&
|
||||
@ -137,7 +137,7 @@ export default function TargetConfigurationDetails({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{shouldRenderOptions ? (
|
||||
{shouldRenderOptions || targetConfiguration.metadata?.help ? (
|
||||
<>
|
||||
<h4 className="mb-4">
|
||||
<Tooltip
|
||||
@ -149,6 +149,7 @@ export default function TargetConfigurationDetails({
|
||||
</span>
|
||||
</Tooltip>
|
||||
</h4>
|
||||
{shouldRenderOptions ? (
|
||||
<div className="mb-4">
|
||||
<FadingCollapsible>
|
||||
<JsonCodeBlock
|
||||
@ -164,6 +165,8 @@ export default function TargetConfigurationDetails({
|
||||
/>
|
||||
</FadingCollapsible>
|
||||
</div>
|
||||
) : null}
|
||||
{targetConfiguration.metadata?.help && (
|
||||
<div className="mb-4">
|
||||
<ShowOptionsHelp
|
||||
targetConfiguration={targetConfiguration}
|
||||
@ -171,10 +174,9 @@ export default function TargetConfigurationDetails({
|
||||
targetName={targetName}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{targetConfiguration.inputs && (
|
||||
<div className="group">
|
||||
|
||||
@ -98,6 +98,16 @@ describe('@nx/gradle/plugin', () => {
|
||||
"^production",
|
||||
],
|
||||
"metadata": {
|
||||
"help": {
|
||||
"command": "./gradlew help --task proj:test",
|
||||
"example": {
|
||||
"options": {
|
||||
"args": [
|
||||
"--rerun",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"technologies": [
|
||||
"gradle",
|
||||
],
|
||||
@ -168,6 +178,16 @@ describe('@nx/gradle/plugin', () => {
|
||||
"^production",
|
||||
],
|
||||
"metadata": {
|
||||
"help": {
|
||||
"command": "./gradlew help --task proj:test",
|
||||
"example": {
|
||||
"options": {
|
||||
"args": [
|
||||
"--rerun",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"technologies": [
|
||||
"gradle",
|
||||
],
|
||||
@ -256,6 +276,16 @@ describe('@nx/gradle/plugin', () => {
|
||||
"^production",
|
||||
],
|
||||
"metadata": {
|
||||
"help": {
|
||||
"command": "./gradlew help --task proj:test",
|
||||
"example": {
|
||||
"options": {
|
||||
"args": [
|
||||
"--rerun",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"technologies": [
|
||||
"gradle",
|
||||
],
|
||||
@ -282,6 +312,16 @@ describe('@nx/gradle/plugin', () => {
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Runs Gradle Tests in CI",
|
||||
"help": {
|
||||
"command": "./gradlew help --task proj:test",
|
||||
"example": {
|
||||
"options": {
|
||||
"args": [
|
||||
"--rerun",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"nonAtomizedTarget": "test",
|
||||
"technologies": [
|
||||
"gradle",
|
||||
@ -300,6 +340,16 @@ describe('@nx/gradle/plugin', () => {
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Runs Gradle test nested/nested/proj/src/test/java/test/test.java in CI",
|
||||
"help": {
|
||||
"command": "./gradlew help --task proj:test",
|
||||
"example": {
|
||||
"options": {
|
||||
"args": [
|
||||
"--rerun",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"technologies": [
|
||||
"gradle",
|
||||
],
|
||||
@ -317,6 +367,16 @@ describe('@nx/gradle/plugin', () => {
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Runs Gradle test nested/nested/proj/src/test/java/test/test1.java in CI",
|
||||
"help": {
|
||||
"command": "./gradlew help --task proj:test",
|
||||
"example": {
|
||||
"options": {
|
||||
"args": [
|
||||
"--rerun",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"technologies": [
|
||||
"gradle",
|
||||
],
|
||||
|
||||
@ -275,6 +275,14 @@ async function createGradleTargets(
|
||||
dependsOn: dependsOnMap[task.name],
|
||||
metadata: {
|
||||
technologies: ['gradle'],
|
||||
help: {
|
||||
command: `${getGradleExecFile()} help --task ${taskCommandToRun}`,
|
||||
example: {
|
||||
options: {
|
||||
args: ['--rerun'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
...(outputs && outputs.length ? { outputs } : {}),
|
||||
};
|
||||
@ -335,6 +343,14 @@ function getTestCiTargets(
|
||||
metadata: {
|
||||
technologies: ['gradle'],
|
||||
description: `Runs Gradle test ${testFile} in CI`,
|
||||
help: {
|
||||
command: `${getGradleExecFile()} help --task ${taskCommandToRun}`,
|
||||
example: {
|
||||
options: {
|
||||
args: ['--rerun'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
...(outputs && outputs.length > 0 ? { outputs } : {}),
|
||||
};
|
||||
@ -356,6 +372,14 @@ function getTestCiTargets(
|
||||
technologies: ['gradle'],
|
||||
description: 'Runs Gradle Tests in CI',
|
||||
nonAtomizedTarget: testTargetName,
|
||||
help: {
|
||||
command: `${getGradleExecFile()} help --task ${taskCommandToRun}`,
|
||||
example: {
|
||||
options: {
|
||||
args: ['--rerun'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
targetGroups[targetGroupName].push(ciTargetName);
|
||||
|
||||
@ -1220,6 +1220,6 @@ function getHelpTextFromTarget(
|
||||
throw new Error(`No help command found for ${projectName}:${targetName}`);
|
||||
|
||||
return execSync(command, {
|
||||
cwd: join(workspaceRoot, project.data.root),
|
||||
cwd: target.options?.cwd ?? workspaceRoot,
|
||||
}).toString();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user