Nuget packages! #59

Merged
merged 6 commits into from Aug 18, 2016

Conversation

Projects
None yet
3 participants
Contributor

diddledan commented Dec 3, 2015

Reference #37
This PR has many changes which are all aimed at nuget packages. I am able to successfully build locally and create .nupkg files which I am then able to install into a new ASP.NET application in Visual Studio. The resultant project is then able to successfully run PHP code. All that is required once the nupkg files are created is to point nuget at the files and install the core, core.parsers, core.codedom and classlibrary packages. Everything else is optional. Ideally we'll be able to create a metapackage which can pull-in the essentials in-one-go, but that's for the future.

Contributor

diddledan commented Dec 3, 2015

oh, hang-on, I appear to have missed-off the web.config automatic updating.

Contributor

diddledan commented Dec 3, 2015

that's better.

Contributor

diddledan commented Dec 6, 2015

the changes between my previous comment and this are a rebased version of the original commits above.

Source/ClassLibrary/ClassLibrary.csproj
+ <OutputPath>bin\ReleaseGAC\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <BaseAddress>4194304</BaseAddress>
+ <DocumentationFile>C:\Users\yabea\Documents\GitHubVisualStudio\Phalanger\Source\Build\..\..\Deployment\Release\PhpNetClassLibrary.xml</DocumentationFile>
@weirdan

weirdan Jan 6, 2016

Contributor

Wouldn't this cause build to fail for everyone not named 'yabea', let alone builds on other operating systems (e.g. Linux/mono)?

+ </PropertyGroup>
+ <Error Condition="!Exists('..\..\..\Solutions\packages\System.Data.SQLite.Core.1.0.98.1\build\net40\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Solutions\packages\System.Data.SQLite.Core.1.0.98.1\build\net40\System.Data.SQLite.Core.targets'))" />
+ </Target>
+<<<<<<< HEAD
@weirdan

weirdan Jan 6, 2016

Contributor

Here you have unresolved conflict (XML parser will likely choke on it).

Contributor

diddledan commented Jan 6, 2016

both the issues highlighted by @weirdan are now fixed.

Contributor

weirdan commented Jan 8, 2016

Could you also fix this?:

CSC: error CS1904: `CS0618' is not a valid warning number

It's in Source/Extensions/GetText/Extensions.GetText.csproj file.

Contributor

weirdan commented Jan 8, 2016

Also, is it possible to nuget pack with .nuspec files instead of .csproj? Nuget-mono doesn't seem to support packing with project files: http://stackoverflow.com/a/34394716/450611

Another improvement I would suggest is automatic package restore for non-VS environments. It's rather easy, just add another target and make BeforeBuild and BeforeRebuild depend on it

  <Target Name="RestorePackages">
         <Exec Command="&quot;nuget&quot; restore &quot;$(MSBuildThisFileDirectory)..\..\Solutions\Phalanger.sln&quot;"/>
   </Target>
Contributor

diddledan commented Jan 8, 2016

with regards to building nuget packages under mono, this is known to fail for various reasons, including the one you cite, but also e.g. nuget/home#913

Contributor

diddledan commented Jan 18, 2016

I've uploaded example builds of nuget packaging at http://go.bwlh.at/phalangernuget

@diddledan diddledan referenced this pull request in DEVSENSE/PhalangerMySql Feb 26, 2016

Open

nugetify extensions #3

diddledan added some commits Mar 19, 2015

Nugetify Core and Extensions
Update .gitignore for nuget-related exclusions
nugitfy Core
nugetify Core.CodeDom
nugetify Core.DuckTyping
nugetify Core.Parsers
nugetify ClassLibrary
nugetify Extensions/Curl
nugetify Extensions/Gd2
nugetify Extensions/GetText
nugetify Extensions/iconv
nugetify Extensions/mbstring
nugetify Extensions/MsSql
nugetify Extensions/PDO
nugetify Extensions/PDOSQLite
nugetify Extensions/PDOSQLServer
nugetify Extensions/Soap
nugetify Extensions/SQLite
- replace custom bundled binaries of System.Data.SQLite with nuget-fetched from upstream
nugetify Extensions/Xml
nugetify Extensions/XmlDom
- Replace HtmlAgilityPack sourcecode with precompiled version installed via nuget
nugetify Extensions/Zip
- replace bundled SharpZipLib code with precompiled version from nuget
nugetify Extensions/Zlib
- Replace bundled Zlib.net code with precompiled version from nuget
nugetify Phalanger.CompilerTask
nugetify phpc
update Phalanger.sln solution file for nugetted projects
fix common.build.targets and XmlDom project file for non-windows
- common.build.targets:
  - add target to restore nuget packages
  - only run updateversionfromchangeset batch script on windows
  - Extra ) char causing additional output folders to be created
  - include UpdateFileVersionFromChangeset.sh for unix-like systems
  - change batch script UpdateFileVersionFromChangeset.cmd to only run on Windows NT systems

- XmlDom Project file
  - added windows-os check to prebuild target with windows-specifics
  - separated ClassDynamizer.exe to separate unrestricted prebuild target
  - fix capitalization of System.Configuration assembly reference
add/update web.config transforms
add and fix web.config.install.xdt xml transform file for the consumer
project's web.config to add the correct configuration automatically

@jakubmisek jakubmisek self-assigned this Jul 27, 2016

Owner

jakubmisek commented Jul 27, 2016

Thats great! One question - how is the versioning handled?

Contributor

diddledan commented Jul 27, 2016

at the moment it's done manually via editing the nuspec. We could possibly introduce a change to, or script in addition to, the file Tools/UpdateFileVersionFromChangeset.cmd (and .sh equivalent)

Owner

jakubmisek commented Jul 27, 2016

Versioning is pretty important here, at least it must be in sync with https://github.com/DEVSENSE/Phalanger/blob/master/Source/Build/AssemblyInfoCommon.cs#L20 and the minor version below ... is it possible to make it somehow ? so the nuget package would have the same version

diddledan added some commits Jul 29, 2016

utilise assembly details in nuspec
modify all the nuspec files to use automatic insertion variables to populate details from each assembly's metadata
remove explicit dependencies in nuspec files
nuget.exe supports dynamically adding the correct dependency and version numbers based on .csproj project-references.
This change removes all the first-party dependencies from the nuspec files leaving just external references.
cleanup and unify build tasks
centralize and unify all the individual projects' build tasks and settings into common.build.{targets,settings}
Contributor

diddledan commented Jul 29, 2016

The commit 6974287 tells nuget to use the details in each project's metadata after they're compiled rather than being manually altered. This means that version numbers should be synchronised now as requested.

920e736 fixes nuget's building of packages complaining that version numbers were unspecified for projects depending on other projects in the solution (referring to ourselves).

2a16875 can be split-out to a separate merge if needed and is a simplification and unification of all the msbuild settings and tasks set in each .csproj file moving them all into the common build tasks and settings files where possible.

Contributor

diddledan commented Jul 29, 2016

about version numbering. nuget uses SEMVER numbers which are different to the original .net method (three numbers instead of four). There's a discussion piece about the implications of nuget/semver with .net libraries.

@jakubmisek jakubmisek merged commit 9ea13a0 into DEVSENSE:master Aug 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment