Add module-root option for changing module location within the repository (#69)
This commit is contained in:
parent
98248079ae
commit
e0e802d0ce
7 changed files with 82 additions and 5809 deletions
|
|
@ -173,6 +173,14 @@ Default `""`.
|
|||
```
|
||||
</details>
|
||||
|
||||
### `module-root`
|
||||
|
||||
Bazel module root directory, where `MODULE.bazel` and `WORKSPACE` is found.
|
||||
|
||||
Change this value to the module root if it's not the repository root.
|
||||
|
||||
Default `"."`.
|
||||
|
||||
### `output-base`
|
||||
|
||||
Change Bazel output base directory.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ inputs:
|
|||
description: Google Cloud account key for remote cache
|
||||
required: false
|
||||
default: ""
|
||||
module-root:
|
||||
description: Bazel module root directory. Default is `.`
|
||||
required: false
|
||||
default: "."
|
||||
output-base:
|
||||
description: Bazel output base directory. Default is $HOME/.cache/bazel (POSIX) or D:/_bazel (Windows)
|
||||
required: false
|
||||
|
|
|
|||
31
config.js
31
config.js
|
|
@ -7,6 +7,7 @@ const github = require('@actions/github')
|
|||
const bazeliskVersion = core.getInput('bazelisk-version')
|
||||
const cacheVersion = core.getInput('cache-version')
|
||||
const externalCacheConfig = yaml.parse(core.getInput('external-cache'))
|
||||
const moduleRoot = core.getInput('module-root')
|
||||
|
||||
const homeDir = os.homedir()
|
||||
const arch = os.arch()
|
||||
|
|
@ -56,10 +57,10 @@ if (diskCacheEnabled) {
|
|||
const repositoryCacheConfig = core.getInput('repository-cache')
|
||||
const repositoryCacheEnabled = repositoryCacheConfig !== 'false'
|
||||
let repositoryCacheFiles = [
|
||||
'MODULE.bazel',
|
||||
'WORKSPACE.bazel',
|
||||
'WORKSPACE.bzlmod',
|
||||
'WORKSPACE'
|
||||
`${moduleRoot}/MODULE.bazel`,
|
||||
`${moduleRoot}/WORKSPACE.bazel`,
|
||||
`${moduleRoot}/WORKSPACE.bzlmod`,
|
||||
`${moduleRoot}/WORKSPACE`
|
||||
]
|
||||
if (repositoryCacheEnabled) {
|
||||
bazelrc.push(`common --repository_cache=${bazelRepository}`)
|
||||
|
|
@ -90,10 +91,10 @@ if (externalCacheConfig) {
|
|||
externalCache.baseCacheKey = `${baseCacheKey}-external-`
|
||||
externalCache.manifest = {
|
||||
files: [
|
||||
'MODULE.bazel',
|
||||
'WORKSPACE.bazel',
|
||||
'WORKSPACE.bzlmod',
|
||||
'WORKSPACE'
|
||||
`${moduleRoot}/MODULE.bazel`,
|
||||
`${moduleRoot}/WORKSPACE.bazel`,
|
||||
`${moduleRoot}/WORKSPACE.bzlmod`,
|
||||
`${moduleRoot}/WORKSPACE`
|
||||
],
|
||||
name: `external-${manifestName}-manifest`,
|
||||
path: `${os.tmpdir()}/external-cache-manifest.txt`
|
||||
|
|
@ -101,10 +102,10 @@ if (externalCacheConfig) {
|
|||
externalCache.default = {
|
||||
enabled: true,
|
||||
files: [
|
||||
'MODULE.bazel',
|
||||
'WORKSPACE.bazel',
|
||||
'WORKSPACE.bzlmod',
|
||||
'WORKSPACE'
|
||||
`${moduleRoot}/MODULE.bazel`,
|
||||
`${moduleRoot}/WORKSPACE.bazel`,
|
||||
`${moduleRoot}/WORKSPACE.bzlmod`,
|
||||
`${moduleRoot}/WORKSPACE`
|
||||
],
|
||||
name: (name) => { return `external-${name}` },
|
||||
paths: (name) => {
|
||||
|
|
@ -130,7 +131,7 @@ module.exports = {
|
|||
baseCacheKey,
|
||||
bazeliskCache: {
|
||||
enabled: core.getBooleanInput('bazelisk-cache'),
|
||||
files: ['.bazelversion'],
|
||||
files: [`${moduleRoot}/.bazelversion`],
|
||||
name: 'bazelisk',
|
||||
paths: [core.toPosixPath(`${userCacheDir}/bazelisk`)]
|
||||
},
|
||||
|
|
@ -140,8 +141,8 @@ module.exports = {
|
|||
enabled: diskCacheEnabled,
|
||||
files: [
|
||||
...repositoryCacheFiles,
|
||||
'**/BUILD.bazel',
|
||||
'**/BUILD'
|
||||
`${moduleRoot}/**/BUILD.bazel`,
|
||||
`${moduleRoot}/**/BUILD`
|
||||
],
|
||||
name: diskCacheName,
|
||||
paths: [bazelDisk]
|
||||
|
|
|
|||
2922
dist/main/index.js
vendored
2922
dist/main/index.js
vendored
File diff suppressed because it is too large
Load diff
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
2922
dist/post/index.js
vendored
2922
dist/post/index.js
vendored
File diff suppressed because it is too large
Load diff
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
Loading…
Add table
Add a link
Reference in a new issue