[dotnet] update to .netcore v1.0.1; add osx build
This commit is contained in:
parent
61f6df21be
commit
da4987dc38
|
@ -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
|
||||
|
|
|
@ -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 && \
|
||||
|
|
|
@ -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() { :; }
|
||||
|
|
@ -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>
|
|
@ -373,7 +373,7 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
else
|
||||
{
|
||||
try {
|
||||
return createDotnetProject() && buildDotnetProject();
|
||||
return buildDotnetProject();
|
||||
} catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
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) {
|
||||
|
@ -493,82 +493,54 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
saveResourceAsFile(pack + "Antlr4.Test.dotnet.csproj", new File(tmpdir, "Antlr4.Test.dotnet.csproj"));
|
||||
|
||||
// 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();
|
||||
|
||||
// add Runtime project reference
|
||||
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",
|
||||
"Antlr4.Test.dotnet.csproj",
|
||||
"-c",
|
||||
"Release"
|
||||
};
|
||||
success = runProcess(args, tmpdir);
|
||||
}
|
||||
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("/"));
|
||||
|
||||
// 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
|
||||
};
|
||||
|
||||
try {
|
||||
boolean success = runProcess(args, tmpdir);
|
||||
|
||||
args = new String[] {
|
||||
dotnetcli,
|
||||
"build",
|
||||
"src"
|
||||
};
|
||||
success = runProcess(args, tmpdir);
|
||||
}
|
||||
catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -648,7 +620,7 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
|
||||
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()
|
||||
};
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"projects": [
|
||||
"replace_this"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dnxcore50"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.1.0"
|
||||
},
|
||||
"CSharp": {
|
||||
"target": "Project",
|
||||
"version": "*"
|
||||
}
|
||||
},
|
||||
"buildOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"outputName": "Test",
|
||||
"nowarn": [
|
||||
"CS3021"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>12962409-846e-4b80-933a-bc484d264132</ProjectGuid>
|
||||
<RootNamespace>Antlr4.Runtime.dotnet</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -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
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"version": "4.7-*",
|
||||
"frameworks": {
|
||||
"netstandard1.3": {
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {},
|
||||
"buildOptions": {
|
||||
"outputName": "Antlr4.Runtime.Standard",
|
||||
"xmlDoc": true,
|
||||
"keyFile": "../Antlr4.snk",
|
||||
"define": [
|
||||
"DOTNETCORE",
|
||||
"NET35PLUS",
|
||||
"NET40PLUS",
|
||||
"NET45PLUS"
|
||||
],
|
||||
"nowarn": [
|
||||
"CS1591",
|
||||
"CS1574",
|
||||
"CS1580"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue