Skip to content

Commit

Permalink
UBERF-5694: Attempt to fix build cache
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo committed Feb 23, 2024
1 parent 0d2501a commit 15a2bfb
Show file tree
Hide file tree
Showing 23 changed files with 276 additions and 272 deletions.
12 changes: 7 additions & 5 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@
],
"commands": [
{
"commandKind": "bulk",
"commandKind": "phased",
"name": "build:watch",
"summary": "Build and watch",
"phases": ["_phase:build", "_phase:validate"],
"description": "Perform build with tsc and watch for changes with rush",
"enableParallelism": true,
"incremental": true,
"ignoreMissingScript": true,
"watchForChanges": true,
"safeForSimultaneousRushProcesses": true,
"disableBuildCache": false
"watchOptions": {
"alwaysWatch": true,
"watchPhases": ["_phase:build", "_phase:validate"]
}
},
{
"commandKind": "bulk",
Expand Down Expand Up @@ -130,7 +132,7 @@
"phases": ["_phase:validate"],
"summary": "validate",
"enableParallelism": true,
"incremental": true
"incremental": true
},
{
"commandKind": "phased",
Expand Down
2 changes: 1 addition & 1 deletion common/config/rush/experiments.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* If true, build caching will respect the allowWarningsInSuccessfulBuild flag and cache builds with warnings.
* This will not replay warnings from the cached build.
*/
// "buildCacheWithAllowWarningsInSuccessfulBuild": true,
"buildCacheWithAllowWarningsInSuccessfulBuild": true,

/**
* If true, the phased commands feature is enabled. To use this feature, create a "phased" command
Expand Down
4 changes: 2 additions & 2 deletions dev/tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"docker:build": "docker build -t hardcoreeng/tool .",
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tool staging",
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tool",
"run-local": "cross-env SERVER_SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node -r ts-node/register --max-old-space-size=18000 ./src/__start.ts",
"run": "cross-env node -r ts-node/register --max-old-space-size=8000 MODEL_VERSION=$(node ../../common/scripts/show_version.js) ./src/__start.ts",
"run-local": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --max-old-space-size=18000 ./bundle/bundle.js",
"run": "rush bundle --to @hcengineering/tool >/dev/null && cross-env node --max-old-space-size=8000 ./bundle/bundle.js",
"upgrade": "rushx run-local upgrade",
"format": "format src",
"test": "jest --passWithNoTests --silent --forceExit",
Expand Down
20 changes: 10 additions & 10 deletions packages/collaborator-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export interface CollaboratorClient {
}

/** @public */
export function getClient (
export function getClient(
hierarchy: Hierarchy,
workspaceId: WorkspaceId,
token: string,
Expand All @@ -128,19 +128,19 @@ export function getClient (
}

class CollaboratorClientImpl implements CollaboratorClient {
constructor (
constructor(
private readonly hierarchy: Hierarchy,
private readonly workspace: WorkspaceId,
private readonly token: string,
private readonly collaboratorUrl: string
) {}

initialContentId (workspace: string, classId: Ref<Class<Doc>>, docId: Ref<Doc>, attribute: string): DocumentURI {
initialContentId(workspace: string, classId: Ref<Class<Doc>>, docId: Ref<Doc>, attribute: string): DocumentURI {
const domain = this.hierarchy.getDomain(classId)
return mongodbDocumentUri(workspace, domain, docId, attribute)
}

private async rpc (method: string, payload: any): Promise<any> {
private async rpc(method: string, payload: any): Promise<any> {
const url = concatLink(this.collaboratorUrl, '/rpc')

const res = await fetch(url, {
Expand All @@ -161,7 +161,7 @@ class CollaboratorClientImpl implements CollaboratorClient {
return result
}

async getContent (collaborativeDoc: CollaborativeDoc, field: string): Promise<Markup> {
async getContent(collaborativeDoc: CollaborativeDoc, field: string): Promise<Markup> {
const workspace = this.workspace.name
const documentId = collaborativeDocumentUri(workspace, collaborativeDoc)

Expand All @@ -171,23 +171,23 @@ class CollaboratorClientImpl implements CollaboratorClient {
return res.html ?? ''
}

async updateContent (collaborativeDoc: CollaborativeDoc, field: string, value: Markup): Promise<void> {
async updateContent(collaborativeDoc: CollaborativeDoc, field: string, value: Markup): Promise<void> {
const workspace = this.workspace.name
const documentId = collaborativeDocumentUri(workspace, collaborativeDoc)

const payload: UpdateContentRequest = { documentId, field, html: value }
await this.rpc('updateContent', payload)
}

async copyContent (collaborativeDoc: CollaborativeDoc, sourceField: string, targetField: string): Promise<void> {
async copyContent(collaborativeDoc: CollaborativeDoc, sourceField: string, targetField: string): Promise<void> {
const workspace = this.workspace.name
const documentId = collaborativeDocumentUri(workspace, collaborativeDoc)

const payload: CopyContentRequest = { documentId, sourceField, targetField }
await this.rpc('copyContent', payload)
}

async branch (source: CollaborativeDoc, target: CollaborativeDoc): Promise<void> {
async branch(source: CollaborativeDoc, target: CollaborativeDoc): Promise<void> {
const workspace = this.workspace.name
const sourceDocumentId = collaborativeDocumentUri(workspace, source)
const targetDocumentId = collaborativeDocumentUri(workspace, target)
Expand All @@ -196,15 +196,15 @@ class CollaboratorClientImpl implements CollaboratorClient {
await this.rpc('branchDocument', payload)
}

async remove (collaborativeDoc: CollaborativeDoc): Promise<void> {
async remove(collaborativeDoc: CollaborativeDoc): Promise<void> {
const workspace = this.workspace.name
const documentId = collaborativeDocumentUri(workspace, collaborativeDoc)

const payload: RemoveDocumentRequest = { documentId, collaborativeDoc }
await this.rpc('removeDocument', payload)
}

async snapshot (
async snapshot(
collaborativeDoc: CollaborativeDoc,
params: CollaborativeDocSnapshotParams
): Promise<CollaborativeDoc> {
Expand Down
6 changes: 3 additions & 3 deletions packages/collaborator-client/src/uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import { Class, CollaborativeDoc, Doc, Domain, Ref, parseCollaborativeDoc } from

export type DocumentURI = string & { __documentUri: true }

export function collaborativeDocumentUri (workspaceUrl: string, docId: CollaborativeDoc): DocumentURI {
export function collaborativeDocumentUri(workspaceUrl: string, docId: CollaborativeDoc): DocumentURI {
const { documentId, versionId } = parseCollaborativeDoc(docId)
return `minio://${workspaceUrl}/${documentId}/${versionId}` as DocumentURI
}

export function platformDocumentUri (
export function platformDocumentUri(
workspaceUrl: string,
objectClass: Ref<Class<Doc>>,
objectId: Ref<Doc>,
Expand All @@ -31,7 +31,7 @@ export function platformDocumentUri (
return `platform://${workspaceUrl}/${objectClass}/${objectId}/${objectAttr}` as DocumentURI
}

export function mongodbDocumentUri (
export function mongodbDocumentUri(
workspaceUrl: string,
domain: Domain,
docId: Ref<Doc>,
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/__tests__/memdb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ const txes = genMinModel()
class ClientModel extends ModelDb implements Client {
notify?: ((...tx: Tx[]) => void) | undefined

getHierarchy (): Hierarchy {
getHierarchy(): Hierarchy {
return this.hierarchy
}

getModel (): ModelDb {
getModel(): ModelDb {
return this
}

Expand All @@ -52,14 +52,14 @@ class ClientModel extends ModelDb implements Client {
return (await this.findAll(_class, query, options)).shift()
}

async searchFulltext (query: SearchQuery, options: SearchOptions): Promise<SearchResult> {
async searchFulltext(query: SearchQuery, options: SearchOptions): Promise<SearchResult> {
return { docs: [] }
}

async close (): Promise<void> {}
async close(): Promise<void> {}
}

async function createModel (): Promise<{ model: ClientModel, hierarchy: Hierarchy, txDb: TxDb }> {
async function createModel(): Promise<{ model: ClientModel; hierarchy: Hierarchy; txDb: TxDb }> {
const hierarchy = new Hierarchy()
for (const tx of txes) {
hierarchy.tx(tx)
Expand Down
50 changes: 25 additions & 25 deletions packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface Client extends Storage, FulltextStorage {
close: () => Promise<void>
}

export type MeasureDoneOperation = () => Promise<{ time: number, serverTime: number }>
export type MeasureDoneOperation = () => Promise<{ time: number; serverTime: number }>

export interface MeasureClient extends Client {
// Will perform on server operation measure and will return a local client time and on server time
Expand Down Expand Up @@ -101,18 +101,18 @@ class ClientImpl implements AccountClient, BackupClient, MeasureClient {
notify?: (...tx: Tx[]) => void
hierarchy!: Hierarchy
model!: ModelDb
constructor (private readonly conn: ClientConnection) {}
constructor(private readonly conn: ClientConnection) {}

setModel (hierarchy: Hierarchy, model: ModelDb): void {
setModel(hierarchy: Hierarchy, model: ModelDb): void {
this.hierarchy = hierarchy
this.model = model
}

getHierarchy (): Hierarchy {
getHierarchy(): Hierarchy {
return this.hierarchy
}

getModel (): ModelDb {
getModel(): ModelDb {
return this.model
}

Expand All @@ -136,7 +136,7 @@ class ClientImpl implements AccountClient, BackupClient, MeasureClient {
return toFindResult(result, data.total)
}

async searchFulltext (query: SearchQuery, options: SearchOptions): Promise<SearchResult> {
async searchFulltext(query: SearchQuery, options: SearchOptions): Promise<SearchResult> {
return await this.conn.searchFulltext(query, options)
}

Expand All @@ -148,7 +148,7 @@ class ClientImpl implements AccountClient, BackupClient, MeasureClient {
return (await this.findAll(_class, query, { ...options, limit: 1 }))[0]
}

async tx (tx: Tx): Promise<TxResult> {
async tx(tx: Tx): Promise<TxResult> {
if (tx.objectSpace === core.space.Model) {
this.hierarchy.tx(tx)
await this.model.tx(tx)
Expand All @@ -160,11 +160,11 @@ class ClientImpl implements AccountClient, BackupClient, MeasureClient {
return result
}

async measure (operationName: string): Promise<MeasureDoneOperation> {
async measure(operationName: string): Promise<MeasureDoneOperation> {
return await this.conn.measure(operationName)
}

async updateFromRemote (...tx: Tx[]): Promise<void> {
async updateFromRemote(...tx: Tx[]): Promise<void> {
for (const t of tx) {
if (t.objectSpace === core.space.Model) {
this.hierarchy.tx(t)
Expand All @@ -174,31 +174,31 @@ class ClientImpl implements AccountClient, BackupClient, MeasureClient {
this.notify?.(...tx)
}

async close (): Promise<void> {
async close(): Promise<void> {
await this.conn.close()
}

async loadChunk (domain: Domain, idx?: number | undefined): Promise<DocChunk> {
async loadChunk(domain: Domain, idx?: number | undefined): Promise<DocChunk> {
return await this.conn.loadChunk(domain, idx)
}

async closeChunk (idx: number): Promise<void> {
async closeChunk(idx: number): Promise<void> {
await this.conn.closeChunk(idx)
}

async loadDocs (domain: Domain, docs: Ref<Doc>[]): Promise<Doc[]> {
async loadDocs(domain: Domain, docs: Ref<Doc>[]): Promise<Doc[]> {
return await this.conn.loadDocs(domain, docs)
}

async upload (domain: Domain, docs: Doc[]): Promise<void> {
async upload(domain: Domain, docs: Doc[]): Promise<void> {
await this.conn.upload(domain, docs)
}

async clean (domain: Domain, docs: Ref<Doc>[]): Promise<void> {
async clean(domain: Domain, docs: Ref<Doc>[]): Promise<void> {
await this.conn.clean(domain, docs)
}

async getAccount (): Promise<Account> {
async getAccount(): Promise<Account> {
return await this.conn.getAccount()
}
}
Expand All @@ -214,7 +214,7 @@ export interface TxPersistenceStore {
/**
* @public
*/
export async function createClient (
export async function createClient(
connect: (txHandler: TxHandler) => Promise<ClientConnection>,
// If set will build model with only allowed plugins.
allowedPlugins?: Plugin[],
Expand All @@ -230,7 +230,7 @@ export async function createClient (

let lastTx: number

function txHandler (...tx: Tx[]): void {
function txHandler(...tx: Tx[]): void {
if (tx == null || tx.length === 0) {
return
}
Expand Down Expand Up @@ -313,7 +313,7 @@ export async function createClient (
return client
}

async function tryLoadModel (
async function tryLoadModel(
conn: ClientConnection,
reload: boolean,
persistence?: TxPersistenceStore
Expand Down Expand Up @@ -346,7 +346,7 @@ async function tryLoadModel (
}

// Ignore Employee accounts.
function isPersonAccount (tx: Tx): boolean {
function isPersonAccount(tx: Tx): boolean {
return (
(tx._class === core.class.TxCreateDoc ||
tx._class === core.class.TxUpdateDoc ||
Expand All @@ -356,7 +356,7 @@ function isPersonAccount (tx: Tx): boolean {
)
}

async function loadModel (
async function loadModel(
conn: ClientConnection,
allowedPlugins: Plugin[] | undefined,
configs: Map<Ref<PluginConfiguration>, PluginConfiguration>,
Expand Down Expand Up @@ -385,7 +385,7 @@ async function loadModel (
return modelResponse
}

async function buildModel (
async function buildModel(
modelResponse: LoadModelResponse,
allowedPlugins: Plugin[] | undefined,
configs: Map<Ref<PluginConfiguration>, PluginConfiguration>,
Expand Down Expand Up @@ -430,7 +430,7 @@ async function buildModel (
}
}

function getLastTxTime (txes: Tx[]): number {
function getLastTxTime(txes: Tx[]): number {
let lastTxTime = 0
for (const tx of txes) {
if (tx.modifiedOn > lastTxTime) {
Expand All @@ -440,7 +440,7 @@ function getLastTxTime (txes: Tx[]): number {
return lastTxTime
}

function fillConfiguration (systemTx: Tx[], configs: Map<Ref<PluginConfiguration>, PluginConfiguration>): void {
function fillConfiguration(systemTx: Tx[], configs: Map<Ref<PluginConfiguration>, PluginConfiguration>): void {
for (const t of systemTx) {
if (t._class === core.class.TxCreateDoc) {
const ct = t as TxCreateDoc<Doc>
Expand All @@ -459,7 +459,7 @@ function fillConfiguration (systemTx: Tx[], configs: Map<Ref<PluginConfiguration
}
}

function pluginFilterTx (
function pluginFilterTx(
excludedPlugins: PluginConfiguration[],
configs: Map<Ref<PluginConfiguration>, PluginConfiguration>,
systemTx: Tx[]
Expand Down
Loading

0 comments on commit 15a2bfb

Please sign in to comment.