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
5 changes: 0 additions & 5 deletions .circleci/scripts/install-linux-dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,3 @@ sudo apt-get update; \
export PATH=$PATH:~/.dotnet
echo "done installing .Net SDK"

# 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
echo "building runtime..."
dotnet build -c Release -f netstandard2.0 runtime/CSharp/src/Antlr4.csproj
echo "done building runtime"
5 changes: 0 additions & 5 deletions .github/scripts-macosx/run-tests-dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ set -euo pipefail

export PATH=$PATH:~/.dotnet

# 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 build -c Release -f netstandard2.0 runtime/CSharp/Antlr4.csproj

# run tests
pushd runtime-testsuite/
export MAVEN_OPTS="-Xmx8g"
Expand Down
6 changes: 6 additions & 0 deletions .github/scripts-windows/run-tests-cpp.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set ChocolateyInstall=C:\tools\chocolatey
C:\ProgramData\chocolatey\bin\cinst.exe visualstudio2022-workload-vctools -y

cd runtime-testsuite
mvn -Dparallel=classes -DthreadCount=2 -Dtest=cpp.** test
cd ..
2 changes: 0 additions & 2 deletions .github/scripts-windows/run-tests-csharp.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
dotnet build runtime/CSharp/src/Antlr4.csproj -c Release
dotnet pack runtime/CSharp/src/Antlr4.csproj -c Release
cd runtime-testsuite
mvn -Dparallel=classes -DthreadCount=2 -Dtest=csharp.** test
cd ..
14 changes: 7 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ jobs:
- name: Set up Maven
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.5.4
maven-version: 3.5.4
# fails due to permissions, use global install
# - name: Set up Python 2
# if: matrix.TARGET == 'python2'
# uses: actions/setup-python@v2
# with:
# python-version: '2.x'
# architecture: 'x64'
# python-version: '2.x'
# architecture: 'x64'
# fails due to permissions, use global install
# - name: Set up Python 3
# if: matrix.TARGET == 'python3'
# uses: actions/setup-python@v2
# with:
# python-version: '3.x'
# architecture: 'x64'
# python-version: '3.x'
# architecture: 'x64'
- name: Set up Node 14
if: matrix.TARGET == 'javascript'
uses: actions/setup-node@v2
Expand All @@ -59,15 +59,15 @@ jobs:
if: matrix.TARGET == 'go'
uses: actions/setup-go@v2
with:
go-version: '^1.13.1'
go-version: '^1.13.1'
# requires manually setting up pwsh
# fails due to incorrect script (missing printf)
# - name: Setup PHP 8.2
# if: matrix.TARGET == 'php'
# uses: shivammathur/setup-php@v2
# with:
# php-version: '8.2'
# extensions: mbstring
# extensions: mbstring
# tools: composer
- name: Build tool with Maven
run: mvn install -DskipTests=true -Darguments="-Dmaven.javadoc.skip=true" -B -V
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
\<?xml version="1.0" encoding="utf-8"?>
\<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
\<ItemGroup Label="ProjectConfigurations">
\<ProjectConfiguration Include="Release|x64">
\<Configuration>Release\</Configuration>
\<Platform>x64\</Platform>
\</ProjectConfiguration>
\</ItemGroup>
\<PropertyGroup Label="Globals">
\<VCProjectVersion>16.0\</VCProjectVersion>
\<Keyword>Win32Proj\</Keyword>
\<ProjectGuid>{f3708606-c8fb-45ca-ae36-b729f91e972b}\</ProjectGuid>
\<RootNamespace>Test\</RootNamespace>
\<WindowsTargetPlatformVersion>10.0\</WindowsTargetPlatformVersion>
\</PropertyGroup>
\<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />

\<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
\<ConfigurationType>Application\</ConfigurationType>
\<UseDebugLibraries>false\</UseDebugLibraries>
\<PlatformToolset><platformToolset>\</PlatformToolset>
\<WholeProgramOptimization>false\</WholeProgramOptimization> \<!-- compile time is more important than run time for tests -->
\<CharacterSet>Unicode\</CharacterSet>
\</PropertyGroup>

\<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />
\<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
\<Import Project="$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
\</ImportGroup>

\<PropertyGroup>
\<LinkIncremental>false\</LinkIncremental>
\<IncludePath><runtimeSourcePath>;$(IncludePath)\</IncludePath>
\<ReferencePath>$(VC_ReferencesPath_x64);<runtimeBinaryPath>\</ReferencePath>
\<OutDir>$(SolutionDir)\</OutDir>
\</PropertyGroup>

\<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
\<ClCompile>
\<WarningLevel>TurnOffAllWarnings\</WarningLevel>
\<FunctionLevelLinking>false\</FunctionLevelLinking>
\<IntrinsicFunctions>false\</IntrinsicFunctions>
\<SDLCheck>false\</SDLCheck>
\<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)\</PreprocessorDefinitions>
\<ConformanceMode>true\</ConformanceMode>
\<LanguageStandard>stdcpp17\</LanguageStandard>
\<DebugInformationFormat>None\</DebugInformationFormat>
\</ClCompile>
\<Link>
\<SubSystem>Console\</SubSystem>
\<EnableCOMDATFolding>true\</EnableCOMDATFolding>
\<OptimizeReferences>false\</OptimizeReferences>
\<GenerateDebugInformation>false\</GenerateDebugInformation>
\<AdditionalDependencies>"<runtimeBinaryPath>\\antlr4-runtime.lib";%(AdditionalDependencies)\</AdditionalDependencies>
\</Link>
\</ItemDefinitionGroup>

\<ItemGroup>
\<ClInclude Include="<lexerName>.h" />
\<ClCompile Include="<lexerName>.cpp" />

<if(parserName)>
\<ClInclude Include="<parserName>.h" />
\<ClCompile Include="<parserName>.cpp" />
<endif>

<if(useListener)>
\<ClInclude Include="<grammarName>BaseListener.h" />
\<ClCompile Include="<grammarName>BaseListener.cpp" />
\<ClInclude Include="<grammarName>Listener.h" />
\<ClCompile Include="<grammarName>Listener.cpp" />
<endif>

<if(useVisitor)>
\<ClInclude Include="<grammarName>BaseVisitor.h" />
\<ClCompile Include="<grammarName>BaseVisitor.cpp" />
\<ClInclude Include="<grammarName>Visitor.h" />
\<ClCompile Include="<grammarName>Visitor.cpp" />
<endif>

\<ClCompile Include="Test.cpp" />
\</ItemGroup>

\<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />
\</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.antlr.v4.runtime.atn.ATNSerializer;
import org.antlr.v4.runtime.misc.IntegerList;
import org.antlr.v4.semantics.SemanticPipeline;
import org.antlr.v4.test.runtime.cpp.BaseCppTest;
import org.antlr.v4.tool.Grammar;
import org.antlr.v4.tool.LexerGrammar;
import org.junit.rules.TestRule;
Expand All @@ -17,6 +18,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.logging.Logger;

Expand Down Expand Up @@ -202,9 +204,14 @@ else if (os.contains("nux")) {
return detectedOS;
}

private static Boolean isWindows;

public static boolean isWindows() {
return getOS().equalsIgnoreCase("windows");
if (isWindows == null) {
isWindows = getOS().equalsIgnoreCase("windows");
}

return isWindows;
}

protected ATN createATN(Grammar g, boolean useSerializer) {
Expand Down Expand Up @@ -242,4 +249,12 @@ protected void semanticProcess(Grammar g) {
}
}

protected static String getTextFromResource(String name) {
try {
return new String(Files.readAllBytes(Paths.get(BaseCppTest.class.getClassLoader().getResource(name).toURI())));
}
catch (Exception ex) {
return null;
}
}
}
Loading