Skip to content

Commit

Permalink
Merging with latest develop
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Feb 12, 2025
2 parents 800633c + 595e0a8 commit edf21ec
Show file tree
Hide file tree
Showing 62 changed files with 2,650 additions and 479 deletions.
26 changes: 13 additions & 13 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions app/gui/src/dashboard/layouts/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import * as reactQuery from '@tanstack/react-query'
import * as React from 'react'
import { useTimeoutCallback } from '../hooks/timeoutHooks'
// eslint-disable-next-line no-restricted-syntax
import ProjectViewTabVue from '@/ProjectViewTab.vue'
import type ProjectViewTabVue from '@/ProjectViewTab.vue'
import { lazy } from 'react'
import { applyPureVueInReact } from 'veaury'
import type { AllowedComponentProps, VNodeProps } from 'vue'
import type { ComponentProps } from 'vue-component-type-helpers'
Expand All @@ -24,11 +25,13 @@ export type ProjectViewTabProps = Omit<
keyof AllowedComponentProps | keyof VNodeProps
>

// applyPureVuewInReact returns Function, but this is not enough to satisfy TSX.
// eslint-disable-next-line no-restricted-syntax
const ProjectViewTab = applyPureVueInReact(ProjectViewTabVue) as (
props: ProjectViewTabProps,
) => JSX.Element
const ProjectViewTab = lazy(() =>
import('@/ProjectViewTab.vue').then((module) => ({
// applyPureVuewInReact returns Function, but this is not enough to satisfy TSX.
// eslint-disable-next-line no-restricted-syntax, @typescript-eslint/no-unsafe-member-access
default: applyPureVueInReact(module.default) as (props: ProjectViewTabProps) => JSX.Element,
})),
)

/** Props for an {@link Editor}. */
export interface EditorProps {
Expand Down
15 changes: 8 additions & 7 deletions app/gui/src/dashboard/pages/dashboard/DashboardTabPanels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import { Suspense } from '#/components/Suspense'
import { useEventCallback } from '#/hooks/eventCallbackHooks'
import { useOpenProjectMutation, useRenameProjectMutation } from '#/hooks/projectHooks'
import type { AssetManagementApi } from '#/layouts/AssetsTable'
import Drive from '#/layouts/Drive'
import Editor from '#/layouts/Editor'
import Settings from '#/layouts/Settings'
import { useLaunchedProjects, usePage } from '#/providers/ProjectsProvider'
import type { ProjectId } from '#/services/Backend'
import type { ReactNode } from 'react'
import { lazy, type ReactNode } from 'react'
import { Collection } from 'react-aria-components'

/** The props for the {@link DashboardTabPanels} component. */
Expand All @@ -22,6 +19,10 @@ export interface DashboardTabPanelsProps {
readonly assetManagementApiRef: React.RefObject<AssetManagementApi> | null
}

const LazyDrive = lazy(() => import('#/layouts/Drive'))
const LazyEditor = lazy(() => import('#/layouts/Editor'))
const LazySettings = lazy(() => import('#/layouts/Settings'))

/** The tab panels for the dashboard page. */
export function DashboardTabPanels(props: DashboardTabPanelsProps) {
const { initialProjectName, ydocUrl, assetManagementApiRef } = props
Expand All @@ -48,7 +49,7 @@ export function DashboardTabPanels(props: DashboardTabPanelsProps) {
shouldForceMount: true,
className: 'flex min-h-0 grow [&[data-inert]]:hidden',
children: (
<Drive
<LazyDrive
assetsManagementApiRef={assetManagementApiRef}
hidden={page !== 'drive'}
initialProjectName={initialProjectName}
Expand All @@ -61,7 +62,7 @@ export function DashboardTabPanels(props: DashboardTabPanelsProps) {
shouldForceMount: true,
className: 'flex min-h-0 grow [&[data-inert]]:hidden',
children: (
<Editor
<LazyEditor
hidden={page !== project.id}
ydocUrl={ydocUrl}
project={project}
Expand All @@ -77,7 +78,7 @@ export function DashboardTabPanels(props: DashboardTabPanelsProps) {
{
id: 'settings',
className: 'flex min-h-0 grow',
children: <Settings />,
children: <LazySettings />,
},
]

Expand Down
16 changes: 6 additions & 10 deletions app/gui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,7 @@ export default defineConfig({
cacheDir: fileURLToPath(new URL('../../node_modules/.cache/vite', import.meta.url)),
plugins: [
wasm(),
...(isDevMode ?
[
await VueDevTools(),
react({
include: fileURLToPath(new URL('../dashboard/**/*.tsx', import.meta.url)),
babel: { plugins: ['@babel/plugin-syntax-import-attributes'] },
}),
]
: []),
...(isDevMode ? [await VueDevTools()] : []),
vue({
customElement: ['**/components/visualizations/**', '**/components/shared/**'],
template: {
Expand All @@ -46,7 +38,11 @@ export default defineConfig({
},
}),
react({
include: fileURLToPath(new URL('./src/dashboard/**/*.tsx', import.meta.url)),
include: [
fileURLToPath(new URL('./src/dashboard/**/*.tsx', import.meta.url)),
fileURLToPath(new URL('./src/dashboard/**/use*.ts', import.meta.url)),
fileURLToPath(new URL('./src/dashboard/**/*Hooks.ts', import.meta.url)),
],
babel: {
plugins: [
syntaxImportAttributes,
Expand Down
2 changes: 1 addition & 1 deletion app/ide-desktop/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"enso-common": "workspace:*",
"enso-gui": "workspace:*",
"enso-runner": "workspace:*",
"esbuild": "^0.24.2",
"esbuild": "^0.25.0",
"esbuild-plugin-wasm": "^1.1.0",
"fast-glob": "^3.3.2",
"lib0": "^0.2.99",
Expand Down
2 changes: 1 addition & 1 deletion app/ydoc-server-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"devDependencies": {
"@types/node": "^22.10.4",
"esbuild": "^0.24.2",
"esbuild": "^0.25.0",
"esbuild-plugin-wasm": "^1.1.0",
"typescript": "^5.7.2"
}
Expand Down
2 changes: 1 addition & 1 deletion app/ydoc-server-polyglot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"esbuild": "^0.24.2",
"esbuild": "^0.25.0",
"esbuild-plugin-wasm": "^1.1.0",
"typescript": "^5.7.2"
}
Expand Down
29 changes: 26 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ lazy val enso = (project in file("."))
`text-buffer`,
`version-output`,
`ydoc-polyfill`,
`ydoc-server`,
`zio-wrapper`
)
.settings(Global / concurrentRestrictions += Tags.exclusive(Exclusive))
Expand Down Expand Up @@ -604,6 +605,7 @@ val googleApiClientVersion = "2.2.0"
val googleApiServicesSheetsVersion = "v4-rev612-1.25.0"
val googleAnalyticsAdminVersion = "0.62.0"
val googleAnalyticsDataVersion = "0.63.0"
val grpcVersion = "1.67.1"

// === Other ==================================================================

Expand Down Expand Up @@ -3786,6 +3788,9 @@ lazy val `engine-runner` = project
`image-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) ++
`table-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) ++
`database-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) ++
`google-api-polyglot-root`
.listFiles("*.jar")
.map(_.getAbsolutePath()) ++
`std-aws-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) ++
`std-microsoft-polyglot-root`
.listFiles("*.jar")
Expand Down Expand Up @@ -4688,6 +4693,8 @@ val `image-polyglot-root` = stdLibComponentRoot("Image") / "polyglot" / "java"
val `image-native-libs` = stdLibComponentRoot("Image") / "polyglot" / "lib"
val `google-api-polyglot-root` =
stdLibComponentRoot("Google_Api") / "polyglot" / "java"
val `google-api-native-libs` =
stdLibComponentRoot("Google_Api") / "polyglot" / "lib"
val `database-polyglot-root` =
stdLibComponentRoot("Database") / "polyglot" / "java"
val `std-aws-polyglot-root` =
Expand Down Expand Up @@ -4918,17 +4925,33 @@ lazy val `std-google-api` = project
"com.google.api-client" % "google-api-client" % googleApiClientVersion exclude ("com.google.code.findbugs", "jsr305"),
"com.google.apis" % "google-api-services-sheets" % googleApiServicesSheetsVersion exclude ("com.google.code.findbugs", "jsr305"),
"com.google.analytics" % "google-analytics-admin" % googleAnalyticsAdminVersion exclude ("com.google.code.findbugs", "jsr305"),
"com.google.analytics" % "google-analytics-data" % googleAnalyticsDataVersion exclude ("com.google.code.findbugs", "jsr305")
"com.google.analytics" % "google-analytics-data" % googleAnalyticsDataVersion exclude ("com.google.code.findbugs", "jsr305"),
"io.grpc" % "grpc-netty-shaded" % grpcVersion
),
// Extract native libraries from grpc-netty-shaded-***.jar, and put them under
// Standard/Google_Api/polyglot/lib directory. The minimized jar will
// be put under Standard/Google_Api/polyglot/java directory.
extractNativeLibs := {
StdBits
.extractNativeLibsFromGrpc(
`google-api-polyglot-root`,
`google-api-native-libs`,
grpcVersion
)
.value
},
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val _ = StdBits
StdBits
.copyDependencies(
`google-api-polyglot-root`,
Seq("std-google-api.jar"),
ignoreScalaLibrary = true
ignoreScalaLibrary = true,
ignoreDependencyIncludeTransitive =
Some(s"grpc-netty-shaded-${grpcVersion}")
)
.value
extractNativeLibs.value
result
}.value
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package org.enso.interpreter.node.expression.builtin.number.decimal;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;

import java.math.BigInteger;
import org.enso.interpreter.runtime.data.EnsoMultiValue;
import org.enso.interpreter.runtime.data.Type;
import org.enso.interpreter.runtime.error.PanicException;
import org.enso.interpreter.runtime.number.EnsoBigInteger;
import org.enso.interpreter.test.WrappedPrimitive;
import org.enso.test.utils.ContextUtils;
import org.enso.test.utils.TestRootNode;
import org.graalvm.polyglot.Context;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

/** Tests Truffle nodes for integer operations. */
public class FloatTest {

private static AbsNode absNode;
private static AddNode addNode;
private static TestRootNode root;
private static Context ctx;

@BeforeClass
public static void setup() {
ctx = ContextUtils.createDefaultContext();
ContextUtils.executeInContext(
ctx,
() -> {
absNode = AbsNode.build();
addNode = AddNode.build();

root = new TestRootNode();
root.insertChildren(absNode, addNode);
return null;
});
}

@AfterClass
public static void teardown() {
ctx.close();
ctx = null;
}

private static final EnsoBigInteger bigInt =
new EnsoBigInteger(new BigInteger("1000000000000000000000000000000000000"));
private static final EnsoBigInteger bigIntNegative =
new EnsoBigInteger(new BigInteger("-1000000000000000000000000000000000000"));

@Test
public void testAbs23() {
ContextUtils.executeInContext(
ctx,
() -> {
assertEquals(23.1, absNode.execute(23.1), 0.01);
assertEquals(23.1, absNode.execute(-23.1), 0.01);
return null;
});
}

@Test
public void testAdd21And1Point0() {
ContextUtils.executeInContext(
ctx,
() -> {
assertEquals(23.1, addNode.execute(22.0, 1.1), 0.01);
return null;
});
}

@Test
public void testAdd21And1() {
ContextUtils.executeInContext(
ctx,
() -> {
assertEquals(23.1, addNode.execute(22.1, 1L), 0.01);
return null;
});
}

@Test
public void testAddMulti21And1() {
ContextUtils.executeInContext(
ctx,
() -> {
var nn = EnsoMultiValue.NewNode.getUncached();
var leak = ContextUtils.leakContext(ctx);
var floatType = leak.getBuiltins().number().getFloat();
var textType = leak.getBuiltins().text();
var both = new Type[] {floatType, textType};
var twentyTwoHello = nn.newValue(both, 2, 0, new Object[] {22.1, "Hello"});
assertEquals(23.2, addNode.execute(1.1, twentyTwoHello), 0.01);
return null;
});
}

@Test
public void testAddInterop21And1() {
ContextUtils.executeInContext(
ctx,
() -> {
var twentyOne = new WrappedPrimitive(21.1);
assertEquals(23.1, addNode.execute(2.0, twentyOne), 0.01);
return null;
});
}

@Test
public void testAddDoubleAndText() {
ContextUtils.executeInContext(
ctx,
() -> {
assertThrows(PanicException.class, () -> addNode.execute(23.1, "Hello"));
return null;
});
}
}
Loading

0 comments on commit edf21ec

Please sign in to comment.