Giter VIP home page Giter VIP logo

netlinx-compile's People

Contributors

amclain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

netlinx-compile's Issues

Add option to write NLRC.exe output to disk

With the recent changes to NLRC.exe, compiler problems can be more difficult to debug. To assist in debugging, an option could be added to netlinx-compile that writes the compiler output to disk.

Revise extension discovery to support workspace.config.yaml

The current extension system assumes that every file has characters that precede the extension (MyWorkspace.apw), but this isn't the case with workspace.config.yaml. One way to solve this is to move the file name wildcard *. out of NetLinx::Compile::Script and into NetLinx::Compile::ExtensionHandler. This allows each extension handler to decide if it should glob files.

workspaces = Dir["#{dir}/*.{#{workspace_extensions.join ','}}"]

Add option to report the command passed to NLRC.exe

With the recent changes to NLRC.exe, compiler problems can be more difficult to debug. To assist in debugging, an option could be added to netlinx-compile that writes the arguments passed to NLRC.exe to stdout or disk.

Argument Error

Hi, I can't seem to get Netlinx-compile to work. It returns the following

C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/netlinx-compile-3.1.1/lib/netlinx/source_file.rb:22:in `scan': invalid byte sequence in UTF-8 (ArgumentError)

Thanks

Projects with both include files and Duet modules fail to compile with NLRC.exe v2.1

When compiling a project with NLRC.exe v2.1 (installed by NetLinx Studio 4) that contains an include file and a duet module, the compiler hangs. If either the include file or Duet module are removed, the project compiles successfully.

This issue is caused by AMX breaking functionality between NLRC.exe v1.0 (distributed with NetLinx 3.x) and NLRC.exe v2.1 (distributed with NetLinx Studio 4). Due to this, it is recommended that users of netlinx-compile _DO NOT UPGRADE TO NETLINX STUDIO 4_ until AMX resolves this issue.


Project files used to replicate the issue:
https://github.com/amclain/netlinx-compile/tree/c78c8b920bd24207343e9a17d6f1e9bc106c5b9f/spec/workspace/duet


Compiling with both an include file and Duet module:

"C:/Program Files (x86)/Common Files/AMXShare/COM/nlrc.exe" "D:/duet-bug/source-file-duet.axs" "-ID:/duet-bug/include" "-MD:/duet-bug/duet-module"
  ------ NLRC.EXE - V2.1 ------------------------------------------------------

  Using Command Line Arguements:


Compiling with only a Duet module:

"C:/Program Files (x86)/Common Files/AMXShare/COM/nlrc.exe" "D:/duet-bug/source-file-duet.axs" "-MD:/duet-bug/duet-module"
  ------ NLRC.EXE - V2.1 ------------------------------------------------------

  Using Command Line Arguements:

     -MD:/duet-bug/duet-module

  ---- Starting NetLinx Compile - Version[2.5.2.300] [07-21-2014 15:45:41] -----







  D:/duet-bug/source-file-duet.axs
  0 error(s), 0 warning(s)

  Token and Variable Count....:     646 (Maximum is 100000)
  Compiled Code...............: 1683558 bytes of memory
  Created SRC file............: D:\duet-bug\source-file-duet.src

  ---- NetLinx Compile Complete [07-21-2014 15:45:42] -------------------------


  ------  End of NLRC.EXE - V2.1  ----------------------------------------------

Compiling with only an include file:

"C:/Program Files (x86)/Common Files/AMXShare/COM/nlrc.exe" "D:/duet-bug/source-file-duet.axs" "-ID:/duet-bug/include"
  ------ NLRC.EXE - V2.1 ------------------------------------------------------

  Using Command Line Arguements:

     -ID:/duet-bug/include

  ---- Starting NetLinx Compile - Version[2.5.2.300] [07-21-2014 15:48:24] -----






  D:/duet-bug/source-file-duet.axs
  0 error(s), 0 warning(s)

  Token and Variable Count....:     646 (Maximum is 100000)
  Compiled Code...............:    8533 bytes of memory
  Created SRC file............: D:\duet-bug\source-file-duet.src

  ---- NetLinx Compile Complete [07-21-2014 15:48:25] -------------------------


  ------  End of NLRC.EXE - V2.1  ----------------------------------------------

Create mocks for the integration tests so they can run under CI

Tests like this need to mock the call to the NetLinx compiler so they can be tested on a continuous integration platform without the need to install proprietary software. The real integration tests should still be available (and flagged as integration) so they can be run on a machine with the compiler installed.

it "compiles a .axs source code file" do
    files = test_file_generator.new 'source-file-plain'

    files.compiled_files.each do |file|
      # Delete any existing files.
      File.delete file if File.exists? file

      # Compiled files should not exist.
      File.exists?(file).should eq false
    end

    # Add source code file to the list of targets to compile.
    compilable.compiler_target_files << files.source_file

    # Run the compiler.
    compiler.compile compilable

    # Compiled files should exist.
    files.compiled_files.each do |file|
      File.exists?(file).should eq true
    end
  end if INTEGRATION_TEST

This is an example of how the call to the compiler was mocked:

describe "Wine" do
    let(:wine_path) { '~/.wine/drive_c/Program Files/Common Files/AMXShare/COM' }
    let(:source_file) { File.expand_path 'source-file-plain', 'spec/workspace/import-test' }
    let(:wine_command) { "wine \"#{File.expand_path('nlrc.exe', wine_path)}\" \"#{source_file}\"" }

    let(:io_double) {
      double().tap do |d|
        d.should_receive(:read) { '' }
        d.should_receive(:close)
      end
    }

    it "can execute the compiler" do
      # Add source code file to the list of targets to compile.
      compilable.compiler_target_files << source_file

      # Stub File.exists? to force Wine path.
      File.should_receive(:exists?).at_least(:once) do |path|
        path.include?('.wine') ? true : false
      end

      # Stub popen to check for correct command.
      IO.should_receive(:popen) do |cmd|
        cmd.should eq wine_command
        io_double
      end

      # Run the compiler.
      compiler.compile compilable
    end
  end

NLRC.exe fails to compile if “-c” exists anywhere in the file path

In the NetLinx compiler, NLRC.exe v2.1 (installed by NetLinx Studio 4), the -c flag was added to specify a config file. It appears that the check for -c happens at any position of any command line parameter, not just at the beginning of each string. Due to this, files and folders containing the string literal “-c” will be incorrectly interpreted by the compiler as the path to a compiler config file.

This issue is caused by AMX breaking functionality between NLRC.exe v1.0 (distributed with NetLinx 3.x) and NLRC.exe v2.1 (distributed with NetLinx Studio 4). Due to this, it is recommended that users of netlinx-compile _DO NOT UPGRADE TO NETLINX STUDIO 4_ until AMX resolves this issue.


File used to replicate the issue:
https://github.com/amclain/netlinx-compile/blob/d6aa92f5dee545312b40aaf20ace0664860f31cb/spec/workspace/import-test/source-file-plain.axs

Any source file will work. To replicate the issue, add a “-c” anywhere in the file path, like “source-code.axs”.


"-c" string literal included in the file path:

"C:/Program Files (x86)/Common Files/AMXShare/COM/nlrc.exe" "D:/netlinx-c/source-file.axs"
  ------ NLRC.EXE - V2.1 ------------------------------------------------------

  Using Configuration File: /netlinx-c/source-file.axs


  ------  End of NLRC.EXE - V2.1  ----------------------------------------------

"-c" string literal changed to "_c":

"C:/Program Files (x86)/Common Files/AMXShare/COM/nlrc.exe" "D:/netlinx_c/source-file.axs"
  ------ NLRC.EXE - V2.1 ------------------------------------------------------

  Using Command Line Arguements:



  ---- Starting NetLinx Compile - Version[2.5.2.300] [07-24-2014 15:28:38] -----






  D:/netlinx_c/source-file.axs
  0 error(s), 0 warning(s)

  Token and Variable Count....:     642 (Maximum is 100000)
  Compiled Code...............:    8387 bytes of memory
  Created SRC file............: D:\netlinx_c\source-file.src

  ---- NetLinx Compile Complete [07-24-2014 15:28:38] -------------------------


  ------  End of NLRC.EXE - V2.1  ----------------------------------------------

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.