amclain / netlinx-compile Goto Github PK
View Code? Open in Web Editor NEWA wrapper utility for the AMX NetLinx compiler.
License: Other
A wrapper utility for the AMX NetLinx compiler.
License: Other
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.
Requested by @kimburgess on the AMX forum:
http://www.amxforums.com/showthread.php?9687-NetLinx-Plugin-For-Sublime-Text/page2
'"wine ' + File.expand_path('nlrc.exe', '~/.wine/drive_c/Program\ Files/Common\ Files/AMXShare/COM') + '"'
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.
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.
This should live in the readme:
https://sourceforge.net/p/netlinx-compile/wiki/Home/
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
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 ----------------------------------------------
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
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 ----------------------------------------------
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.