From a5e8d0498db51dd23dec6fdea8fe563801215fc0 Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Tue, 13 Mar 2018 14:21:59 +0800 Subject: [PATCH 1/2] Generate dockerfile for java app Signed-off-by: Jinbo Wang --- configureWorkspace/config-utils.ts | 1 + configureWorkspace/configure.ts | 113 +++++++++++- package-lock.json | 274 ++++++++++++++++++++++++++--- package.json | 2 + 4 files changed, 355 insertions(+), 35 deletions(-) diff --git a/configureWorkspace/config-utils.ts b/configureWorkspace/config-utils.ts index 6fdf6dcaa2..e4ae257c41 100644 --- a/configureWorkspace/config-utils.ts +++ b/configureWorkspace/config-utils.ts @@ -19,6 +19,7 @@ export async function quickPickPlatform(): Promise{ const items: string[] = []; items.push('Go'); + items.push('Java'); items.push('.NET Core'); items.push('Node.js'); items.push('Python'); diff --git a/configureWorkspace/configure.ts b/configureWorkspace/configure.ts index 43605a9f92..1a7a97a69c 100644 --- a/configureWorkspace/configure.ts +++ b/configureWorkspace/configure.ts @@ -1,10 +1,12 @@ import vscode = require('vscode'); import * as path from 'path'; import * as fs from 'fs'; +import * as pomParser from 'pom-parser'; +import * as gradleParser from 'gradle-to-js/lib/parser'; import { promptForPort, quickPickPlatform } from './config-utils'; import { reporter } from '../telemetry/telemetry'; -function genDockerFile(serviceName: string, platform: string, port: string, { cmd, author, version }: PackageJson): string { +function genDockerFile(serviceName: string, platform: string, port: string, { cmd, author, version, artifactName }: PackageJson): string { switch (platform.toLowerCase()) { case 'node.js': @@ -80,6 +82,20 @@ CMD ["python3", "-m", "${serviceName}"] # Using miniconda (make sure to replace 'myenv' w/ your environment name): #RUN conda env create -f environment.yml #CMD /bin/bash -c "source activate myenv && python3 -m ${serviceName}" +`; + + case 'java': + const artifact = artifactName ? artifactName : `${serviceName}.jar`; + return ` +FROM openjdk:8-jdk-alpine +VOLUME /tmp +ARG JAVA_OPTS +ENV JAVA_OPTS=$JAVA_OPTS +ADD ${artifact} ${serviceName}.jar +EXPOSE ${port} +ENTRYPOINT exec java $JAVA_OPTS -jar ${serviceName}.jar +# For Spring-Boot project, use the entrypoint below to reduce Tomcat startup time. +#ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar ${serviceName}.jar `; default: @@ -137,6 +153,15 @@ build: . ports: - ${port}:${port}`; + case 'java': + return `version: '2.1' + +services: + ${serviceName}: + image: ${serviceName} + build: . + ports: + - ${port}:${port}`; default: return `version: '2.1' @@ -221,6 +246,22 @@ services: - ${port}:${port} `; + case 'java': + return `version: '2.1' + +services: + ${serviceName}: + image: ${serviceName} + build: + context: . + dockerfile: Dockerfile + environment: + JAVA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005,quiet=y + ports: + - ${port}:${port} + - 5005:5005 + `; + default: return `version: '2.1' @@ -255,23 +296,29 @@ interface PackageJson { cmd: string, fullCommand: string, //full command author: string, - version: string + version: string, + artifactName: string } async function getPackageJson(folder: vscode.WorkspaceFolder): Promise { return vscode.workspace.findFiles(new vscode.RelativePattern(folder, 'package.json'), null, 1, null); } -async function readPackageJson(folder: vscode.WorkspaceFolder): Promise { - // open package.json and look for main, scripts start - const uris: vscode.Uri[] = await getPackageJson(folder); - var pkg: PackageJson = { +function getDefaultPackageJson(): PackageJson { + return { npmStart: true, fullCommand: 'npm start', cmd: 'npm start', author: 'author', - version: '0.0.1' - }; //default + version: '0.0.1', + artifactName: '' + }; +} + +async function readPackageJson(folder: vscode.WorkspaceFolder): Promise { + // open package.json and look for main, scripts start + const uris: vscode.Uri[] = await getPackageJson(folder); + var pkg: PackageJson = getDefaultPackageJson(); //default if (uris && uris.length > 0) { const json = JSON.parse(fs.readFileSync(uris[0].fsPath, 'utf8')); @@ -300,6 +347,49 @@ async function readPackageJson(folder: vscode.WorkspaceFolder): Promise { + var pkg: PackageJson = getDefaultPackageJson(); //default + + if (fs.existsSync(path.join(folder.uri.fsPath, 'pom.xml'))) { + const json = await new Promise((resolve, reject) => { + pomParser.parse({ + filePath: path.join(folder.uri.fsPath, 'pom.xml') + }, (error, response) => { + if (error) { + reject(`Failed to parse pom.xml: ${error}`); + return; + } + resolve(response.pomObject); + }); + }); + + if (json.project.version) { + pkg.version = json.project.version; + } + + if (json.project.artifactid) { + pkg.artifactName = `target/${json.project.artifactid}-${pkg.version}.jar`; + } + } else if (fs.existsSync(path.join(folder.uri.fsPath, 'build.gradle'))) { + const json = await gradleParser.parseFile(path.join(folder.uri.fsPath, 'build.gradle')); + + if (json.jar && json.jar.version) { + pkg.version =json.jar.version; + } else if (json.version) { + pkg.version = json.version; + } + + if (json.jar && json.jar.archiveName) { + pkg.artifactName = `build/libs/${json.jar.archiveName}`; + } else { + const baseName = json.jar && json.jar.baseName ? json.jar.baseName : json.archivesBaseName || folder.name; + pkg.artifactName = `build/libs/${baseName}-${pkg.version}.jar`; + } + } + + return pkg; +} + const DOCKER_FILE_TYPES = { 'docker-compose.yml': genDockerCompose, 'docker-compose.debug.yml': genDockerComposeDebug, @@ -342,7 +432,12 @@ export async function configure(): Promise { if (!port) return; const serviceName = path.basename(folder.uri.fsPath).toLowerCase(); - const pkg = await readPackageJson(folder); + let pkg: PackageJson = getDefaultPackageJson(); + if (platformType.toLowerCase() === 'java') { + pkg = await readPomAndGradle(folder); + } else { + pkg = await readPackageJson(folder); + } await Promise.all(Object.keys(DOCKER_FILE_TYPES).map((fileName) => { return createWorkspaceFileIfNotExists(fileName, DOCKER_FILE_TYPES[fileName]); diff --git a/package-lock.json b/package-lock.json index 358ee85099..e1df8ef7ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,20 +79,26 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, "applicationinsights": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.18.0.tgz", "integrity": "sha1-Fi67SKODQIvE3kTbMrQXMH9Fu8E=" }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "1.0.3" + } + }, "arr-diff": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", @@ -304,7 +310,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, "requires": { "ansi-styles": "2.2.1", "escape-string-regexp": "1.0.5", @@ -358,8 +363,7 @@ "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" }, "concat-map": { "version": "0.0.1", @@ -388,6 +392,148 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "coveralls": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-2.13.3.tgz", + "integrity": "sha512-iiAmn+l1XqRwNLXhW8Rs5qHZRFMYp9ZIPjEOVRpC/c4so6Y/f4/lFi0FfR5B9cCqgyhkJ5cZmbvcVRfP8MHchw==", + "requires": { + "js-yaml": "3.6.1", + "lcov-parse": "0.0.10", + "log-driver": "1.2.5", + "minimist": "1.2.0", + "request": "2.79.0" + }, + "dependencies": { + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "requires": { + "hoek": "2.16.3" + } + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=" + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "requires": { + "boom": "2.10.1" + } + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "requires": { + "chalk": "1.1.3", + "commander": "2.11.0", + "is-my-json-valid": "2.16.1", + "pinkie-promise": "2.0.1" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=" + }, + "request": { + "version": "2.79.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", + "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.11.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "oauth-sign": "0.8.2", + "qs": "6.3.2", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.4.3", + "uuid": "3.1.0" + } + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "requires": { + "hoek": "2.16.3" + } + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=" + } + } + }, "cryptiles": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", @@ -594,8 +740,12 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=" }, "event-stream": { "version": "3.3.4", @@ -777,14 +927,12 @@ "generate-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", - "dev": true + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=" }, "generate-object-property": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", - "dev": true, "requires": { "is-property": "1.0.2" } @@ -931,6 +1079,30 @@ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, + "gradle-to-js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gradle-to-js/-/gradle-to-js-1.0.1.tgz", + "integrity": "sha1-VXmcRoyw7OFsnRJ86d752lLPxlI=", + "requires": { + "bluebird": "3.3.5", + "deep-assign": "2.0.0" + }, + "dependencies": { + "bluebird": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.3.5.tgz", + "integrity": "sha1-XudH8ce9lnZYtoOTZDCu51OVWjQ=" + }, + "deep-assign": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-2.0.0.tgz", + "integrity": "sha1-6+BrHwfwja5ZdiDj3RYi83GhxXI=", + "requires": { + "is-obj": "1.0.1" + } + } + } + }, "growl": { "version": "1.10.3", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", @@ -1364,7 +1536,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, "requires": { "ansi-regex": "2.1.1" } @@ -1482,7 +1653,6 @@ "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", - "dev": true, "requires": { "generate-function": "2.0.0", "generate-object-property": "1.2.0", @@ -1502,8 +1672,7 @@ "is-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", - "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", - "dev": true + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" }, "is-posix-bracket": { "version": "0.1.1", @@ -1520,8 +1689,7 @@ "is-property": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" }, "is-stream": { "version": "1.1.0", @@ -1569,6 +1737,15 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "js-yaml": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", + "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", + "requires": { + "argparse": "1.0.10", + "esprima": "2.7.3" + } + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -1613,8 +1790,7 @@ "jsonpointer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", - "dev": true + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=" }, "jsprim": { "version": "1.4.1", @@ -1666,6 +1842,11 @@ "readable-stream": "2.0.6" } }, + "lcov-parse": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", + "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=" + }, "lodash": { "version": "4.17.4", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", @@ -1796,6 +1977,11 @@ "lodash.escape": "3.2.0" } }, + "log-driver": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", + "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=" + }, "map-stream": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", @@ -2128,18 +2314,27 @@ "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" }, "pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, "requires": { "pinkie": "2.0.4" } }, + "pom-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pom-parser/-/pom-parser-1.1.1.tgz", + "integrity": "sha1-b6tNJJjofIYgcqsgWqiLEgnl+WY=", + "requires": { + "bluebird": "3.5.1", + "coveralls": "2.13.3", + "traverse": "0.6.6", + "xml2js": "0.4.19" + } + }, "preserve": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", @@ -2340,6 +2535,11 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", @@ -2389,6 +2589,11 @@ "resolved": "https://registry.npmjs.org/split-ca/-/split-ca-1.0.1.tgz", "integrity": "sha1-bIOv82kvphJW4M0ZfgXp3hV2kaY=" }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, "sshpk": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", @@ -2459,7 +2664,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, "requires": { "ansi-regex": "2.1.1" } @@ -2486,8 +2690,7 @@ "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, "tar": { "version": "2.2.1", @@ -2595,6 +2798,11 @@ "punycode": "1.4.1" } }, + "traverse": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", + "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=" + }, "tunnel": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", @@ -2869,6 +3077,20 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": "1.2.4", + "xmlbuilder": "9.0.7" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" + }, "xmldom": { "version": "0.1.27", "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", diff --git a/package.json b/package.json index 8adbe61b01..42f0c13a36 100644 --- a/package.json +++ b/package.json @@ -608,8 +608,10 @@ "azure-arm-website": "^1.0.0-preview", "dockerfile-language-server-nodejs": "^0.0.13", "dockerode": "^2.5.1", + "gradle-to-js": "^1.0.1", "moment": "^2.19.3", "opn": "^5.1.0", + "pom-parser": "^1.1.1", "request-promise": "^4.2.2", "vscode-extension-telemetry": "^0.0.6", "vscode-languageclient": "^3.5.0-next.4" From 217453a9962ebbda8e082d1693031fb729098996 Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Tue, 13 Mar 2018 14:50:49 +0800 Subject: [PATCH 2/2] Fix function name and lint issue --- configureWorkspace/configure.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configureWorkspace/configure.ts b/configureWorkspace/configure.ts index 1a7a97a69c..26861a696c 100644 --- a/configureWorkspace/configure.ts +++ b/configureWorkspace/configure.ts @@ -347,7 +347,7 @@ async function readPackageJson(folder: vscode.WorkspaceFolder): Promise { +async function readPomOrGradle(folder: vscode.WorkspaceFolder): Promise { var pkg: PackageJson = getDefaultPackageJson(); //default if (fs.existsSync(path.join(folder.uri.fsPath, 'pom.xml'))) { @@ -374,7 +374,7 @@ async function readPomAndGradle(folder: vscode.WorkspaceFolder): Promise { const serviceName = path.basename(folder.uri.fsPath).toLowerCase(); let pkg: PackageJson = getDefaultPackageJson(); if (platformType.toLowerCase() === 'java') { - pkg = await readPomAndGradle(folder); + pkg = await readPomOrGradle(folder); } else { pkg = await readPackageJson(folder); }