From: Wonyoung Choi Date: Tue, 3 Apr 2018 02:28:21 +0000 (+0900) Subject: Support nuspec file in dotnet-pack X-Git-Tag: submit/tizen/20180402.095245^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec8006bdd80ab534a6039b76407991787ba99656;p=platform%2Fcore%2Fdotnet%2Fbuild-tools.git Support nuspec file in dotnet-pack Change-Id: If7cf631c0900670a7ab1f788df13e40b42d2dccd --- diff --git a/Tools/dotnet-build.sh b/Tools/dotnet-build.sh index 9ffaef8f..687678af 100755 --- a/Tools/dotnet-build.sh +++ b/Tools/dotnet-build.sh @@ -23,25 +23,10 @@ exit_on_error() { run_dotnet() { echo "+ dotnet $@" - $RETRY_CMD $TIMEOUT_CMD 600 dotnet $@ + $RETRY_CMD $TIMEOUT_CMD 600 dotnet $@ /nologo exit_on_error $? } -update_version_to_asterisk() { - local PROJS="" - if [[ $PROJECT_TYPE == "csproj" ]]; then - PROJS=$PROJECT - elif [[ $PROJECT_TYPE == "dir" ]]; then - PROJS=$PROJECT/*.csproj - elif [[ $PROJECT_TYPE == "sln" ]]; then - PROJS=$(find . -name "*.csproj") - fi - for p in $PROJS; do - xmlstarlet ed -L -u "//PackageReference/@Version" --value "*" $p - xmlstarlet ed -L -u "//PackageReference/@version" --value "*" $p - done -} - cmd_restore() { local OPTS="" [ -n "$SOURCE" ] && OPTS="$OPTS -s $SOURCE" @@ -59,14 +44,19 @@ cmd_pack() { local OPTS="" [ -n "$CONFIGURATION" ] && OPTS="$OPTS -c $CONFIGURATION" [ -n "$VERSION" ] && OPTS="$OPTS /p:Version=$VERSION" - run_dotnet pack --no-restore --no-build $PROJECT $OPTS $@ /p:UsingRPMMacro=true + if [[ $PROJECT == *".nuspec" ]]; then + NUSPECPATH=$(readlink -f $PROJECT) + OPTS="$OPTS /p:NuspecFile=$NUSPECPATH /p:PWD=$PWD" + TMPDIR=$(mktemp -d) + cp $SCRIPT_DIR/dummypack.csproj $TMPDIR + PROJECT=$TMPDIR/dummypack.csproj + fi + run_dotnet pack --no-build $PROJECT $OPTS $@ /p:UsingRPMMacro=true } cmd_install() { local DEST=$1; shift - mkdir -p $DEST - if [[ $TYPE == "assembly" ]]; then find $PROJECT/bin -name $PROJECT.dll -exec install -p -m 644 {} $DEST \; elif [[ $TYPE == "nupkg" ]]; then @@ -74,21 +64,6 @@ cmd_install() { fi } -cmd_nuspec_addfile() { - local SRC=$1; shift - local TARGET=$1; shift - - CHK_FILES=$(xmlstarlet sel -t -v "count(/package/files)" $PROJECT) - if [ $CHK_FILES -eq 0 ]; then - xmlstarlet ed -L -s "/package" -t elem -n "files" -v "" $PROJECT - fi - - xmlstarlet ed -L -s "/package/files" -t elem -n "file" -v "" \ - -i "/package/files/file[last()]" -t attr -n "src" -v "$SRC" \ - -i "/package/files/file[last()]" -t attr -n "target" -v "$TARGET" \ - $PROJECT -} - ######################################################################### # Parse arguments @@ -111,45 +86,6 @@ fi CMD=$1; shift PROJECT=$1; shift -# Check whether the project can be built using dotnet-cli -PROJECT_TYPE="" -USE_DOTNET_CLI=false -if [ -f $PROJECT ]; then - if [[ $PROJECT == *".sln" ]]; then - PROJECT_TYPE="sln" - VS_VERSION=$(grep -E "^VisualStudioVersion" $PROJECT | cut -f2 -d= | xargs) - if [[ $VS_VERSION == "15."* ]]; then - USE_DOTNET_CLI=true - fi - elif [[ $PROJECT == *".csproj" ]]; then - PROJECT_TYPE="csproj" - RET=$(grep "Microsoft.NET.Sdk" $PROJECT | wc -l) - if [ $RET -gt 0 ]; then - USE_DOTNET_CLI=true - fi - elif [[ $PROJECT == *".project.json" ]]; then - PROJECT_TYPE="project.json" - fi -elif [ -d $PROJECT ]; then - PROJECT_TYPE="dir" - RET=$(find $PROJECT -name "*.project.json" | wc -l) - if [ $RET -eq 0 ]; then - CSPROJS=$(find $PROJECT -name "*.csproj") - for p in $CSPROJS; do - RET=$(grep "Microsoft.NET.Sdk" $p | wc -l) - if [ $RET -gt 0 ]; then - USE_DOTNET_CLI=true - break; - fi - done - fi -fi - -if [ $USE_DOTNET_CLI == false ]; then - echo "Not supported project type." - exit 1 -fi - export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true @@ -157,8 +93,6 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true echo "----------------------------------------------" echo "CMD=$CMD" echo "PROJECT=$PROJECT" -echo "PROJECT_TYPE=$PROJECT_TYPE" -echo "USE_DOTNET_CLI=$USE_DOTNET_CLI" echo "SOURCE=$SOURCE" echo "CONFIGURATION=$CONFIGURATION" echo "VERSION=$VERSION" @@ -171,6 +105,5 @@ case $CMD in build) cmd_build $@ ;; pack) cmd_pack $@ ;; install) cmd_install $@ ;; - nuspec_addfile) cmd_nuspec_addfile $@ ;; *) usage; exit 1 ;; esac diff --git a/Tools/dummypack.csproj b/Tools/dummypack.csproj new file mode 100644 index 00000000..91a2d771 --- /dev/null +++ b/Tools/dummypack.csproj @@ -0,0 +1,19 @@ + + + + netstandard2.0 + + + + false + + + + false + true + version=$(Version) + $(PWD) + $(PWD) + + + \ No newline at end of file diff --git a/dotnet/TIZEN.txt b/dotnet/TIZEN.txt index 59ec934c..5eb9b4bf 100644 --- a/dotnet/TIZEN.txt +++ b/dotnet/TIZEN.txt @@ -1,11 +1,5 @@ The following files are added to build Tizen stuff with dotnet-cli. -- .NETPortable targets -sdk/*/Microsoft/Portable/* - -- Symlink Microsoft.CSharp.Targets -sdk/*/Microsoft.CSharp.Targets -> sdk/*/Microsoft.CSharp.targets - - Dependent libraries for x86-64 deps/* diff --git a/dotnet/sdk/2.0.0/Microsoft.CSharp.Targets b/dotnet/sdk/2.0.0/Microsoft.CSharp.Targets deleted file mode 120000 index 495bab44..00000000 --- a/dotnet/sdk/2.0.0/Microsoft.CSharp.Targets +++ /dev/null @@ -1 +0,0 @@ -Microsoft.CSharp.targets \ No newline at end of file diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/Microsoft.Portable.Core.props b/dotnet/sdk/2.0.0/Microsoft/Portable/Microsoft.Portable.Core.props deleted file mode 100755 index eb95ac81..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/Microsoft.Portable.Core.props +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Portable - .NETPortable - .NET Portable Subset - - - true - - - - - - - {CandidateAssemblyFiles}; - $(ReferencePath); - {HintPathFromItem}; - {TargetFrameworkDirectory}; - {Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)}; - {RawFileName}; - $(OutDir) - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/Microsoft.Portable.Core.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/Microsoft.Portable.Core.targets deleted file mode 100755 index 189ee3c4..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/Microsoft.Portable.Core.targets +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - <_FullFrameworkReferenceAssemblyPaths>$(TargetFrameworkDirectory) - - - - - - $(ResolveReferencesDependsOn); - ImplicitlyExpandTargetFramework; - - - - $(ImplicitlyExpandTargetFrameworkDependsOn); - GetReferenceAssemblyPaths - - - - - - - - - - - false - false - .NET - $(TargetFrameworkIdentifier),$(TargetFrameworkVersion) - ImplicitlyExpandTargetFramework - True - - - - - - - - - <_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)" - Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'"/> - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets deleted file mode 100755 index b8655013..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.Common.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.Common.targets deleted file mode 100755 index a95b73d1..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.Common.targets +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.VisualBasic.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.VisualBasic.targets deleted file mode 100755 index a24d84f3..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.0/Microsoft.Portable.VisualBasic.targets +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - Embed - true - Empty - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.CSharp.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.CSharp.targets deleted file mode 100755 index e5ecdd79..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.CSharp.targets +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.Common.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.Common.targets deleted file mode 100755 index 4aa142b4..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.Common.targets +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.VisualBasic.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.VisualBasic.targets deleted file mode 100755 index 97d9ea0b..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.5/Microsoft.Portable.VisualBasic.targets +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - true - Empty - - - - - - - - <_VBRuntimeSearchDirectories Include="$(TargetFrameworkDirectory)" /> - - - - <_VBRuntimeFound Condition="Exists('%(_VBRuntimeSearchDirectories.Identity)Microsoft.VisualBasic.dll')">true - - - - Embed - - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.CSharp.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.CSharp.targets deleted file mode 100755 index c3f76e1b..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.CSharp.targets +++ /dev/null @@ -1,24 +0,0 @@ - - - - - true - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.Common.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.Common.targets deleted file mode 100755 index 4aa142b4..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.Common.targets +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.VisualBasic.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.VisualBasic.targets deleted file mode 100755 index 3804d78b..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v4.6/Microsoft.Portable.VisualBasic.targets +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - true - Empty - - - - - - - - <_VBRuntimeSearchDirectories Include="$(TargetFrameworkDirectory)" /> - - - - <_VBRuntimeFound Condition="Exists('%(_VBRuntimeSearchDirectories.Identity)Microsoft.VisualBasic.dll')">true - - - - Embed - - - - - true - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.CSharp.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.CSharp.targets deleted file mode 100755 index 1afd014b..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.CSharp.targets +++ /dev/null @@ -1,24 +0,0 @@ - - - - - true - - - - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.Common.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.Common.targets deleted file mode 100755 index 5437ec69..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.Common.targets +++ /dev/null @@ -1,23 +0,0 @@ - - - - - true - true - .NETPlatform,Version=v5.0 - - - - diff --git a/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.VisualBasic.targets b/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.VisualBasic.targets deleted file mode 100755 index 9b2d0b33..00000000 --- a/dotnet/sdk/2.0.0/Microsoft/Portable/v5.0/Microsoft.Portable.VisualBasic.targets +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - true - Empty - - - - - - true - - - - - - -