Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local build #124

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ build
prebuilds
yarn.lock

libddwaf
#libddwaf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33 changes: 19 additions & 14 deletions scripts/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,41 @@
**/
'use strict'
// const assert = require('assert')
const childProcess = require('child_process')
// const childProcess = require('child_process')
const fs = require('fs')
const path = require('path')
const tar = require('tar')

const pkg = require('../package.json')
// const pkg = require('../package.json')

const libddwafVersion = process.argv[2] || pkg.libddwaf_version
// const libddwafVersion = process.argv[2] || pkg.libddwaf_version

// only relevant if libddwaf repo is private
// assert(process.env.GH_TOKEN, 'GH_TOKEN must be set')

const libddwafFolder = path.join(__dirname, '..', 'libddwaf')

fs.mkdirSync(libddwafFolder, { recursive: true })
// fs.mkdirSync(libddwafFolder, { recursive: true })

childProcess.spawnSync('gh', [
'release', 'download',
'--repo', 'DataDog/libddwaf',
'--dir', libddwafFolder,
'--pattern', `libddwaf-${libddwafVersion}-*-linux-musl.tar.gz`,
'--pattern', `libddwaf-${libddwafVersion}-darwin-*.tar.gz`,
'--pattern', `libddwaf-${libddwafVersion}-windows-*.tar.gz`,
libddwafVersion
])
// childProcess.spawnSync('gh', [
// 'release', 'download',
// '--repo', 'DataDog/libddwaf',
// '--dir', libddwafFolder,
// '--pattern', `libddwaf-${libddwafVersion}-*-linux-musl.tar.gz`,
// '--pattern', `libddwaf-${libddwafVersion}-darwin-*.tar.gz`,
// '--pattern', `libddwaf-${libddwafVersion}-windows-*.tar.gz`,
// libddwafVersion
// ])

for (const name of fs.readdirSync(libddwafFolder)) {
const file = path.join(libddwafFolder, name)

tar.x({ file, cwd: libddwafFolder, sync: true })

fs.rmSync(file)
}

for (const name of fs.readdirSync(libddwafFolder)) {
const newDir = path.join(libddwafFolder, name)
const renamedDir = newDir.substring(0, newDir.indexOf('-c03e4f9'))
fs.renameSync(newDir, renamedDir)
}
Loading