Skip to content

Commit 15ae74e

Browse files
committed
Unfortunately this doesn't actually work.
The reason we started the source-build-reference-packages repo was that some assemblies cannot be round-tripped with ILAsm/ILDasm. We at least need to know that list in order not to fail trying.
1 parent d7a12ef commit 15ae74e

File tree

1 file changed

+56
-67
lines changed

1 file changed

+56
-67
lines changed

build-source-tarball.sh

Lines changed: 56 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ usage() {
88
echo " --skip-build assume we have already built (requires you have built with the /p:ArchiveDownloadedPackages=true flag)"
99
echo " --enable-leak-detection build leaked-binary detection tasts for later use while building from this tarball"
1010
echo " --skip-prebuilt-check do not confirm that all prebuilt packages used are either reference packages, previously-built, or known extras"
11-
echo " --assume-no-prebuilts assume that no prebuilts are necessary and reference packages and a previously-built set of packages will be provided when building the tarball. implies --skip-prebuilt-check, makes --with-ref-packages and --with-packages redundant"
1211
echo " --with-ref-packages <dir> use the specified directory of available reference packages to determine what prebuilts to delete, instead of downloading the most recent version"
1312
echo " --with-packages <dir> use the specified directory of available previously-built packages to determine what prebuilts to delete, instead of downloading the most recent version"
1413
echo "use -- to send the remaining arguments to build.sh"
@@ -52,7 +51,6 @@ SKIP_BUILD=0
5251
INCLUDE_LEAK_DETECTION=0
5352
MINIMIZE_DISK_USAGE=0
5453
SKIP_PREBUILT_ENFORCEMENT=0
55-
DELETE_ALL_PREBUILTS=0
5654
CUSTOM_REF_PACKAGES_DIR=''
5755
CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR=''
5856
MAIN_BUILD_ARGS=("/p:ArchiveDownloadedPackages=true")
@@ -77,11 +75,6 @@ while :; do
7775
--skip-prebuilt-check)
7876
SKIP_PREBUILT_ENFORCEMENT=1
7977
;;
80-
--assume-no-prebuilts)
81-
DELETE_ALL_PREBUILTS=1
82-
SKIP_PREBUILT_ENFORCEMENT=1
83-
MAIN_BUILD_ARGS+=( "/p:SkipDownloadingPreviouslyBuiltArtifacts=true" )
84-
;;
8578
--with-ref-packages)
8679
CUSTOM_REF_PACKAGES_DIR="$2"
8780
if [ ! -d "$CUSTOM_REF_PACKAGES_DIR" ]; then
@@ -117,6 +110,10 @@ while :; do
117110
shift
118111
done
119112

113+
if [[ -d "$CUSTOM_REF_PACKAGES_DIR" && -d "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" ]]; then
114+
MAIN_BUILD_ARGS+=( "/p:SkipDownloadingPreviouslyBuiltArtifacts=true" )
115+
fi
116+
120117
if [ $MINIMIZE_DISK_USAGE -eq 1 ]; then
121118
echo "WARNING"
122119
echo "WARNING"
@@ -325,77 +322,69 @@ if [ $INCLUDE_LEAK_DETECTION -eq 1 ]; then
325322
"$CLI_PATH/dotnet" publish -o $FULL_TARBALL_ROOT/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection $SCRIPT_ROOT/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj
326323
fi
327324

328-
if [ "$DELETE_ALL_PREBUILTS" == "0" ]; then
325+
echo 'Removing reference-only packages from tarball prebuilts...'
329326

330-
echo 'Removing reference-only packages from tarball prebuilts...'
327+
for ref_package in $(find $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/reference-packages/packages-to-delete/ -name '*.nupkg' | tr '[:upper:]' '[:lower:]')
328+
do
329+
if [ -e $TARBALL_ROOT/packages/prebuilt/$(basename $ref_package) ]; then
330+
rm $TARBALL_ROOT/packages/prebuilt/$(basename $ref_package)
331+
fi
332+
done
331333

332-
for ref_package in $(find $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/reference-packages/packages-to-delete/ -name '*.nupkg' | tr '[:upper:]' '[:lower:]')
333-
do
334-
if [ -e $TARBALL_ROOT/packages/prebuilt/$(basename $ref_package) ]; then
335-
rm $TARBALL_ROOT/packages/prebuilt/$(basename $ref_package)
336-
fi
337-
done
334+
if [ -d "$CUSTOM_REF_PACKAGES_DIR" ]; then
335+
allRefPkgs=(`ls "$CUSTOM_REF_PACKAGES_DIR" | tr '[:upper:]' '[:lower:]'`)
336+
else
337+
allRefPkgs=(`tar -tf $TARBALL_ROOT/packages/archive/Private.SourceBuild.ReferencePackages.*.tar.gz | tr '[:upper:]' '[:lower:]'`)
338+
fi
339+
if [ -d "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" ]; then
340+
allSourceBuiltPkgs=(`ls "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" | tr '[:upper:]' '[:lower:]'`)
341+
else
342+
allSourceBuiltPkgs=(`tar -tf $TARBALL_ROOT/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz | tr '[:upper:]' '[:lower:]'`)
343+
fi
338344

339-
if [ -d "$CUSTOM_REF_PACKAGES_DIR" ]; then
340-
allRefPkgs=(`ls "$CUSTOM_REF_PACKAGES_DIR" | tr '[:upper:]' '[:lower:]'`)
341-
else
342-
allRefPkgs=(`tar -tf $TARBALL_ROOT/packages/archive/Private.SourceBuild.ReferencePackages.*.tar.gz | tr '[:upper:]' '[:lower:]'`)
343-
fi
344-
if [ -d "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" ]; then
345-
allSourceBuiltPkgs=(`ls "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" | tr '[:upper:]' '[:lower:]'`)
346-
else
347-
allSourceBuiltPkgs=(`tar -tf $TARBALL_ROOT/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz | tr '[:upper:]' '[:lower:]'`)
348-
fi
345+
echo 'Removing reference-packages from tarball prebuilts...'
349346

350-
echo 'Removing reference-packages from tarball prebuilts...'
347+
for ref_package in ${allRefPkgs[@]}
348+
do
349+
if [ -e $TARBALL_ROOT/packages/prebuilt/$ref_package ]; then
350+
rm $TARBALL_ROOT/packages/prebuilt/$ref_package
351+
fi
352+
done
351353

352-
for ref_package in ${allRefPkgs[@]}
353-
do
354-
if [ -e $TARBALL_ROOT/packages/prebuilt/$ref_package ]; then
355-
rm $TARBALL_ROOT/packages/prebuilt/$ref_package
356-
fi
357-
done
354+
echo 'Removing previously source-built packages from tarball prebuilts...'
358355

359-
echo 'Removing previously source-built packages from tarball prebuilts...'
356+
for ref_package in ${allSourceBuiltPkgs[@]}
357+
do
358+
if [ -e $TARBALL_ROOT/packages/prebuilt/$ref_package ]; then
359+
rm $TARBALL_ROOT/packages/prebuilt/$ref_package
360+
fi
361+
done
360362

361-
for ref_package in ${allSourceBuiltPkgs[@]}
362-
do
363-
if [ -e $TARBALL_ROOT/packages/prebuilt/$ref_package ]; then
364-
rm $TARBALL_ROOT/packages/prebuilt/$ref_package
365-
fi
366-
done
363+
echo 'Removing known extra packages from tarball prebuilts...'
364+
while IFS= read -r packagePattern
365+
do
366+
if [[ "$packagePattern" =~ ^# ]]; then
367+
continue
368+
fi
369+
rm -f $TARBALL_ROOT/packages/prebuilt/$packagePattern
370+
done < $SCRIPT_ROOT/support/additional-prebuilts-to-delete.txt
367371

368-
echo 'Removing known extra packages from tarball prebuilts...'
369-
while IFS= read -r packagePattern
372+
if [ $SKIP_PREBUILT_ENFORCEMENT -ne 1 ]; then
373+
echo 'Checking for extra prebuilts...'
374+
error_encountered=false
375+
for package in `ls -A $TARBALL_ROOT/packages/prebuilt`
370376
do
371-
if [[ "$packagePattern" =~ ^# ]]; then
372-
continue
377+
if grep -q "$package" $SCRIPT_ROOT/support/allowed-prebuilts.txt; then
378+
echo "Allowing prebuilt $package"
379+
else
380+
echo "ERROR: $package is not in the allowed prebuilts list ($SCRIPT_ROOT/support/allowed-prebuilts.txt)"
381+
error_encountered=true
373382
fi
374-
rm -f $TARBALL_ROOT/packages/prebuilt/$packagePattern
375-
done < $SCRIPT_ROOT/support/additional-prebuilts-to-delete.txt
376-
377-
if [ $SKIP_PREBUILT_ENFORCEMENT -ne 1 ]; then
378-
echo 'Checking for extra prebuilts...'
379-
error_encountered=false
380-
for package in `ls -A $TARBALL_ROOT/packages/prebuilt`
381-
do
382-
if grep -q "$package" $SCRIPT_ROOT/support/allowed-prebuilts.txt; then
383-
echo "Allowing prebuilt $package"
384-
else
385-
echo "ERROR: $package is not in the allowed prebuilts list ($SCRIPT_ROOT/support/allowed-prebuilts.txt)"
386-
error_encountered=true
387-
fi
388-
done
389-
if [ "$error_encountered" = "true" ]; then
390-
echo "Either remove this prebuilt, add it to the known extras list ($SCRIPT_ROOT/support/additional-prebuilts-to-delete.txt) or add it to the allowed prebuilts list."
391-
exit 1
392-
fi
383+
done
384+
if [ "$error_encountered" = "true" ]; then
385+
echo "Either remove this prebuilt, add it to the known extras list ($SCRIPT_ROOT/support/additional-prebuilts-to-delete.txt) or add it to the allowed prebuilts list."
386+
exit 1
393387
fi
394-
395-
else
396-
echo "Deleting all prebuilt packages..."
397-
# leave the actual directory so we can use it as a NuGet source later without problems
398-
rm -rf $TARBALL_ROOT/packages/prebuilt/*
399388
fi
400389

401390
echo 'Removing source-built, previously source-built packages and reference packages from il pkg src...'

0 commit comments

Comments
 (0)