remove gradle-module-explorer
- Commit
cf4e1469416c87e193512109fa529693995cfd0a- Author
- Vayun Mathur <[email protected]>
- When
- 2026-07-30 02:20 UTC (4 months ago)
- Parents
aca244b
Diff
gradle-module-explorer/.gitignore
diff --git a/gradle-module-explorer/.gitignore b/gradle-module-explorer/.gitignoredeleted file mode 100644index d3e15b1e69..0000000000--- a/gradle-module-explorer/.gitignore+++ /dev/null@@ -1,3 +0,0 @@-node_modules/-out/-*.vsix
gradle-module-explorer/.vscode/launch.json
diff --git a/gradle-module-explorer/.vscode/launch.json b/gradle-module-explorer/.vscode/launch.jsondeleted file mode 100644index 0163a56d26..0000000000--- a/gradle-module-explorer/.vscode/launch.json+++ /dev/null@@ -1,14 +0,0 @@-{- "version": "0.2.0",- "configurations": [- {- "name": "Run Gradle Module Explorer",- "type": "extensionHost",- "request": "launch",- "args": [- "--extensionDevelopmentPath=${workspaceFolder}",- "${workspaceFolder}/.."- ]- }- ]-}
gradle-module-explorer/.vscodeignore
diff --git a/gradle-module-explorer/.vscodeignore b/gradle-module-explorer/.vscodeignoredeleted file mode 100644index feaceea766..0000000000--- a/gradle-module-explorer/.vscodeignore+++ /dev/null@@ -1,3 +0,0 @@-.vscode/**-node_modules/**-.gitignore
gradle-module-explorer/README.md
diff --git a/gradle-module-explorer/README.md b/gradle-module-explorer/README.mddeleted file mode 100644index 588c5bbf2c..0000000000--- a/gradle-module-explorer/README.md+++ /dev/null@@ -1,56 +0,0 @@-# Gradle Module Explorer--A VS Code extension that adds a custom **Modules** view to the activity bar for this-Gradle multi-module project. Written in plain JavaScript — no build step, no `npm install`-required to run it.--## What it shows--- A flat list of every Gradle module from `settings.gradle.kts`, using the Gradle- colon path as the label (e.g. `games:chess`, `sdk:openassistant`).-- Top-level modules are sorted **alphabetically**, with the `library:*` group and then- the `sdk:*` group pinned to the **bottom**.-- Expanding a module shows its **real filesystem**, with two things filtered out:- - **Nested-module folders** (they appear as their own top-level entries instead).- - **Build/IDE clutter**: `build/`, `.gradle/`, `.idea/`, `.cxx/`, `.kotlin/`, `out/`,- `.git/`, `.DS_Store`.-- Clicking a file opens it. A **refresh** button (top-right of the view) re-reads- `settings.gradle.kts`; it also auto-refreshes when that file changes.--The extension only activates in a workspace that contains a Gradle settings file-(`workspaceContains:settings.gradle.kts`), so it stays dormant in other projects.--## Run it (F5, no toolchain needed)--1. Open the `gradle-module-explorer` folder in VS Code.-2. Press **F5** ("Run Gradle Module Explorer").--This launches an Extension Development Host with the parent repo (`..`) already open, and-the **Modules** icon appears in the activity bar. Because it's plain JS, there is nothing-to compile.--## Install it permanently (optional)--Packaging a `.vsix` requires Node/npm (not currently on this machine). Once Node is-available:--```bash-cd gradle-module-explorer-npx @vscode/vsce package-code --install-extension gradle-module-explorer-0.0.1.vsix-```--Because it is gated on `settings.gradle.kts`, it only shows up when you open a Gradle-workspace.--## How modules are discovered--Modules come from parsing `include(":...")` statements in `settings.gradle.kts`. The-Gradle path maps to disk by replacing `:` with the path separator (e.g. `:games:chess`-→ `games/chess`), which matches this repo's default layout.--## Files--- `extension.js` — all the logic (module parsing, sorting, tree data provider).-- `package.json` — view container, view, command, and activation declarations.-- `resources/modules.svg` — activity-bar icon.
gradle-module-explorer/extension.js
diff --git a/gradle-module-explorer/extension.js b/gradle-module-explorer/extension.jsdeleted file mode 100644index c7ab29f1b8..0000000000--- a/gradle-module-explorer/extension.js+++ /dev/null@@ -1,286 +0,0 @@-const vscode = require('vscode');-const fs = require('fs');-const path = require('path');--/** Directory/file names hidden from every filesystem view (Gradle/IDE clutter). */-const IGNORED_NAMES = new Set([- 'build',- '.gradle',- '.idea',- '.cxx',- '.kotlin',- 'out',- '.git',- '.DS_Store',-]);--/** First workspace folder that contains a Gradle settings file, else the first folder. */-function findGradleRoot() {- const folders = vscode.workspace.workspaceFolders;- if (!folders || folders.length === 0) {- return undefined;- }- for (const folder of folders) {- const root = folder.uri.fsPath;- if (- fs.existsSync(path.join(root, 'settings.gradle.kts')) ||- fs.existsSync(path.join(root, 'settings.gradle'))- ) {- return root;- }- }- return folders[0].uri.fsPath;-}--/** Read the settings file and extract every included module via `include(":a:b")`. */-function parseModules(root) {- let content = '';- for (const name of ['settings.gradle.kts', 'settings.gradle']) {- const file = path.join(root, name);- if (fs.existsSync(file)) {- content = fs.readFileSync(file, 'utf8');- break;- }- }-- const modules = [];- const seen = new Set();- const re = /include\s*\(?\s*(["'])\s*:([^"']+)\1/g;- let match;- while ((match = re.exec(content)) !== null) {- const gradlePath = match[2].trim();- if (!gradlePath || seen.has(gradlePath)) {- continue;- }- seen.add(gradlePath);- modules.push({- gradlePath,- dir: path.join(root, ...gradlePath.split(':')),- });- }- return modules;-}--/** 0 = normal (top, alphabetical), 1 = library group, 2 = sdk group (both at bottom). */-function groupRank(gradlePath) {- const first = gradlePath.split(':')[0];- if (first === 'library') {- return 1;- }- if (first === 'sdk') {- return 2;- }- return 0;-}--function sortModules(modules) {- return [...modules].sort((a, b) => {- const ra = groupRank(a.gradlePath);- const rb = groupRank(b.gradlePath);- if (ra !== rb) {- return ra - rb;- }- return a.gradlePath.localeCompare(b.gradlePath);- });-}--class ModuleTreeProvider {- constructor() {- this._onDidChangeTreeData = new vscode.EventEmitter();- this.onDidChangeTreeData = this._onDidChangeTreeData.event;- this.modules = [];- this.moduleDirs = [];- this.reload();- }-- refresh() {- this.reload();- this._onDidChangeTreeData.fire();- }-- reload() {- this.root = findGradleRoot();- this.modules = this.root ? sortModules(parseModules(this.root)) : [];- this.moduleDirs = this.modules.map((m) => m.dir);- }-- getTreeItem(node) {- if (node.kind === 'module') {- const item = new vscode.TreeItem(- node.module.gradlePath,- vscode.TreeItemCollapsibleState.Collapsed,- );- item.resourceUri = vscode.Uri.file(node.module.dir);- item.iconPath = new vscode.ThemeIcon('package');- item.tooltip = node.module.dir;- item.contextValue = 'gradleModule';- return item;- }-- if (node.kind === 'dir') {- // Compact a chain of single-child folders into one row (a/b/c), like- // VS Code's "compact folders". resourceUri (final dir) gives the icon.- const chain = this.collapseChain(node.path);- const item = new vscode.TreeItem(- chain.label,- vscode.TreeItemCollapsibleState.Collapsed,- );- item.resourceUri = vscode.Uri.file(chain.finalDir);- item.iconPath = vscode.ThemeIcon.Folder;- return item;- }-- const item = new vscode.TreeItem(- vscode.Uri.file(node.path),- vscode.TreeItemCollapsibleState.None,- );- item.command = {- command: 'vscode.open',- title: 'Open',- arguments: [vscode.Uri.file(node.path)],- };- return item;- }-- getChildren(node) {- if (!node) {- return this.modules.map((module) => ({ kind: 'module', module }));- }- if (node.kind === 'file') {- return [];- }- if (node.kind === 'module') {- return this.readModuleChildren(node.module.dir);- }- // Descend through any collapsed single-folder chain first.- return this.readDir(this.collapseChain(node.path).finalDir);- }-- /**- * Children shown directly under a module. Collapses the `src/` layer: its- * children (main, androidTest, test, ...) are lifted to the module root and- * shown alongside the module's other files/folders.- */- readModuleChildren(moduleDir) {- let entries;- try {- entries = fs.readdirSync(moduleDir, { withFileTypes: true });- } catch (e) {- return [];- }-- const dirs = [];- const files = [];- for (const entry of entries) {- if (IGNORED_NAMES.has(entry.name)) {- continue;- }- const full = path.join(moduleDir, entry.name);- if (entry.isDirectory()) {- if (entry.name === 'src') {- // Lift src/'s children up to the module root instead of showing src/.- for (const child of this.readDir(full)) {- (child.kind === 'dir' ? dirs : files).push(child);- }- continue;- }- if (this.isModuleSubtree(full)) {- continue; // Shown as its own top-level module entry instead.- }- dirs.push({ kind: 'dir', path: full });- } else if (entry.isFile()) {- files.push({ kind: 'file', path: full });- }- }-- const byBasename = (a, b) =>- path.basename(a.path).localeCompare(path.basename(b.path));- dirs.sort(byBasename);- files.sort(byBasename);- return [...dirs, ...files];- }-- /** True if `dir` is a module directory or an ancestor of one (a nested-module subtree). */- isModuleSubtree(dir) {- return this.moduleDirs.some(- (md) => md === dir || md.startsWith(dir + path.sep),- );- }-- /**- * Follow a run of single-child directories starting at `dir`. Returns the- * deepest directory reached and a "a/b/c" label of the joined segment names.- * Stops when a directory has zero or multiple visible children, or its single- * child is a file.- */- collapseChain(dir) {- const segments = [path.basename(dir)];- let current = dir;- // Guard against pathological depth / symlink loops.- for (let i = 0; i < 100; i++) {- const children = this.readDir(current);- if (children.length === 1 && children[0].kind === 'dir') {- current = children[0].path;- segments.push(path.basename(current));- } else {- break;- }- }- return { finalDir: current, label: segments.join('/') };- }-- readDir(dir) {- let entries;- try {- entries = fs.readdirSync(dir, { withFileTypes: true });- } catch (e) {- return [];- }-- const dirs = [];- const files = [];- for (const entry of entries) {- if (IGNORED_NAMES.has(entry.name)) {- continue;- }- const full = path.join(dir, entry.name);- if (entry.isDirectory()) {- if (this.isModuleSubtree(full)) {- continue; // Shown as its own top-level module entry instead.- }- dirs.push({ kind: 'dir', path: full });- } else if (entry.isFile()) {- files.push({ kind: 'file', path: full });- }- }-- const byBasename = (a, b) =>- path.basename(a.path).localeCompare(path.basename(b.path));- dirs.sort(byBasename);- files.sort(byBasename);- return [...dirs, ...files];- }-}--function activate(context) {- const provider = new ModuleTreeProvider();-- context.subscriptions.push(- vscode.window.registerTreeDataProvider('gradleModuleExplorer.view', provider),- vscode.commands.registerCommand('gradleModuleExplorer.refresh', () =>- provider.refresh(),- ),- );-- const watcher = vscode.workspace.createFileSystemWatcher(- '**/settings.gradle{.kts,}',- );- watcher.onDidChange(() => provider.refresh());- watcher.onDidCreate(() => provider.refresh());- watcher.onDidDelete(() => provider.refresh());- context.subscriptions.push(watcher);-}--function deactivate() {}--module.exports = { activate, deactivate };
gradle-module-explorer/package.json
diff --git a/gradle-module-explorer/package.json b/gradle-module-explorer/package.jsondeleted file mode 100644index 7e56630824..0000000000--- a/gradle-module-explorer/package.json+++ /dev/null@@ -1,55 +0,0 @@-{- "name": "gradle-module-explorer",- "displayName": "Gradle Module Explorer",- "description": "Custom source tree that lists Gradle modules (flattened with colon paths) with library/sdk grouped at the bottom.",- "version": "0.0.1",- "publisher": "modern-apps",- "private": true,- "engines": {- "vscode": "^1.75.0"- },- "categories": [- "Other"- ],- "activationEvents": [- "workspaceContains:settings.gradle.kts",- "workspaceContains:settings.gradle"- ],- "main": "./extension.js",- "contributes": {- "viewsContainers": {- "activitybar": [- {- "id": "gradleModuleExplorer",- "title": "Modules",- "icon": "resources/modules.svg"- }- ]- },- "views": {- "gradleModuleExplorer": [- {- "id": "gradleModuleExplorer.view",- "name": "Gradle Modules"- }- ]- },- "commands": [- {- "command": "gradleModuleExplorer.refresh",- "title": "Refresh Modules",- "category": "Gradle Modules",- "icon": "$(refresh)"- }- ],- "menus": {- "view/title": [- {- "command": "gradleModuleExplorer.refresh",- "when": "view == gradleModuleExplorer.view",- "group": "navigation"- }- ]- }- }-}
gradle-module-explorer/resources/modules.svg
diff --git a/gradle-module-explorer/resources/modules.svg b/gradle-module-explorer/resources/modules.svgdeleted file mode 100644index 1c01adc4c5..0000000000--- a/gradle-module-explorer/resources/modules.svg+++ /dev/null@@ -1,5 +0,0 @@-<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">- <path d="M12 2.5l8.5 4.25L12 11 3.5 6.75 12 2.5z"/>- <path d="M3.5 12L12 16.25 20.5 12"/>- <path d="M3.5 17.25L12 21.5 20.5 17.25"/>-</svg>