Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix batch for inheritance details #224

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft
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
74 changes: 74 additions & 0 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

name: TestsCodeGen

# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "Generate"
Generate:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2.3.1
with:
persist-credentials: false

- name: Install NewPlatform.Flexberry.Designer.CommandLine
run: nuget install NewPlatform.Flexberry.Designer.CommandLine -Version 0.1.0-alpha19 -OutputDirectory gen

- name: Starting X virtual framebuffer (Xvfb) in background
run: Xvfb -ac :99 -screen 0 1280x1024x16 &

- name: Code generation
env:
FLEXBERRY_TOKEN: ${{ secrets.FLEXBERRY_TOKEN }}
run: |
export DISPLAY=:99
export SSH_ASKPASS=1
export FLEXBERRY_TOKEN
mono ./gen/NewPlatform.Flexberry.Designer.CommandLine.0.1.0-alpha19/tools/flexberry.exe ./GenConfig.fdg "${FLEXBERRY_TOKEN}"
- name: Tune ssh-keys
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
set -x
export PRIVATE_KEY
# Setup SSH agent
export SSH_AUTH_SOCK=/tmp/ssh_agent.sock
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
# Start ssh agent
ssh-agent -a $SSH_AUTH_SOCK #> /dev/null
ssh-add - <<< "${PRIVATE_KEY}"
- name: Git commit
run: |
set -x
git config user.name "Flexberry-man"
git config user.email "mail@flexberry.net"
git add --all
git commit -m "Flexberry code generation"
# TODO: решить проблему с новыми добавленными файлами, которые не показываются в git diff, пример решения: https://stackoverflow.com/questions/855767/can-i-use-git-diff-on-untracked-files
# STATUS=$(git diff)
# if [ "$STATUS" != "" ]
# then
# git add --all
# git commit -m "Flexberry code generation"
# fi
- name: Git push
run: |
set -x
SSH_AUTH_SOCK=/tmp/ssh_agent.sock
export SSH_AUTH_SOCK;
# Redirect any output to /dev/null to hide any sensitive credential data that might otherwise be exposed.
git push --force --quiet "git@github.com:${GITHUB_REPOSITORY}.git" > /dev/null 2>&1
echo "Done."
- name: Cleanup
if: always()
run: |
rm -Rf .ssh .github *
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/packages/
**/bin/
*/obj/
*/*/obj/
**/obj/
.vs
*/*/FakesAssemblies/
**/*.vspscc
*.user

# Code generator
gen/
116 changes: 116 additions & 0 deletions Tests/BusinessServers/BearBS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace NewPlatform.Flexberry.ORM.ODataService.Tests
{
using System;
using System.Xml;


// *** Start programmer edit section *** (Using statements)
using System.Collections.Generic;
using System.Linq;
using ICSSoft.STORMNET;

// *** End programmer edit section *** (Using statements)


/// <summary>
/// BearBS.
/// </summary>
// *** Start programmer edit section *** (BearBS CustomAttributes)

// *** End programmer edit section *** (BearBS CustomAttributes)
[ICSSoft.STORMNET.AccessType(ICSSoft.STORMNET.AccessType.none)]
public class BearBS : ICSSoft.STORMNET.Business.BusinessServer
{

// *** Start programmer edit section *** (BearBS CustomMembers)

// *** End programmer edit section *** (BearBS CustomMembers)


// *** Start programmer edit section *** (OnUpdateМедведь CustomAttributes)

// *** End programmer edit section *** (OnUpdateМедведь CustomAttributes)
public virtual ICSSoft.STORMNET.DataObject[] OnUpdateМедведь(NewPlatform.Flexberry.ORM.ODataService.Tests.Медведь UpdatedObject)
{
// *** Start programmer edit section *** (OnUpdateМедведь)

var updatedObjects = new List<DataObject>();
if (UpdatedObject.GetStatus() == ObjectStatus.Created)
{
UpdatedObject.ПолеБС = "Object created.";

string testMethodName = "ChangeMasterTest";
if (UpdatedObject.ЦветГлаз == testMethodName)
{
UpdatedObject.ЛесОбитания.Название = testMethodName;
updatedObjects.Add(UpdatedObject.ЛесОбитания);
}
}
else if (UpdatedObject.GetStatus() == ObjectStatus.Altered)
{
if (UpdatedObject.IsAlteredProperty(x => x.ЛесОбитания) && UpdatedObject.ЛесОбитания != null)
{
UpdatedObject.ПолеБС = $"Медведь обитает в {UpdatedObject.ЛесОбитания.Название}";
}

IEnumerable<Берлога> берлоги = UpdatedObject.Берлога.GetAllObjects().Cast<Берлога>();

var новаяБерлога = берлоги.FirstOrDefault(б => б.GetStatus() == ObjectStatus.Created);
if (новаяБерлога != null)
{
foreach (Берлога берлога in UpdatedObject.Берлога)
{
if (берлога != новаяБерлога)
{
берлога.Заброшена = true;
updatedObjects.Add(берлога);
}
}
}

var последняяБерлога = берлоги.FirstOrDefault(б => б.GetStatus() == ObjectStatus.Altered);
if (последняяБерлога != null)
{
foreach (Берлога берлога in UpdatedObject.Берлога)
{
if (берлога != последняяБерлога)
{
берлога.Заброшена = true;
updatedObjects.Add(берлога);
}
}

UpdatedObject.ЦветГлаз = последняяБерлога.Наименование;
последняяБерлога.Заброшена = false;
updatedObjects.Add(последняяБерлога);
}

var разрушеннаяБерлога = берлоги.FirstOrDefault(б => б.GetStatus() == ObjectStatus.Deleted);
if (разрушеннаяБерлога != null)
{
foreach (Берлога берлога in UpdatedObject.Берлога)
{
if (берлога != разрушеннаяБерлога)
{
берлога.Комфортность += 1;
updatedObjects.Add(берлога);
}
}
}
}

return updatedObjects.Distinct().ToArray();
// *** End programmer edit section *** (OnUpdateМедведь)
}
}
}
5 changes: 3 additions & 2 deletions Tests/BusinessServers/CarBS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace NewPlatform.Flexberry.ORM.ODataService.Tests
{
using System;
using System.Xml;


// *** Start programmer edit section *** (Using statements)
using System.Collections.Generic;
using ICSSoft.STORMNET;
Expand Down
2 changes: 0 additions & 2 deletions Tests/BusinessServers/CatsBS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class CatsBS : ICSSoft.STORMNET.Business.BusinessServer
public virtual ICSSoft.STORMNET.DataObject[] OnUpdateПерелом(NewPlatform.Flexberry.ORM.ODataService.Tests.Перелом UpdatedObject)
{
// *** Start programmer edit section *** (OnUpdateПерелом)

return new ICSSoft.STORMNET.DataObject[0];
// *** End programmer edit section *** (OnUpdateПерелом)
}
Expand All @@ -67,7 +66,6 @@ public virtual ICSSoft.STORMNET.DataObject[] OnUpdateЛапа(NewPlatform.Flexbe
public virtual ICSSoft.STORMNET.DataObject[] OnUpdateКошка(NewPlatform.Flexberry.ORM.ODataService.Tests.Кошка UpdatedObject)
{
// *** Start programmer edit section *** (OnUpdateКошка)

return new ICSSoft.STORMNET.DataObject[0];
// *** End programmer edit section *** (OnUpdateКошка)
}
Expand Down
62 changes: 62 additions & 0 deletions Tests/BusinessServers/DenBS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace NewPlatform.Flexberry.ORM.ODataService.Tests
{
using System;
using System.Xml;


// *** Start programmer edit section *** (Using statements)
using ICSSoft.STORMNET;

// *** End programmer edit section *** (Using statements)


/// <summary>
/// DenBS.
/// </summary>
// *** Start programmer edit section *** (DenBS CustomAttributes)

// *** End programmer edit section *** (DenBS CustomAttributes)
[ICSSoft.STORMNET.AccessType(ICSSoft.STORMNET.AccessType.none)]
public class DenBS : ICSSoft.STORMNET.Business.BusinessServer
{

// *** Start programmer edit section *** (DenBS CustomMembers)

// *** End programmer edit section *** (DenBS CustomMembers)


// *** Start programmer edit section *** (OnUpdateБерлога CustomAttributes)

// *** End programmer edit section *** (OnUpdateБерлога CustomAttributes)
public virtual ICSSoft.STORMNET.DataObject[] OnUpdateБерлога(NewPlatform.Flexberry.ORM.ODataService.Tests.Берлога UpdatedObject)
{
// *** Start programmer edit section *** (OnUpdateБерлога)

if (UpdatedObject.GetStatus() == ObjectStatus.Created)
{
UpdatedObject.ПолеБС = "Object created.";
}
else if (UpdatedObject.GetStatus() == ObjectStatus.Altered)
{
if (UpdatedObject.IsAlteredProperty(x => x.ЛесРасположения) && UpdatedObject.ЛесРасположения != null)
{
UpdatedObject.ПолеБС = $"Берлога расположена в {UpdatedObject.ЛесРасположения.Название}";
}
}

return new DataObject[0];

// *** End programmer edit section *** (OnUpdateБерлога)
}
}
}
49 changes: 49 additions & 0 deletions Tests/BusinessServers/ForestBS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace NewPlatform.Flexberry.ORM.ODataService.Tests
{
using System;
using System.Xml;


// *** Start programmer edit section *** (Using statements)

// *** End programmer edit section *** (Using statements)


/// <summary>
/// ForestBS.
/// </summary>
// *** Start programmer edit section *** (ForestBS CustomAttributes)

// *** End programmer edit section *** (ForestBS CustomAttributes)
[ICSSoft.STORMNET.AccessType(ICSSoft.STORMNET.AccessType.none)]
public class ForestBS : ICSSoft.STORMNET.Business.BusinessServer
{

// *** Start programmer edit section *** (ForestBS CustomMembers)

// *** End programmer edit section *** (ForestBS CustomMembers)


// *** Start programmer edit section *** (OnUpdateЛес CustomAttributes)

// *** End programmer edit section *** (OnUpdateЛес CustomAttributes)
public virtual ICSSoft.STORMNET.DataObject[] OnUpdateЛес(NewPlatform.Flexberry.ORM.ODataService.Tests.Лес UpdatedObject)
{
// *** Start programmer edit section *** (OnUpdateЛес)

return new ICSSoft.STORMNET.DataObject[] { UpdatedObject };

// *** End programmer edit section *** (OnUpdateЛес)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,11 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BearBS.cs" />
<Compile Include="CarBS.cs" />
<Compile Include="CatsBS.cs" />
<Compile Include="DenBS.cs" />
<Compile Include="ForestBS.cs" />
<Compile Include="БерлогаБС.cs">
<SubType>Code</SubType>
</Compile>
Expand Down
Loading