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

New download urls #7576

Merged
merged 9 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion app/lib/tool/test_profile/import_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ class _PubDevImportSource implements ImportSource {
final file = File(p.join(archiveCachePath, archiveName));
// download package archive if not already in the cache
if (!await file.exists()) {
// TODO: Use archive_url from version-listing, that is stable!
jonasfj marked this conversation as resolved.
Show resolved Hide resolved
final rs = await _client.get(Uri.parse(
'${urls.siteRoot}${urls.pkgArchiveDownloadUrl(package, version)}'));
'${urls.siteRoot}/packages/$package/versions/$version.tar.gz',
));
await file.parent.create(recursive: true);
await file.writeAsBytes(rs.bodyBytes);
}
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/pkg_versions_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ <h2 id="stable">Stable versions of oxygen</h2>
</a>
</td>
<td class="archive">
<a href="/packages/oxygen/versions/1.2.0.tar.gz" rel="nofollow" title="Download oxygen 1.2.0 archive">
<a href="/api/archives/oxygen-1.2.0.tar.gz" rel="nofollow" title="Download oxygen 1.2.0 archive">
<img class="version-table-icon" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 1.2.0 archive" width="24" height="24"/>
</a>
</td>
Expand All @@ -270,7 +270,7 @@ <h2 id="stable">Stable versions of oxygen</h2>
</td>
<td class="documentation"></td>
<td class="archive">
<a href="/packages/oxygen/versions/1.0.0.tar.gz" rel="nofollow" title="Download oxygen 1.0.0 archive">
<a href="/api/archives/oxygen-1.0.0.tar.gz" rel="nofollow" title="Download oxygen 1.0.0 archive">
<img class="version-table-icon" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 1.0.0 archive" width="24" height="24"/>
</a>
</td>
Expand Down Expand Up @@ -315,7 +315,7 @@ <h2 id="prerelease">Prerelease versions of oxygen</h2>
</a>
</td>
<td class="archive">
<a href="/packages/oxygen/versions/2.0.0-dev.tar.gz" rel="nofollow" title="Download oxygen 2.0.0-dev archive">
<a href="/api/archives/oxygen-2.0.0-dev.tar.gz" rel="nofollow" title="Download oxygen 2.0.0-dev archive">
<img class="version-table-icon" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 2.0.0-dev archive" width="24" height="24"/>
</a>
</td>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/handlers/custom_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void main() {
'topics': ['chemical-element'],
},
'archive_url':
'${activeConfiguration.primaryApiUri}/packages/oxygen/versions/1.2.0.tar.gz',
'${activeConfiguration.primaryApiUri}/api/archives/oxygen-1.2.0.tar.gz',
'package_url':
'${activeConfiguration.primaryApiUri}/api/packages/oxygen',
'url':
Expand Down Expand Up @@ -80,7 +80,7 @@ void main() {
'topics': ['chemical-element'],
},
'archive_url':
'${activeConfiguration.primaryApiUri}/packages/flutter_titanium/versions/1.10.0.tar.gz',
'${activeConfiguration.primaryApiUri}/api/archives/flutter_titanium-1.10.0.tar.gz',
'package_url':
'${activeConfiguration.primaryApiUri}/api/packages/flutter_titanium',
'url':
Expand Down Expand Up @@ -109,7 +109,7 @@ void main() {
'topics': ['chemical-element'],
},
'archive_url':
'${activeConfiguration.primaryApiUri}/packages/neon/versions/1.0.0.tar.gz',
'${activeConfiguration.primaryApiUri}/api/archives/neon-1.0.0.tar.gz',
'package_url':
'${activeConfiguration.primaryApiUri}/api/packages/neon',
'url':
Expand Down
2 changes: 1 addition & 1 deletion app/test/frontend/handlers/invalid_package_url_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void main() {
expect(urls, contains('/packages/<package>/versions/<version>'));
expect(urls, contains('/api/packages/<package>'));
// this a naive assertion that fails, if new end-points are introduced!
expect(urls, hasLength(43), reason: 'check if new end-points was added');
expect(urls, hasLength(44), reason: 'check if new end-points was added');
});

testWithProfile(
Expand Down
2 changes: 1 addition & 1 deletion app/test/frontend/templates_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import 'handlers/_utils.dart';

const String goldenDir = 'test/frontend/golden';

final _regenerateGoldens = false;
final _regenerateGoldens = true;

void main() {
group('templates', () {
Expand Down
4 changes: 2 additions & 2 deletions app/test/shared/urls_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ void main() {
group('archive url', () {
test('without base uri', () {
expect(pkgArchiveDownloadUrl('foo', '1.0.0+1'),
'/packages/foo/versions/1.0.0%2B1.tar.gz');
'/api/archives/foo-1.0.0%2B1.tar.gz');
});

test('with base uri', () {
expect(
pkgArchiveDownloadUrl('foo', '1.0.0+1',
baseUri: Uri.parse('https://pub.dev/')),
'https://pub.dev/packages/foo/versions/1.0.0%2B1.tar.gz',
'https://pub.dev/api/archives/foo-1.0.0%2B1.tar.gz',
);
});
});
Expand Down
16 changes: 12 additions & 4 deletions app/test/task/end2end_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,20 @@ void expectGoldenFile(
expect(xmlContent.split('\n'), golden.split('\n'), reason: 'in $fileName');
}

final _sdkVersionsToReplace = [
runtimeSdkVersion,
toolStableDartSdkVersion,
Platform.version.split(' ').first,
];

final _goldenReplacements = <Pattern, String>{
'Pana <code>$panaVersion</code>,': 'Pana <code>%%pana-version%%</code>,',
'Dart <code>$runtimeSdkVersion</code>':
'Dart <code>%%stable-dart-version%%</code>',
'Dart <code>$toolStableDartSdkVersion</code>':
'Dart <code>%%stable-dart-version%%</code>',
for (final sdkVersion in _sdkVersionsToReplace)
'api.dart.dev/stable/$sdkVersion/':
'api.dart.dev/stable/%%stable-dart-version%%/',
for (final sdkVersion in _sdkVersionsToReplace)
'Dart <code>$sdkVersion</code>':
'Dart <code>%%stable-dart-version%%</code>',
'/static/hash-${staticFileCache.etag}/': '/static/hash-%%etag%%/',
_timestampPattern: '%%timestamp%%',
_escapedTimestampPattern: '%%escaped-timestamp%%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h2>Constructors</h2>
(
<span class="parameter" id="-param-text">
<span class="type-annotation">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/String-class.html">String</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/String-class.html">String</a>
</span>
<span class="parameter-name">text</span>
</span>
Expand All @@ -86,11 +86,11 @@ <h2>Properties</h2>
<dl class="properties">
<dt id="hashCode" class="property inherited">
<span class="name">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/Object/hashCode.html">hashCode</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/Object/hashCode.html">hashCode</a>
</span>
<span class="signature">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/int-class.html">int</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/int-class.html">int</a>
</span>
</dt>
<dd class="inherited">
Expand All @@ -102,11 +102,11 @@ <h2>Properties</h2>
</dd>
<dt id="runtimeType" class="property inherited">
<span class="name">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/Object/runtimeType.html">runtimeType</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/Object/runtimeType.html">runtimeType</a>
</span>
<span class="signature">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/Type-class.html">Type</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/Type-class.html">Type</a>
</span>
</dt>
<dd class="inherited">
Expand All @@ -122,7 +122,7 @@ <h2>Properties</h2>
</span>
<span class="signature">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/String-class.html">String</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/String-class.html">String</a>
</span>
</dt>
<dd>
Expand All @@ -137,14 +137,14 @@ <h2>Methods</h2>
<dl class="callables">
<dt id="noSuchMethod" class="callable inherited">
<span class="name">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/Object/noSuchMethod.html">noSuchMethod</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/Object/noSuchMethod.html">noSuchMethod</a>
</span>
<span class="signature">
(
<wbr/>
<span class="parameter" id="noSuchMethod-param-invocation">
<span class="type-annotation">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/Invocation-class.html">Invocation</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/Invocation-class.html">Invocation</a>
</span>
<span class="parameter-name">invocation</span>
</span>
Expand All @@ -168,7 +168,7 @@ <h2>Methods</h2>
)
<span class="returntype parameter">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/String-class.html">String</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/String-class.html">String</a>
</span>
</span>
</dt>
Expand All @@ -187,7 +187,7 @@ <h2>Methods</h2>
)
<span class="returntype parameter">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/String-class.html">String</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/String-class.html">String</a>
</span>
</span>
</dt>
Expand All @@ -204,21 +204,21 @@ <h2>Operators</h2>
<dl class="callables">
<dt id="operator ==" class="callable inherited">
<span class="name">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/Object/operator_equals.html">operator ==</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/Object/operator_equals.html">operator ==</a>
</span>
<span class="signature">
(
<wbr/>
<span class="parameter" id="==-param-other">
<span class="type-annotation">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/Object-class.html">Object</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/Object-class.html">Object</a>
</span>
<span class="parameter-name">other</span>
</span>
)
<span class="returntype parameter">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/bool-class.html">bool</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/bool-class.html">bool</a>
</span>
</span>
</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h1>
<li>
<span class="parameter" id="-param-text">
<span class="type-annotation">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/String-class.html">String</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/String-class.html">String</a>
</span>
<span class="parameter-name">text</span>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h1>
</h1>
</div>
<div class="multi-line-signature">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/String-class.html">String</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/String-class.html">String</a>
<span class="name ">text</span>
<div class="features">
<span class="feature">final</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h1>
</div>
<div class="multi-line-signature">
<span class="returntype">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/String-class.html">String</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/String-class.html">String</a>
</span>
<span class="name ">toLowerCase</span>
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ <h1>
<ol class="annotation-list">
<li>
@
<a href="https://api.dart.dev/stable/3.3.0/dart-core/override-constant.html">override</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/override-constant.html">override</a>
</li>
</ol>
</div>
<span class="returntype">
<a href="https://api.dart.dev/stable/3.3.0/dart-core/String-class.html">String</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/String-class.html">String</a>
</span>
<span class="name ">toString</span>
(
Expand All @@ -89,7 +89,7 @@ <h1>
Some classes have a default textual representation, often paired with a static
<code>parse</code>
function (like
<a href="https://api.dart.dev/stable/3.3.0/dart-core/int/parse.html" rel="ugc">int.parse</a>
<a href="https://api.dart.dev/stable/%%stable-dart-version%%/dart-core/int/parse.html" rel="ugc">int.parse</a>
). These classes will provide the textual representation as their string representation.
</p>
<p>
Expand Down
Loading
Loading