Skip to content

Commit

Permalink
Update AspNetCore-v3 projects to 3.1.4; change nuget package deploy t…
Browse files Browse the repository at this point in the history
…o the same scripts used by v5; read nuget key from file; Release 3.1.4
  • Loading branch information
steveschmitt committed Apr 20, 2021
1 parent e9bfa98 commit 3aa90d9
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 15 deletions.
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ApplicationIcon />
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<StartupObject />
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Breeze.snk</AssemblyOriginatorKeyFile>
<Version>3.1.0</Version>
<Version>3.1.4</Version>
<Authors>Jay Traband</Authors>
<Company>IdeaBlade</Company>
<Product>Breeze Server - ASP.NET Core Library</Product>
Expand All @@ -22,6 +23,7 @@ Note: Version 5.x of this package is for .NET 5, whereas Version 3.x in for .NE
<PackageReleaseNotes>Version 5.x of this package is for .NET Core 5, whereas Version 3.x is for .NET Core 3 and Version 1.x is for .NET Core 2.
Please review the Breeze release notes at http://breeze.github.io/doc-net/release-notes.html</PackageReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
6 changes: 3 additions & 3 deletions AspNetCore-v3/Breeze.Core/Breeze.Core.csproj
Expand Up @@ -4,9 +4,9 @@
<TargetFramework>netstandard2.1</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Breeze.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>3.1.0</AssemblyVersion>
<FileVersion>3.1.0</FileVersion>
<Version>3.1.0</Version>
<AssemblyVersion>3.1.4</AssemblyVersion>
<FileVersion>3.1.4</FileVersion>
<Version>3.1.4</Version>
<Authors>Jay Traband</Authors>
<Company>IdeaBlade</Company>
<Product>Breeze Server - Core Library</Product>
Expand Down
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Breeze.snk</AssemblyOriginatorKeyFile>
<Version>3.1.0</Version>
<Version>3.1.4</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Jay Traband</Authors>
<Company>IdeaBlade</Company>
Expand Down
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>3.1.0</Version>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<Version>3.1.4</Version>
<AssemblyVersion>3.1.4.0</AssemblyVersion>
<FileVersion>3.1.4.0</FileVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Jay Traband, Steve Schmitt</Authors>
<Company>IdeaBlade</Company>
Expand Down
6 changes: 3 additions & 3 deletions AspNetCore-v3/Breeze.Persistence/Breeze.Persistence.csproj
Expand Up @@ -4,9 +4,9 @@
<TargetFramework>netstandard2.1</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Breeze.snk</AssemblyOriginatorKeyFile>
<Version>3.1.0</Version>
<AssemblyVersion>3.1.0</AssemblyVersion>
<FileVersion>3.1.0</FileVersion>
<Version>3.1.4</Version>
<AssemblyVersion>3.1.4</AssemblyVersion>
<FileVersion>3.1.4</FileVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Jay Traband</Authors>
<Company>IdeaBlade</Company>
Expand Down
17 changes: 17 additions & 0 deletions AspNetCore-v3/package.json
@@ -0,0 +1,17 @@
{
"name": "aspnetcore-v3",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"deploy-local": "node tools/deploy local",
"deploy-remote": "node tools/deploy remote"
},
"author": "Jay Traband",
"license": "ISC",
"devDependencies": {
"del": "^6.0.0",
"fs-extra": "^9.1.0"
}
}
40 changes: 40 additions & 0 deletions AspNetCore-v3/tools/build-utils.js
@@ -0,0 +1,40 @@
var fs = require("fs-extra");
var exec = require('child_process').exec;
var del = require('del');


// Get single command line argument, and show usage method if its incorrect */
function getArg() {
var args = process.argv.slice(2);
if (args.length !== 1 || args[0].indexOf('.js') >= 0) {
var msg = "Usage: " + process.argv[0] + " " + process.argv[1] + " [filenameRoot]"
throw new Error(msg);
}
return args[0];
}

// exec cmd, then call fn if cmd was successful
// options.cwd = current working dir
// cb is function(err, stdout, stderr);
function execCmd(cmd, options, callback) {
options = options || {};
exec(cmd, function (error, stdout, stderr) {
stdout && console.log('stdout: ' + stdout);
stderr && console.log('stderr: ' + stderr);
error && console.log('error: ' + error);
if (callback) callback(error, stdout, stderr);
});
}

/** Return the first line of text from the file */
function readFirstLine(filename) {
const data = fs.readFileSync(filename, {encoding:'utf8', flag:'r'});
const line = data.toString().split(/[\r\n]/)[0];
return line;
}

module.exports = {
execCmd: execCmd,
getArg: getArg,
readFirstLine: readFirstLine
}
80 changes: 80 additions & 0 deletions AspNetCore-v3/tools/deploy.js
@@ -0,0 +1,80 @@
/**
* Deploys nupkg to local cache dir for testing
*/
var fs = require("fs-extra");
var del = require('del');
const bu = require('.\\build-utils');

const localNugetCacheDir = process.env.LOCALAPPDATA + '\\NuGet\\Test';
const version = '3.1.4';
const debugOrRelease = 'Release'

var baseNames = [
'Breeze.AspNetCore.NetCore',
'Breeze.Core',
'Breeze.Persistence',
'Breeze.Persistence.EFCore',
'Breeze.Persistence.NH',
];

const arg = bu.getArg();
argl = arg.toLowerCase();
if (argl == 'local') {
deployLocal();
} else if (argl == 'remote') {
deployRemote();
} else {
console.log(`You must pass in either 'local' or 'remote'. You passed: ${argl}`);
}

// should ONLY be called manually after testing locally installed nugets from nugetPack step.
// deliberately does NOT have a dependency on nugetPack

function deployLocal() {
deleteLocalAppCache(baseNames);
const nupkgs = getNupkgs(baseNames);
nupkgs.forEach(nupkg => {
// call will look something like the line below
// --> nuget add .\Breeze.Core\bin\Debug\Breeze.Core.5.0.2.nupkg -Source C:/Users/Jay/AppData/Local/NuGet/Test
cmd = `nuget add ${nupkg} -Source ${localNugetCacheDir}`;
console.log(cmd);
bu.execCmd(cmd);
});
}

function deployRemote() {
// Before running, put the nuget key in a file 2 levels above (outside the repo)
const key = bu.readFirstLine('../../~nugetkey.txt');
const nupkgs = getNupkgs(baseNames);
nupkgs.forEach(nupkg => {
var cmd = `nuget push ${nupkg} ${key} -Source https://www.nuget.org`;
console.log(cmd);
bu.execCmd(cmd);
});
}

function getNupkgs(baseNames) {
const nupkgs = baseNames.map(baseName => {
// check if nupkg exists.
var fn = `.\\${baseName}\\bin\\${debugOrRelease}\\${baseName}.${version}.nupkg`;
if (!fs.existsSync(fn)) {
console.log('Unable to locate: ' + fn);
process.exit(1);
}
return fn;
});
return nupkgs;
}

function deleteLocalAppCache(baseNames) {
baseNames.forEach(baseName => {
const cacheDir = localNugetCacheDir + '\\' + baseName;
console.log(cacheDir);
if (fs.existsSync(cacheDir)) {
console.log('Deleting: ' + cacheDir)
del(cacheDir, { force: true} );
}
})
};


Expand Up @@ -11,7 +11,7 @@

Note: Version 5.x of this package is for .NET 5, whereas Version 3.x in for .NET Core 3 and Version 1.x is for .NET Core 2.
</Description>
<Copyright>Copyright IdeaBlade 2012-2021</Copyright>
<Copyright>Copyright © IdeaBlade 2012-2021</Copyright>
<PackageProjectUrl>http://breeze.github.io</PackageProjectUrl>
<Authors>Jay Traband, Steve Schmitt</Authors>
<Company>IdeaBlade</Company>
Expand Down
9 changes: 8 additions & 1 deletion AspNetCore-v5/tools/build-utils.js
Expand Up @@ -26,8 +26,15 @@ function execCmd(cmd, options, callback) {
});
}

/** Return the first line of text from the file */
function readFirstLine(filename) {
const data = fs.readFileSync(filename, {encoding:'utf8', flag:'r'});
const line = data.toString().split(/[\r\n]/)[0];
return line;
}

module.exports = {
execCmd: execCmd,
getArg: getArg
getArg: getArg,
readFirstLine: readFirstLine
}
4 changes: 3 additions & 1 deletion AspNetCore-v5/tools/deploy.js
Expand Up @@ -43,9 +43,11 @@ function deployLocal() {
}

function deployRemote() {
// Before running, put the nuget key in a file 2 levels above (outside the repo)
const key = bu.readFirstLine('../../~nugetkey.txt');
const nupkgs = getNupkgs(baseNames);
nupkgs.forEach(nupkg => {
var cmd = `nuget push ${nupkg} {{ nuget key goes here }} -Source https://www.nuget.org`;
var cmd = `nuget push ${nupkg} ${key} -Source https://www.nuget.org`;
console.log(cmd);
bu.execCmd(cmd);
});
Expand Down

0 comments on commit 3aa90d9

Please sign in to comment.