Skip to content

Commit 6b43f97

Browse files
committed
Databasic dependencies incrementation, VS2017 implementation, result directory name changed, dll, xml amd pdb results copying into result directory
1 parent 085a51f commit 6b43f97

8 files changed

+113
-132
lines changed

BaseBuild.js

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ Class.Define('BaseBuild', {
9090
var dirFullPath = '';
9191
for (var i = 0, l = this.modulesInfo.length; i < l; i += 1) {
9292
dirFullPath = this.modulesInfo[i].dirFullPath;
93-
this.cleanDirectory(dirFullPath + '/bin/Debug');
94-
this.cleanDirectory(dirFullPath + '/bin/Release');
93+
this.cleanDirectory(dirFullPath + '/bin/Debug', ['nupkg']);
94+
this.cleanDirectory(dirFullPath + '/bin/Release', ['nupkg']);
9595
}
9696
},
9797
setUpVersionToAssemblyInfos: function () {
@@ -149,14 +149,15 @@ Class.Define('BaseBuild', {
149149
readStream = Wsh.Fso.OpenTextFile(nugetCfgFullPath, 1, false);
150150
nugetCfgContent = readStream.ReadAll();
151151
readStream.Close();
152-
nugetCfgContent = this._setUpVersionToNugspecCfgContent(nugetCfgContent);
152+
nugetCfgContent = this._setUpVersionToNugspecCfgContentVersionNode(nugetCfgContent);
153+
nugetCfgContent = this._setUpVersionToNugspecCfgContentDependencyNode(nugetCfgContent);
153154
// for overwriting, not as Unicode
154155
writeStream = Wsh.Fso.CreateTextFile(nugetCfgFullPath, true, false);
155156
writeStream.Write(nugetCfgContent);
156157
writeStream.Close();
157158
}
158159
},
159-
_setUpVersionToNugspecCfgContent: function (nugetCfgContent) {
160+
_setUpVersionToNugspecCfgContentVersionNode: function (nugetCfgContent) {
160161
var index = 0,
161162
openingNode = '<version>',
162163
closingNode = '</version>',
@@ -182,6 +183,35 @@ Class.Define('BaseBuild', {
182183
}
183184
return nugetCfgContent;
184185
},
186+
_setUpVersionToNugspecCfgContentDependencyNode: function (nugetCfgContent) {
187+
var index = 0,
188+
openingNode = '<dependency id="Databasic',
189+
closingNode = '/>',
190+
valueBegin = 0,
191+
valueEnd = 0,
192+
versionStr = '',
193+
versionsJoined = this.versions.join('.');
194+
while (true) {
195+
valueBegin = nugetCfgContent.indexOf(openingNode, index);
196+
if (valueBegin == -1) break;
197+
valueBegin += openingNode.length;
198+
valueEnd = nugetCfgContent.indexOf(closingNode, valueBegin);
199+
if (valueEnd == -1) break;
200+
versionStr = nugetCfgContent.substring(valueBegin, valueEnd);
201+
if (!/version="([0-9\.]*)"/gi.test(versionStr)) {
202+
index = valueEnd;
203+
continue;
204+
}
205+
versionStr = versionStr.replace(/version="([0-9\.]*)"/gi, function (m) {
206+
return 'version="'+ versionsJoined + '"';
207+
});
208+
nugetCfgContent = nugetCfgContent.substr(0, valueBegin)
209+
+ versionStr
210+
+ nugetCfgContent.substr(valueEnd);
211+
index = valueBegin + versionStr.length;
212+
}
213+
return nugetCfgContent;
214+
},
185215
setUpVersionToReadmes: function () {
186216
var readStream = null,
187217
writeStream = null,
@@ -210,15 +240,15 @@ Class.Define('BaseBuild', {
210240
//log(nugetCfgContent);
211241
return nugetCfgContent;
212242
},
213-
cleanDirectory: function (relativeOrAbsolutePath, allFiles) {
243+
cleanDirectory: function (relativeOrAbsolutePath, extensions) {
214244
var folder = Wsh.Fso.GetFolder(relativeOrAbsolutePath),
215245
filesEnum = new Enumerator(folder.files),
216-
allFiles = !!allFiles,
246+
allFiles = extensions == '*',
217247
fileExt = '';
218248
for (; !filesEnum.atEnd() ; filesEnum.moveNext()) {
219249
file = Wsh.Fso.GetFile(String(filesEnum.item()));
220250
fileExt = String(Wsh.Fso.GetExtensionName(file.Path)).toLowerCase();
221-
if (allFiles || (!allFiles && fileExt == 'nupkg')) {
251+
if (allFiles || (!allFiles && extensions.indexOf(fileExt) > -1)) {
222252
try {
223253
Wsh.Fso.DeleteFile(file.Path);
224254
} catch (e) { }

Databasic.BuildCommands.jsproj

Lines changed: 0 additions & 89 deletions
This file was deleted.

Databasic.BuildCommands.njsproj

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
2+
<PropertyGroup>
3+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
4+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
5+
<Name>Databasic.BuildCommands</Name>
6+
<RootNamespace>Databasic.BuildCommands</RootNamespace>
7+
</PropertyGroup>
8+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
9+
<PropertyGroup>
10+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
11+
<SchemaVersion>2.0</SchemaVersion>
12+
<ProjectGuid>30027b0b-a90f-4997-b00b-f40ae88382a5</ProjectGuid>
13+
<ProjectHome>.</ProjectHome>
14+
<StartupFile>
15+
</StartupFile>
16+
<StartWebBrowser>False</StartWebBrowser>
17+
<SearchPath>
18+
</SearchPath>
19+
<WorkingDirectory>.</WorkingDirectory>
20+
<OutputPath>.</OutputPath>
21+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
22+
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
23+
<StartWebBrowser>false</StartWebBrowser>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
26+
<DebugSymbols>true</DebugSymbols>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
29+
<DebugSymbols>true</DebugSymbols>
30+
</PropertyGroup>
31+
<ItemGroup>
32+
<Folder Include="WSH\" />
33+
</ItemGroup>
34+
<ItemGroup>
35+
<Compile Include="BaseBuild.js" />
36+
<Compile Include="WSH\Class.js" />
37+
<Compile Include="WSH\Json2.js" />
38+
<Compile Include="WSH\Log.js" />
39+
<Compile Include="WSH\Shell.js" />
40+
<Compile Include="WSH\String.js" />
41+
<Compile Include="WSH\Wsh.js" />
42+
<Compile Include="_references.js" />
43+
</ItemGroup>
44+
<ItemGroup>
45+
<Content Include=".gitignore" />
46+
<Content Include="GLOBAL_VERSION_NUMBER" />
47+
<Content Include="LICENSE" />
48+
<Content Include="PostBuild.bat" />
49+
<Content Include="PostBuild.wsf" />
50+
<Content Include="PreBuild.bat" />
51+
<Content Include="PreBuild.wsf" />
52+
<Content Include="README.md" />
53+
</ItemGroup>
54+
<!-- Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them. -->
55+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
56+
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
57+
</Project>

GLOBAL_VERSION_NUMBER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.6.1
1+
1.2.9.0

PostBuild.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@cscript.exe PostBuild.wsf "c:\works\tec\vb\databasic\Databasic.All\bin\Debug\"
1+
@cscript.exe PostBuild.wsf "c:\works\tec\vb\databasic\Databasic.All\bin\Release\"

PostBuild.wsf

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
Constructor: function () {
1212
//return;
1313
try {
14-
var destinationDir = Wsh.Fso.GetFolder("../Databasic.NuGetPackages")
14+
//Wsh.Echo("DEBUG:"+WScript.Arguments.Item(0));
15+
//Wsh.Echo("DEBUG:"+WScript.Arguments.Item(1));
16+
var destinationDir = Wsh.Fso.GetFolder("../Databasic.Releases")
1517
.path.replace(/\\/g, '/') + '/',
1618
buildPath = WScript.Arguments.Item(0).replace(/\\/gi, '/') + '/',
19+
projectName = WScript.Arguments.Item(1),
1720
folder = Wsh.Fso.GetFolder(buildPath),
1821
filesEnum = new Enumerator(folder.files),
1922
fileExt = '',
@@ -29,9 +32,17 @@
2932
nupkgFiles.sort().reverse();
3033
lastNupkgFile = nupkgFiles.shift();
3134
Wsh.Fso.CopyFile(
32-
buildPath + lastNupkgFile,
33-
destinationDir + lastNupkgFile,
34-
true // to overwrite existing
35+
buildPath + lastNupkgFile, destinationDir + lastNupkgFile, true // to overwrite existing
36+
);
37+
Wsh.Fso.CopyFile(
38+
buildPath + projectName + ".dll", destinationDir + projectName + ".dll", true // to overwrite existing
39+
);
40+
41+
Wsh.Fso.CopyFile(
42+
buildPath + projectName + ".pdb", destinationDir + projectName + ".pdb", true // to overwrite existing
43+
);
44+
Wsh.Fso.CopyFile(
45+
buildPath + projectName + ".xml", destinationDir + projectName + ".xml", true // to overwrite existing
3546
);
3647
for (var i = 0, l = nupkgFiles.length; i < l; i += 1) {
3748
try {
@@ -40,7 +51,7 @@
4051
}
4152
Wsh.WriteLine("PostBuild.wsf - SUCCESS: New NuGet package copied successfully.");
4253
} catch (e) {
43-
Wsh.Echo("PostBuild.wsf - ERROR: " + e.message + ".");
54+
Wsh.Echo("PostBuild.wsf - ERROR: " + e.message + " (" + e.file + ":" + e.line + ").");
4455
}
4556
}
4657
});

PreBuild.wsf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
this.setUpVersionToReadmes();
2323
this.incrementGlobalVersionNumberRevision();
2424
this.storeGlobalVersionNumber();
25-
this.cleanDirectory("../Databasic.NuGetPackages");
25+
this.cleanDirectory("../Databasic.Releases", "*");
2626
Wsh.WriteLine("PreBuild.wsf - SUCCESS: All version numbers before build updated successfully.");
2727
} catch (e) {
2828
Wsh.Echo("PreBuild.wsf - ERROR: " + e.message + ".");

package.appxmanifest

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)