4
4
# ##
5
5
# ## Prepares the environment for a source build by downloading Private.SourceBuilt.Artifacts.*.tar.gz,
6
6
# ## installing the version of dotnet referenced in global.json,
7
- # ## and detecting new binaries and removing any non-SB allowed binaries.
7
+ # ## and detecting binaries and removing any non-SB allowed binaries.
8
8
# ##
9
9
# ## Options:
10
10
# ## --no-artifacts Exclude the download of the previously source-built artifacts archive
27
27
# ## Default is null.
28
28
# ## --with-sdk Use the SDK in the specified directory
29
29
# ## Default is the .NET SDK
30
- # ## --packages-source-feed URL or specified directory as the source feed for packages
30
+ # ## --with-packages URL or specified directory to use as the source feed for packages
31
31
# ## Default is the previously source-built artifacts archive
32
32
# ## --no-validate Do not run validation. Only remove the binaries.
33
33
# ## --no-clean Do not remove the binaries. Only run the validation.
@@ -133,7 +133,7 @@ while :; do
133
133
fi
134
134
shift
135
135
;;
136
- --packages-source-feed )
136
+ --with-packages )
137
137
packagesSourceFeed=$2
138
138
shift
139
139
;;
@@ -195,15 +195,22 @@ function ParseBinaryArgs {
195
195
exit 1
196
196
fi
197
197
198
- # # Attemping to run the binary tooling without a packages directory or source-feed will fail.
199
- # # So either the --with-packages flag must be passed with a valid directory or the source feed must be set using --packages-source-feed
198
+ # # Attemping to run the binary tooling without a packages directory or source-feed will fail. So either the
199
+ # # --with-packages flag must be passed with a valid directory or a pre-existing packages directory must exist.
200
200
if [ " $packagesSourceFeed " == " $defaultPackagesDir " ] && [ ! -d " $packagesSourceFeed " ]; then
201
- echo " ERROR: A pre-existing packages directory is needed if --packages-source-feed is not provided. \
201
+ echo " ERROR: A pre-existing packages directory is needed if --with-packages is not provided. \
202
202
Please either supply a packages directory using --with-packages or \
203
203
execute ./prep.sh with download artifacts enabled before proceeding. Exiting..."
204
204
exit 1
205
205
fi
206
206
207
+ # Attempting to run the binary tooling with a custom packages feed that does not
208
+ # have PackageVersions.props in the packages directory or source-feed will fail.
209
+ if [ " $packagesSourceFeed " != " $defaultPackagesDir " ] && [ ! -f " $packagesSourceFeed /PackageVersions.props" ]; then
210
+ echo " ERROR: PackageVersions.props is needed in the packages directory or source-feed. Exiting..."
211
+ exit 1
212
+ fi
213
+
207
214
# Unpack the previously built packages if the previously built packages directory is empty and
208
215
# if we're using the default artifacts
209
216
previouslyBuiltPackagesDir=" $defaultPackagesDir /previously-source-built"
@@ -213,10 +220,12 @@ function ParseBinaryArgs {
213
220
echo " Unpacking previously built artifacts from ${packageArtifacts} to $previouslyBuiltPackagesDir "
214
221
mkdir -p " $previouslyBuiltPackagesDir "
215
222
tar -xzf ${packageArtifacts} -C " $previouslyBuiltPackagesDir "
223
+ tar -xzf ${packageArtifacts} -C " $previouslyBuiltPackagesDir " PackageVersions.props
224
+ packagesSourceFeed=" $previouslyBuiltPackagesDir "
216
225
else
217
- echo " ERROR: A pre-existing package archive is needed if --packages-source-feed is not provided. \
218
- Please either supply a source-feed using --packages-source-feed or \
219
- execute ./prep.sh with with download artifacts enabled before proceeding. Exiting..."
226
+ echo " ERROR: A pre-existing package archive is needed if --with-packages is not provided. \
227
+ Please either supply a source-feed using --with-packages or execute ./prep.sh with \
228
+ download artifacts enabled before proceeding. Exiting..."
220
229
exit 1
221
230
fi
222
231
fi
@@ -289,11 +298,8 @@ function RunBinaryTool {
289
298
# Set the environment variable for the packages source feed
290
299
export ARTIFACTS_PATH=" $packagesSourceFeed "
291
300
292
- # Get the runtime version
293
- runtimeVersion=$( " $dotnetSdk /dotnet" --list-runtimes | tail -n 1 | awk ' {print $2}' )
294
-
295
301
# Run the BinaryDetection tool
296
- " $dotnetSdk /dotnet" run --project " $BinaryTool " -c Release -p RuntimeVersion =" $runtimeVersion " " $TargetDir " " $OutputDir " -ab " $allowedBinaries " -db " $disallowedSbBinaries " -m $mode -l Debug
302
+ " $dotnetSdk /dotnet" run --project " $BinaryTool " -c Release -p PackagesPropsDirectory =" $packagesSourceFeed " " $TargetDir " " $OutputDir " -ab " $allowedBinaries " -db " $disallowedSbBinaries " -m $mode -l Debug
297
303
}
298
304
299
305
# Check for the version of dotnet to install
0 commit comments