mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-02 13:00:18 -05:00
Build app for both platforms (#249)
* binary: check platform, throw exception on mismatch * binary: build script actually builds linux platform app * zip from Mac both linux and darwin apps * quiet npm installs during builds
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
_ = require("lodash")
|
||||
fse = require("fs-extra")
|
||||
os = require("os")
|
||||
del = require("del")
|
||||
path = require("path")
|
||||
cp = require("child_process")
|
||||
@@ -44,13 +45,31 @@ smokeTests = {
|
||||
# can pass options to better control the build
|
||||
# for example
|
||||
# skipClean - do not delete "dist" folder before build
|
||||
module.exports = (platform, version, options = {}) ->
|
||||
buildCypressApp = (platform, version, options = {}) ->
|
||||
distDir = _.partial(meta.distDir, platform)
|
||||
buildDir = _.partial(meta.buildDir, platform)
|
||||
buildAppDir = _.partial(meta.buildAppDir, platform)
|
||||
|
||||
log = _.partialRight(logger, platform)
|
||||
|
||||
canBuildInDocker = ->
|
||||
platform == "linux" && os.platform() == "darwin"
|
||||
|
||||
badPlatformMismatch = ->
|
||||
console.error("⛔️ cannot build #{platform} from #{os.platform()}")
|
||||
console.error("⛔️ should use matching platform to build it")
|
||||
console.error("program arguments")
|
||||
console.error(process.argv)
|
||||
|
||||
checkPlatform = ->
|
||||
log("#checkPlatform")
|
||||
if platform == os.platform() then return
|
||||
|
||||
console.log("trying to build #{platform} from #{os.platform()}")
|
||||
if platform == "linux" && os.platform() == "darwin"
|
||||
console.log("try running ./scripts/build-linux-binary.sh")
|
||||
Promise.reject(new Error("Build platform mismatch"))
|
||||
|
||||
cleanupPlatform = ->
|
||||
log("#cleanupPlatform")
|
||||
|
||||
@@ -215,6 +234,7 @@ module.exports = (platform, version, options = {}) ->
|
||||
reject new Error("Verifying App via GateKeeper failed")
|
||||
|
||||
Promise.resolve()
|
||||
.then(checkPlatform)
|
||||
.then(cleanupPlatform)
|
||||
.then(buildPackages)
|
||||
.then(copyPackages)
|
||||
@@ -238,3 +258,5 @@ module.exports = (platform, version, options = {}) ->
|
||||
.return({
|
||||
buildDir: buildDir()
|
||||
})
|
||||
|
||||
module.exports = buildCypressApp
|
||||
|
||||
@@ -29,10 +29,10 @@ npmRun = (args, cwd) ->
|
||||
reject(new Error(msg))
|
||||
|
||||
|
||||
runAllBuildJs = _.partial(npmRun, ["run", "all", "build-js"])
|
||||
runAllBuildJs = _.partial(npmRun, ["run", "all", "build-js", "--skip-packages", "cli,docs"])
|
||||
|
||||
# removes transpiled JS files in the original package folders
|
||||
runAllCleanJs = _.partial(npmRun, ["run", "all", "clean-js"])
|
||||
runAllCleanJs = _.partial(npmRun, ["run", "all", "clean-js", "--skip-packages", "cli,docs"])
|
||||
|
||||
# builds all the packages except for cli and docs
|
||||
runAllBuild = _.partial(npmRun,
|
||||
@@ -100,7 +100,7 @@ npmInstallAll = (pathToPackages) ->
|
||||
|
||||
|
||||
retryNpmInstall = (pkg) ->
|
||||
npmInstall = _.partial(npmRun, ["install", "--production"])
|
||||
npmInstall = _.partial(npmRun, ["install", "--production", "--quiet"])
|
||||
npmInstall(pkg)
|
||||
.catch {code: "EMFILE"}, ->
|
||||
Promise
|
||||
@@ -114,7 +114,7 @@ npmInstallAll = (pathToPackages) ->
|
||||
## prunes out all of the devDependencies
|
||||
## from what was copied
|
||||
retryGlobbing()
|
||||
.map(retryNpmInstall)
|
||||
.mapSeries(retryNpmInstall)
|
||||
.then ->
|
||||
console.log("Finished NPM Installing", new Date() - started)
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ linuxZip = (src, dest) ->
|
||||
)
|
||||
|
||||
zippers = {
|
||||
linux: linuxZip
|
||||
linux: macZip
|
||||
darwin: macZip
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user