Merge pull request #1845 from xied75/dotnetcore

[dotnet] speed up tests; rename runtime dll ready for nuget
This commit is contained in:
Terence Parr 2017-05-12 08:00:38 -07:00 committed by GitHub
commit c1663e7c0f
5 changed files with 51 additions and 38 deletions

View File

@ -6,7 +6,7 @@ set -euo pipefail
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt-get update
sudo apt-get install dotnet-dev-1.0.1
sudo apt-get install dotnet-dev-1.0.3
# install mvn
wget http://apache.mirrors.lucidnetworks.net/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && \

View File

@ -12,10 +12,10 @@ ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
# download dotnet core
curl https://download.microsoft.com/download/8/F/9/8F9659B9-E628-4D1A-B6BF-C3004C8C954B/dotnet-1.1.1-sdk-osx-x64.pkg -o /tmp/dotnet-1.1.1-sdk-osx-x64.pkg
curl https://download.microsoft.com/download/1/1/4/114223DE-0AD6-4B8A-A8FB-164E5862AF6E/dotnet-dev-osx-x64.1.0.3.pkg -o /tmp/dotnet-dev-osx-x64.1.0.3.pkg
# install dotnet core
sudo installer -pkg /tmp/dotnet-1.1.1-sdk-osx-x64.pkg -target /
sudo installer -pkg /tmp/dotnet-dev-osx-x64.1.0.3.pkg -target /
# make the link
ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/

View File

@ -1,4 +1,12 @@
#!/bin/bash
mvn -q -Dparallel=methods -DthreadCount=4 -Dtest=csharp.* -Dantlr-csharp-netstandard=true test
# we need to build the runtime before test run, since we used "--no-dependencies"
# when we call dotnet cli for restore and build, in order to speed up
dotnet restore ../runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.dotnet.csproj
dotnet build -c Release ../runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.dotnet.csproj
# call test
mvn -q -Dparallel=classes -DthreadCount=4 -Dtest=csharp.* -Dantlr-csharp-netstandard=true test

View File

@ -127,19 +127,6 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
/** Errors found while running antlr */
protected StringBuilder antlrToolErrors;
@org.junit.Rule
public final TestRule testWatcher = new TestWatcher() {
@Override
protected void succeeded(Description description) {
// remove tmpdir if no error.
if (!PRESERVE_TEST_DIR) {
eraseTempDir();
}
}
};
@Override
public void testSetUp() throws Exception {
if (CREATE_PER_TEST_DIRECTORIES) {
@ -150,7 +137,7 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
else {
tmpdir = new File(BASE_TEST_DIR).getAbsolutePath();
if (!PRESERVE_TEST_DIR && new File(tmpdir).exists()) {
eraseFiles();
eraseDirectory(new File(tmpdir));
}
}
antlrToolErrors = new StringBuilder();
@ -523,7 +510,8 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
args = new String[] {
dotnetcli,
"restore",
"Antlr4.Test.dotnet.csproj"
"Antlr4.Test.dotnet.csproj",
"--no-dependencies"
};
success = runProcess(args, tmpdir);
@ -533,7 +521,8 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
"build",
"Antlr4.Test.dotnet.csproj",
"-c",
"Release"
"Release",
"--no-dependencies"
};
success = runProcess(args, tmpdir);
}
@ -797,25 +786,30 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
}
}
protected void eraseFiles() {
if (tmpdir == null) {
return;
}
File tmpdirF = new File(tmpdir);
String[] files = tmpdirF.list();
if(files!=null) for(String file : files) {
new File(tmpdir+"/"+file).delete();
}
protected void eraseDirectory(File dir) {
File[] files = dir.listFiles();
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
eraseDirectory(file);
}
else {
file.delete();
}
}
}
dir.delete();
}
@Override
public void eraseTempDir() {
File tmpdirF = new File(tmpdir);
if ( tmpdirF.exists() ) {
eraseFiles();
tmpdirF.delete();
}
if (!PRESERVE_TEST_DIR) {
File tmpdirF = new File(tmpdir);
if ( tmpdirF.exists() ) {
eraseDirectory(tmpdirF);
tmpdirF.delete();
}
}
}
public String getFirstLineOfException() {

View File

@ -1,16 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>4.7</VersionPrefix>
<Company>The ANTLR Organization</Company>
<Version>4.7.1</Version>
<TargetFramework>netstandard1.3</TargetFramework>
<DefineConstants>$(DefineConstants);DOTNETCORE;NET35PLUS;NET40PLUS;NET45PLUS</DefineConstants>
<NoWarn>$(NoWarn);CS1591;CS1574;CS1580</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Antlr4.Runtime.Standard</AssemblyName>
<AssemblyName>Antlr4.Runtime.Core</AssemblyName>
<AssemblyOriginatorKeyFile>../../Antlr4.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Antlr4.Runtime.Standard</PackageId>
<PackageId>Antlr4.Runtime.Core</PackageId>
<Title>ANTLR 4 .NET Core Runtime</Title>
<Authors>Eric Vergnaud, Terence Parr, Sam Harwell</Authors>
<Description>The .NET Core C# ANTLR 4 runtime from the ANTLR Organization</Description>
<Copyright>Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.</Copyright>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseUrl>https://github.com/antlr/antlr4/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/antlr/antlr4</PackageProjectUrl>
<PackageIconUrl>https://raw.github.com/antlr/website-antlr4/master/images/icons/antlr.png</PackageIconUrl>
<PackageReleaseNotes>https://github.com/antlr/antlr4/releases</PackageReleaseNotes>
<PackageTags>antlr parsing grammar</PackageTags>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>