Skip to content

Commit

Permalink
Merge branch 'feature/sdk-static' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
AliveDevil committed Aug 1, 2024
2 parents a9fb359 + 79e35e0 commit 547ac5e
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/IKVM.MSBuild.Tasks/IkvmReferenceItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public static IkvmReferenceItem[] Import(IEnumerable<ITaskItem> 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();
}

Expand Down Expand Up @@ -271,6 +272,11 @@ public IkvmReferenceItem(ITaskItem item)
/// </summary>
public List<string> ResolvedReferences { get; set; }

/// <summary>
/// Whether Ikvmc should enable static-semantics.
/// </summary>
public bool Static { get; set; } = false;

/// <summary>
/// Writes the metadata to the item.
/// </summary>
Expand Down Expand Up @@ -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");
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/IKVM.MSBuild.Tasks/IkvmReferenceItemMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

}

Expand Down
1 change: 1 addition & 0 deletions src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -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)" />
Expand Down
1 change: 1 addition & 0 deletions src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
SharedClassLoader="$(SharedClassLoader)"
NoStdLib="$(NoCompilerStandardLib)"
NoParameterReflection="$(NoParameterReflection)"
Static="$(Static)"
WarningLevel="$(WarningLevel)"
References="@(_IkvmCompilerReferencePath)"
StrictFinalFieldSemantics="$(StrictFinalFieldSemantics)"
Expand Down
1 change: 1 addition & 0 deletions src/IKVM.NET.Sdk/targets/IKVM.NET.Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<StrictFinalFieldSemantics Condition=" '$(StrictFinalFieldSemantics)' == '' ">true</StrictFinalFieldSemantics>
<RemoveAssertions Condition=" '$(RemoveAssertions)' == '' ">true</RemoveAssertions>
<NoParameterReflection Condition=" '$(NoParameterReflection)' == '' ">true</NoParameterReflection>
<Static Condition=" '$(Static)' == '' ">false</Static>
</PropertyGroup>

<!-- language specific functionality -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)" />
Expand Down
1 change: 1 addition & 0 deletions src/IKVM/buildTransitive/IKVM.IkvmReference.Tasks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
CompressResources="true"
ClassLoader="%(IkvmReferenceItem.ClassLoader)"
NoStdLib="true"
Static="%(IkvmReferenceItem.Static)"
References="@(_IkvmCompilerReferencePath->'%(FullPath)')"
Input="%(IkvmReferenceItem.Compile)"
Condition=" '%(IkvmReferenceItem.Compile)' != '' "/>
Expand Down
1 change: 1 addition & 0 deletions src/IKVM/buildTransitive/IKVM.IkvmReference.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<Private>true</Private>
<CopyLocal>true</CopyLocal>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<Static>false</Static>
</IkvmReference>
</ItemDefinitionGroup>

Expand Down

0 comments on commit 547ac5e

Please sign in to comment.