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

New GUI/IDE build script support #7832

Merged
merged 43 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
92c08a0
wip
mwu-tow Sep 17, 2023
d8e1607
wip
mwu-tow Sep 18, 2023
660a5d2
wip
mwu-tow Sep 18, 2023
a14bbd8
Merge remote-tracking branch 'origin/develop' into wip/mwu/new-ide-build
mwu-tow Sep 18, 2023
655405f
wip
mwu-tow Sep 18, 2023
d7fa887
wip
mwu-tow Sep 20, 2023
48991dd
Merge branch 'wip/mwu/new-ide-build' of https://github.com/luna/enso …
mwu-tow Sep 20, 2023
949f348
wip
mwu-tow Sep 20, 2023
688ea4d
Merge remote-tracking branch 'origin/develop' into wip/mwu/new-ide-build
mwu-tow Sep 20, 2023
8b64bf1
wip
mwu-tow Sep 20, 2023
7d453dc
Merge branch 'wip/mwu/new-ide-build' of https://github.com/luna/enso …
mwu-tow Sep 20, 2023
188ed05
wip
mwu-tow Sep 20, 2023
0028361
wip
mwu-tow Sep 21, 2023
67f9a85
ignore
mwu-tow Sep 22, 2023
27f35bf
Merge remote-tracking branch 'origin/develop' into wip/mwu/new-ide-build
mwu-tow Sep 22, 2023
26c34b5
wip
mwu-tow Sep 23, 2023
48eb2d7
Merge remote-tracking branch 'origin/develop' into wip/mwu/new-ide-build
mwu-tow Sep 23, 2023
96fc3db
wip, cleanups
mwu-tow Sep 25, 2023
00ff8ea
wip, cleanups
mwu-tow Sep 25, 2023
be8809d
remove dep no longer necessary
mwu-tow Sep 25, 2023
45a5f42
more entries in the lock for @swc
mwu-tow Sep 25, 2023
6b2fe82
swc for x64 mac
mwu-tow Sep 27, 2023
8b062eb
separate job for building gui2
mwu-tow Sep 28, 2023
5a8c594
Merge remote-tracking branch 'origin/develop' into wip/mwu/new-ide-build
mwu-tow Sep 28, 2023
a98fa8c
fixes for electron
mwu-tow Sep 29, 2023
8c359e2
don't run npm install in ensogl-pack
mwu-tow Sep 29, 2023
35a645b
Allow explicit skipping of npm install. Use it in watch skcript.
mwu-tow Sep 29, 2023
3558667
fmt
mwu-tow Sep 30, 2023
625bb98
CR
mwu-tow Sep 30, 2023
5c17c25
Merge remote-tracking branch 'origin/develop' into wip/mwu/new-ide-build
mwu-tow Oct 1, 2023
b971385
cleanups
mwu-tow Oct 1, 2023
c698a32
fixing warnings
mwu-tow Oct 1, 2023
e0f2cc8
Merge branch 'develop' into wip/mwu/new-ide-build
Frizi Oct 2, 2023
85110c1
Merge branch 'develop' into wip/mwu/new-ide-build
Frizi Oct 2, 2023
d4372d2
handle missing project metadata
Frizi Oct 2, 2023
2990eb7
add prettier ignore for a log file
Frizi Oct 2, 2023
89f0298
trailing newline
Frizi Oct 2, 2023
f6fbc07
CR feedback
mwu-tow Oct 2, 2023
649ba83
Merge remote-tracking branch 'origin/wip/mwu/new-ide-build' into wip/…
mwu-tow Oct 2, 2023
74cc2f1
Merge branch 'develop' into wip/mwu/new-ide-build
Frizi Oct 3, 2023
5f46851
lint
Frizi Oct 3, 2023
ba7ffce
Merge remote-tracking branch 'origin/develop' into wip/mwu/new-ide-build
mwu-tow Oct 3, 2023
22e3653
Merge remote-tracking branch 'origin/wip/mwu/new-ide-build' into wip/…
mwu-tow Oct 3, 2023
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
435 changes: 425 additions & 10 deletions .github/workflows/gui.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./run --upload-artifacts ${{ runner.os == 'Linux' }} wasm build
- run: ./run wasm build --wasm-upload-artifact ${{ runner.os == 'Linux' }}
env:
ENSO_AG_GRID_LICENSE_KEY: ${{ secrets.ENSO_AG_GRID_LICENSE_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ bench-report*.xml
## Binaries ##
##############

/built-distribution/
/enso
/project-manager
*.exe
/enso.exp
/enso.lib

*.dll
*.exe
*.pdb
*.so
*.jar
/built-distribution/


#########
Expand Down
6 changes: 5 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ ci-build/
enso/

# Popular IDEs
.idea
.bsp
.idea
.vscode

# Stray files generated during build
svm_*.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no nl

14 changes: 10 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"rust-analyzer.linkedProjects": ["./app/gui2/rust-ffi/Cargo.toml"],
"rust-analyzer.linkedProjects": [
"./app/gui2/rust-ffi/Cargo.toml"
],
"vue.complete.casing.status": false,
"vue.complete.casing.props": "camel",
"vue.complete.casing.tags": "pascal",
"auto-snippets.snippets": [
{ "language": "vue", "snippet": "Vue single-file component" }
{
"language": "vue",
"snippet": "Vue single-file component"
}
],
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.experimental.useFlatConfig": true,
Expand All @@ -18,5 +23,6 @@
],
"files.watcherExclude": {
"**/target": true
}
}
},
"cmake.configureOnOpen": false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something project-specific? I don't think we are using cmake anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VS code just keeps pestering me about setting up CMake without this. Not sure why it is so keen on this.

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no nl

2 changes: 1 addition & 1 deletion app/gui2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"dev": "vite",
"build": "run-p typecheck build-only",
"build": "npm --workspace enso-authentication run compile && run-p typecheck build-only",
"preview": "vite preview",
"test:unit": "vitest",
"test:e2e": "playwright test",
Expand Down
8 changes: 4 additions & 4 deletions app/gui2/shared/yjsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ export class DistributedModule {
}

insertNewNode(offset: number, content: string, meta: NodeMetadata): ExprId {
const range = [offset, offset + content.length]
const range = [offset, offset + content.length] as const
const newId = random.uuidv4() as ExprId
this.transact(() => {
this.doc.contents.insert(offset, content + '\n')
const start = Y.createRelativePositionFromTypeIndex(this.doc.contents, range[0]!)
const end = Y.createRelativePositionFromTypeIndex(this.doc.contents, range[1]!)
const start = Y.createRelativePositionFromTypeIndex(this.doc.contents, range[0], -1)
const end = Y.createRelativePositionFromTypeIndex(this.doc.contents, range[1])
this.doc.idMap.set(newId, encodeRange([start, end]))
this.doc.metadata.set(newId, meta)
})
Expand Down Expand Up @@ -281,7 +281,7 @@ export class IdMap {
// For all remaining expressions, we need to write them into the map.
if (!this.accessed.has(expr)) return
const range = IdMap.rangeForKey(key)
const start = Y.createRelativePositionFromTypeIndex(this.contents, range[0])
const start = Y.createRelativePositionFromTypeIndex(this.contents, range[0], -1)
const end = Y.createRelativePositionFromTypeIndex(this.contents, range[1])
const encoded = encodeRange([start, end])
this.yMap.set(expr, encoded)
Expand Down
3 changes: 1 addition & 2 deletions app/gui2/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const INITIAL_URL_KEY = `Enso-initial-url`
import './assets/main.css'

import { basicSetup } from 'codemirror'
import * as dashboard from 'enso-authentication'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the side-effect of importing this statically will be that the dashboard code will no longer be split into its own chunk. That's fine, but it will likely cause vite to emit a "large chunk size" warning, which gui2 can't do much about. I guess we could try to improve the overall bundle size later.

import { isMac } from 'lib0/environment'
import { decodeQueryParams } from 'lib0/url'
import { createPinia } from 'pinia'
Expand Down Expand Up @@ -46,8 +47,6 @@ function stopApp() {

const appRunner = { runApp, stopApp }

const dashboard = await import('enso-authentication')

/** The entrypoint into the IDE. */
function main() {
/** Note: Signing out always redirects to `/`. It is impossible to make this work,
Expand Down
2 changes: 1 addition & 1 deletion app/gui2/src/stores/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const useGraphStore = defineStore('graph', () => {
rootSpan: stmt.expression,
position: meta == null ? Vec2.Zero() : new Vec2(meta.x, -meta.y),
docRange: [
Y.createRelativePositionFromTypeIndex(text, stmt.exprOffset),
Y.createRelativePositionFromTypeIndex(text, stmt.exprOffset, -1),
Y.createRelativePositionFromTypeIndex(text, stmt.exprOffset + stmt.expression.length),
],
}
Expand Down
25 changes: 14 additions & 11 deletions app/gui2/ydoc-server/languageServerSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,18 @@ class ModulePersistence extends ObservableV2<{ removed: () => void }> {
newContent += synced.code
}

newContent += META_TAG + '\n'

const metaStartLine = (newContent.match(/\n/g) ?? []).length
let metaContent = META_TAG + '\n'

if (idMapKeys != null || (contentDelta && contentDelta.length > 0)) {
if (
idMapKeys != null ||
synced.idMapJson == null ||
(contentDelta && contentDelta.length > 0)
) {
const idMapJson = json.stringify(idMapToArray(this.doc.idMap))
allEdits.push(...applyDiffAsTextEdits(metaStartLine, synced.idMapJson ?? '', idMapJson))
newContent += idMapJson + '\n'
metaContent += idMapJson + '\n'
} else {
newContent += synced.idMapJson + '\n'
metaContent += (synced.idMapJson ?? '[]') + '\n'
}

const nodeMetadata = this.syncedMeta.ide.node
Expand All @@ -385,14 +387,15 @@ class ModulePersistence extends ObservableV2<{ removed: () => void }> {
}

const metadataJson = json.stringify(this.syncedMeta)
allEdits.push(
...applyDiffAsTextEdits(metaStartLine + 1, synced.metadataJson ?? '', metadataJson),
)
newContent += metadataJson
metaContent += metadataJson
} else {
newContent += synced.metadataJson
metaContent += synced.metadataJson ?? '{}'
}

const oldMetaContent = this.syncedContent.slice(synced.code.length)
allEdits.push(...applyDiffAsTextEdits(metaStartLine, oldMetaContent, metaContent))
newContent += metaContent

const newVersion = computeTextChecksum(newContent)

if (DEBUG_LOG_SYNC) {
Expand Down
2 changes: 1 addition & 1 deletion app/ide-desktop/lib/client/electron-builder-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function createElectronBuilderConfig(passedArgs: Arguments): electronBuil
extraMetadata: {
version: BUILD_INFO.version,
},
copyright: 'Copyright © 2022 ${author}.',
copyright: `Copyright © ${new Date().getFullYear()} ${common.COMPANY_NAME}`,
artifactName: 'enso-${os}-${version}.${ext}',
/** Definitions of URL {@link electronBuilder.Protocol} schemes used by the IDE.
*
Expand Down
1 change: 1 addition & 0 deletions app/ide-desktop/lib/client/src/bin/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class Server {
logger.error(`Error creating server:`, err.http)
reject(err)
}
// Prepare the YDoc server access point for the new Vue-based GUI.
if (httpServer) {
ydocServer.createGatewayServer(httpServer)
}
Expand Down
3 changes: 3 additions & 0 deletions app/ide-desktop/lib/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const DEEP_LINK_SCHEME = 'enso'
/** Name of the product. */
export const PRODUCT_NAME = 'Enso'

/** Company name, used as the copyright holder. */
export const COMPANY_NAME = 'New Byte Order sp. z o.o.'

/** COOP, COEP, and CORP headers: https://web.dev/coop-coep/
*
* These are required to increase the resolution of `performance.now()` timers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"./tailwind.css": "./tailwind.css"
},
"scripts": {
"compile": "tsc",
"typecheck": "tsc --noEmit"
},
"dependencies": {
Expand Down
6 changes: 1 addition & 5 deletions app/ide-desktop/lib/types/modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,7 @@ declare module 'create-servers' {
option: CreateServersOptions,
// The types come from a third-party API and cannot be changed.
// eslint-disable-next-line no-restricted-syntax
handler: (
// eslint-disable-next-line no-restricted-syntax
err: HttpError | undefined,
servers: CreatedServers
) => void
handler: (err: HttpError | undefined, servers: CreatedServers) => void
): unknown
}

Expand Down
2 changes: 1 addition & 1 deletion build-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ required-versions:
# NB. The Rust version is pinned in rust-toolchain.toml.
# NB. The Node version is pinned in .node-version.
cargo-watch: ^8.1.1
wasm-pack: ^0.10.2
wasm-pack: ^0.12.1
# TODO [mwu]: Script can install `flatc` later on (if `conda` is present), so this is not required. However it should
# be required, if `conda` is missing.
# flatc: =1.12.0
5 changes: 5 additions & 0 deletions build/build/paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
shader-tools.yml:
app/:
gui/:
gui2/: # The new, Vue-based GUI.
dist/:
ide-desktop/:
lib/:
client/:
Expand Down Expand Up @@ -57,6 +59,9 @@
index.js:
style.css:

gui2/:
assets/:

# Final WASM artifacts in `dist` directory.
wasm/:
dynamic-assets/: # Assets used by the WASM application.
Expand Down
9 changes: 7 additions & 2 deletions build/build/src/ci_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ pub fn gui() -> Result<Workflow> {
workflow.add(PRIMARY_OS, job::Lint);
workflow.add(PRIMARY_OS, job::WasmTest);
workflow.add(PRIMARY_OS, job::NativeTest);
workflow.add(PRIMARY_OS, job::NewGuiTest);

// FIXME: Integration tests are currently always failing.
// The should be reinstated when fixed.
Expand All @@ -461,10 +462,14 @@ pub fn gui() -> Result<Workflow> {
let _wasm_job = workflow.add(os, job::BuildWasm);
}
let project_manager_job = workflow.add(os, job::BuildBackend);
workflow.add_customized(os, job::PackageIde, |job| {
workflow.add_customized(os, job::PackageOldIde, |job| {
job.needs.insert(wasm_job_linux.clone());
job.needs.insert(project_manager_job);
job.needs.insert(project_manager_job.clone());
});
workflow.add_customized(os, job::PackageNewIde, |job| {
job.needs.insert(project_manager_job.clone());
});
workflow.add(os, job::NewGuiBuild);
}
Ok(workflow)
}
Expand Down
37 changes: 33 additions & 4 deletions build/build/src/ci_gen/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ impl JobArchetype for NativeTest {
}
}

#[derive(Clone, Copy, Debug)]
pub struct NewGuiTest;
impl JobArchetype for NewGuiTest {
fn job(&self, os: OS) -> Job {
plain_job(&os, "New (Vue) GUI tests", "gui2 test")
}
}

#[derive(Clone, Copy, Debug)]
pub struct NewGuiBuild;
impl JobArchetype for NewGuiBuild {
fn job(&self, os: OS) -> Job {
plain_job(&os, "New (Vue) GUI build", "gui2 build")
}
}

#[derive(Clone, Copy, Debug)]
pub struct WasmTest;
impl JobArchetype for WasmTest {
Expand Down Expand Up @@ -132,7 +148,7 @@ impl JobArchetype for BuildWasm {
plain_job_customized(
&os,
"Build GUI (WASM)",
" --upload-artifacts ${{ runner.os == 'Linux' }} wasm build",
"wasm build --wasm-upload-artifact ${{ runner.os == 'Linux' }}",
|step| vec![step.with_secret_exposed(crate::env::ENSO_AG_GRID_LICENSE_KEY)],
)
}
Expand Down Expand Up @@ -222,18 +238,31 @@ pub fn expose_os_specific_signing_secret(os: OS, step: Step) -> Step {
}

#[derive(Clone, Copy, Debug)]
pub struct PackageIde;
impl JobArchetype for PackageIde {
pub struct PackageOldIde;
impl JobArchetype for PackageOldIde {
fn job(&self, os: OS) -> Job {
plain_job_customized(
&os,
"Package IDE",
"Package Old IDE",
"ide build --wasm-source current-ci-run --backend-source current-ci-run",
|step| vec![expose_os_specific_signing_secret(os, step)],
)
}
}

#[derive(Clone, Copy, Debug)]
pub struct PackageNewIde;
impl JobArchetype for PackageNewIde {
fn job(&self, os: OS) -> Job {
plain_job_customized(
&os,
"Package New IDE",
"ide2 build --backend-source current-ci-run --gui2-upload-artifact false",
|step| vec![expose_os_specific_signing_secret(os, step)],
)
}
}

#[derive(Clone, Copy, Debug)]
pub struct CiCheckBackend;
impl JobArchetype for CiCheckBackend {
Expand Down
Loading