Skip to content

Commit f64f207

Browse files
Merge pull request #89 from datalogics-josepha/build-change
Change how we get packages off the raid.
2 parents 56c5c4a + 59fa6c9 commit f64f207

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
lines changed

tasks.py

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import pathlib
77
import xml.etree.ElementTree as ET
8+
import shutil
89

910
samples_list = [
1011
'Annotations/Annotations/',
@@ -133,6 +134,14 @@ def clean_nuget_cache(ctx):
133134
def build_samples(ctx, pkg_name='Adobe.PDF.Library.NET', config='Debug'):
134135
"""Builds the .NET samples"""
135136
ctx.run('invoke clean-samples')
137+
138+
sourceFeed = 'https://api.nuget.org/v3/index.json'
139+
140+
if config == 'Release':
141+
get_public_packages()
142+
elif config == 'Debug':
143+
get_nightly_packages()
144+
136145
for sample in samples_list:
137146
full_path = os.path.join(os.getcwd(), sample)
138147
if 'DrawSeparations' in sample or 'DocToImages' in sample:
@@ -145,10 +154,10 @@ def build_samples(ctx, pkg_name='Adobe.PDF.Library.NET', config='Debug'):
145154
last_directory = os.path.basename(os.path.dirname(full_path))
146155
full_name = full_path + last_directory + '.csproj'
147156
set_nuget_pkg_version(pathlib.Path(full_name), package=pkg_name)
148-
if config == 'Release':
149-
ctx.run(live_source_build())
150-
elif config == 'Debug':
151-
ctx.run(nightly_source_build())
157+
158+
packagesPath = os.getcwd()
159+
160+
ctx.run(f'dotnet build --source {sourceFeed} --source {packagesPath}')
152161

153162

154163
@task()
@@ -172,41 +181,41 @@ def run_samples(ctx):
172181
ctx.run(f'dotnet run --no-build')
173182

174183

175-
def live_source_build():
184+
def copy_packages_locally(libraryPackages):
185+
for package in libraryPackages:
186+
shutil.copy(package, os.getcwd())
187+
188+
189+
def get_public_packages():
176190
"""Locations of packages that are live"""
177191
if platform.system() == 'Darwin':
178-
return (f'dotnet build '
179-
'--source https://api.nuget.org/v3/index.json '
180-
'--source /Volumes/raid/products/released/APDFL/nuget/DotNET/for_apdfl_18.0.5Plus/approved/current '
181-
'--source /Volumes/raid/products/released/APDFL/nuget/SampleInputFile/for_apdfl_18.0.4Plus/approved/current ')
192+
libraryPackagePath = '/Volumes/raid/products/released/APDFL/nuget/DotNET/for_apdfl_18.0.5Plus/approved/current'
193+
sampleInputPackagePath = '/Volumes/raid/products/released/APDFL/nuget/SampleInputFile/for_apdfl_18.0.4Plus/approved/current'
182194
elif platform.system() == 'Windows':
183-
return (f'dotnet build '
184-
'--source https://api.nuget.org/v3/index.json '
185-
'--source \\\\ivy\\raid\\products\\released\\APDFL\\nuget\\DotNET\\for_apdfl_18.0.5Plus\\approved\\current '
186-
187-
'--source \\\\ivy\\raid\\products\\released\\APDFL\\nuget\\SampleInputFile\\for_apdfl_18.0.4Plus\\approved\\current ')
195+
libraryPackagePath = '\\\\ivy\\raid\\products\\released\\APDFL\\nuget\\DotNET\\for_apdfl_18.0.5Plus\\approved\\current'
196+
sampleInputPackagePath = '\\\\ivy\\raid\\products\\released\\APDFL\\nuget\\SampleInputFile\\for_apdfl_18.0.4Plus\\approved\\current'
188197
else:
189-
return (f'dotnet build '
190-
'--source https://api.nuget.org/v3/index.json '
191-
'--source /raid/products/released/APDFL/nuget/DotNET/for_apdfl_18.0.5Plus/approved/current '
192-
'--source /raid/products/released/APDFL/nuget/SampleInputFile/for_apdfl_18.0.4Plus/approved/current ')
198+
libraryPackagePath = '/raid/products/released/APDFL/nuget/DotNET/for_apdfl_18.0.5Plus/approved/current'
199+
sampleInputPackagePath = '/raid/products/released/APDFL/nuget/SampleInputFile/for_apdfl_18.0.4Plus/approved/current'
200+
201+
libraryPackages = [os.path.join(libraryPackagePath, item) for item in os.listdir(libraryPackagePath)]
202+
sampleInputPackages = [os.path.join(sampleInputPackagePath, item) for item in os.listdir(sampleInputPackagePath)]
203+
204+
copy_packages_locally(libraryPackages + sampleInputPackages)
193205

194206

195-
def nightly_source_build():
207+
def get_nightly_packages():
196208
"""Locations of nightly packages. Note: These paths will only work on the nuget-builder build machine"""
197209
if platform.system() == 'Darwin':
198-
return (f'dotnet build '
199-
'--source https://api.nuget.org/v3/index.json '
200-
'--source /Volumes/raid/nuget-builder-samples-test ')
210+
libraryPackagePath = '/Volumes/raid/nuget-builder-samples-test'
201211
elif platform.system() == 'Windows':
202-
return (f'dotnet build '
203-
'--source https://api.nuget.org/v3/index.json '
204-
'--source \\\\ivy\\raid\\nuget-builder-samples-test ')
212+
libraryPackagePath = '\\\\ivy\\raid\\nuget-builder-samples-test'
205213
else:
206-
return (f'dotnet build '
207-
'--source https://api.nuget.org/v3/index.json '
208-
'--source /raid/nuget-builder-samples-test ')
214+
libraryPackagePath = '/raid/nuget-builder-samples-test'
215+
216+
libraryPackages = [os.path.join(libraryPackagePath, item) for item in os.listdir(libraryPackagePath)]
209217

218+
copy_packages_locally(libraryPackages)
210219

211220

212221
tasks = []

0 commit comments

Comments
 (0)