Skip to content

Commit 79221ce

Browse files
committed
with profile => $profile 로 변경
readme file update
1 parent 5953dc2 commit 79221ce

File tree

5 files changed

+54
-47
lines changed

5 files changed

+54
-47
lines changed

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,14 @@ Gradle Build Helper is a Visual Studio Code extension that simplifies running Gr
3030
2. Type and select `Gradle Build Helper`.
3131
3. Select a directory (if multi-project is enabled).
3232
4. Choose a Gradle task to execute.
33-
5. If the selected task includes `with profile`, select one from the available profiles. The selected task will be executed with the profile appended, e.g., `-Pprofile=dev`.
33+
5. If the selected task includes `$profile`, select one from the available profiles. The selected task will be executed with the profile appended, e.g., `-Pprofile=dev`.
3434

3535
---
3636

3737
## Configuration
3838

3939
This extension provides the following configurable options:
4040

41-
### Build Command
42-
**Property**: `gradle.build.helper.command`
43-
44-
- **Type**: `string`
45-
- **Default**: `gradlew`
46-
- **Description**: Default build command used by the extension.
47-
48-
---
49-
5041
### Multi-Project Support
5142
**Property**: `gradle.build.helper.isMultiProject`
5243

@@ -61,7 +52,7 @@ This extension provides the following configurable options:
6152

6253
- **Type**: `array`
6354
- **Default**: `["css", "dev"]`
64-
- **Description**: List of available Gradle profiles. If a task includes `with profile`, you will be prompted to select a profile, and the task will be executed with the selected profile, e.g., `-Pprofile=dev`.
55+
- **Description**: List of available Gradle profiles. If a task includes `$profile`, you will be prompted to select a profile, and the task will be executed with the selected profile, e.g., `-Pprofile=dev`.
6556

6657
---
6758

@@ -72,15 +63,25 @@ This extension provides the following configurable options:
7263
- **Default**:
7364
```json
7465
[
75-
"build",
76-
"clean build",
77-
"clean",
78-
"clean build with profile",
79-
"appRun"
66+
"gradlew build",
67+
"gradlew clean build",
68+
"gradlew build -t",
69+
"gradlew clean",
70+
"gradlew clean build $profile",
71+
"gradlew appRun"
8072
]
8173
```
82-
- **Description**: List of available Gradle tasks. Tasks containing `with profile` will require selecting a profile before execution, and the command will be modified to include the profile, e.g., `-Pprofile=dev`.
74+
- **Description**: List of available Gradle tasks. Tasks containing `$profile` will require selecting a profile before execution, and the command will be modified to include the profile, e.g., `-Pprofile=dev`.
75+
76+
- Note: If you are using MacOS or Linux, replace gradlew with ./gradlew in the task list. For example:
8377

78+
```json
79+
[
80+
"./gradlew build",
81+
"./gradlew clean build",
82+
...
83+
]
84+
```
8485
---
8586

8687
### Excluded Directories
@@ -99,14 +100,13 @@ Add the following configuration to your VS Code `settings.json` file to customiz
99100
{
100101
"gradle.build.helper.profiles": ["css", "dev", "prod"],
101102
"gradle.build.helper.tasks": [
102-
"build",
103-
"clean build",
104-
"clean",
105-
"clean build with profile",
106-
"test",
107-
"deploy"
103+
"gradlew build",
104+
"gradlew clean build",
105+
"gradlew clean",
106+
"gradlew clean build $profile",
107+
"gradlew test",
108+
"gradlew deploy"
108109
],
109-
"gradle.build.helper.command": "./gradlew",
110110
"gradle.build.helper.isMultiProject": true,
111111
"gradle.build.helper.excludeDirectory": [".git", "node_modules"]
112112
}

extension.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ async function selectDirectory() {
5050

5151
async function executeGradleCommand(directory) {
5252
const config = vscode.workspace.getConfiguration("gradle.build.helper");
53-
const commandScript = config.get("command") || "gradlew";
5453
const gradleTasks = config
5554
.get("tasks", [])
56-
.map((task) => `${commandScript} ${task}`);
55+
.map((task) => `${task}`);
56+
57+
// [Custom] 항목 추가
58+
gradleTasks.push("[Custom]");
5759

5860
const selectedTask = await vscode.window.showQuickPick(gradleTasks, {
5961
placeHolder: "Select a Gradle task",
@@ -62,19 +64,23 @@ async function executeGradleCommand(directory) {
6264
if (!selectedTask) return;
6365

6466
let terminal = vscode.window.terminals.find(
65-
(term) => term.name === "GradleHelper"
67+
(term) => term.name === "gradle-build-helper"
6668
);
6769
if (!terminal) {
68-
terminal = vscode.window.createTerminal("GradleHelper");
70+
terminal = vscode.window.createTerminal("gradle-build-helper");
6971
}
7072

71-
let command = `${commandScript} `;
73+
let command = ``;
7274

73-
if (directory) {
74-
command += `:${directory.replace(/\//g, ":")}:`;
75-
}
75+
if (selectedTask === "[Custom]") {
76+
const customTask = await vscode.window.showInputBox({
77+
placeHolder: "Enter the custom Gradle task",
78+
prompt: "Type the Gradle task you want to execute.",
79+
});
7680

77-
if (selectedTask.includes("with profile")) {
81+
if (!customTask) return;
82+
command += `${customTask}`;
83+
} else if (selectedTask.includes("$profile")) {
7884
let profiles = config.get("profiles", []);
7985

8086
// Profile 입력 처리
@@ -92,9 +98,13 @@ async function executeGradleCommand(directory) {
9298

9399
if (!selectedProfile) return;
94100

95-
command += `${selectedTask.replace(`${commandScript} `, "").replace("with profile", `-Pprofile=${selectedProfile}`)}`;
101+
command += `${selectedTask.replace("$profile", `-Pprofile=${selectedProfile}`)}`;
96102
} else {
97-
command += `${selectedTask.replace(`${commandScript} `, "")}`;
103+
command += `${selectedTask}`;
104+
}
105+
106+
if (directory) {
107+
command += ` -p ${directory}`;
98108
}
99109

100110
terminal.show();

gradle-build-helper-1.0.2.vsix

32.4 KB
Binary file not shown.

images/screenshot.png

-2.92 KB
Loading

package.json

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gradle-build-helper",
33
"displayName": "gradle-build-helper",
44
"description": "",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"publisher": "hwantage",
77
"license": "MIT",
88
"engines": {
@@ -44,7 +44,7 @@
4444
"items": {
4545
"type": "string"
4646
},
47-
"default": ["css", "dev"],
47+
"default": ["dev"],
4848
"description": "Available gradle profile"
4949
},
5050
"gradle.build.helper.tasks": {
@@ -53,19 +53,16 @@
5353
"type": "string"
5454
},
5555
"default": [
56-
"build",
57-
"clean build",
58-
"clean",
59-
"clean build with profile",
60-
"appRun"
56+
"gradlew build",
57+
"gradlew clean build",
58+
"gradlew clean",
59+
"gradlew build -t",
60+
"gradlew clean build $profile",
61+
"gradlew css",
62+
"gradlew war"
6163
],
6264
"description": "Available Gradle tasks"
6365
},
64-
"gradle.build.helper.command": {
65-
"type": "string",
66-
"default": "gradlew",
67-
"description": "Default build command"
68-
},
6966
"gradle.build.helper.isMultiProject": {
7067
"type": "boolean",
7168
"default": true,

0 commit comments

Comments
 (0)