Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Moving to CoreCLR build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriyse committed Dec 28, 2016
1 parent ce55d02 commit 38adb2e
Show file tree
Hide file tree
Showing 82 changed files with 199 additions and 400 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -12,3 +12,5 @@ pythonnet.egg-info
*.userprefs
build/
tools/nuget/*.exe
.vs
*.lock.json
52 changes: 52 additions & 0 deletions pythonnet.CoreCLR.sln
@@ -0,0 +1,52 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Console", "src\console\Console.xproj", "{5BF55E20-325C-45B3-86FC-2FDBBD91901F}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Python.Runtime", "src\Python.Runtime\Python.Runtime.xproj", "{C41B9F67-571D-4852-B7C4-B54E84DCBCDC}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "embed_tests", "src\embed_tests\embed_tests.xproj", "{9F91A9DC-D7B3-45A9-96FF-57AACC1B959A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Py35-UCS2-Win-Debug|Any CPU = Py35-UCS2-Win-Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5BF55E20-325C-45B3-86FC-2FDBBD91901F}.Debug|Any CPU.ActiveCfg = Py35-UCS2-Win-Debug|Any CPU
{5BF55E20-325C-45B3-86FC-2FDBBD91901F}.Debug|Any CPU.Build.0 = Py35-UCS2-Win-Debug|Any CPU
{5BF55E20-325C-45B3-86FC-2FDBBD91901F}.Py35-UCS2-Win-Debug|Any CPU.ActiveCfg = Py35-UCS2-Win-Debug|Any CPU
{5BF55E20-325C-45B3-86FC-2FDBBD91901F}.Py35-UCS2-Win-Debug|Any CPU.Build.0 = Py35-UCS2-Win-Debug|Any CPU
{5BF55E20-325C-45B3-86FC-2FDBBD91901F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BF55E20-325C-45B3-86FC-2FDBBD91901F}.Release|Any CPU.Build.0 = Release|Any CPU
{C41B9F67-571D-4852-B7C4-B54E84DCBCDC}.Debug|Any CPU.ActiveCfg = Py35-UCS2-Win-Debug|Any CPU
{C41B9F67-571D-4852-B7C4-B54E84DCBCDC}.Debug|Any CPU.Build.0 = Py35-UCS2-Win-Debug|Any CPU
{C41B9F67-571D-4852-B7C4-B54E84DCBCDC}.Py35-UCS2-Win-Debug|Any CPU.ActiveCfg = Py35-UCS2-Win-Debug|Any CPU
{C41B9F67-571D-4852-B7C4-B54E84DCBCDC}.Py35-UCS2-Win-Debug|Any CPU.Build.0 = Py35-UCS2-Win-Debug|Any CPU
{C41B9F67-571D-4852-B7C4-B54E84DCBCDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C41B9F67-571D-4852-B7C4-B54E84DCBCDC}.Release|Any CPU.Build.0 = Release|Any CPU
{9F91A9DC-D7B3-45A9-96FF-57AACC1B959A}.Debug|Any CPU.ActiveCfg = Py35-UCS2-Win-Debug|Any CPU
{9F91A9DC-D7B3-45A9-96FF-57AACC1B959A}.Debug|Any CPU.Build.0 = Py35-UCS2-Win-Debug|Any CPU
{9F91A9DC-D7B3-45A9-96FF-57AACC1B959A}.Py35-UCS2-Win-Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F91A9DC-D7B3-45A9-96FF-57AACC1B959A}.Py35-UCS2-Win-Debug|Any CPU.Build.0 = Debug|Any CPU
{9F91A9DC-D7B3-45A9-96FF-57AACC1B959A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F91A9DC-D7B3-45A9-96FF-57AACC1B959A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = src\console\Console.csproj
Policies = $0
$0.VersionControlPolicy = $1
$1.inheritsSet = Mono
$0.ChangeLogPolicy = $2
$2.UpdateMode = None
$2.MessageStyle = $3
$3.LineAlign = 0
$2.inheritsSet = Mono
EndGlobalSection
EndGlobal
File renamed without changes.
19 changes: 19 additions & 0 deletions src/Python.Runtime/Python.Runtime.xproj
@@ -0,0 +1,19 @@
<?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>c41b9f67-571d-4852-b7c4-b54e84dcbcdc</ProjectGuid>
<RootNamespace>runtime.x</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions src/Python.Runtime/project.json
@@ -0,0 +1,33 @@
{
"version": "0.1.0-*",

"buildOptions": {
"compile": {
"exclude": [
"interop33.cs"
]
},
"allowUnsafe": true,
"embed": {
"include": [ "**/*.resx", "resources/**/*" ]
}
},
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
//"netstandard1.3": {
// "imports": "dnxcore50"
//},
"net46": {

}
},
"configurations": {
"Py35-UCS2-Win-Debug": {
"buildOptions": {
"define": [ "TRACE", "DEBUG", "UCS2", "PYTHON35" ]
}
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -149,7 +149,7 @@ public static void Initialize()
Runtime.PyDict_SetItemString(module_globals, "__builtins__", builtins);

var assembly = Assembly.GetExecutingAssembly();
using (Stream stream = assembly.GetManifestResourceStream("clr.py"))
using (Stream stream = assembly.GetManifestResourceStream("Python.Runtime.resources.clr.py"))
using (StreamReader reader = new StreamReader(stream))
{
// add the contents of clr.py to the module
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions src/console/Console.xproj
@@ -0,0 +1,19 @@
<?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>5bf55e20-325c-45b3-86fc-2fdbbd91901f</ProjectGuid>
<RootNamespace>Console</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
28 changes: 28 additions & 0 deletions src/console/project.json
@@ -0,0 +1,28 @@
{
"version": "0.1.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"runtimes": {
"win7-x64": {}
},
"dependencies": {
"NETStandard.Library": "1.6.0",
"Python.Runtime": "0.1.0-*"
},
"frameworks": {
//"netstandard1.6": {
// "imports": "dnxcore50"
//},
"net46": {

}
},
"configurations": {
"Py35-UCS2-Win-Debug": {
"buildOptions": {
"define": [ "TRACE", "DEBUG"]
}
}
}
}
187 changes: 0 additions & 187 deletions src/embed_tests/Python.EmbeddingTest.csproj

This file was deleted.

22 changes: 22 additions & 0 deletions src/embed_tests/embed_tests.xproj
@@ -0,0 +1,22 @@
<?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>9f91a9dc-d7b3-45a9-96ff-57aacc1b959a</ProjectGuid>
<RootNamespace>Python.EmbeddingTest</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

3 comments on commit 38adb2e

@vmuriart
Copy link

Choose a reason for hiding this comment

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

How did you figure out how to setup the initial project.json, or what did you use to do the migration?
I haven't found any resources that go in detail on how they've done it.

@dmitriyse
Copy link
Owner Author

@dmitriyse dmitriyse commented on 38adb2e Feb 6, 2017

Choose a reason for hiding this comment

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

Hi!
Current (based on project.json) dotnet build system works bad with build configurations.

  1. If you build multiple projects, You cannot specify build configuration for each one. (At least I did not managed to do so.)
    This problem will solved in csproj 2017.

Most robust way is to avoid build configurations and prepare project.json configuration each time before build.
e.g. Calculate build constaints in setup.py and put into "buildOptions"->"define" section of related project.json files.

P.S. I started my branch befor your great efforts and made big mistake. My branch is too incompatible with current master.
Once i will have two days in my commercial project schedule, I will re implement my changes. So our efforts will be compatible. Good way is to have three branches:

  1. Master MSBuild/XBUild
  2. MSBuild/XBuild with Separation (Python.Runtime + Python.Runtime)
  3. CoreCLR with Separation (Python.Runtime + Python.Runtime)
    -- In the future ---
  4. CoreCLR/ MSBuild 2017 with Separation (Python.Runtime + Python.Runtime)

P.P.S (I have separate branch with Proof Of Concept that works well on Linux)) but this code not present in this fork, i also plan to debug my branches under linux. (Two funcs requred manual encoding conversion and passing through unmanaged memory).

@vmuriart
Copy link

Choose a reason for hiding this comment

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

@dmitriyse thanks for the reply! Yeah we had bad timing by a few days 😞.

The three branches (two pulls requests) would be ideal.

  • Coreclr migration
  • Python.Runtime/Python.Runtime.Interops separation

And then merge them back into master once all the kinks are out of the way.

CoreClr

To deal with the Coreclr build config issues, we would probably end up using 2 solution files and each project would have two csproj files. Hangfire uses this setup and seems to work. From your work, this seems pretty straight forward. Setting up the CI will probably be the most time consuming portion. I think the coreclr team is also adding the all reflection API back.

Python.Runtime separation

I'm currently actively working on this one. I've been cherry picking some of your commits into master to prepare it for this. I create a non-working branch that isolated all the changes you did but is based on the current master branch. Now I'm using that branch to create a working version of it. I just got the native interface to work, so haven't started on the harder portion yet.

Altogether awesome work/pathfinding! I am making sure to give you credit since you did all the hard work!

Ps. On the Linux issue, when I was working on isolating the commits, I noticed a couple typos in the code that maybe the reason you are seeing the issues on Linux (the pull request I closed earlier had one of them for example). I think there were 3 or 4 total in which the fork you were working from used #IF !(...) but you impletemented them as if (...) without the negation. I know that one of them was on the UCS4 section of the converter.cs class.

Please sign in to comment.