Giter VIP home page Giter VIP logo

h5's People

Contributors

dlemstra avatar mjrist avatar pfriesch avatar theolivenbaum avatar thom-stage avatar thomz12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

h5's Issues

Wrong logic of DateTime.SpecifyKind

Steps To Reproduce
https://dev.deck.net/9d292f241ded3180d8118d9bdb1e4edd

public class Program
{
    public static void Main()
    {
             DateTime date = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc);

            Console.WriteLine(date.ToString("u"));
    }
}

to compare:
https://dev.deck.net/4916fff18f204ff5d2e171dfbd1cbde9

Expected Result
2019-08-05 00:00:00Z
Actual Result

// Depending on time zone
UTC+1 - 2019-08-04 23:00:00Z
UTC+2 - 2019-08-04 22:00:00Z
etc

i think to fix this issues by change this line :
https://github.com/theolivenbaum/h5/blob/d9c8a733e6b55584c3bd37b1f461ae9378882550/H5/H5/shared/System/DateTime.cs#L734
with this :
return new DateTime(value.Ticks, kind);

AddTicks not work correctly

add ticks not work correctly in this simple :
https://deck.net/d8843f388823586dca2a2b94bbbd6af1
Expected Result
2019-12-01T00:00:00.0000000
2019-11-30T23:59:59.9990000
2019-11-30T23:59:59.9990000
Actual Result
2019-12-01T00:00:00.0000000
2019-12-01T00:00:00.0000000
2019-11-30T23:59:59.9990000
i think to fix this problem its to replace:
https://github.com/theolivenbaum/h5/blob/d9c8a733e6b55584c3bd37b1f461ae9378882550/H5/H5/shared/System/DateTime.cs#L454
with is :
return new DateTime((ulong)(ticks + value));
or with this:
return new DateTime((long)(ticks + value));

Box2D support

In my project I'd like to use Box2D. Is it possible to port that over from Retyped.box2d?

Is that something I can look into? Are you decompiling the Retyped packages for that?

Crash when building the template

Building on Ubuntu 20.04. Only installed sdk is 3.1

Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  [info] [16:13:09] Found compilation server
  Running _ComputePackageReferencePublish for Test
  Running _HandlePackageFileConflicts
  Running _ComputeReferenceAssemblies
  Running _ComputeUserRuntimeAssemblies
  Running GenerateBuildDependencyFile
  No output assembly found, will build.
  Running _GenerateRuntimeConfigurationFilesInputCache
  Running GenerateBuildRuntimeConfigurationFiles
  Writing project runtime config file /home/andre/RiderProjects/Tetys/csharp/Test/bin/Debug/netstandard2.0/Test.runtimeconfig.json
  Test -> 
  Skipping updating the h5 compiler. You can always install/update it by calling dotnet tool update --global h5-compiler
  Deleting previous assembly: /home/andre/RiderProjects/Tetys/csharp/Test/bin/Debug/netstandard2.0/Test.dll
  H5 compilation begins now... 
  
  
  
       5555555555555555555555555555555555555555
        5555555555555555555hhhhhhhhhhhhhhhh5555
        555     55555555555hh             h5555 
        555     55555555555hh             h555  
        555     55555555555hh     hhhhhhhhh555  
         55     55555555555hh     hhhhhhhhh555  
         555     5555555555hh     hhhhhhhh5555  
         555              5hh            h5555  
         555              5hh            h555   
          555    5555     5hhhhhhhh      h555   
          555    5555     5hhhhhhhh      h555   
          555     555     5hhhhhhhh     h5555   
          555     555     5hh           h555    
          5555555 555     5hh        hhhh555    
           5555555555555555hhhhhhhhhhhhhh555    
           5555555555555555hhhhhhh5555555555    
                 55555555555555555555           
                   5555555555555555            
  
  
  [info] [16:13:10] Executing h5 compiler with arguments: '--project /home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj --configuration Debug --assembly-version 1.0.0.0'
  [info] [16:13:10] Found compilation server, sending compilation request
  
  
  [info] [16:13:10]  Setting working directory to '/home/andre/RiderProjects/Tetys/csharp/Test'
  [info] [16:13:10]  [B] H5 Compilation
  [info] [16:13:10]  H5 config file is not found. Returning default config
  [info] [16:13:10]  [E] H5 Compilation in 0.0010 seconds
  [info] [16:13:10]  
  
       __ _  _  _  _ 
      |_ |_)|_)/ \|_)
      |__| \| \\_/| \
  
  
  [fail] [16:13:10]  
H5 : error H5003: The SDK 'h5.Target/0.0.11500' specified could not be found.  /home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj [/home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj]
  [fail] [16:13:10]  
  Stack Trace:    at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
     at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
     at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
     at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
     at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
     at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
     at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
     at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
     at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
     at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
     at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
     at H5.Translator.Translator.EnsureProjectProperties()
     at H5.Translator.TranslatorProcessor.SetTranslatorProperties()
     at H5.Translator.TranslatorProcessor.PreProcess(IH5DotJson_AssemblySettings translatorConfiguration)
     at H5.Compiler.CompilationProcessor.Compile(CompilationRequest compilationRequest, UID128 compilationUID, CancellationToken cancellationToken)
/home/andre/.nuget/packages/h5.target/0.0.11500/Sdk/Sdk.targets(462,9): error MSB3073: The command "h5 --project "/home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj" --configuration "Debug" --assembly-version "1.0.0.0"" exited with code 1. [/home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj]

Build FAILED.

H5 : error H5003: The SDK 'h5.Target/0.0.11500' specified could not be found.  /home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj [/home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj]
/home/andre/.nuget/packages/h5.target/0.0.11500/Sdk/Sdk.targets(462,9): error MSB3073: The command "h5 --project "/home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj" --configuration "Debug" --assembly-version "1.0.0.0"" exited with code 1. [/home/andre/RiderProjects/Tetys/csharp/Test/Test.csproj]
    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:02.58

Question about h5 progress

Hello
I am currently using BridgeDotNet but they stopped developing two years ago on the project .
so I am thinking of moving to h5.
May I know how much you have improved from BridgeDotNet ?
how much you have been able to support .net 5 ?
Is the project safe now for me to move to ?
is this an experimental project or a serious project ?

Out parameter name resolution bug

(src.v || "") should have been (src1.v || "") on the generated code below:

switch (value) {
    case 0: 
        {
            src = { };
            this._paginationManager.GroupResultsBy(function (sh) {
                return Mosaik.Schema.Node.prototype.TryGetSource.call(sh.Node, src) ? src.v : "";
            });
        }
        break;
    case 1: 
        {
            src1 = { };
            this._paginationManager.GroupResultsBy(function (sh) {
                return Mosaik.Schema.Node.prototype.TryGetSource.call(sh.Node, src1) ? (Mosaik.NodeRenderer.GetDisplayName(sh.Node) || "") + " / " + (src.v || "") : Mosaik.NodeRenderer.GetDisplayName(sh.Node);
            });
        }
        break;
}

Allow net50 in addition to netstandard 2.0?

Does anything specific speak against supporting net50 as target framework?
I am currently using special empty H5 csproj files which point on the same libraries i use in desktop environment.
However defining the projects as net5.0 would not require out libraries to avoid using modern language features like switch expressions etc.

Add Inputs/Outputs to project target

See: dotnet/msbuild#274

Example:

Inputs="$(MSBuildAllProjects);
                @(Compile);
                @(_CoreCompileResourceInputs);
                $(ApplicationIcon);
                $(AssemblyOriginatorKeyFile);
                @(ReferencePath);
                @(CompiledLicenseFile);
                @(LinkResource);
                @(EmbeddedDocumentation);
                $(Win32Resource);
                $(Win32Manifest);
                @(CustomAdditionalCompileInputs);
                $(ResolvedCodeAnalysisRuleSet)"
          Outputs="@(DocFileItem);
                 @(IntermediateAssembly);
                 @(_DebugSymbolsIntermediatePath);
                 $(NonExistentFile);
                 @(CustomAdditionalCompileOutputs)"

Task didn't work in h5

Hello:
i'm got 4 errors when i'm run the code
first error is ' Task is not yet completed '
and the others errors is ' Task is already completed '

code here :

namespace System.Net.Http
{
    public class HttpClient
    {
        private static uint timeout = 100000;
        public static uint Timeout { get { return timeout; }
            set {
                if (value >= uint.MaxValue)
                {
                    timeout = uint.MaxValue ;
                }
                else
                {
                    timeout = value;
                }
            }
        }

        public static async Task<XMLHttpRequest> GetAsync(string requestUri)
        {
            var tcs = new TaskCompletionSource<XMLHttpRequest>();
       
             XMLHttpRequest xmlHttp = new XMLHttpRequest();
            xmlHttp.timeout = Timeout;
            xmlHttp.open("GET", requestUri);
     
            xmlHttp.onreadystatechange = async (e) =>
            {
                if(xmlHttp.status == 200)
                {
                    tcs.SetResult(xmlHttp);
                }
                else
                {
                    tcs.SetException(new Exception("Response status code does not indicate success: " + xmlHttp.statusText));
                }
            };
            xmlHttp.send();
            return await tcs.Task;

        }
    }
}

Locales not supported

image

My h5.json:

{
	"output": "../Shoptico.Core.Backend/wwwroot/$(AssemblyName)/",
	"sourceMap":
	{
		"enabled": false
	},
	"reflection":
	{
		"disabled": false
	},
	"locales": "en-US;en-GB;bg-BG", //if I keep this - I get the crash, if I remove it - it's okay
	"generateTypeScript": false,
	"cleanOutputFolderBeforeBuild": true,
	"logging":
	{
		"level": "None"
	},
	"loader":
	{
		"type": "ES6",
		"manualLoading": true,
		"skipManualVariables": true
	},
	"htmlx":
	{
		"keepJSDependencies": true
	}
}

Auto close compilation server.

When using h5 projects in GitLab CI builds, the build will wait forever for the H5 compiler to close. There should be a way to ensure the compilation server shuts down either after a successful compilation, or after a specific idle time.

.NET 5.0

I know, a bit early, but what are the plans on .NET 5.0?

h5 cdn files?

I hope cdn files for h5 will be provided this is well improve network download size alot.

Referencing netstandard2.0 library projects.

I am working on an opengl/webgl based ui rendering library. The project is setup as follows:

  • UniGui.Core <- NetStandard 2.0 library, standard sdk, contains an iGlContext interface with all the gl calls defined plus the ui system.
  • UniGui.Desktop <- NetStandard 2.0 library, standard sdk, OpenTK based implementation of the Core interfaces.
  • UniGui.Html5 <- NetStandard 2.0 library, H5 sdk, H5 webgl2 based implementation of the Core interfaces.

Using Bridge.net it was possible to reference one of the implementation projects, and compile the whole application into either an desktop or webgl powered application. Using H5 however, compiling the Html5 projects results in:

         [info] [10:36:24]  
         
              __ _  _  _  _ 
             |_ |_)|_)/ \|_)
             |__| \| \\_/| \
         
         
         [fail] [10:36:24]  
     1>H5 : error H5003: Could not find file '/home/andre/RiderProjects/Tetys/csharp/Tetys.Libs.UniGui.Core/bin/Debug/netstandard2.0/netstandard.dll'.
         [fail] [10:36:24]  
         Stack Trace:    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
            at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
            at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
            at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
            at H5.Translator.Translator.AddNestedReferences(List`1 referencesPathes, String refPath)
            at H5.Translator.Translator.AddNestedReferences(List`1 referencesPathes, String refPath)
            at H5.Translator.Translator.BuildAssembly(CancellationToken cancellationToken)
            at H5.Translator.Translator.Translate(CancellationToken cancellationToken)
            at H5.Translator.TranslatorProcessor.Process()
            at H5.Compiler.CompilationProcessor.Compile(CompilationRequest compilationRequest, UID128 compilationUID, CancellationToken cancellationToken)
     1>/home/andre/.nuget/packages/h5.target/0.0.11500/Sdk/Sdk.targets(462,9): error MSB3073: The command "h5 --project "/home/andre/RiderProjects/Tetys/csharp/Tetys.Libs.UniGui.Html5/Tetys.Libs.UniGui.Html5.csproj" --configuration "Debug" --assembly-version "1.0.0.0"" exited with code 1.
     1>Done Building Project "/home/andre/RiderProjects/Tetys/csharp/Tetys.Libs.UniGui.Html5/Tetys.Libs.UniGui.Html5.csproj" (build target(s)) -- FAILED.

Build FAILED.

       "/home/andre/RiderProjects/Tetys/csharp/Tetys.Libs.UniGui.Html5/Tetys.Libs.UniGui.Html5.csproj" (build target) (1) ->
       (_H5Build target) -> 
         H5 : error H5003: Could not find file '/home/andre/RiderProjects/Tetys/csharp/Tetys.Libs.UniGui.Core/bin/Debug/netstandard2.0/netstandard.dll'.
         /home/andre/.nuget/packages/h5.target/0.0.11500/Sdk/Sdk.targets(462,9): error MSB3073: The command "h5 --project "/home/andre/RiderProjects/Tetys/csharp/Tetys.Libs.UniGui.Html5/Tetys.Libs.UniGui.Html5.csproj" --configuration "Debug" --assembly-version "1.0.0.0"" exited with code 1.

    0 Warning(s)
    2 Error(s)

+= string concatenation failing with struct to class property concat

Hello
i saw this issues in bridge.net and try to run it on h5 In fact, the problem also exists in h5.
here is the sample :
Expected: Animal Farm
Actual: Animal

using System;
using H5;
using H5.Core;
using static H5.Core.es5;
using static H5.Core.dom;
using Console = System.Console;

namespace h5
{
    public struct Book
    {
        public string Title;
    }
    public class Delivery
    {
        public Book[] Books;
    }
    class Program
    {
        static void Main(string[] args)
        {

            {
                var delivery = new Delivery();
                delivery.Books = new Book[1];
                delivery.Books[0] = new Book();

                delivery.Books[0].Title = "Animal";
                delivery.Books[0].Title += " Farm";

                // Expected: Animal Farm
                // Actual:   Animal
                Console.Log(delivery.Books[0].Title);
            }
        }
    }
}


Support for local tools.

https://docs.microsoft.com/en-us/dotnet/core/tools/local-tools-how-to-use

When installing h5-compiler with this approach, compiling fails with

       _CheckForH5:
         h5 check-if-online
         'h5' is not recognized as an internal or external command,
         operable program or batch file.

Running "h5" from cmd obviously does not work. "dotnet h5" however works when installing localy. Would it be an option to change the manual system calls which the build process does to "dotnet h5" instead of "h5"? This way we could avoid the need to install h5 globally and allow people to build without doing anything before.

Allow typed arrays as parameter for texImage2D

For some reason I can't use a typed array for the texImage2D and texSubImage2D functions.

Uint8Array platformData = new Uint8Array(data);

_gl.texImage2D(_gl.TEXTURE_2D, 0, _gl.RGBA, width, height, 0, _gl.RGBA, _gl.UNSIGNED_BYTE, platformData);

Casting it to an ArrayBufferView works with H5:

Uint8Array platformData = new Uint8Array(data);
ArrayBufferView view = (object)platformData as ArrayBufferView;

_gl.texImage2D(_gl.TEXTURE_2D, 0, _gl.RGBA, width, height, 0, _gl.RGBA, _gl.UNSIGNED_BYTE, view);

It used to work in Bridge.NET, is this a bug?

Documentation request - reasons why to use instead of Bridge

I've dabbled with Bridge.net in the past, and remember it being a good platform. Could you explain a bit more in the readme about the motivation for h5, in particular what shortcomings bridge.net has that this addresses. From reading the readme I see that the loss of Retyped is a downside to h5, but I don't know all the upsides.

Incorrect async state-machine if any variable in the return block

Originally reported here: Incorrect async state-machine behaviour causing both IF- and ELSE conditions to execute

Seems to be due this line:
https://github.com/theolivenbaum/h5/blob/284112b3f50a9d75a9a359e6dfbeb0eda8d00954/H5/Compiler/Translator/Emitter/Blocks/AbstractEmitterBlock.Write.cs#L976

        public static bool IsReturnLast(string str)
        {
            str = str.TrimEnd();
            return str.EndsWith("return;") || Regex.IsMatch(str, "(?m:^)return(.*)?;$");
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.