forked from apache/logging-log4net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3242db5
commit fd53aa1
Showing
9 changed files
with
131 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const | ||
gulp = requireModule("gulp"); | ||
|
||
gulp.task("hash-build-artifacts", async () => { | ||
const | ||
path = require("path"), | ||
crypto = require("crypto"), | ||
{ readFile, writeFile, ls, FsEntities } = require("yafs"), | ||
artifactsFolder = path.join("build", "artifacts"); | ||
const | ||
buildArtifacts = await ls(artifactsFolder, { | ||
fullPaths: true, | ||
entities: FsEntities.files | ||
}), | ||
nupkg = buildArtifacts.find(p => p.match(/\.nupkg$/)), | ||
binaries = buildArtifacts.find(p => p.match(/apache-log4net-binaries-\d+\.\d+\.\d+.zip$/)), | ||
source = buildArtifacts.find(p => p.match(/apache-log4net-source-\d+\.\d+\.\d+.zip$/)); | ||
|
||
if (!nupkg) { | ||
throw new Error(`apache-log4net nupkg not found in ${artifactsFolder}`); | ||
} | ||
if (!binaries) { | ||
throw new Error(`apache-log4net binaries zip not found in ${artifactsFolder}`); | ||
} | ||
if (!source) { | ||
throw new Error(`apache-log4net source zip not found in ${artifactsFolder}`); | ||
} | ||
|
||
await writeSHA512For(nupkg); | ||
await writeSHA512For(binaries); | ||
await writeSHA512For(source); | ||
|
||
function writeSHA512For(filepath) { | ||
return new Promise(async (resolve, reject) => { | ||
try { | ||
const | ||
hash = crypto.createHash("sha512"), | ||
data = await readFile(filepath); | ||
hash.update(data); | ||
const | ||
outfile = `${filepath}.sha512`, | ||
hex = hash.digest("hex"), | ||
contents = `${hex} *${path.basename(filepath)}`; | ||
await writeFile(outfile, contents); | ||
resolve(); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const { renameSync } = require("fs"); | ||
|
||
const gulp = requireModule("gulp"); | ||
|
||
gulp.task("prefix-build-artifacts", async () => { | ||
// prefixes build artifacts with 'apache-' | ||
const | ||
{ ls, rename, FsEntities } = require("yafs"), | ||
path = require("path"), | ||
artifactsFolder = path.join("build/artifacts"), | ||
contents = await ls(artifactsFolder, { fullPaths: true, entities: FsEntities.files }); | ||
for (let item of contents) { | ||
const basename = path.basename(item); | ||
if (basename.match(/^apache-/)) { | ||
continue; | ||
} | ||
const newName = path.join( | ||
path.dirname(item), | ||
`apache-${basename}` | ||
); | ||
await rename(item, newName, true); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const | ||
gulp = requireModule("gulp"); | ||
|
||
gulp.task("prepare-build-artifacts", gulp.series( | ||
"zip", | ||
"prefix-build-artifacts", | ||
"hash-build-artifacts" | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters