Merge pull request #13 from Microsoft/users/roniga/package

Users/roniga/package
This commit is contained in:
Rohit Nigam 2015-12-23 18:23:45 +05:30
Родитель 6900c3a583 55155e6d8f
Коммит 51e533e68c
6 изменённых файлов: 180 добавлений и 99 удалений

163
.gitignore поставляемый
Просмотреть файл

@ -1,81 +1,82 @@
# Created by https://www.gitignore.io/api/node
### Node ###
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules
### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
**/*.class
**/*.jar
**/*pom.properties
## Application Specific
_build
# Created by https://www.gitignore.io/api/node
### Node ###
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules
### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
**/*.class
**/*.jar
**/*pom.properties
## Application Specific
_build
_package
tests/Tools/target

Просмотреть файл

@ -5,10 +5,21 @@ var mocha = require("gulp-mocha");
var tslint = require("gulp-tslint");
var istanbul = require("gulp-istanbul");
var path = require("path");
var shell = require('shelljs')
var gutil = require('gulp-util');
var buildDirectory = "_build";
var sourceFiles = ["src/**/*.ts", "tests/**/*.ts"];
var testFiles = [buildDirectory + "/**/*Tests*.js"];
var packageDirectory = "_package";
var sourcePaths = {
typescriptFiles: "src/**/*.ts",
copyFiles: ["src/*.json", "src/*.md", "src/Images/*", "src/Tasks/**/*.json", "src/Tasks/**/*.md", "src/Tasks/**/*.png", "src/Tasks/**/*.svg"]
};
var testPaths = {
typescriptFiles: "tests/**/*.ts",
compiledJSFiles: buildDirectory + "/**/*Tests*.js"
};
var manifestFile = "vss-extension.json";
var jsCoverageDir = path.join(buildDirectory, "codecoverage");
// create and keep compiler
@ -19,16 +30,21 @@ var compilation = tsb.create({
verbose: false
});
gulp.task("build", ["lint"], function() {
return gulp.src(sourceFiles, { base: "." })
gulp.task("compile", ["lint"], function() {
return gulp.src([sourcePaths.typescriptFiles, testPaths.typescriptFiles], { base: "." })
.pipe(compilation())
.pipe(gulp.dest(buildDirectory))
.pipe(istanbul({includeUntested: true}))
.pipe(istanbul.hookRequire());
});
gulp.task("build", ["compile"], function() {
return gulp.src(sourcePaths.copyFiles, { base: "." })
.pipe(gulp.dest(buildDirectory));
});
gulp.task("lint", function() {
return gulp.src(sourceFiles)
return gulp.src([sourcePaths.typescriptFiles, testPaths.typescriptFiles])
.pipe(tslint())
.pipe(tslint.report("verbose"))
});
@ -41,7 +57,7 @@ gulp.task("clean", function(done) {
});
gulp.task("test", ["build"], function() {
return gulp.src(testFiles, { read: false })
return gulp.src(testPaths.compiledJSFiles, { read: false })
.pipe(mocha())
.pipe(istanbul.writeReports({
dir: jsCoverageDir,
@ -51,7 +67,7 @@ gulp.task("test", ["build"], function() {
});
gulp.task("testci", ["build"], function() {
return gulp.src(testFiles, { read: false })
return gulp.src(testPaths.compiledJSFiles, { read: false })
.pipe(mocha({ reporter: "xunit", reporterOptions: { output: path.join(buildDirectory, "mochaTestResult.xml") } }))
.pipe(istanbul.writeReports({
dir: jsCoverageDir,
@ -60,8 +76,54 @@ gulp.task("testci", ["build"], function() {
.pipe(istanbul.enforceThresholds({ thresholds: { global: 95 } }));
});
gulp.task("package", ["build"], function(cb) {
createPackage(cb);
});
gulp.task("watch", function() {
gulp.watch(sourceFiles, ["test"]);
gulp.watch([sourcePaths.typescriptFiles, testPaths.typescriptFiles], ["test"]);
});
gulp.task("default", ["build"]);
var createPackage = function (cb) {
var srcBuildDirectory = buildDirectory + "/src";
runMaven(function () {
createVsix(manifestFile, srcBuildDirectory, packageDirectory, cb);
}, function (err) {
cb(new gutil.PluginError({
plugin: "package",
message: err
}));
});
}
var runMaven = function(successcb, failcb) {
var mavenPath = shell.which('mvn');
if (!mavenPath) {
failcb('mvn.exe needs to be in the path. Could not find.');
return;
}
shell.exec("mvn package", {silent:true}, function(code, output) {
if (code !== 0) {
failcb(output);
}
else {
successcb();
}
});
}
var createVsix = function(manifestFile, srcBuildDirectory, packageDirectory, cb) {
shell.exec("tfx extension create --manifest-globs " + manifestFile + " --root " + srcBuildDirectory + " --output-path " + packageDirectory, {silent:true}, function(code, output) {
if (code !== 0) {
cb(new gutil.PluginError({
plugin: "package",
message: output
}));
}
else {
cb();
}
});
}

Просмотреть файл

@ -16,14 +16,16 @@
"gulp-mocha": "^2.1.3",
"gulp-tsb": "^1.7.4",
"gulp-tslint": "^3.5.0",
"gulp-util": "^3.0.4",
"mocha": "^2.3.3",
"q": "^1.4.1",
"rimraf": "^2.4.3",
"shelljs": "^0.3.0",
"sinon": "^1.17.2",
"sinon-chai": "^2.8.0",
"tfx-cli": "^0.3.8",
"tsd": "^0.6.5",
"tslint": "^2.5.1",
"vso-task-lib": "^0.5.4"
"tslint": "^2.5.1"
},
"dependencies": {
"vso-task-lib": "^0.5.4"

20
pom.xml
Просмотреть файл

@ -16,7 +16,23 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<build.profile.id>dev</build.profile.id>
<skip.jacoco.check>true</skip.jacoco.check>
</properties>
<profiles>
<profile>
<id>ci</id>
<properties>
<build.profile.id>ci</build.profile.id>
<!-- All tests are run. -->
<skip.jacoco.check>false</skip.jacoco.check>
</properties>
</profile>
<profile>
<id>dev</id>
</profile>
</profiles>
<build>
<outputDirectory>${session.executionRootDirectory}/_build</outputDirectory>
@ -46,10 +62,10 @@
<destFile>${session.executionRootDirectory}/_build/testReports/codecoverage/jacoco.exec</destFile>
<append>true</append>
</configuration>
</execution>
</execution>
</executions>
</plugin>
</plugins>
</plugins>
</build>
</project>

Просмотреть файл

@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "vmwareapp",
"name": "VMWareApp",
"version": "0.0.1",
"version": "1.0.0",
"publisher": "ms",
"description": "Manage your VMvare environments",
"public": true,
@ -41,7 +41,7 @@
},
"files": [
{
"path": "vmOperations"
"path": "Tasks/vmOperations"
},
{
"path": "images",
@ -86,7 +86,7 @@
"ms.vss-distributed-task.tasks"
],
"properties": {
"name": "vmOperations"
"name": "Tasks/vmOperations"
}
}
]

Просмотреть файл

@ -54,7 +54,6 @@
<configuration>
<includes>
<include>**/*UnitTests.java</include>
<include>**/*PlatformTests.java</include>
</includes>
<reportsDirectory>../../_build/testReports/vmOpsTool</reportsDirectory>
<testClassesDirectory>../../_build/tests/tools/vmOpsTool</testClassesDirectory>
@ -66,8 +65,8 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<include>**/*IntegrationTests.java</include>
<includes>
<include>**/*PlatformTests.java</include>
</includes>
<reportsDirectory>../../_build/testReports/vmOpsTool</reportsDirectory>
<testClassesDirectory>../../_build/tests/tools/vmOpsTool</testClassesDirectory>
@ -107,6 +106,7 @@
</limits>
</rule>
</rules>
<skip>${skip.jacoco.check}</skip>
</configuration>
</execution>
</executions>