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

Replace xamarin-mac #333

Merged
merged 3 commits into from
May 27, 2020
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
156 changes: 154 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
"description": "Extremely fast, native C#-dialect and powerful tooling for mobile and desktop developers.",
"dependencies": {
"@fuse-open/transpiler": "^1.14.0",
"dotnet-run": "^1.3.1"
"@fuse-open/xamarin-mac": "^3.4.0",
"dotnet-run": "^1.3.1",
"findup-sync": "^4.0.0"
},
"devDependencies": {
"filecompare": "^1.0.4",
"xbash": "^1.4.1"
},
"scripts": {
"build": "xbash scripts/build.sh",
"postinstall": "node scripts/restore.js",
"postpack": "node scripts/restore.js",
"prepack": "xbash scripts/pack.sh",
"test": "xbash scripts/test.sh",
"version": "xbash scripts/version.sh",
Expand All @@ -22,7 +27,8 @@
"files": [
".unoconfig",
"bin/*",
"lib/build/*"
"lib/build/*",
"scripts/restore.js"
],
"repository": {
"type": "git",
Expand Down
20 changes: 20 additions & 0 deletions scripts/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,24 @@ function rm-all {
done
}

function rm-identical {
local root=$1
shift
IFS=$'\n'
for i in `find-all "$@"`; do
local file="$root/`basename $i`"
[ -f "$file" ] || continue
node_modules/.bin/filecompare "$i" "$file" > /dev/null || continue
echo "stripping $file"
rm -rf "$file"
done
}

h1 "Optimizing package"

# Xamarin.Mac will be added back by restore.js
rm-identical bin node_modules/@fuse-open/xamarin-mac *.dll *.dylib
rm-identical bin/mac node_modules/@fuse-open/xamarin-mac *.dll *.dylib

# Drop superfluous build artifacts
rm-all bin *.config *.mdb *.pdb *.xml
39 changes: 39 additions & 0 deletions scripts/restore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const fs = require("fs");
const path = require("path");
const findup = require("findup-sync");

function findNodeModule(name) {
const package = findup(`node_modules/${name}/package.json`);
return path.dirname(package);
}

function restoreXamarinMac(dst) {
if (!fs.existsSync(dst))
return;

const src = findNodeModule("@fuse-open/xamarin-mac");

for (file of fs.readdirSync(src)) {
switch (file.split('.').pop()) {
case "dll":
case "dylib":
break;
default:
continue;
}

const srcf = path.join(src, file);
const dstf = path.join(dst, file);

if (fs.existsSync(dstf))
continue;

const relative = path.relative(process.cwd(), dstf);
console.log(`restoring ${relative}`);
fs.copyFileSync(srcf, dstf);
}
}

// Restore Xamarin.Mac binaries.
restoreXamarinMac(path.join(__dirname, "..", "bin"));
restoreXamarinMac(path.join(__dirname, "..", "bin", "mac"));
9 changes: 4 additions & 5 deletions src/runtime/mac/app-mac.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\build\net45\FuseOpen.Xamarin.Mac.props" Condition="Exists('..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\build\net45\FuseOpen.Xamarin.Mac.props')" />
<Import Project="..\..\..\node_modules\@fuse-open\xamarin-mac\FuseOpen.Xamarin.Mac.props" Condition="Exists('..\..\..\node_modules\@fuse-open\xamarin-mac\FuseOpen.Xamarin.Mac.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -44,7 +44,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FuseOpen.Xamarin.OpenTK.3.4.0.2\lib\net45\OpenTK.dll</HintPath>
<HintPath>..\..\..\node_modules\@fuse-open\xamarin-mac\OpenTK.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -53,7 +53,7 @@
<HintPath>..\..\..\lib\UnoCore\build\DotNet\Debug\UnoCore.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Mac, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\lib\net45\Xamarin.Mac.dll</HintPath>
<HintPath>..\..\..\node_modules\@fuse-open\xamarin-mac\Xamarin.Mac.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\GlobalAssemblyInfo.targets" />
Expand All @@ -73,7 +73,6 @@
<None Include="monostub">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down Expand Up @@ -113,6 +112,6 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\build\net45\FuseOpen.Xamarin.Mac.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\build\net45\FuseOpen.Xamarin.Mac.props'))" />
<Error Condition="!Exists('..\..\..\node_modules\@fuse-open\xamarin-mac\FuseOpen.Xamarin.Mac.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\node_modules\@fuse-open\xamarin-mac\FuseOpen.Xamarin.Mac.props'))" />
</Target>
</Project>
5 changes: 0 additions & 5 deletions src/runtime/mac/packages.config

This file was deleted.

6 changes: 3 additions & 3 deletions src/tool/engine/Uno.Build.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\build\net45\FuseOpen.Xamarin.Mac.props" Condition="Exists('..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\build\net45\FuseOpen.Xamarin.Mac.props')" />
<Import Project="..\..\..\node_modules\@fuse-open\xamarin-mac\FuseOpen.Xamarin.Mac.props" Condition="Exists('..\..\..\node_modules\@fuse-open\xamarin-mac\FuseOpen.Xamarin.Mac.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -42,7 +42,7 @@
<HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Mac, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\lib\net45\Xamarin.Mac.dll</HintPath>
<HintPath>..\..\..\node_modules\@fuse-open\xamarin-mac\Xamarin.Mac.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -171,6 +171,6 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\build\net45\FuseOpen.Xamarin.Mac.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\FuseOpen.Xamarin.Mac.3.4.0.2\build\net45\FuseOpen.Xamarin.Mac.props'))" />
<Error Condition="!Exists('..\..\..\node_modules\@fuse-open\xamarin-mac\FuseOpen.Xamarin.Mac.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\node_modules\@fuse-open\xamarin-mac\FuseOpen.Xamarin.Mac.props'))" />
</Target>
</Project>
1 change: 0 additions & 1 deletion src/tool/engine/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FuseOpen.Xamarin.Mac" version="3.4.0.2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
</packages>