Skip to content

Commit

Permalink
Merge pull request #377 from realm/ad/doc/nuget/#284
Browse files Browse the repository at this point in the history
NuGet mods for 0.71.0 including attempt to include Android
  • Loading branch information
AndyDentFree committed Jan 25, 2016
2 parents df24480 + de6354a commit a7e72fe
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 157 deletions.
17 changes: 13 additions & 4 deletions NuGet/NuGet.Library/Realm.nuspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.8">
<id>RealmBeta</id>
<version>0.70.0</version>
<id>Realm</id>
<version>$version$</version>
<title>Realm</title>
<authors>Realm</authors>
<owners>Realm</owners>
<developmentDependency>true</developmentDependency>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<projectUrl>http://github.com/realm/realm-dotnet</projectUrl>
<iconUrl>http://realm.io/img/favicon-32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Realm for Xamarin (private beta)</description>
<summary />
<language>en-US</language>
<tags>Realm</tags>
<dependencies>
<dependency id="RealmWeaverBeta.Fody" version="0.70.0"/>
<dependency id="RealmWeaver.Fody" version="0.71.0"/>
</dependencies>
</metadata>
<files>
<file src="../../Realm.XamarinIOS/bin/iPhone/Release/Realm.dll" target="lib/Xamarin.iOS10" />
<!-- IOS files -->
<file src="../../Realm.XamarinIOS/bin/iPhoneSimulator/Release/RealmSimulator.dll" target="lib\Xamarin.iOS10" />
<file src="../../Realm.XamarinIOS/bin/iPhone/Release/Realm.dll" target="lib\Xamarin.iOS10" />
<!-- Android files -->
<file src="Realm.targets" target="build\MonoAndroid44" />
<file src="../../Realm.XamarinAndroid/bin/Release/Realm.dll" target="lib\MonoAndroid44" />
<file src="../../wrappers/build/Release-android/armeabi/libwrappers.so" target="lib\MonoAndroid44\armeabi" />
<file src="../../wrappers/build/Release-android/armeabi-v7a/libwrappers.so" target="lib\MonoAndroid44\armeabi-v7a" />
<file src="../../wrappers/build/Release-android/x86/libwrappers.so" target="lib\MonoAndroid44\x86" />
</files>
</package>
14 changes: 14 additions & 0 deletions NuGet/NuGet.Library/Realm.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<AndroidNativeLibrary Include="../packages/Realm.0.71.0/lib/MonoAndroid44/armeabi/libwrappers.so">
<Link>../packages/Realm.0.71.0/lib/MonoAndroid44/armeabi/libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="../packages/Realm.0.71.0/lib/MonoAndroid44/armeabi-v7a/libwrappers.so">
<Link>../packages/Realm.0.71.0/lib/MonoAndroid44/armeabi-v7a/libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="../packages/Realm.0.71.0/lib/MonoAndroid44/x86/libwrappers.so">
<Link>../packages/Realm.0.71.0/lib/MonoAndroid44/x86/libwrappers.so</Link>
</AndroidNativeLibrary>
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion NuGet/NuGet.Weaver/Fody_ToBeDeleted.txt

This file was deleted.

8 changes: 2 additions & 6 deletions NuGet/NuGet.Weaver/Nuget.Weaver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
<Optimize>false</Optimize>
</PropertyGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml" />
<Content Include="readme.txt" />
<None Include="RealmWeaver.Fody.nuspec">
<SubType>Designer</SubType>
</None>
<None Include="install.ps1" />
<None Include="packages.config" />
<None Include="uninstall.ps1" />
<Content Include="Fody_ToBeDeleted.txt" />
</ItemGroup>
<Target Name="Clean">
<RemoveDir Directories="$(SolutionDir)NuGetBuild" />
Expand All @@ -38,9 +36,7 @@
<MakeDir Directories="$(SolutionDir)NuGetBuild" />
<Copy SourceFiles="$(SolutionDir)NuGet\NuGet.Weaver\RealmWeaver.Fody.nuspec" DestinationFolder="$(SolutionDir)NuGetBuild" />
<Copy SourceFiles="$(SolutionDir)RealmWeaver\bin\$(ConfigurationName)\RealmWeaver.Fody.dll" DestinationFolder="$(SolutionDir)NuGetBuild" />
<Copy SourceFiles="$(SolutionDir)NuGet\NuGet.Weaver\Fody_ToBeDeleted.txt" DestinationFolder="$(SolutionDir)NuGetBuild\Content" />
<Copy SourceFiles="$(ProjectDir)install.ps1" DestinationFolder="$(SolutionDir)NuGetBuild\Tools" />
<Copy SourceFiles="$(ProjectDir)uninstall.ps1" DestinationFolder="$(SolutionDir)NuGetBuild\Tools" />
<Copy SourceFiles="$(ProjectDir)FodyWeavers.xml" DestinationFolder="$(SolutionDir)NuGetBuild\Content" />
<PepitaPackage.CreatePackageTask NuGetBuildDirectory="$(SolutionDir)NuGetBuild" MetadataAssembly="$(SolutionDir)RealmWeaver\bin\$(ConfigurationName)\RealmWeaver.Fody.dll" />
</Target>
<Import Project="..\..\packages\PepitaPackage.1.20.0.0\build\PepitaPackage.targets" Condition="Exists('..\..\packages\PepitaPackage.1.20.0.0\build\PepitaPackage.targets')" />
Expand Down
12 changes: 8 additions & 4 deletions NuGet/NuGet.Weaver/RealmWeaver.Fody.nuspec
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.8">
<id>RealmWeaverBeta.Fody</id>
<version>0.70.0</version>
<id>RealmWeaver.Fody</id>
<version>0.71.0</version>
<title>RealmWeaver.Fody</title>
<authors>Realm</authors>
<owners>Realm</owners>
<developmentDependency>true</developmentDependency>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<projectUrl>http://github.com/realm/realm-dotnet</projectUrl>
<iconUrl>http://realm.io/img/favicon-32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Realm for Xamarin: make descendants of RealmObject automaticallyu persistent (private beta)</description>
<description>Realm for Xamarin: make descendants of RealmObject automatically persistent (private beta)</description>
<summary />
<language>en-US</language>
<tags>Realm</tags>
<dependencies>
<dependency id="Fody" version="1.29.3"/>
<dependency id="Fody" version="1.29.4"/>
</dependencies>
</metadata>
<files>
<file src="../..RealmWeaver/bin/Release/RealmWeaver.Fody.dll" target=""/>
</files>
</package>
94 changes: 0 additions & 94 deletions NuGet/NuGet.Weaver/install.ps1

This file was deleted.

47 changes: 0 additions & 47 deletions NuGet/NuGet.Weaver/uninstall.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion Realm.XamarinAndroid/Realm.XamarinAndroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.4</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
89 changes: 89 additions & 0 deletions internals/RealmDotnetNugetBuild.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
Realm for Xamarin Nuget Build
==============================

These are steps for our internal manual process to build.

The process has not been automated yet as the tools need running on both OS X and Windows to complete the build.

We currently produce two NuGet packages. You will usually build them and test using them from a local folder such as `~/LocalRealm`. We will refer to this as the **local test folder**.

Paths below assume you're starting in the root dir `realm-dotnet` checked out from GitHub.

Building the DLLS
-----------------

* go into the Wrappers dir in terminal
* `make clean`
* `make all`
* In Xamarin Studio, open`Realm.sln`
* select Release ARM
* select Realm.XamarinAndroid project and Rebuild
* select Release iPhoneSimulator
* select Realm.XamarinIOS project and Rebuild
* rename `/Users/andydent/dev/Realm/realm-dotnet/Realm.XamarinIOS/bin/iPhoneSimulator/Release/Realm.dll` to `RealmSimulator.dll` so you have a uniquely named DLL for the simulator
* select Release iPhone with a device attached
* select Realm.XamarinIOS project and Rebuild



Once you have your DLLS,


Setting Version Numbers
-----------------------
Edit `NuGet/NuGet.Library/Realm.targets` and update version numbers in the paths.

If the Fody Weaver version number is also changing, edit it in `NuGet/NuGet.Weaver/RealmWeaver.Fody.nuspec`


Building Fody NuGet
-------------------
You **have** to build this using Visual Studio. Open the normal Realm solution and force a rebuild of the `Nuget.Weaver` project. The `NuGetBuild` folder is created by this build.

Copy the `RealmWeaver.Fody.0.71.0.nupkg` generated in `NuGetBuild` to your **local test folder**.

Building Realm NuGet
--------------------
This step is performed from a Windows commandline using the NuGet tool.

You can have a full realm-dotnet tree over on a Windows machine, and copy over the built binaries from an OS X machine. (see below)

Easier is to run in a VM or have the realm-dotnet folder mounted as a shared folder, eg:
`Z:\andydent_Mac\dev\Realm\realm-dotnet` accessible from your Windows environment.

In either case, change to the `NuGet/NuGet.Library` directory containing `Realm.nuspec` and run the command:

`c:\tools\nuget pack -version 0.71.0 -NoDefaultExcludes Realm.nuspec`

The above assumes that the NuGet.exe tool was unpacked into `C:\tools` and you are building version `0.71.0`. The build scripts make no assumptions about the location of NuGet, just using relative paths from the location of the nuspec file.

Done correctly, this creates a package `/Users/andydent/dev/Realm/realm-dotnet/NuGet/NuGet.Library/Realm.0.71.0.nupkg` which you should copy to your **local test folder**.


### Binaries on OS X
If you are copying binaries from an OS X machine to a separate Windows tree, you will need to get:

* `Realm.XamarinAndroid/bin/Release`
* `Realm.XamarinIOS/bin/iPhone/Release`
* `Realm.XamarinIOS/bin/iPhoneSimulator/Release`
* `wrappers/build/Release-*` multiple directories
Testing the packages
--------------------
Set your Xamarin or Visual Studio to use your **local test folder** as a NuGet source.

Create new projects and use the NuGet Package manager to _add_ just the `Realm.0.71.0.nupkg`. It should automatically also add the Fody weaver and Fody in its turn. They will in ask you to overwrite `FodyWeavers.xml` which you normally allow.

You should then be able to build and run code using Realm.

Once you are happy with this, compress your **local test folder** and upload as a Git new release or to NuGet (instructions to be added when we go public).

Useful Stuff
-------------
Some aspects of NuGet builds suffer from the combination of being both **by convention** and **optional** which means you have very little chance of being told **if** or **what** you are doing wrong.


[Xamarin Advanced NuGet](https://developer.xamarin.com/guides/cross-platform/advanced/nuget/) is a key page because it describes the platform tags specific to Xamarin.

We need to use other tags for non-Xamarin .NET use.

[NuGet Targets and Props](https://docs.nuget.org/release-notes/nuget-2.5#automatic-import-of-msbuild-targets-and-props-files) explains the build folder has to be at the top and can then have framework-specific folders. It covers the conventions in detail.

0 comments on commit a7e72fe

Please sign in to comment.