Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Documentation and Example project
Browse files Browse the repository at this point in the history
  • Loading branch information
devboy committed Jan 19, 2015
1 parent 4e19073 commit edf7381
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 63 deletions.
6 changes: 5 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#### 0.0.7 - January 19 2015
* More documentation and guides
* Example project

#### 0.0.6 - January 14 2015
* Updates for Paket.Core 0.22.9
* Does not modify paths of "Plugins" directories
* Removed DLL embedding (postponed until Unity5 where you can link DLLs per platform)
* Removed DLL embedding (postponed until Unity5 where you can link DLLs per platform)

#### 0.0.5 - November 12 2014
* Cleans `Paket.Unity3D` directories in Unity3D projects when updating dependencies
Expand Down
74 changes: 50 additions & 24 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,32 @@ Target "MergeExe" (fun _ ->
// --------------------------------------------------------------------------------------
// Build a NuGet package

Target "NuGet" (fun _ ->
let nugetParams = {
NuGetHelper.NuGetDefaults() with
let publishNugetParam =
#if MONO
false
#else
hasBuildParam "nugetkey"
#endif

let publishNuget nugetParams =
NuGet (fun p -> nugetParams) ("nuget/" + nugetParams.Project + ".nuspec")
#if MONO
if hasBuildParam "nugetkey" then
let source =
if isNullOrEmpty nugetParams.PublishUrl then ""
else sprintf "-s %s" nugetParams.PublishUrl
let args = sprintf "push \"%s\" %s %s" (nugetParams.OutputPath @@ sprintf "%s.%s.nupkg" nugetParams.Project nugetParams.Version) nugetParams.AccessKey source
let result =
ExecProcess (fun info ->
info.FileName <- nugetParams.ToolPath
info.WorkingDirectory <- FullName nugetParams.WorkingDir
info.Arguments <- args) nugetParams.TimeOut
if result <> 0 then failwithf "Error during NuGet push. %s %s" nugetParams.ToolPath args
#endif


Target "NuGet->Tool" (fun _ ->
{ NuGetHelper.NuGetDefaults() with
Authors = authors
Project = project
Summary = summary
Expand All @@ -185,31 +208,30 @@ Target "NuGet" (fun _ ->
Tags = tags
OutputPath = "bin"
AccessKey = getBuildParamOrDefault "nugetkey" ""
#if MONO
Publish = false
#else
Publish = hasBuildParam "nugetkey"
#endif
Publish = publishNugetParam
Dependencies = [] }
|> publishNuget
)

NuGet (fun p -> nugetParams) ("nuget/" + project + ".nuspec")

#if MONO
if hasBuildParam "nugetkey" then
let source =
if isNullOrEmpty nugetParams.PublishUrl then ""
else sprintf "-s %s" nugetParams.PublishUrl
let args = sprintf "push \"%s\" %s %s" (nugetParams.OutputPath @@ sprintf "%s.%s.nupkg" nugetParams.Project nugetParams.Version) nugetParams.AccessKey source
let result =
ExecProcess (fun info ->
info.FileName <- nugetParams.ToolPath
info.WorkingDirectory <- FullName nugetParams.WorkingDir
info.Arguments <- args) nugetParams.TimeOut
//enableProcessTracing <- tracing
if result <> 0 then failwithf "Error during NuGet push. %s %s" nugetParams.ToolPath args
#endif
Target "NuGet->Example" (fun _ ->
{ NuGetHelper.NuGetDefaults() with
Authors = authors
Project = project + ".Example.Source"
Summary = "Example project demonstrating Paket.Unity3D"
Description = "Example project demonstrating Paket.Unity3D"
Version = release.NugetVersion
ReleaseNotes = String.Join(Environment.NewLine, release.Notes)
WorkingDir = "."
Tags = tags
OutputPath = "bin"
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = publishNugetParam
Dependencies = [] }
|> publishNuget
)

Target "NuGet" DoNothing

// --------------------------------------------------------------------------------------
// Generate the documentation

Expand Down Expand Up @@ -318,6 +340,10 @@ Target "All" DoNothing
==> "NuGet"
==> "BuildPackage"

"NuGet->Tool"
==> "NuGet->Example"
==> "NuGet"

"CleanDocs"
==> "GenerateHelp"
==> "GenerateReferenceDocs"
Expand Down
4 changes: 4 additions & 0 deletions docs/content/dll-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DLL dependencies

DLL dependencies are not supported at the moment.
> Waiting for the release of Unity3D 5 where you can specify target platforms per DLL.
35 changes: 20 additions & 15 deletions docs/content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

An extension for the [Paket][paket] dependency manager that enables the integration of NuGet dependencies into [Unity3D][unity] projects.

[paket]: http://fsprojects.github.io/Paket/
[unity]: https://www.unity3d.com/
[paket]: http://fsprojects.github.io/Paket/
[unity]: https://www.unity3d.com/

## How to get Paket.Unity3D

Expand All @@ -14,18 +14,21 @@ Paket.Unity3D is available as:

[![NuGet Status](http://img.shields.io/nuget/v/Paket.Unity3D.svg?style=flat)](https://www.nuget.org/packages/Paket.Unity3D/)

## Getting Started
## Prerequisites

### Windows

Please have a look at the documentation of [Paket][paket] on how to setup and declare project dependencies.
You’ll need [.NET Framework 4.0](http://www.microsoft.com/en-us/download/details.aspx?id=17851)

Place the `paket.unity3d.exe` next to your `paket.exe`
### *Nix

You can place `paket.unity3d.references` alongside your Unity3D `Assets` directory to have Paket.Unity3D automatically sync files for the packages noted in that file whenever `paket.unity3d.exe` is executed.
You’ll need [Mono MRE 3.10](http://www.mono-project.com/download/)

## Getting Started

Check out the [Tutorial][tutorial] to get started
Check out the [Guide][tutorial] to get started

Contributing and copyright
--------------------------
## Contributing and copyright

The project is hosted on [GitHub][gh] where you can [report issues][issues], fork the project and submit pull requests.

Expand All @@ -34,9 +37,11 @@ Please see the [Quick contributing guide in the README][readme] for contribution
The library is available under MIT license, which allows modification and redistribution for both commercial and non-commercial purposes.
For more information see the [License file][license].

[content]: https://github.com/devboy/Paket.Unity3D/tree/master/docs/content
[gh]: https://github.com/devboy/Paket.Unity3D
[issues]: https://github.com/devboy/Paket.Unity3D/issues
[readme]: https://github.com/devboy/Paket.Unity3D/blob/master/README.md
[license]: http://devboy.github.io/Paket.Unity3D/license.html
[tutorial]: http://devboy.github.io/Paket.Unity3D/tutorial.html
[content]: https://github.com/devboy/Paket.Unity3D/tree/master/docs/content
[gh]: https://github.com/devboy/Paket.Unity3D
[issues]: https://github.com/devboy/Paket.Unity3D/issues
[readme]: https://github.com/devboy/Paket.Unity3D/blob/master/README.md
[license]: http://devboy.github.io/Paket.Unity3D/license.html
[tutorial]: ./tutorial.html
[paket.dependencies]: http://fsprojects.github.io/Paket/dependencies-file.html
[paket.references]: http://fsprojects.github.io/Paket/references-files.html
13 changes: 13 additions & 0 deletions docs/content/source-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Source dependencies

To distribute source-code and/or arbitrary files with Paket.Unity3D the [content files][contentfiles] feature of NuGet is used.

## File copy

Files and folders inside the `content` directory of a nuget package will be copied to `Assets/Paket.Unity3D/$PKG_NAME/`.

## Plugin directories

Paket.Unity3D respects the `Plugins` directory which means that it will be copied to `Assets/Plugins`.

[contentfiles]: http://docs.nuget.org/docs/reference/nuspec-reference#Content_Files
51 changes: 35 additions & 16 deletions docs/content/tutorial.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
# Quick start guide

Go over to [Paket][11] and install it into your project.
This guide will focus on Paket.Unity3D and you will need a `.paket` directory containing a recent version of [paket.exe][paket.exe] at the root of your project directory structure.
Please also have a look at the documentation of [Paket][paket].

## paket.dependencies

Proceed by adjusting your `paket.dependencies` file to include `Paket.Unity3D`. We use `LibNoise` as an example dependency to be installed in the Unity3D project
If no `paket.dependencies` file is present in the root of your project you can create one as follows:

source https://nuget.org/api/v2
[lang=batchfile]
[mono] .paket/paket.exe init

nuget LibNoise
nuget Paket.Unity3D
First you need to add Paket.Unity3D as a dependency. So ensure that the following `source` and `nuget` dependency are present in `paket.dependencies`:

For more info on `paket.dependencies` check the [Paket documentation][1]
source https://nuget.org/api/v2
nuget Paket.Unity3D

Proceed by installing Paket.Unity3D:

[lang=batchfile]
[mono] .paket.exe update

`paket.unity3d.exe` should now be present under `./packages/Paket.Unity3D/tools/`

For more info on `paket.dependencies` check the [Paket documentation][paket.dependencies]

## paket.unity3d.references

Then add a `paket.unity3d.references` next to the `Assets` directory of the Unity3D project which contains the `LibNoise` reference.
Then add a `paket.unity3d.references` file next to the `Assets` directory of your Unity3D project.

Declare your dependencies, for example:

In `paket.dependencies`:

LibNoise
nuget Paket.Unity3D.Example.Source

In `paket.unity3d.references`:

Paket.Unity3D.Example.Source

`paket.unity3d.references` is the same as a `paket.references` file. For more info on `paket.dependencies` check the [Paket documentation][paket.references]

## Update and install

Update your dependencies with [Paket][11]
Update your dependencies with [Paket][paket]

[lang=batchfile]
$ [mono] .paket/paket.exe update
Expand All @@ -31,11 +52,9 @@ Install the references into the Unity3D project
[lang=batchfile]
$ [mono] packages/Paket.Unity3D/tools/paket.unity3d.exe

LibNoise is now added to the Assets directory and the directory should look like this

![alt text](img/quick-start-folders.png "Directory structure")

Now LibNoise can be accessed in by other code in the Unity3D project.
Your dependencies should now be added to the Assets directory.

[1]: http://fsprojects.github.io/Paket/dependencies-file.html
[11]: http://fsprojects.github.io/Paket
[paket.dependencies]: http://fsprojects.github.io/Paket/dependencies-file.html
[paket.references]: http://fsprojects.github.io/Paket/references-files.html
[paket]: http://fsprojects.github.io/Paket/
[paket.exe]: https://github.com/fsprojects/Paket/releases/latest
3 changes: 3 additions & 0 deletions docs/content/xcode-linking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# XCode linking

Dependencies containing native iOS frameworks are currently not automatically linked when building iOS projects.
12 changes: 8 additions & 4 deletions docs/tools/templates/template.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@RenderBody()
</div>
<div class="span3">
<img src="@Root/img/logo.png" alt="F# Project" style="width:150px;margin:10px" />
<img src="@Root/img/logo.png" alt="F# Project" style="width:150px;margin:10px" />
<ul class="nav nav-list" id="menu" style="margin-top: 20px;">
<li class="nav-header">@Properties["project-name"]</li>
<li><a href="@Root/index.html">Home page</a></li>
Expand All @@ -43,9 +43,13 @@
<li><a href="@Properties["project-github"]">Source Code on GitHub</a></li>
<li><a href="@Root/license.html">License</a></li>
<li><a href="@Root/release-notes.html">Release Notes</a></li>

<li class="nav-header">Getting started</li>
<li><a href="@Root/tutorial.html">Sample tutorial</a></li>

<li class="nav-header">Documentation</li>
<li><a href="@Root/tutorial.html">Quick start guide</a></li>
<li class="divider"></li>
<li><a href="@Root/source-dependencies.html">Source dependencies</a></li>
<li><a href="@Root/dll-dependencies.html">DLL dependencies</a></li>
<li><a href="@Root/xcode-linking.html">XCode linking</a></li>

<li class="nav-header">Documentation</li>
<li><a href="@Root/reference/index.html">API Reference</a></li>
Expand Down
23 changes: 23 additions & 0 deletions nuget/Paket.Unity3D.Example.Source.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>@project@</id>
<version>@build.number@</version>
<authors>@authors@</authors>
<owners>@authors@</owners>
<licenseUrl>http://github.com/fsprojects/Paket.Unity3D/blob/master/LICENSE</licenseUrl>
<projectUrl>http://fsprojects.github.com/Paket.Unity3D</projectUrl>
<!--<iconUrl>https://raw.githubusercontent.com/fsprojects/ProjectScaffold/master/docs/files/img/logo.png</iconUrl>-->
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>@summary@</summary>
<description>@description@</description>
<releaseNotes>@releaseNotes@</releaseNotes>
<copyright>Copyright 2013</copyright>
<tags>@tags@</tags>
<dependencies />
</metadata>
<files>
<file src="src/Paket.Unity3D.Example/Sources/**/*.cs" target="content" />
<file src="src/Paket.Unity3D.Example/Plugins/**/*.h" target="content/Plugins" />
</files>
</package>
1 change: 1 addition & 0 deletions src/Paket.Unity3D.Example/Plugins/iOS/Example.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define EXAMPLE @"PAKET.UNITY3D.EXAMPLE"
16 changes: 16 additions & 0 deletions src/Paket.Unity3D.Example/Sources/Example.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using UnityEngine;

namespace Paket.Unity3D
{

public class Example
{

public static void shout()
{
Debug.Log("shout");
}

}

}
6 changes: 3 additions & 3 deletions src/Paket.Unity3D/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("Paket.Unity3D")>]
[<assembly: AssemblyProductAttribute("Paket.Unity3D")>]
[<assembly: AssemblyDescriptionAttribute("Piggy-backs ontop of Paket to add dependencies to Unity3D projects")>]
[<assembly: AssemblyVersionAttribute("0.0.6")>]
[<assembly: AssemblyFileVersionAttribute("0.0.6")>]
[<assembly: AssemblyVersionAttribute("0.0.7")>]
[<assembly: AssemblyFileVersionAttribute("0.0.7")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] Version = "0.0.6"
let [<Literal>] Version = "0.0.7"

0 comments on commit edf7381

Please sign in to comment.