Conversation
1d42a53 to
77e0dab
Compare
77e0dab to
1d42a53
Compare
1d42a53 to
268abd8
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 51 out of 53 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+1
to
+2
| import { computed, ref } from '@vue/runtime-core'; | ||
| import { defineStore } from 'pinia'; |
Comment on lines
+1
to
+2
| import { computed, ref } from '@vue/runtime-core'; | ||
| import { defineStore } from 'pinia'; |
| if (fs.existsSync(shPath)) { | ||
| return shPath; | ||
| } | ||
| fs.renameSync(sdkPath, newPath); |
|
|
||
| <script setup lang="ts"> | ||
| import { computed, onMounted } from 'vue'; | ||
| import { RouterLink, useRoute } from 'vue-router'; |
Comment on lines
+36
to
+40
| import { useTaskCenterStore } from '@/stores/taskCenter'; | ||
|
|
||
| const route = useRoute(); | ||
| const catalogStore = useSdkCatalogStore(); | ||
| const taskCenterStore = useTaskCenterStore(); |
Comment on lines
+1
to
+2
| import { computed, ref } from '@vue/runtime-core'; | ||
| import { defineStore } from 'pinia'; |
| "github", | ||
| "sifli" | ||
| ], | ||
| "description": "Toolchain download source for this SDK." |
Comment on lines
+259
to
279
| const sanitizedName = newDirectoryName.trim(); | ||
| if ( | ||
| !sanitizedName || | ||
| sanitizedName === '.' || | ||
| sanitizedName === '..' || | ||
| sanitizedName.includes('/') || | ||
| sanitizedName.includes('\\') | ||
| ) { | ||
| throw new Error('目录名称无效。'); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * 在终端中执行 SDK 激活脚本 | ||
| */ | ||
| private async executeActivationScript(activationScript: { | ||
| scriptPath: string; | ||
| configPath: string; | ||
| command: string; | ||
| }): Promise<void> { | ||
| try { | ||
| this.logService.info(`Executing SDK activation script: ${activationScript.scriptPath}`); | ||
| const terminal = await this.terminalService.getOrCreateSiFliTerminalAndCdProject(false, { autoExport: false }); | ||
|
|
||
| const scriptDir = path.dirname(activationScript.scriptPath); | ||
|
|
||
| // 获取当前SDK的工具链路径 | ||
| const toolsPath = this.configService.getSdkToolsPath(scriptDir); | ||
|
|
||
| // 先设置 SIFLI_SDK_TOOLS_PATH 环境变量(如果有配置的话) | ||
| if (toolsPath && toolsPath.trim() !== '') { | ||
| await this.setEnvironmentVariable(terminal, 'SIFLI_SDK_TOOLS_PATH', toolsPath); | ||
| } | ||
| const parentDir = path.dirname(sdkPath); | ||
| const newPath = path.join(parentDir, sanitizedName); | ||
|
|
||
| // 直接执行导出脚本的绝对路径 | ||
| let executeCommand: string; | ||
| if (process.platform === 'win32') { | ||
| // Windows PowerShell 使用配置的 PowerShell 路径和 -ExecutionPolicy Bypass 执行脚本 | ||
| const powershellPath = this.terminalService.getPowerShellExecutablePath(); | ||
| executeCommand = `& "${activationScript.scriptPath}"`; | ||
| } else { | ||
| // Unix-like 系统执行脚本 | ||
| executeCommand = `. "${activationScript.scriptPath}"`; | ||
| } | ||
|
|
||
| // 显示并聚焦终端 | ||
| terminal.show(); | ||
|
|
||
| // 发送命令到终端 | ||
| terminal.sendText(executeCommand); | ||
|
|
||
| this.terminalService.markSdkEnvironmentPrepared(); | ||
|
|
||
| this.logService.info(`SDK activation script executed successfully: ${executeCommand}`); | ||
| } catch (error) { | ||
| this.logService.error('Error executing activation script:', error); | ||
| throw error; | ||
| if (sdkPath === newPath) { | ||
| return { oldPath: sdkPath, newPath }; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * 获取当前激活的 SDK | ||
| */ | ||
| public getCurrentSdk(): SdkVersion | undefined { | ||
| return this.configService.getCurrentSdk(); | ||
| } | ||
|
|
||
| /** | ||
| * 根据 SDK 路径获取对应平台的 export 脚本路径 | ||
| * @param sdkPath SDK 根目录路径,如果不传则使用当前激活的 SDK | ||
| * @returns export 脚本的完整路径,如果不存在则返回 undefined | ||
| */ | ||
| public getExportScriptPath(sdkPath?: string): string | undefined { | ||
| const targetSdkPath = sdkPath || this.configService.getCurrentSdkPath(); | ||
| if (!targetSdkPath) { | ||
| return undefined; | ||
| if (fs.existsSync(newPath)) { | ||
| throw new Error(`目标目录已存在: ${newPath}`); | ||
| } |
Comment on lines
+24
to
+26
| { value: 'branch', label: '分支分支 (Branch)' }, | ||
| { value: 'tag', label: '发布版本 (Release/Tag)' }, | ||
| ]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.