Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Feature/12.0.102: Strong Name Assembly #31

Merged
merged 13 commits into from
Dec 30, 2019
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
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
SCRIPTS: /root/repo/ci/scripts
BUILD_SOLUTION: /root/repo/Src/Newtonsoft.Json/Newtonsoft.Json.csproj
BUILD_DESTINATION_BASE: /root/repo/Src/Newtonsoft.Json-for-Unity/Plugins
BUILD_ADDITIONAL_CONSTANTS: SIGNING

docker:
- image: applejag/newtonsoft.json-for-unity.package-builder:v1
Expand Down Expand Up @@ -90,7 +91,7 @@ jobs:

- run:
name: Build Testing library
command: BUILD_CONFIGURATION=Debug BUILD_DESTINATION=/workspace/testlib $SCRIPTS/build.sh Tests "$BUILD_SOLUTION"
command: BUILD_CONFIGURATION=Debug BUILD_DESTINATION=/workspace/testlib BUILD_ADDITIONAL_CONSTANTS= $SCRIPTS/build.sh Tests "$BUILD_SOLUTION"

- run:
name: Move resulting package into workspace
Expand Down
Binary file added Src/IdentityPublicKey.snk
Binary file not shown.
4 changes: 4 additions & 0 deletions Src/Newtonsoft.Json-for-Unity.Tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
*.ulf
*.alf

# Signing key added by local build script
Assets/IdentityPublicKey.snk
Assets/IdentityPublicKey.snk.meta

# Unity generated
/[Ll]ibrary/
/[Ll]ogs/
Expand Down
7 changes: 6 additions & 1 deletion Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

#if SIGNING
[assembly: AssemblyDelaySign(true)]
[assembly: AssemblyKeyFile("../IdentityPublicKey.snk")]
#endif

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
Expand All @@ -46,4 +51,4 @@

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid("0be3d72b-d2ef-409c-985c-d3ede89a25f1")]
[assembly: Guid("0be3d72b-d2ef-409c-985c-d3ede89a25f1")]
Binary file removed Src/Newtonsoft.Json/Dynamic.snk
Binary file not shown.
6 changes: 6 additions & 0 deletions Src/Newtonsoft.Json/Newtonsoft.Json.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@
<!-- Unity standalone build -->
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyTitle>Json.NET for Unity standalone (Win, OS X, Linux)</AssemblyTitle>
<DefineConstants>NET462;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_FAST_REVERSE;HAVE_FULL_REFLECTION;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>bin\$(Configuration)\unity-standalone-net462</OutputPath>
<DefineConstants>NETSTANDARD2_0;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_FAST_REVERSE;HAVE_FULL_REFLECTION;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants>
<OutputPath>bin\$(Configuration)\unity-standalone</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(UnityBuild)'=='AOT'">
<!-- Unity AOT (IL2CPP) build -->
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyTitle>Json.NET for Unity AOT (IL2CPP)</AssemblyTitle>
<DefineConstants>NET462;UNITY_LTS;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_CONCURRENT_DICTIONARY;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>bin\$(Configuration)\unity-aot-net462</OutputPath>
<DefineConstants>NETSTANDARD2_0;UNITY_LTS;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_CONCURRENT_DICTIONARY;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants>
<OutputPath>bin\$(Configuration)\unity-aot</OutputPath>
</PropertyGroup>
Expand Down
19 changes: 11 additions & 8 deletions Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using System.Runtime.InteropServices;
using System.Security;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
#if NET20
Expand All @@ -42,21 +42,24 @@
[assembly: AllowPartiallyTrustedCallers]
#endif

#if !SIGNED
#if SIGNING
[assembly: AssemblyDelaySign(true)]
[assembly: AssemblyKeyFile("../IdentityPublicKey.snk")]

[assembly: InternalsVisibleTo("Newtonsoft.Json.Schema")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests")]
#else
[assembly: InternalsVisibleTo("Newtonsoft.Json.Schema, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f561df277c6c0b497d629032b410cdcf286e537c054724f7ffa0164345f62b3e642029d7a80cc351918955328c4adc8a048823ef90b0cf38ea7db0d729caf2b633c3babe08b0310198c1081995c19029bc675193744eab9d7345b8a67258ec17d112cebdbbb2a281487dceeafb9d83aa930f32103fbe1d2911425bc5744002c7")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f561df277c6c0b497d629032b410cdcf286e537c054724f7ffa0164345f62b3e642029d7a80cc351918955328c4adc8a048823ef90b0cf38ea7db0d729caf2b633c3babe08b0310198c1081995c19029bc675193744eab9d7345b8a67258ec17d112cebdbbb2a281487dceeafb9d83aa930f32103fbe1d2911425bc5744002c7")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Dynamic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbd8d53b9d7de30f1f1278f636ec462cf9c254991291e66ebb157a885638a517887633b898ccbcf0d5c5ff7be85a6abe9e765d0ac7cd33c68dac67e7e64530e8222101109f154ab14a941c490ac155cd1d4fcba0fabb49016b4ef28593b015cab5937da31172f03f67d09edda404b88a60023f062ae71d0b2e4438b74cc11dc9")]
#else
[assembly: InternalsVisibleTo("Newtonsoft.Json.Schema")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Dynamic")]
#endif

[assembly: InternalsVisibleTo("Newtonsoft.Json.Dynamic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbd8d53b9d7de30f1f1278f636ec462cf9c254991291e66ebb157a885638a517887633b898ccbcf0d5c5ff7be85a6abe9e765d0ac7cd33c68dac67e7e64530e8222101109f154ab14a941c490ac155cd1d4fcba0fabb49016b4ef28593b015cab5937da31172f03f67d09edda404b88a60023f062ae71d0b2e4438b74cc11dc9")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

#if HAVE_COM_ATTRIBUTES
// Setting ComVisible to false makes the types in this assembly not visible
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.

Expand All @@ -67,4 +70,4 @@
[assembly: Guid("9ca358aa-317b-4925-8ada-4a29e943a363")]
#endif

[assembly: CLSCompliant(true)]
[assembly: CLSCompliant(true)]
12 changes: 10 additions & 2 deletions ci/local_build_into_package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,29 @@ param (
[string] $WorkingDirectory = "/root/repo",

[string] $RelativeBuildSolution = "Src/Newtonsoft.Json/Newtonsoft.Json.csproj",
[string] $RelativeBuildDestinationBase = "Src/Newtonsoft.Json-for-Unity/Plugins/"
[string] $RelativeBuildDestinationBase = "Src/Newtonsoft.Json-for-Unity/Plugins/",

[switch] $DontSign
)

$ErrorActionPreference = "Stop"

Write-Host ">> Starting $DockerImage" -BackgroundColor DarkRed
$watch = [System.Diagnostics.Stopwatch]::StartNew()

$AdditionalConstants = ""
if (-not $DontSign) {
$AdditionalConstants += ";SIGNING"
}

$container = docker run -dit `
-v "${VolumeSource}:/root/repo" `
-e SCRIPTS=/root/repo/ci/scripts `
-e BUILD_SOLUTION=/root/repo/$RelativeBuildSolution `
-e BUILD_DESTINATION_BASE=/root/repo/$RelativeBuildDestinationBase `
-e BUILD_CONFIGURATION=$Configuration `
-e BASH_ENV=/.bash_env `
-e BUILD_ADDITIONAL_CONSTANTS=$AdditionalConstants `
-e BASH_ENV=/root/.bashrc `
$DockerImage

if ($LASTEXITCODE -ne 0) {
Expand Down
4 changes: 3 additions & 1 deletion ci/local_test_in_unity_container.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ if (!$SkipPackageRebuild) {
&$PSScriptRoot\local_build_into_package.ps1 `
-Configuration Debug `
-UnityBuilds @('Tests') `
-RelativeBuildDestinationBase "Src/Newtonsoft.Json-for-Unity.Tests/Packages/Newtonsoft.Json-for-Unity.Tests/Plugins/"
-RelativeBuildDestinationBase "Src/Newtonsoft.Json-for-Unity.Tests/Packages/Newtonsoft.Json-for-Unity.Tests/Plugins/" `
-DontSign
if ($LASTEXITCODE -ne 0) {
throw "Failed to complete debug build"
}
Expand Down Expand Up @@ -94,6 +95,7 @@ try {
rm -rfv $TEST_PROJECT/Assets/Newtonsoft.Json.Tests/obj
rm -rfv $TEST_PROJECT/Assets/Newtonsoft.Json.Tests/bin
cp -vur Src/Newtonsoft.Json.Tests/. $TEST_PROJECT/Assets/Newtonsoft.Json.Tests/
cp -v Src/IdentityPublicKey.snk $TEST_PROJECT/Assets/
'@

Invoke-DockerCommand "Run tests" `
Expand Down
6 changes: 5 additions & 1 deletion ci/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BUILD_DESTINATION=${3:-${BUILD_DESTINATION:-"${BUILD_DESTINATION_BASE:?"Build ou
: ${VERSION_ASSEMBLY:?"Assembly version required."}
: ${VERSION_SUFFIX:?"Version suffix required."}
: ${BUILD_CONFIGURATION:="Release"}
: ${BUILD_ADDITIONAL_CONSTANTS:=}

error() {
>&2 echo "$0: $@"
Expand All @@ -31,6 +32,7 @@ echo "############"
echo "$0: BUILDING PROJECT '$BUILD_SOLUTION'"
echo "$0: BUILD '$BUILD_UNITY' ($BUILD_FRAMEWORK, $BUILD_CONFIGURATION)"
echo "$0: OUTPUT '$BUILD_DESTINATION'"
echo "$0: ADDITIONAL CONSTANTS '$BUILD_ADDITIONAL_CONSTANTS'"
echo "############"
echo

Expand All @@ -42,11 +44,13 @@ msbuild -t:build "$BUILD_SOLUTION" \
-p:VersionPrefix="$VERSION_JSON_NET" \
-p:VersionSuffix="$VERSION_SUFFIX" \
-p:AssemblyVersion="$VERSION_ASSEMBLY" \
-p:FileVersion="$VERSION"
-p:FileVersion="$VERSION" \
-p:AdditionalConstants=\""$BUILD_ADDITIONAL_CONSTANTS"\"

echo
echo "############"
echo "$0: DONE: BUILDING PROJECT '$BUILD_SOLUTION'"
echo "$0: DONE: BUILD '$BUILD_UNITY' ($BUILD_FRAMEWORK, $BUILD_CONFIGURATION)"
echo "$0: DONE: OUTPUT '$BUILD_DESTINATION'"
echo "$0: ADDITIONAL CONSTANTS '$BUILD_ADDITIONAL_CONSTANTS'"
echo "############"