diff --git a/src/IKVM.MSBuild.Tasks/IkvmReferenceItem.cs b/src/IKVM.MSBuild.Tasks/IkvmReferenceItem.cs index f1e900a33..54facce0f 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmReferenceItem.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmReferenceItem.cs @@ -72,6 +72,7 @@ public static IkvmReferenceItem[] Import(IEnumerable items) item.CacheSymbolsPath = item.Item.GetMetadata(IkvmReferenceItemMetadata.CacheSymbolsPath); item.StagePath = item.Item.GetMetadata(IkvmReferenceItemMetadata.StagePath); item.StageSymbolsPath = item.Item.GetMetadata(IkvmReferenceItemMetadata.StageSymbolsPath); + item.Static = string.Equals(item.Item.GetMetadata(IkvmReferenceItemMetadata.Static), "true", StringComparison.OrdinalIgnoreCase); item.Save(); } @@ -271,6 +272,11 @@ public IkvmReferenceItem(ITaskItem item) /// public List ResolvedReferences { get; set; } + /// + /// Whether Ikvmc should enable static-semantics. + /// + public bool Static { get; set; } = false; + /// /// Writes the metadata to the item. /// @@ -300,6 +306,7 @@ public void Save() Item.SetMetadata(IkvmReferenceItemMetadata.Private, Private ? "true" : "false"); Item.SetMetadata(IkvmReferenceItemMetadata.ReferenceOutputAssembly, ReferenceOutputAssembly ? "true" : "false"); Item.SetMetadata(IkvmReferenceItemMetadata.ResolvedReferences, string.Join(IkvmReferenceItemMetadata.PropertySeperatorString, ResolvedReferences)); + Item.SetMetadata(IkvmReferenceItemMetadata.Static, Static ? "true" : "false"); } /// diff --git a/src/IKVM.MSBuild.Tasks/IkvmReferenceItemMetadata.cs b/src/IKVM.MSBuild.Tasks/IkvmReferenceItemMetadata.cs index f9ef738f6..72636a8f1 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmReferenceItemMetadata.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmReferenceItemMetadata.cs @@ -30,6 +30,7 @@ static class IkvmReferenceItemMetadata public static readonly string Aliases = "Aliases"; public static readonly string Private = "Private"; public static readonly string ReferenceOutputAssembly = "ReferenceOutputAssembly"; + public static readonly string Static = "Static"; } diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets index f937f4ab5..1f028d0d6 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets @@ -293,6 +293,7 @@ Value = b.ToString(); <_IkvmCompilerArgs Include="-sharedclassloader" Condition=" '$(SharedClassLoader)' == 'true' " /> <_IkvmCompilerArgs Include="-w$(WarningLevel)" /> <_IkvmCompilerArgs Include="-noparameterreflection" Condition=" '$(NoParameterReflection)' == 'true' " /> + <_IkvmCompilerArgs Include="-static" Condition=" '$(Static)' == 'true' " /> <_IkvmCompilerArgs Include="-exclude:$([System.IO.Path]::GetFullPath('$(_ExcludeFilePath)'))" Condition="Exists('$(_ExcludeFilePath)') And '@(ExcludeRegex)' != '' " /> <_IkvmCompilerArgs Include="@(_AssemblyAttributesClass->'-assemblyattributes:%(FullPath)')" /> <_IkvmCompilerReferencePath Remove="@(_IkvmCompilerReferencePath)" /> diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets index f0106ab7b..affb1f803 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets @@ -132,6 +132,7 @@ SharedClassLoader="$(SharedClassLoader)" NoStdLib="$(NoCompilerStandardLib)" NoParameterReflection="$(NoParameterReflection)" + Static="$(Static)" WarningLevel="$(WarningLevel)" References="@(_IkvmCompilerReferencePath)" StrictFinalFieldSemantics="$(StrictFinalFieldSemantics)" diff --git a/src/IKVM.NET.Sdk/targets/IKVM.NET.Sdk.props b/src/IKVM.NET.Sdk/targets/IKVM.NET.Sdk.props index e007dcb58..eae6e88d5 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.NET.Sdk.props +++ b/src/IKVM.NET.Sdk/targets/IKVM.NET.Sdk.props @@ -26,6 +26,7 @@ true true true + false diff --git a/src/IKVM/buildTransitive/IKVM.IkvmReference.NoTasks.targets b/src/IKVM/buildTransitive/IKVM.IkvmReference.NoTasks.targets index e13c617fe..ac7d175f4 100644 --- a/src/IKVM/buildTransitive/IKVM.IkvmReference.NoTasks.targets +++ b/src/IKVM/buildTransitive/IKVM.IkvmReference.NoTasks.targets @@ -41,6 +41,7 @@ <_IkvmCompilerArgs Include="-removeassertions" Condition=" '$(RemoveAssertions)' == 'true' " /> <_IkvmCompilerArgs Include="-target:library" /> <_IkvmCompilerArgs Include="-nostdlib" /> + <_IkvmCompilerArgs Include="-static" Condition=" '%(IkvmReferenceItem.Static)' == 'true' " /> <_IkvmCompilerArgs Include="-classloader:%(IkvmReferenceItem.ClassLoader)" Condition=" '%(IkvmReferenceItem.ClassLoader)' != '' " /> <_IkvmCompilerArgs Include="@(_IkvmCompilerReferencePath->'-reference:%(FullPath)')" /> <_IkvmCompilerArgs Include="-out:%(IkvmReferenceItem.StagePath)" /> diff --git a/src/IKVM/buildTransitive/IKVM.IkvmReference.Tasks.targets b/src/IKVM/buildTransitive/IKVM.IkvmReference.Tasks.targets index 752d54b7e..b78ca0b96 100644 --- a/src/IKVM/buildTransitive/IKVM.IkvmReference.Tasks.targets +++ b/src/IKVM/buildTransitive/IKVM.IkvmReference.Tasks.targets @@ -44,6 +44,7 @@ CompressResources="true" ClassLoader="%(IkvmReferenceItem.ClassLoader)" NoStdLib="true" + Static="%(IkvmReferenceItem.Static)" References="@(_IkvmCompilerReferencePath->'%(FullPath)')" Input="%(IkvmReferenceItem.Compile)" Condition=" '%(IkvmReferenceItem.Compile)' != '' "/> diff --git a/src/IKVM/buildTransitive/IKVM.IkvmReference.props b/src/IKVM/buildTransitive/IKVM.IkvmReference.props index be4181734..db8211eb7 100644 --- a/src/IKVM/buildTransitive/IKVM.IkvmReference.props +++ b/src/IKVM/buildTransitive/IKVM.IkvmReference.props @@ -23,6 +23,7 @@ true true true + false