Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ matrix:
compiler: clang
osx_image: xcode8.1
env: TARGET=swift
- os: osx
osx_image: xcode8.2
env: TARGET=dotnet
- os: linux
jdk: oraclejdk7
env: TARGET=java
Expand Down
3 changes: 1 addition & 2 deletions .travis/before-install-linux-dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +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.0-preview2.1-003177
sudo apt-get install dotnet-dev-1.0.1

# install mvn
wget http://apache.mirrors.lucidnetworks.net/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && \
Expand Down
27 changes: 27 additions & 0 deletions .travis/before-install-osx-dotnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -euo pipefail

thisdir=$(dirname "$0")

# pre-requisites for dotnet core
brew update
brew install openssl
mkdir -p /usr/local/lib
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

# install dotnet core
sudo installer -pkg /tmp/dotnet-1.1.1-sdk-osx-x64.pkg -target /

# make the link
ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/

# Work around apparent rvm bug that is in Travis's Xcode image.
# https://github.com/direnv/direnv/issues/210
# https://github.com/travis-ci/travis-ci/issues/6307
shell_session_update() { :; }

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<NoWarn>$(NoWarn);CS3021</NoWarn>
<AssemblyName>Test</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Antlr4.Test.dotnet</PackageId>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public boolean compile() {
else
{
try {
return createDotnetProject() && buildDotnetProject();
return buildDotnetProject();
} catch(Exception e) {
return false;
}
Expand Down Expand Up @@ -426,7 +426,7 @@ private String locateExec() {
if (!NETSTANDARD)
return new File(tmpdir, "bin/Release/Test.exe").getAbsolutePath();

return new File(tmpdir, "src/bin/Debug/netcoreapp1.0/Test.dll").getAbsolutePath();
return new File(tmpdir, "bin/Release/netcoreapp1.0/Test.dll").getAbsolutePath();
}

private String locateTool(String tool) {
Expand Down Expand Up @@ -493,83 +493,55 @@ public boolean createProject() {
}
}

public boolean createDotnetProject() {
public boolean buildDotnetProject() {
try {
mkdir(tmpdir + "/src");

// move files to /src, since global.json need to be one level higher
File source = new File(tmpdir);
File[] files = source.listFiles();
for (File thisSource : files) {
if (!thisSource.isDirectory()) {
File thisDest = new File(tmpdir + "/src/" + thisSource.getName());
boolean success = thisSource.renameTo(thisDest);

if (!success) {
throw new RuntimeException("Moving file " + thisSource + " to " + thisDest + " failed.");
}
}
}

// save auxiliary files
String pack = BaseCSharpTest.class.getPackage().getName().replace(".", "/") + "/";
saveResourceAsFile(pack + "global.json", new File(tmpdir, "global.json"));
saveResourceAsFile(pack + "project.json", new File(tmpdir, "src/project.json"));
return true;
}
catch(Exception e) {
e.printStackTrace(System.err);
return false;
}
}

public boolean buildDotnetProject() {
// find runtime package
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
final URL runtimeProj = loader.getResource("CSharp/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.dotnet.xproj");
if ( runtimeProj==null ) {
throw new RuntimeException("C# runtime project file not found!");
}
File runtimeProjFile = new File(runtimeProj.getFile());
String runtimeProjPath = runtimeProjFile.getParentFile().getParentFile().getPath();
String projectRefPath = runtimeProjPath.substring(0, runtimeProjPath.lastIndexOf("/"));
saveResourceAsFile(pack + "Antlr4.Test.dotnet.csproj", new File(tmpdir, "Antlr4.Test.dotnet.csproj"));

// update global.json to reference runtime path
try {
String content = new java.util.Scanner(new File(tmpdir + "/global.json")).useDelimiter("\\Z").next();
content = content.replaceAll("replace_this", projectRefPath);
java.io.PrintWriter out = new java.io.PrintWriter(tmpdir + "/global.json");
out.write(content);
out.close();
}
catch(Exception e) {
return false;
}

// build test
String dotnetcli = locateTool("dotnet");
String[] args = new String[] {
dotnetcli,
"restore",
".",
projectRefPath
};
// find runtime package
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
final URL runtimeProj = loader.getResource("CSharp/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.dotnet.csproj");
if ( runtimeProj==null ) {
throw new RuntimeException("C# runtime project file not found!");
}
File runtimeProjFile = new File(runtimeProj.getFile());
String runtimeProjPath = runtimeProjFile.getPath();

try {
// add Runtime project reference
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a reference to the project (runtimeProjPath) rather than the Assembly is likely to be the cause of the very long Travis build with both Linux and MacOSX. I'm guessing this tells dotnet to rebuild both the test project and the runtime project.
Have you tried simply referencing the Assembly here?

String dotnetcli = locateTool("dotnet");
String[] args = new String[] {
dotnetcli,
"add",
"Antlr4.Test.dotnet.csproj",
"reference",
runtimeProjPath
};
boolean success = runProcess(args, tmpdir);

// restore project
args = new String[] {
dotnetcli,
"restore",
"Antlr4.Test.dotnet.csproj"
};
success = runProcess(args, tmpdir);

// build test
args = new String[] {
dotnetcli,
"build",
"src"
"Antlr4.Test.dotnet.csproj",
"-c",
"Release"
};
success = runProcess(args, tmpdir);
}
catch(Exception e) {
e.printStackTrace(System.err);
return false;
}


return true;
}

Expand Down Expand Up @@ -648,7 +620,7 @@ mono, exec, new File(tmpdir, "input").getAbsolutePath(),

String dotnet = locateTool("dotnet");
return new String[] {
dotnet, exec, new File(tmpdir, "src/input").getAbsolutePath(),
dotnet, exec, new File(tmpdir, "input").getAbsolutePath(),
output.toAbsolutePath().toString(),
errorOutput.toAbsolutePath().toString()
};
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>4.7</VersionPrefix>
<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>
<AssemblyOriginatorKeyFile>../../Antlr4.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Antlr4.Runtime.Standard</PackageId>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
</PropertyGroup>

</Project>

This file was deleted.

28 changes: 20 additions & 8 deletions runtime/CSharp/runtime/CSharp/Antlr4.dotnet.sln
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26114.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Antlr4.Runtime.dotnet", "Antlr4.Runtime\Antlr4.Runtime.dotnet.xproj", "{12962409-846E-4B80-933A-BC484D264132}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.dotnet", "Antlr4.Runtime\Antlr4.Runtime.dotnet.csproj", "{0F9F8436-A767-4407-8E81-F9C6270E2B5A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{12962409-846E-4B80-933A-BC484D264132}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12962409-846E-4B80-933A-BC484D264132}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12962409-846E-4B80-933A-BC484D264132}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12962409-846E-4B80-933A-BC484D264132}.Release|Any CPU.Build.0 = Release|Any CPU
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Debug|x64.ActiveCfg = Debug|x64
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Debug|x64.Build.0 = Debug|x64
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Debug|x86.ActiveCfg = Debug|x86
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Debug|x86.Build.0 = Debug|x86
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Release|Any CPU.Build.0 = Release|Any CPU
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Release|x64.ActiveCfg = Release|x64
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Release|x64.Build.0 = Release|x64
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Release|x86.ActiveCfg = Release|x86
{0F9F8436-A767-4407-8E81-F9C6270E2B5A}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
27 changes: 0 additions & 27 deletions runtime/CSharp/runtime/CSharp/project.json

This file was deleted.