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
Allow neon to compile from the source #131
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @shargon it is passing UT but the code is not working.
Can we make the Neo.SmartContract.Framework to be automatically referenced?
Neo PR Test ReportRepository: neo-devpack-dotnet Code version / branchNeo-devpack-dotnet: shargon:compile-source Test Results
Additional infoWe made two tests that should have the same results, but one of them failed to compile the smart-contract. We followed instructions provided in the PR. Test List1. Initial UT 2. Compile Contract 1 from unit tests The test was to compile the same file that is used in unit tests, using the command line. namespace Neo.Compiler.MSIL.TestClasses
{
public class Contract1 : SmartContract.Framework.SmartContract
{
//default smartcontract entry point.
//but the unittest can be init from anywhere
//no need to add code in Main.
public static object Main(string method, object[] args)
{
return UnitTest_001();
}
public static byte[] UnitTest_001()
{
var nb = new byte[] { 1, 2, 3, 4 };
return nb;
}
}
} Expected result:
3. Compile Contract 2 from unit tests namespace Neo.Compiler.MSIL.TestClasses
{
public class Contract2 : SmartContract.Framework.SmartContract
{
//default smartcontract entry point.
//but the unittest can be init from anywhere
//no need to add code in Main.
public static object Main(string method, object[] args)
{
Neo.SmartContract.Framework.Services.Neo.Runtime.Notify(args[0]);
Neo.SmartContract.Framework.Services.Neo.Runtime.Notify(args[2]);
return UnitTest_002();
}
public static byte UnitTest_002()
{
var nb = new byte[] { 1, 2, 3, 4 };
return nb[2];
}
}
} Expected result:
Actual result: |
If everyone want to, yes, it's easy |
What doesn't work, could you explain it? |
That's the reason of references 😂 You obtain the same behavior in Visual Studio |
I think build from a csproj is more better. |
@lock9 could you review it again? |
@shargon we are trying to deploy a SC into neo 3 testnet but we are having several issues. I will test this later today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is well written and it is very clear. My only suggestion would be to move the content inside that switch to methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiling using csproj small fix
I think "Neo.SmartContract.Framework.dll" should be added as a reference by default. There is no need to add it manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes, this will help a lot to use the compiler. I'm just waiting for the Erik to check if we should use nuget or code references are ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works perfectly. Thanks!
Close #132
Without arguments
Compile from source
-f "V:\Temp\sc.cs" -r "Neo.SmartContract.Framework.dll"
Compile as usual
-f "V:\Temp\sc.dll"