Skip to content

Commit 025d5cc

Browse files
committed
[Nuget] First try to create Nuget packages for Net46
1 parent ea47df1 commit 025d5cc

16 files changed

+373
-0
lines changed

src/Runtime/Nuget/Readme.Core.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# XSharp Core Package
2+
3+
This package contains the needed DLLs used to build a XSharp application with Core Dialect.
4+
5+
- XSharp.Core.dll

src/Runtime/Nuget/Readme.RT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# XSharp VO Package
2+
3+
This package contains the needed basic DLLs in order to use the XSharp Runtime.
4+
5+
-XSharp.MacroCompiler.dll
6+
-XSharp.RDD.dll
7+
-XSharp.RT.dll
8+
-XSharp.Data.dll
9+
-XSharp.RT.Debugger.dll

src/Runtime/Nuget/Readme.VFP.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# XSharp VFP Package
2+
3+
This package contains the needed DLLs used to build a "basic" VFP-Compatible XSharp application.
4+
5+
- XSharp.VFP.dll
6+
- XSharp.VFP.UI.dll
7+

src/Runtime/Nuget/Readme.VO.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# XSharp VO Package
2+
3+
This package contains the needed DLLs used to build a "basic" VO-Compatible XSharp application.
4+
5+
- XSharp.VO.dll

src/Runtime/Nuget/Readme.VOSDK.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# XSharp VO-SDK Package
2+
3+
This package contains the needed DLLs used to build a VO-Compatible XSharp application.
4+
5+
- VOConsoleClasses.dll
6+
- VORDDClasses.dll
7+
- VOSQLClasses.dll
8+
- VOGUIClasses.dll
9+
- CAPAINT.DLL
10+
- VOReportClasses.dll
11+
- VOSystemClasses.dll
12+
- VOWin32APILibrary.dll
13+
- CATO3CNT.DLL
14+
- CATO3DAT.DLL
15+
- CATO3MSK.DLL
16+
- CATO3NBR.DLL
17+
- CATO3SBR.DLL
18+
- CATO3TBR.DLL
19+
- CATO3TIM.DLL
20+
- CATO3SPL.DLL
21+
- MSVCRT.DLL

src/Runtime/Nuget/Readme.XPP.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# XSharp XPP Package
2+
3+
This package contains the needed DLLs used to build a "basic" XBase++-Compatible XSharp application.
4+
5+
- XSharp.XPP.dll

src/Runtime/Nuget/XSPackNuget.prgx

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
USING System
2+
USING System.Collections.Generic
3+
USING System.Linq
4+
USING System.Text
5+
USING System.Diagnostics
6+
7+
VAR Tool := ""
8+
IF Args:Count >= 1
9+
Tool := Args[0]
10+
ENDIF
11+
12+
VAR Root := "..\Dev"
13+
14+
VAR VersionFile := Root + "\src\Common\BuildNumber.h"
15+
16+
VAR SourceFolder := Root + "\Artifacts\Release"
17+
VAR Version := GetBuildNumber( VersionFile )
18+
19+
IF Args:Count >= 2
20+
SourceFolder := Args[1]
21+
ENDIF
22+
IF Args:Count >= 3
23+
Version := Args[2]
24+
ENDIF
25+
26+
IF String.IsNullOrEmpty( Tool )
27+
Console.WriteLine( "Usage : XSPackNuget <Tool> [<SourceFolder> [<Version>] ]" )
28+
Console.WriteLine( "<Tool> should be Core, RT, VOSDK, VO, VFP, XPP")
29+
Console.WriteLine( "<SourceFolder> indicate the Path where files are stored")
30+
Console.WriteLine( "<Version> indicate the version of the package to generate")
31+
RETURN
32+
ENDIF
33+
34+
Console.WriteLine( "Running XSPackNuget ..." )
35+
Console.WriteLine( "Tool : " + Tool )
36+
Console.WriteLine( "Source Folder : " + SourceFolder )
37+
Console.WriteLine( "Version : " + Version )
38+
//
39+
var result := CheckNuGet()
40+
IF ( ! result )
41+
Console.WriteLine( "The application 'Microsoft.NuGet' is NOT installed." )
42+
Console.WriteLine( "Please run : winget install Microsoft.NuGet" )
43+
RETURN
44+
ENDIF
45+
46+
CreateNuSpec( SourceFolder, Tool, Version )
47+
48+
IF !RunNuget( Tool, Version )
49+
Console.WriteLine( "Something went wrong...." )
50+
ENDIF
51+
Console.WriteLine( "Done." )
52+
53+
FUNCTION GetBuildNumber( versionFile AS STRING ) AS String
54+
VAR version := "3.0.0"
55+
VAR number := ""
56+
VAR versionDef := "FILEVERSION_NUMBER"
57+
//
58+
VAR content := File.ReadLines( versionFile )
59+
FOREACH VAR line in content
60+
VAR pos := line:IndexOf( versionDef )
61+
IF ( pos >= 0 )
62+
number := line:SubString( pos + versionDef:Length + 1 )
63+
number := number:Replace( e"\"", "" )
64+
version := number:Trim()
65+
EXIT
66+
ENDIF
67+
NEXT
68+
// More than 3 digits and ends with .0 ?
69+
IF ( version:Count( { c => c == '.' } ) == 3 ) .AND. version:EndsWith( ".0" )
70+
version := version:SubString( 0, version:Length - 2 )
71+
ENDIF
72+
RETURN version
73+
74+
FUNCTION CheckNuGet() AS LOGIC
75+
VAR result := FALSE
76+
//
77+
var startInfo := ProcessStartInfo{}
78+
startInfo:FileName := "winget.exe"
79+
startInfo:Arguments := "list"
80+
startInfo:RedirectStandardOutput := true
81+
startInfo:UseShellExecute := false
82+
startInfo:CreateNoWindow := true
83+
84+
BEGIN USING var WinGetExe := Process.Start(startInfo)
85+
BEGIN USING VAR reader := WinGetExe:StandardOutput
86+
var execResult := reader:ReadToEnd()
87+
result := execResult:Contains( "Microsoft.NuGet" )
88+
END USING
89+
END USING
90+
RETURN result
91+
92+
PROCEDURE CreateNuSpec( sourceFolder AS STRING, tool AS String, version AS STRING )
93+
VAR source := "XSharp." + tool + ".nuspec.txt"
94+
VAR destination := "XSharp." + tool + "." + version +".nuspec"
95+
VAR content := ""
96+
//
97+
content := File.ReadAllText( source )
98+
content := content:Replace( "$SourceFolder", sourceFolder )
99+
content := content:Replace( "$Version", version )
100+
File.WriteAllText( destination, content )
101+
//
102+
RETURN
103+
104+
FUNCTION RunNuget( tool AS String, version AS STRING ) AS LOGIC
105+
VAR fileName := "XSharp." + tool + "." + version + ".nuspec"
106+
VAR nupkg := "XSharp." + tool + "." + version + ".nupkg"
107+
VAR success := false
108+
//
109+
var startInfo := ProcessStartInfo{}
110+
startInfo:FileName := "nuget.exe"
111+
startInfo:Arguments := "pack " + fileName
112+
startInfo:RedirectStandardOutput := true
113+
startInfo:UseShellExecute := false
114+
startInfo:CreateNoWindow := true
115+
116+
BEGIN USING var WinGetExe := Process.Start(startInfo)
117+
BEGIN USING VAR reader := WinGetExe:StandardOutput
118+
var execResult := reader:ReadToEnd()
119+
success := execResult:Contains( nupkg )
120+
IF !success
121+
Console.WriteLine( execResult )
122+
ENDIF
123+
END USING
124+
END USING
125+
RETURN success
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
3+
<metadata>
4+
<id>XSharp.Core</id>
5+
<version>$Version</version>
6+
<title>XSharp Core</title>
7+
<authors>XSharp B.V.</authors>
8+
<owners>XSharp B.V.</owners>
9+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
10+
<licenseUrl>https://github.com/X-Sharp/XSharpPublic/src/License.txt</licenseUrl>
11+
<icon>icon\Xsharp.png</icon>
12+
<readme>Readme.md</readme>
13+
<description>XSharp Core</description>
14+
<copyright>Copyright (C) 2015 and beyond by XSharp B.V.</copyright>
15+
<tags>XSharp, Core</tags>
16+
<repository type="git" url="https://github.com/X-Sharp/XSharpPublic.git" />
17+
<dependencies>
18+
<group targetFramework=".NETFramework4.6">
19+
</group>
20+
</dependencies>
21+
</metadata>
22+
<files>
23+
<file src="icon\Xsharp.png" target="icon\Xsharp.png" />
24+
<file src="Readme.Core.md" target="Readme.md" />
25+
<file src="$SourceFolder\XSharp.Core.dll" target="lib\net46\XSharp.Core.dll" />
26+
</files>
27+
</package>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3+
<metadata>
4+
<id>XSharp.RT</id>
5+
<version>$Version</version>
6+
<title>XSharp Runtime</title>
7+
<authors>XSharp B.V.</authors>
8+
<owners>XSharp B.V.</owners>
9+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
10+
<licenseUrl>https://github.com/X-Sharp/XSharpPublic/src/License.txt</licenseUrl>
11+
<icon>icon\Xsharp.png</icon>
12+
<readme>Readme.md</readme>
13+
<description>XSharp Runtime</description>
14+
<copyright>Copyright (C) 2015 and beyond by XSharp B.V.</copyright>
15+
<tags>XSharp, Runtime</tags>
16+
<repository type="git" url="https://github.com/X-Sharp/XSharpPublic.git" />
17+
<dependencies>
18+
<group targetFramework=".NETFramework4.6">
19+
<dependency id="XSharp.Core" version="$Version" />
20+
</group>
21+
</dependencies>
22+
</metadata>
23+
<files>
24+
<file src="icon\Xsharp.png" target="icon\Xsharp.png" />
25+
<file src="Readme.RT.md" target="Readme.md" />
26+
<file src="$SourceFolder\XSharp.MacroCompiler.dll" target="lib\net46\XSharp.MacroCompiler.dll" />
27+
<file src="$SourceFolder\XSharp.RDD.dll" target="lib\net46\XSharp.RDD.dll" />
28+
<file src="$SourceFolder\XSharp.RT.dll" target="lib\net46\XSharp.RT.dll" />
29+
<file src="$SourceFolder\XSharp.Data.dll" target="lib\net46\XSharp.Data.dll" />
30+
<file src="$SourceFolder\XSharp.RT.Debugger.dll" target="lib\net46\XSharp.RT.Debugger.dll" />
31+
</files>
32+
</package>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3+
<metadata>
4+
<id>XSharp.VFP</id>
5+
<version>$Version</version>
6+
<title>XSharp Visual FoxPro Runtime</title>
7+
<authors>XSharp B.V.</authors>
8+
<owners>XSharp B.V.</owners>
9+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
10+
<licenseUrl>https://github.com/X-Sharp/XSharpPublic/src/License.txt</licenseUrl>
11+
<icon>icon\Xsharp.png</icon>
12+
<readme>Readme.md</readme>
13+
<description>XSharp Visual FoxPro Runtime</description>
14+
<copyright>Copyright (C) 2015 and beyond by XSharp B.V.</copyright>
15+
<tags>XSharp, VFP, Runtime</tags>
16+
<repository type="git" url="https://github.com/X-Sharp/XSharpPublic.git" />
17+
<dependencies>
18+
<group targetFramework=".NETFramework4.6">
19+
<dependency id="XSharp.RT" version="$Version" />
20+
</group>
21+
</dependencies>
22+
</metadata>
23+
<files>
24+
<file src="icon\Xsharp.png" target="icon\Xsharp.png" />
25+
<file src="Readme.VFP.md" target="Readme.md" />
26+
<file src="$SourceFolder\XSharp.VFP.dll" target="lib\net46\XSharp.VFP.dll" />
27+
<file src="$SourceFolder\XSharp.VFP.UI.dll" target="lib\net46\XSharp.VFP.UI.dll" />
28+
</files>
29+
</package>

0 commit comments

Comments
 (0)