Write homerc both to USERPROFILE and HOME on Windows
This commit is contained in:
parent
3e0beb3116
commit
d23b2a7513
6 changed files with 29 additions and 19 deletions
|
|
@ -13,6 +13,7 @@ const platform = os.platform()
|
||||||
let bazelDisk = core.toPosixPath(`${homeDir}/.cache/bazel-disk`)
|
let bazelDisk = core.toPosixPath(`${homeDir}/.cache/bazel-disk`)
|
||||||
let bazelRepository = core.toPosixPath(`${homeDir}/.cache/bazel-repo`)
|
let bazelRepository = core.toPosixPath(`${homeDir}/.cache/bazel-repo`)
|
||||||
let bazelOutputBase = `${homeDir}/.bazel`
|
let bazelOutputBase = `${homeDir}/.bazel`
|
||||||
|
let bazelrcPaths = [core.toPosixPath(`${homeDir}/.bazelrc`)]
|
||||||
let userCacheDir = `${homeDir}/.cache`
|
let userCacheDir = `${homeDir}/.cache`
|
||||||
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
|
|
@ -24,6 +25,9 @@ switch (platform) {
|
||||||
bazelRepository = 'D:/_bazel-repo'
|
bazelRepository = 'D:/_bazel-repo'
|
||||||
bazelOutputBase = 'D:/_bazel'
|
bazelOutputBase = 'D:/_bazel'
|
||||||
userCacheDir = `${homeDir}/AppData/Local`
|
userCacheDir = `${homeDir}/AppData/Local`
|
||||||
|
if (process.env.HOME) {
|
||||||
|
bazelrcPaths.push(core.toPosixPath(`${process.env.HOME}/.bazelrc`))
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,7 +120,7 @@ module.exports = {
|
||||||
paths: {
|
paths: {
|
||||||
bazelExternal,
|
bazelExternal,
|
||||||
bazelOutputBase: core.toPosixPath(bazelOutputBase),
|
bazelOutputBase: core.toPosixPath(bazelOutputBase),
|
||||||
bazelrc: core.toPosixPath(`${homeDir}/.bazelrc`)
|
bazelrc: bazelrcPaths
|
||||||
},
|
},
|
||||||
platform,
|
platform,
|
||||||
repositoryCache: {
|
repositoryCache: {
|
||||||
|
|
|
||||||
19
dist/main/index.js
vendored
19
dist/main/index.js
vendored
|
|
@ -19,6 +19,7 @@ const platform = os.platform()
|
||||||
let bazelDisk = core.toPosixPath(`${homeDir}/.cache/bazel-disk`)
|
let bazelDisk = core.toPosixPath(`${homeDir}/.cache/bazel-disk`)
|
||||||
let bazelRepository = core.toPosixPath(`${homeDir}/.cache/bazel-repo`)
|
let bazelRepository = core.toPosixPath(`${homeDir}/.cache/bazel-repo`)
|
||||||
let bazelOutputBase = `${homeDir}/.bazel`
|
let bazelOutputBase = `${homeDir}/.bazel`
|
||||||
|
let bazelrcPaths = [core.toPosixPath(`${homeDir}/.bazelrc`)]
|
||||||
let userCacheDir = `${homeDir}/.cache`
|
let userCacheDir = `${homeDir}/.cache`
|
||||||
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
|
|
@ -30,6 +31,9 @@ switch (platform) {
|
||||||
bazelRepository = 'D:/_bazel-repo'
|
bazelRepository = 'D:/_bazel-repo'
|
||||||
bazelOutputBase = 'D:/_bazel'
|
bazelOutputBase = 'D:/_bazel'
|
||||||
userCacheDir = `${homeDir}/AppData/Local`
|
userCacheDir = `${homeDir}/AppData/Local`
|
||||||
|
if (process.env.HOME) {
|
||||||
|
bazelrcPaths.push(core.toPosixPath(`${process.env.HOME}/.bazelrc`))
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,7 +126,7 @@ module.exports = {
|
||||||
paths: {
|
paths: {
|
||||||
bazelExternal,
|
bazelExternal,
|
||||||
bazelOutputBase: core.toPosixPath(bazelOutputBase),
|
bazelOutputBase: core.toPosixPath(bazelOutputBase),
|
||||||
bazelrc: core.toPosixPath(`${homeDir}/.bazelrc`)
|
bazelrc: bazelrcPaths
|
||||||
},
|
},
|
||||||
platform,
|
platform,
|
||||||
repositoryCache: {
|
repositoryCache: {
|
||||||
|
|
@ -74654,13 +74658,12 @@ async function setupBazel () {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setupBazelrc () {
|
async function setupBazelrc () {
|
||||||
fs.writeFileSync(
|
for (const bazelrcPath of config.paths.bazelrc) {
|
||||||
config.paths.bazelrc,
|
fs.writeFileSync(
|
||||||
`startup --output_base=${config.paths.bazelOutputBase}\n`
|
bazelrcPath,
|
||||||
)
|
`startup --output_base=${config.paths.bazelOutputBase}\n`
|
||||||
|
)
|
||||||
for (const line of config.bazelrc) {
|
fs.appendFileSync(bazelrcPath, config.bazelrc.join("\n"))
|
||||||
fs.appendFileSync(config.paths.bazelrc, `${line}\n`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/post/index.js
vendored
6
dist/post/index.js
vendored
|
|
@ -19,6 +19,7 @@ const platform = os.platform()
|
||||||
let bazelDisk = core.toPosixPath(`${homeDir}/.cache/bazel-disk`)
|
let bazelDisk = core.toPosixPath(`${homeDir}/.cache/bazel-disk`)
|
||||||
let bazelRepository = core.toPosixPath(`${homeDir}/.cache/bazel-repo`)
|
let bazelRepository = core.toPosixPath(`${homeDir}/.cache/bazel-repo`)
|
||||||
let bazelOutputBase = `${homeDir}/.bazel`
|
let bazelOutputBase = `${homeDir}/.bazel`
|
||||||
|
let bazelrcPaths = [core.toPosixPath(`${homeDir}/.bazelrc`)]
|
||||||
let userCacheDir = `${homeDir}/.cache`
|
let userCacheDir = `${homeDir}/.cache`
|
||||||
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
|
|
@ -30,6 +31,9 @@ switch (platform) {
|
||||||
bazelRepository = 'D:/_bazel-repo'
|
bazelRepository = 'D:/_bazel-repo'
|
||||||
bazelOutputBase = 'D:/_bazel'
|
bazelOutputBase = 'D:/_bazel'
|
||||||
userCacheDir = `${homeDir}/AppData/Local`
|
userCacheDir = `${homeDir}/AppData/Local`
|
||||||
|
if (process.env.HOME) {
|
||||||
|
bazelrcPaths.push(core.toPosixPath(`${process.env.HOME}/.bazelrc`))
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,7 +126,7 @@ module.exports = {
|
||||||
paths: {
|
paths: {
|
||||||
bazelExternal,
|
bazelExternal,
|
||||||
bazelOutputBase: core.toPosixPath(bazelOutputBase),
|
bazelOutputBase: core.toPosixPath(bazelOutputBase),
|
||||||
bazelrc: core.toPosixPath(`${homeDir}/.bazelrc`)
|
bazelrc: bazelrcPaths
|
||||||
},
|
},
|
||||||
platform,
|
platform,
|
||||||
repositoryCache: {
|
repositoryCache: {
|
||||||
|
|
|
||||||
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
13
index.js
13
index.js
|
|
@ -28,13 +28,12 @@ async function setupBazel () {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setupBazelrc () {
|
async function setupBazelrc () {
|
||||||
fs.writeFileSync(
|
for (const bazelrcPath of config.paths.bazelrc) {
|
||||||
config.paths.bazelrc,
|
fs.writeFileSync(
|
||||||
`startup --output_base=${config.paths.bazelOutputBase}\n`
|
bazelrcPath,
|
||||||
)
|
`startup --output_base=${config.paths.bazelOutputBase}\n`
|
||||||
|
)
|
||||||
for (const line of config.bazelrc) {
|
fs.appendFileSync(bazelrcPath, config.bazelrc.join("\n"))
|
||||||
fs.appendFileSync(config.paths.bazelrc, `${line}\n`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue