Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dotnet-bgen
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Mar 12, 2020
2 parents 5dda97a + 16a84bd commit 800d63b
Show file tree
Hide file tree
Showing 77 changed files with 4,404 additions and 1,493 deletions.
5 changes: 5 additions & 0 deletions jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def githubGetPullRequestLabels ()

def githubAddComment (url, markdown)
{
if (markdown.length () > 32768) {
// GitHub only allows adding comments < 65536 characters log, so lets cap at half that, which should be more than enough to say that something went horribly wrong
markdown = markdown.substring (0, 32768)
}

def json = groovy.json.JsonOutput.toJson ([body: markdown])
def jsonFile = "${workspace}/xamarin-macios/jenkins/commit-comments.json"
try {
Expand Down
8 changes: 6 additions & 2 deletions jenkins/add-commit-comment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,19 @@ fi

JSONFILE=$(mktemp)
LOGFILE=$(mktemp)
TMPFILE=$(mktemp)
cleanup ()
{
rm -f "$JSONFILE" "$LOGFILE"
rm -f "$JSONFILE" "$LOGFILE" "$TMPFILE"
}
trap cleanup ERR
trap cleanup EXIT

# Cap comment at 32768 characters, to avoid running into GitHub limits.
head -c 32768 "$FILE" > "$TMPFILE"

printf '{\n"body": ' > "$JSONFILE"
python -c 'import json,sys; print(json.dumps(sys.stdin.read()))' < "$FILE" >> "$JSONFILE"
python -c 'import json,sys; print(json.dumps(sys.stdin.read()))' < "$TMPFILE" >> "$JSONFILE"
printf '}\n' >> "$JSONFILE"

if test -n "$VERBOSE"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class DetectSdkLocationsTaskBase : Task

public string SessionId { get; set; }

// This is also an input
[Output]
public string XamarinSdkRoot {
get; set;
}
Expand Down
138 changes: 7 additions & 131 deletions msbuild/Xamarin.Mac.Tasks.Core/Tasks/MmpTaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,84 +19,25 @@

namespace Xamarin.Mac.Tasks
{
public class MmpTaskBase : ToolTask
public class MmpTaskBase : BundlerToolTaskBase
{
protected override string ToolName {
get { return "mmp"; }
}

public string SessionId { get; set; }

[Required]
public string AppBundleDir { get; set; }

[Required]
public string FrameworkRoot { get; set; }

[Required]
public string OutputPath { get; set; }

[Required]
public ITaskItem ApplicationAssembly { get; set; }

[Required]
public string HttpClientHandler { get; set; }

[Required]
public string TargetFrameworkMoniker { get; set; }

public string TargetFrameworkIdentifier { get { return TargetFramework.Identifier; } }

public TargetFramework TargetFramework { get { return TargetFramework.Parse (TargetFrameworkMoniker); } }

public string TargetFrameworkVersion { get { return TargetFramework.Version.ToString (); } }

[Required]
public string SdkRoot { get; set; }

[Required]
public ITaskItem AppManifest { get; set; }

[Required]
public string SdkVersion { get; set; }

public bool IsAppExtension { get; set; }
public bool IsXPCService { get; set; }

[Required]
public bool EnableSGenConc { get; set; }

public bool UseXamMacFullFramework { get; set; }

public string ApplicationName { get; set; }
public string ArchiveSymbols { get; set; }
public string Architecture { get; set; }
public string LinkMode { get; set; }
public bool Debug { get; set; }
public bool Profiling { get; set; }
public string I18n { get; set; }
public string ExtraArguments { get; set; }
public int Verbosity { get; set; }

public string AotMode { get; set; }
public bool HybridAOT { get; set; }
public string ExplicitAotAssemblies { get; set; }

public ITaskItem [] ExplicitReferences { get; set; }
public ITaskItem [] NativeReferences { get; set; }

[Required]
public string ResponseFilePath { get; set; }

public string IntermediateOutputPath { get; set; }

[Output]
public ITaskItem[] NativeLibraries { get; set; }

protected override string GenerateFullPathToTool ()
{
return Path.Combine (FrameworkRoot, "bin", "mmp");
}

protected override bool ValidateParameters ()
{
Expand All @@ -107,11 +48,7 @@ protected override bool ValidateParameters ()

protected override string GenerateCommandLineCommands ()
{
var args = new CommandLineArgumentBuilder ();
bool msym;

if (Debug)
args.AddLine ("/debug");
var args = GenerateCommandLineArguments ();

if (!string.IsNullOrEmpty (OutputPath))
args.AddQuotedLine ("/output:" + Path.GetFullPath (OutputPath));
Expand Down Expand Up @@ -139,11 +76,6 @@ protected override string GenerateCommandLineCommands ()
if (arch.HasFlag (XamMacArch.x86_64))
args.AddLine ("/arch:x86_64");

if (!string.IsNullOrEmpty (ArchiveSymbols) && bool.TryParse (ArchiveSymbols.Trim (), out msym))
args.AddLine ("--msym:" + (msym ? "yes" : "no"));

args.AddLine (string.Format ("--http-message-handler={0}", HttpClientHandler));

if (AppManifest != null) {
try {
var plist = PDictionary.FromFile (AppManifest.ItemSpec);
Expand All @@ -163,12 +95,6 @@ protected override string GenerateCommandLineCommands ()
}
}

if (Profiling)
args.AddLine ("/profiling");

if (EnableSGenConc)
args.AddLine ("/sgen-conc");

switch ((LinkMode ?? string.Empty).ToLower ()) {
case "full":
break;
Expand All @@ -194,18 +120,11 @@ protected override string GenerateCommandLineCommands ()
args.AddLine (aot);
}

if (!string.IsNullOrEmpty (I18n))
args.AddQuotedLine ("/i18n:" + I18n);

if (ExplicitReferences != null) {
foreach (var asm in ExplicitReferences)
if (References != null) {
foreach (var asm in References)
args.AddQuotedLine ("/assembly:" + Path.GetFullPath (asm.ItemSpec));
}

if (!string.IsNullOrEmpty (ApplicationAssembly.ItemSpec)) {
args.AddQuotedLine ("/root-assembly:" + Path.GetFullPath (ApplicationAssembly.ItemSpec));
}

if (NativeReferences != null) {
foreach (var nr in NativeReferences)
args.AddQuotedLine ("/native-reference:" + Path.GetFullPath (nr.ItemSpec));
Expand All @@ -216,56 +135,13 @@ protected override string GenerateCommandLineCommands ()
if (IsXPCService)
args.AddQuotedLine ("/xpc");

args.AddQuotedLine ("/sdkroot:" + SdkRoot);

if (!string.IsNullOrEmpty (IntermediateOutputPath)) {
Directory.CreateDirectory (IntermediateOutputPath);

args.AddQuotedLine ("--cache:" + Path.GetFullPath (IntermediateOutputPath));
}

// Generate a response file
var responseFile = Path.GetFullPath (ResponseFilePath);

if (File.Exists (responseFile))
File.Delete (responseFile);

try {
using (var fs = File.Create (responseFile)) {
using (var writer = new StreamWriter (fs))
writer.Write (args);
}
} catch (Exception ex) {
Log.LogWarning ("Failed to create response file '{0}': {1}", responseFile, ex);
}

// Some arguments can not safely go in the response file and are
// added separately. They must go _after_ the response file
// as they may override options passed in the response file
var actualArgs = new CommandLineArgumentBuilder ();

actualArgs.AddQuoted ($"@{responseFile}");

if (!string.IsNullOrWhiteSpace (ExtraArguments))
actualArgs.Add (ExtraArguments);

var verbosity = VerbosityUtils.Merge (ExtraArguments, (LoggerVerbosity) Verbosity);
if (verbosity.Length > 0) {
foreach (var arg in verbosity) {
actualArgs.Add (arg);
}
} else {
// for compatibility with earlier versions nothing means one /v
actualArgs.Add ("/verbose");
}

return actualArgs.ToString ();
return CreateResponseFile (args, ExtraArgs == null ? null : CommandLineArgumentBuilder.Parse (ExtraArgs));
}

string GetMonoBundleDirName ()
{
if (!string.IsNullOrEmpty (ExtraArguments)) {
var args = CommandLineArgumentBuilder.Parse (ExtraArguments);
if (!string.IsNullOrEmpty (ExtraArgs)) {
var args = CommandLineArgumentBuilder.Parse (ExtraArgs);

for (int i = 0; i < args.Length; i++) {
string arg;
Expand Down
4 changes: 4 additions & 0 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ Copyright (C) 2013-2014 Xamarin. All rights reserved.
<EnableSGenConc Condition="'$(EnableSGenConc)' == ''">false</EnableSGenConc>
<AotScope Condition="'$(AotScope)' == ''">None</AotScope>
<ArchiveOnBuild Condition="'$(ArchiveOnBuild)' == ''">False</ArchiveOnBuild>
<Profiling Condition="'$(MtouchProfiling)' == ''">False</Profiling>
<!-- MmpDebug first checks $(DebugSymbols) and then defaults to False. We don't want to touch the DebugSymbols value, since it's used by other tasks. -->
<MmpDebug Condition="'$(MmpDebug)' == ''">$(DebugSymbols)</MmpDebug>
<MmpDebug Condition="'$(MmpDebug)' == ''">False</MmpDebug>
</PropertyGroup>

<PropertyGroup>
Expand Down
11 changes: 6 additions & 5 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ Copyright (C) 2014 Xamarin. All rights reserved.
<Output TaskParameter="SdkDevPath" PropertyName="_SdkDevPath" />
<Output TaskParameter="SdkUsrPath" PropertyName="_SdkUsrPath" />
<Output TaskParameter="IsXcode8" PropertyName="_IsXcode8" />
<Output TaskParameter="XamarinSdkRoot" PropertyName="_XamarinSdkRoot" />
</DetectSdkLocations>
</Target>

Expand Down Expand Up @@ -531,23 +532,22 @@ Copyright (C) 2014 Xamarin. All rights reserved.
<Mmp
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
FrameworkRoot="$(XamarinMacFrameworkRoot)"
AppBundleDir="$(AppBundleDir)"
OutputPath="$(OutputPath)"
ApplicationName="$(_AppBundleName)"
ApplicationAssembly="$(OutputPath)$(TargetName)$(TargetExt)"
MainAssembly="$(OutputPath)$(TargetName)$(TargetExt)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
UseXamMacFullFramework="$(UseXamMacFullFramework)"
Architecture="$(XamMacArch)"
ArchiveSymbols="$(MonoSymbolArchive)"
LinkMode="$(LinkMode)"
Debug="$(DebugSymbols)"
Debug="$(MmpDebug)"
HttpClientHandler="$(HttpClientHandler)"
I18n="$(I18n)"
Profiling="$(Profiling)"
ExtraArguments="$(MonoBundlingExtraArgs)"
ExtraArgs="$(MonoBundlingExtraArgs)"
NativeReferences="@(NativeReference)"
ExplicitReferences="@(ReferencePath);@(ReferenceCopyLocalAssemblyPaths)"
References="@(ReferencePath);@(ReferenceCopyLocalAssemblyPaths)"
ResponseFilePath="$(IntermediateOutputPath)response-file.rsp"
SdkRoot="$(_SdkDevPath)"
IntermediateOutputPath="$(IntermediateOutputPath)mmp-cache"
Expand All @@ -560,6 +560,7 @@ Copyright (C) 2014 Xamarin. All rights reserved.
HybridAOT="$(HybridAOT)"
ExplicitAotAssemblies="$(ExplicitAotAssemblies)"
StandardOutputImportance="High"
XamarinSdkRoot="$(_XamarinSdkRoot)"
>
<Output TaskParameter="NativeLibraries" ItemName="_NativeLibrary" />
</Mmp>
Expand Down
Loading

0 comments on commit 800d63b

Please sign in to comment.