Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest versioning policy #92

Merged
merged 9 commits into from
Jan 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,75 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---

This project uses other open source projects, which are used under the terms
of the following license(s).

.NET Core, .NET Reference Source

Copyright (c) Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

mcs/class (from Mono)

Copyright (c) 2010 J�r�mie "Garuma" Laval

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

mcs/class (from Mono)

Copyright (C) 2009 Novell, Inc (http://www.novell.com)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 changes: 40 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,46 @@ The following table describes the properties available for customizing the code
5. Save and close the project file
6. Right click the project in **Solution Explorer** and select **Reload Project**

## Assembly Strong Name Policy

Starting with the beta release of version 4.4.1 of the C# target, a new strong name policy is used for this target. The
new policy is designed to make it easy to write libraries referencing a specific target framework (e.g. .NET 4.0), and
then replace the **Antlr4.Runtime.dll** assembly at runtime built for a newer target framework (e.g. .NET 4.5). For
authors of intermediate library, this dramatically simplifies the process of distributing libraries targeting many
target frameworks. The following graph show the supported replacements which retain binary compatibility. Note that the
dashed line represents a currently-untested link in the graph (see
[#91](https://github.com/tunnelvisionlabs/antlr4cs/issues/91)).

![Framework Compatibility](images/FrameworkCompatibility.png)

### Pre-release Builds

To ensure the highest level of reliability for developers targeting final releases of particular versions of the ANTLR 4
Runtime, pre-release builds use a different strong name key than final builds. Library authors are encouraged to use
strong-named assemblies when referencing the final builds, especially when code is executing in an environment where
other libraries may be referencing ANTLR 4 (e.g. Visual Studio extensions).

While the strong name keys used for the build are included in the repository, users are **strongly discouraged** from
distributing builds of the ANTLR 4 Runtime using a strong name produced by **antlr4.snk**. Failure to follow this rule
will compromise the reliability of the millions of other users using applications that reference ANTLR on a daily basis.

### Example

Suppose a library writer wishes to use ANTLR 4, and produce output which supports the .NET Framework 3.0 and newer,
including the wide selection of targets offered by the Portable Class Library profile 328. In this example library,
also suppose that all referenced dependencies are present in both the .NET Framework 3.0 and Profile 328, so the same
code compiles in both cases without problems. This library writer only needs to produce and distribute two builds of the
library: a `net30` build which is built against the `net30` build of ANTLR 4, and a `portable-net40` build which is
built against the `portable-net40` build of ANTLR 4.

Now suppose an application developer wishes to use the library described previously. This application is a desktop
application targeting .NET 4.5, and the application developer wishes to use the highest-performing available build of
ANTLR 4. By simply installing the previous library from NuGet, an additional reference will automatically be added to
the **Antlr4.Runtime** package. Without additional configuration, the application will build against the
`portable-net40` build of the library and the `net45` build of ANTLR 4. This situation is fully supported (and
recommended), because the Framework Compatibility graph above includes a chain extending from `portable-net40` to
`net45`.

## Grammars

*TODO*
Expand Down
15 changes: 12 additions & 3 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ If ($Debug) {
$BuildConfig = 'Release'
}

If ($AntlrVersion.Contains('-')) {
$KeyConfiguration = 'Dev'
} Else {
$KeyConfiguration = 'Final'
}

If ($NoClean) {
$Target = 'build'
} Else {
Expand All @@ -52,10 +58,13 @@ If (-not $Java6Home -and (Test-Path $Java6RegKey)) {
$CSharpToolVersionNodeInfo = Select-Xml "/mvn:project/mvn:version" -Namespace @{mvn='http://maven.apache.org/POM/4.0.0'} $pom
$CSharpToolVersion = $CSharpToolVersionNodeInfo.Node.InnerText.trim()

$nuget = '..\runtime\CSharp\.nuget\NuGet.exe'

# build the main project
$msbuild = "$env:windir\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe"

&$msbuild '/nologo' '/m' '/nr:false' "/t:$Target" "/p:Configuration=$BuildConfig" "/p:VisualStudioVersion=$VisualStudioVersion" $SolutionPath
&$nuget 'restore' $SolutionPath
&$msbuild '/nologo' '/m' '/nr:false' "/t:$Target" "/p:Configuration=$BuildConfig" "/p:VisualStudioVersion=$VisualStudioVersion" "/p:KeyConfiguration=$KeyConfiguration" $SolutionPath
if ($LASTEXITCODE -ne 0) {
$host.ui.WriteErrorLine('Build failed, aborting!')
exit $p.ExitCode
Expand All @@ -64,7 +73,8 @@ if ($LASTEXITCODE -ne 0) {
# build the compact framework project
$msbuild = "$env:windir\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"

&$msbuild '/nologo' '/m' '/nr:false' '/t:rebuild' "/p:Configuration=$BuildConfig" $CF35SolutionPath
&$nuget 'restore' $CF35SolutionPath
&$msbuild '/nologo' '/m' '/nr:false' '/t:rebuild' "/p:Configuration=$BuildConfig" "/p:KeyConfiguration=$KeyConfiguration" $CF35SolutionPath
if ($LASTEXITCODE -ne 0) {
$host.ui.WriteErrorLine('.NET 3.5 Compact Framework Build failed, aborting!')
exit $p.ExitCode
Expand Down Expand Up @@ -128,7 +138,6 @@ $packages = @(
'Antlr4'
'Antlr4.VS2008')

$nuget = '..\runtime\CSharp\.nuget\NuGet.exe'
ForEach ($package in $packages) {
If (-not (Test-Path ".\$package.nuspec")) {
$host.ui.WriteErrorLine("Couldn't locate NuGet package specification: $package")
Expand Down
41 changes: 31 additions & 10 deletions build/keys.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
# Note: these values may only change during minor release
$Keys = @{
'net20' = '7983ae52036899ac'
'net30' = '7671200403f6656a'
'net35-cf' = '770a97458f51159e'
'net35-client' = '4307381ae04f9aa7'
'net40-client' = 'bb1075973a9370c4'
'net45' = 'edc21c04cf562012'
'netcore45' = 'e4e9019902d0b6e2'
'portable-net40' = '90bf14da8e1462b4'
'portable-net45' = '3d23c8e77559f391'

If ($AntlrVersion.Contains('-')) {

# Use the development keys
$Keys = @{
'net20' = 'e9931a4108ef2354'
'net30' = 'e9931a4108ef2354'
'net35-cf' = 'e9931a4108ef2354'
'net35-client' = 'e9931a4108ef2354'
'net40-client' = 'e9931a4108ef2354'
'net45' = 'e9931a4108ef2354'
'netcore45' = 'e9931a4108ef2354'
'portable-net40' = 'e9931a4108ef2354'
'portable-net45' = 'e9931a4108ef2354'
}

} Else {

# Use the final release keys
$Keys = @{
'net20' = '09abb75b9ed49849'
'net30' = '09abb75b9ed49849'
'net35-cf' = '09abb75b9ed49849'
'net35-client' = '09abb75b9ed49849'
'net40-client' = '09abb75b9ed49849'
'net45' = '09abb75b9ed49849'
'netcore45' = '09abb75b9ed49849'
'portable-net40' = '09abb75b9ed49849'
'portable-net45' = '09abb75b9ed49849'
}

}

function Resolve-FullPath() {
Expand Down
Binary file added build/keys/Antlr4.dev.snk
Binary file not shown.
Binary file added build/keys/Antlr4.snk
Binary file not shown.
File renamed without changes.
Binary file added images/FrameworkCompatibility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 0 additions & 101 deletions runtime/CSharp/.nuget/NuGet.VS2008.targets

This file was deleted.

Loading