Skip to content

Commit

Permalink
Merge pull request #9 from NEKERAFA/feature/us-26-generate-grid
Browse files Browse the repository at this point in the history
New version
  • Loading branch information
NEKERAFA authored May 20, 2020
2 parents 7d7e494 + 1b4db46 commit 68c14fb
Show file tree
Hide file tree
Showing 34 changed files with 793 additions and 321 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/ClingoSharp.CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: ClingoSharp Publish

on:
push:
branches:
- master

jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Checkout submodules
run: |
git submodule init
git submodule update
- name: Building dependecies
run: .\build.ps1
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: clingo-windows
path: .\clingo\build\win

build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Checkout submodules
run: |
git submodule init
git submodule update
- name: Building dependecies
run: ./build.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: clingo-linux
path: ./clingo/build/linux

build:
needs: [build-windows, build-linux]
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: Download Windows Artifacts
uses: actions/download-artifact@v1
with:
name: clingo-windows
- name: Download Linux Artifacts
uses: actions/download-artifact@v1
with:
name: clingo-linux
- name: Installing Artifacts
run: |
Copy-Item -Path '.\clingo-windows\*' -Destination '.\clingo\build\win' -Recurse
Copy-Item -Path '.\clingo-linux\*' -Destination '.\clingo\build\linux' -Recurse
- name: Build
run: dotnet build --configuration Release
- name: Test
run: .\test.ps1
- name: Setup DocFX
run: choco install docfx -y
- name: Building documentation
run: |
docfx .\docfx.json
if ($lastexitcode -ne 0){
throw [System.Exception] "docfx build failed with exit code $lastexitcode."
}
- name: Reporting coverage result
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: .\coverage.info
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: site
path: _site

deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Download Artifacts # The built project is downloaded into the 'site' folder.
uses: actions/download-artifact@v1
with:
name: site
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: "site" # The deployment folder should match the name of the artifact. Even though our project builds into the 'build' folder the artifact name of 'site' must be placed here.
88 changes: 49 additions & 39 deletions .github/workflows/ClingoSharp.CI.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: ClingoSharp Workflow
name: ClingoSharp Test

on:
push:
branches:
- master
pull_request:
branches:
- develop
Expand All @@ -12,7 +9,7 @@ on:
- bugfix/*

jobs:
build:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
Expand All @@ -23,50 +20,63 @@ jobs:
run: |
git submodule init
git submodule update
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: Building dependecies
run: .\build.ps1
- name: Build
run: dotnet build --configuration Release
- name: Test
run: .\test.ps1
- name: Setup DocFX
run: choco install docfx -y
- name: Building documentation
run: |
docfx .\docfx.json
if ($lastexitcode -ne 0){
throw [System.Exception] "docfx build failed with exit code $lastexitcode."
}
- name: Reporting coverage result
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: .\coverage.info
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: site
path: _site

deploy:
needs: [build]
name: clingo-windows
path: .\clingo\build\win

build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Checkout submodules
run: |
git submodule init
git submodule update
- name: Building dependecies
run: ./build.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: clingo-linux
path: ./clingo/build/linux

build:
needs: [build-windows, build-linux]
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Download Artifacts # The built project is downloaded into the 'site' folder.
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: Download Windows Artifacts
uses: actions/download-artifact@v1
with:
name: clingo-windows
- name: Download Linux Artifacts
uses: actions/download-artifact@v1
with:
name: site
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
name: clingo-linux
- name: Installing Artifacts
run: |
Copy-Item -Path '.\clingo-windows' -Destination '.\clingo\build\win\' -Recurse
Copy-Item -Path '.\clingo-linux' -Destination '.\clingo\build\linux\' -Recurse
- name: Build
run: dotnet build --configuration Release
- name: Test
run: .\test.ps1
- name: Reporting coverage result
uses: coverallsapp/github-action@master
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: "site" # The deployment folder should match the name of the artifact. Even though our project builds into the 'build' folder the artifact name of 'site' must be placed here.
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: .\coverage.info
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ coverage.info
*.user
*.userosscache
*.sln.docstates
nuget.config

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
10 changes: 5 additions & 5 deletions ClingoSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClingoSharp.NativeWrapper",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClingoSharp.CoreServices", "src\ClingoSharp.CoreServices\ClingoSharp.CoreServices.csproj", "{FD343390-4193-4981-B985-4FA0767B77A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClingoSharp.Test", "tests\ClingoSharp.Test.csproj", "{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClingoSharp.Tests", "tests\ClingoSharp.Tests.csproj", "{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{498A4F49-6B6C-4A39-932D-9F7F41DCE625}"
EndProject
Expand All @@ -29,10 +29,6 @@ Global
{AD231050-B939-48E7-8D5B-5D313C44B8B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD231050-B939-48E7-8D5B-5D313C44B8B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD231050-B939-48E7-8D5B-5D313C44B8B8}.Release|Any CPU.Build.0 = Release|Any CPU
{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}.Release|Any CPU.Build.0 = Release|Any CPU
{F85762B3-1F18-404A-9778-8066F74E486A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F85762B3-1F18-404A-9778-8066F74E486A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F85762B3-1F18-404A-9778-8066F74E486A}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -41,6 +37,10 @@ Global
{FD343390-4193-4981-B985-4FA0767B77A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD343390-4193-4981-B985-4FA0767B77A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD343390-4193-4981-B985-4FA0767B77A1}.Release|Any CPU.Build.0 = Release|Any CPU
{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E26B31EE-8CF9-43E7-A8F7-E7D7EF283A73}.Release|Any CPU.Build.0 = Release|Any CPU
{166D0AD3-F1FE-4519-A7B0-76C6F653B584}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{166D0AD3-F1FE-4519-A7B0-76C6F653B584}.Debug|Any CPU.Build.0 = Debug|Any CPU
{166D0AD3-F1FE-4519-A7B0-76C6F653B584}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Clingo# (ClingoSharp)

[![.NET Standard v2.0](https://img.shields.io/badge/.NET%20Standard-2.0-7014e8)](https://docs.microsoft.com/en-us/dotnet/standard/net-standard)
[![.NET Core v3.0](https://img.shields.io/badge/.NET%20Core-3.0-7014e8)](https://dotnet.microsoft.com/download/dotnet-core/3.0)
[![.NET Framework v4.8](https://img.shields.io/badge/.NET%20Framework-4.8-7014e8)](https://dotnet.microsoft.com/download/dotnet-framework/net48)
[![Clingo 5.4.0](https://img.shields.io/badge/Clingo-5.4.0-blue)](https://github.com/potassco/clingo)
![ClingoSharp Workflow](https://github.com/NEKERAFA/ClingoSharp/workflows/ClingoSharp%20Workflow/badge.svg?branch=master&event=push)
[![Coverage Status](https://coveralls.io/repos/github/NEKERAFA/ClingoSharp/badge.svg?branch=master)](https://coveralls.io/github/NEKERAFA/ClingoSharp?branch=master)
Expand Down
13 changes: 2 additions & 11 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,8 @@ Write-Host ""

Write-Host "Compiling clingo..." -ForegroundColor Green

Write-Host "Compiling Win32 version..." -ForegroundColor Yellow

cmake "clingo" -B".\clingo\build\win\x86" -DCLINGO_BUILD_SHARED=ON -DCLINGO_BUILD_WITH_PYTHON=OFF -DCLINGO_BUILD_WITH_LUA=OFF -DCLINGO_BUILD_APPS=OFF -G "Visual Studio 16 2019" -A Win32
cmake --build ".\clingo\build\win\x86" --config Release

Write-Host ""

Write-Host "Compiling Windows x64 version..." -ForegroundColor Yellow

cmake "clingo" -B".\clingo\build\win\x64" -DCLINGO_BUILD_SHARED=ON -DCLINGO_BUILD_WITH_PYTHON=OFF -DCLINGO_BUILD_WITH_LUA=OFF -DCLINGO_BUILD_APPS=OFF -G "Visual Studio 16 2019" -A x64
cmake --build ".\clingo\build\win\x64" --config Release
cmake "clingo" -B".\clingo\build\win" -DCLINGO_BUILD_SHARED=ON -DCLINGO_BUILD_WITH_PYTHON=OFF -DCLINGO_BUILD_WITH_LUA=OFF -DCLINGO_BUILD_APPS=OFF -G "Visual Studio 16 2019" -A x64
cmake --build ".\clingo\build\win" --config Release

Write-Host ""

Expand Down
50 changes: 5 additions & 45 deletions build.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
echo -e "\033[92mClearing working directory...\033[0m"

if [ -f "./clingo/build/linux/i386"]; then
echo -e "\033[93mDeleting ./clingo/build/linux/i386...\033[0m"
rm -r "./clingo/build/linux/i386"
fi

if [ -f "./clingo/build/linux/amd64"]; then
echo -e "\033[93mDeleting ./clingo/build/linux/amd64...\033[0m"
rm -r "./clingo/build/linux/amd64"
fi

if [ -f "./src/ClingoSharp/runtimes/linux/i386"]; then
echo -e "\033[93mDeleting ./src/ClingoSharp/runtimes/linux/i386...\033[0m"
rm -r "./src/ClingoSharp/runtimes/linux/i386"
fi

if [ -f "./src/ClingoSharp/runtimes/linux/amd64"]; then
echo -e "\033[93mDeleting ./src/ClingoSharp/runtimes/linux/amd64...\033[0m"
rm -r "./src/ClingoSharp/runtimes/linux/amd64"
if [ -d "./clingo/build/linux" ]; then
echo -e "\033[93mDeleting ./clingo/build/linux...\033[0m"
rm -r "./clingo/build/linux"
fi

echo ""

echo -e "\033[92mCompiling clingo...\033[0m"

echo -e "\033[93mCompiling Linux x86 version...\033[0m"

cmake "clingo" -B"./clingo/build/linux/i386" -DCLINGO_BUILD_SHARED=ON -DCLINGO_BUILD_WITH_PYTHON=OFF -DCLINGO_BUILD_WITH_LUA=OFF -DCLINGO_BUILD_APPS=OFF -m32
cmake --build "./clingo/build/linux/i368" -DCMAKE_BUILD_TYPE=Release

echo -e "\033[93mCopying Linux x86 version to ./src/ClingoSharp/runtimes/linux-i386/native...\033[0m"
mkdir -p "./src/ClingoSharp/runtimes/linux-i386/native"
cp "./clingo/build/linux/i386/clingo.so" "./src/ClingoSharp/runtimes/linux-i386/native"

echo -e "\033[93mCopying Linux x86 version to ./tests/runtimes/linux-i386/native...\033[0m"
mkdir -p "./tests/runtimes/linux-i386/native"
cp "./clingo/build/linux/i386/clingo.so" "./tests/runtimes/linux-i386/native"

echo ""

echo -e "\033[93mCompiling Linux x64 version...\033[0m"

cmake "clingo" -B"./clingo/build/linux/amd64" -DCLINGO_BUILD_SHARED=ON -DCLINGO_BUILD_WITH_PYTHON=OFF -DCLINGO_BUILD_WITH_LUA=OFF -DCLINGO_BUILD_APPS=OFF -m64
cmake --build "./clingo/build/linux/amd64" -DCMAKE_BUILD_TYPE=Release

echo -e "\033[93mCopying Linux x64 version to ./src/ClingoSharp/runtimes/linux-amd64/native...\033[0m"
mkdir -p "./src/ClingoSharp/runtimes/linux-amd64/native"
cp "./clingo/build/linux/amd64/clingo.so" "./src/ClingoSharp/runtimes/linux-amd64/native"

echo -e "\033[93mCopying Linux x64 version to ./tests/runtimes/linux-amd64/native...\033[0m"
mkdir -p "./tests/runtimes/linux-amd64/native"
cp "./clingo/build/linux/amd64/clingo.so" "./tests/runtimes/linux-amd64/native"
cmake -B"./clingo/build/linux" -DCLINGO_BUILD_SHARED=ON -DCLINGO_BUILD_WITH_PYTHON=OFF -DCLINGO_BUILD_WITH_LUA=OFF -DCLINGO_BUILD_APPS=OFF "clingo"
cmake --build "./clingo/build/linux"

echo ""

Expand Down
11 changes: 10 additions & 1 deletion examples/InspectionModel/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using ClingoSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;

namespace ClingoSharpApp
{
Expand All @@ -11,7 +13,13 @@ static void Main(string[] args)
Console.WriteLine($"Clingo {Clingo.Version}\n");

Control ctl = new Control(new List<string>() { "0" });
ctl.Add("base", new List<string>() { }, "{a; b}.");

string filename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "program.lp");
Console.WriteLine(filename);
ctl.Load(filename);


//ctl.Add("base", new List<string>() { }, "{a; b}.");
var parts = new List<Tuple<string, List<Symbol>>>()
{
new Tuple<string, List<Symbol>>("base", new List<Symbol>() {}),
Expand All @@ -36,6 +44,7 @@ static void Main(string[] args)
{
continue;
}

}
}
}
Loading

0 comments on commit 68c14fb

Please sign in to comment.