Skip to content

Commit

Permalink
Upgrade pana to 0.22.0 (dart-lang#7472)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Feb 9, 2024
1 parent d32ab0b commit 0d675e9
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 41 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Important changes to data models, configuration, and migrations between each
AppEngine version, listed here to ease deployment and troubleshooting.

## Next Release (replace with git tag when deployed)
* Bumped runtimeVersion to `2024.02.09`.
* Upgraded pana to `0.22.0`.
* Note: applied rate limit on search endpoints.

## `20240206t104500-all`
Expand Down
8 changes: 4 additions & 4 deletions app/lib/frontend/static_files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:crypto/crypto.dart' as crypto;
import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
import 'package:mime/mime.dart' as mime;
import 'package:pana/pana.dart' show runProc;
import 'package:pana/pana.dart' show runConstrained;
import 'package:path/path.dart' as path;

final _logger = Logger('pub.static_files');
Expand Down Expand Up @@ -297,7 +297,7 @@ Future<DateTime> _detectLastModified(Directory dir) async {
}

Future _runPubGet(Directory dir) async {
final pr = await runProc(
final pr = await runConstrained(
['dart', 'pub', 'get'],
workingDirectory: dir.path,
timeout: Duration(minutes: 2),
Expand Down Expand Up @@ -346,7 +346,7 @@ Future<void> updateWebAppBuild() async {
final webAppDir = Directory(resolveWebAppDirPath());

await _runPubGet(webAppDir);
final pr = await runProc(
final pr = await runConstrained(
['/bin/sh', 'build.sh'],
workingDirectory: webAppDir.path,
timeout: const Duration(minutes: 2),
Expand All @@ -364,7 +364,7 @@ Future<void> updateWebAppBuild() async {
Future<void> updateWebCssBuild() async {
final webCssDir = Directory(resolveWebCssDirPath());
await _runPubGet(webCssDir);
final pr = await runProc(
final pr = await runConstrained(
['/bin/sh', 'build.sh'],
workingDirectory: webCssDir.path,
timeout: const Duration(minutes: 2),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/service/openid/openssl_commands.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Future<bool> verifyTextWithRsaSignature({
await signatureFile.writeAsBytes(signature);
final publicKeyFile = File(p.join(dir.path, 'public.pem'));
await publicKeyFile.writeAsString(publicKey.asPemString);
final pr = await runProc(
final pr = await runConstrained(
[
'openssl',
'dgst',
Expand Down
4 changes: 2 additions & 2 deletions app/lib/shared/versions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ final RegExp runtimeVersionPattern = RegExp(r'^\d{4}\.\d{2}\.\d{2}$');
/// when the version switch happens.
const _acceptedRuntimeVersions = <String>[
// The current [runtimeVersion].
'2024.02.05',
'2024.02.09',
// Fallback runtime versions.
'2024.02.05',
'2024.01.30',
'2024.01.22',
];

/// Sets the current runtime versions.
Expand Down
14 changes: 9 additions & 5 deletions app/lib/tool/test_profile/resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'dart:io';
import 'package:_pub_shared/data/package_api.dart' as package_api;
import 'package:basics/basics.dart';
import 'package:http/http.dart' as http;
import 'package:pana/pana.dart' show ToolEnvironment;
import 'package:pana/pana.dart' show SdkConfig, ToolEnvironment;
import 'package:path/path.dart' as p;

import '../../shared/configuration.dart';
Expand All @@ -29,10 +29,14 @@ Future<List<ResolvedVersion>> resolveVersions(
await pubCacheDir.create();

final toolEnv = await ToolEnvironment.create(
dartSdkDir: activeConfiguration.tools?.previewDartSdkPath ??
activeConfiguration.tools?.stableDartSdkPath,
flutterSdkDir: activeConfiguration.tools?.previewFlutterSdkPath ??
activeConfiguration.tools?.stableFlutterSdkPath,
dartSdkConfig: SdkConfig(
rootPath: activeConfiguration.tools?.previewDartSdkPath ??
activeConfiguration.tools?.stableDartSdkPath,
),
flutterSdkConfig: SdkConfig(
rootPath: activeConfiguration.tools?.previewFlutterSdkPath ??
activeConfiguration.tools?.stableFlutterSdkPath,
),
pubCacheDir: pubCacheDir.path,
);

Expand Down
4 changes: 2 additions & 2 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ packages:
dependency: "direct main"
description:
name: pana
sha256: "3fc3fe8e7a9fd4827fa4d625a423eec95d305b2bc3538a3adf7fd6c49217af97"
sha256: "7112322f009656dbc3a71653bd981c55f3ed9a5625b8b4edec9b07e47564e073"
url: "https://pub.dev"
source: hosted
version: "0.21.45"
version: "0.22.0"
path:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies:
watcher: ^1.0.0
yaml: '^3.0.0'
# pana version to be pinned
pana: '0.21.45'
pana: '0.22.0'
# 3rd-party packages with pinned versions
mailer: '6.0.1'
ulid: '2.0.0'
Expand Down
2 changes: 1 addition & 1 deletion app/test/dartdoc/dartdoc_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void main() {
}
await Directory(pubCacheDir).create(recursive: true);
toolEnv = await ToolEnvironment.create(
globalDartdocVersion: dartdocVersion,
dartdocVersion: dartdocVersion,
pubCacheDir: pubCacheDir,
);
await toolEnv.runUpgrade(pkgDir, false);
Expand Down
6 changes: 3 additions & 3 deletions app/test/service/openid/openssl_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Future<RsaKeyPair> generateRsaKeyPair({
return withTempDirectory((dir) async {
final privateKeyPath = p.join(dir.path, 'private-$uuid.pem');
final publicKeyPath = p.join(dir.path, 'public-$uuid.pem');
final pr1 = await runProc(
final pr1 = await runConstrained(
[
'openssl',
'genrsa',
Expand All @@ -47,7 +47,7 @@ Future<RsaKeyPair> generateRsaKeyPair({
privateContent.replaceAll(' RSA PRIVATE KEY', ' PRIVATE KEY'))
.single;

final pr2 = await runProc(
final pr2 = await runConstrained(
[
'openssl',
'rsa',
Expand Down Expand Up @@ -86,7 +86,7 @@ Future<Uint8List> signTextWithRsa({
await privateKeyFile.writeAsString(
encodePemBlock(PemLabel.privateKey, privateKey)
.replaceAll(' PRIVATE KEY', ' RSA PRIVATE KEY'));
final pr = await runProc(
final pr = await runConstrained(
[
'openssl',
'dgst',
Expand Down
2 changes: 1 addition & 1 deletion app/test/shared/versions_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ and do not format to also bump the runtimeVersion.''',
final content =
await File('../pkg/pub_worker/lib/src/bin/pana_wrapper.dart')
.readAsString();
expect(content, contains("globalDartdocVersion: '$dartdocVersion'"));
expect(content, contains("dartdocVersion: '$dartdocVersion'"));
});

scopedTest('GC is not deleting currently accepted versions', () {
Expand Down
4 changes: 2 additions & 2 deletions app/test/task/testdata/goldens/packages/oxygen/score.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ <h3>
,
<strong>Windows</strong>
,
<strong>MacOS</strong>
<strong>macOS</strong>
,
<strong>Linux</strong>
)
Expand All @@ -436,7 +436,7 @@ <h3>
<li>✓ iOS</li>
<li>✓ Windows</li>
<li>✓ Linux</li>
<li>MacOS</li>
<li>macOS</li>
<li>✓ Web</li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ <h3>
,
<strong>Windows</strong>
,
<strong>MacOS</strong>
<strong>macOS</strong>
,
<strong>Linux</strong>
)
Expand All @@ -440,7 +440,7 @@ <h3>
<li>✓ iOS</li>
<li>✓ Windows</li>
<li>✓ Linux</li>
<li>MacOS</li>
<li>macOS</li>
<li>✓ Web</li>
</ul>
</div>
Expand Down
25 changes: 11 additions & 14 deletions pkg/pub_worker/lib/src/bin/pana_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,18 @@ Future<void> main(List<String> args) async {
}

final toolEnv = await ToolEnvironment.create(
dartSdkDir: dartSdk?.path,
flutterSdkDir: flutterSdk?.path,
dartSdkConfig: SdkConfig(
rootPath: dartSdk?.path,
configHomePath: configDir,
),
flutterSdkConfig: SdkConfig(
rootPath: flutterSdk?.path,
configHomePath: configDir,
),
pubCacheDir: pubCache,
panaCacheDir: Platform.environment['PANA_CACHE'],
environment: {
'CI': 'true',
if (configDir != null) 'XDG_CONFIG_HOME': configDir,
},
useGlobalDartdoc: true,
// keep in-sync with app/lib/shared/versions.dart
globalDartdocVersion: '8.0.4',
dartdocVersion: '8.0.4',
);

//final dartdocOutputDir =
Expand All @@ -132,16 +133,12 @@ Future<void> main(List<String> args) async {
version: version,
options: InspectOptions(
pubHostedUrl: Platform.environment['PUB_HOSTED_URL']!,
checkRemoteRepository: true,
dartdocTimeout: _dartdocTimeout,
dartdocOutputDir: rawDartdocOutputFolder.path,
resourcesOutputDir: resourcesOutputDir.path,
totalTimeout: _dartdocTimeout,
),
logger: _log,
storeResource: (filename, data) async {
final file = File(p.join(resourcesOutputDir.path, filename));
await file.parent.create(recursive: true);
await file.writeAsBytes(data);
},
);

await postPorcessDartdoc(
Expand Down
4 changes: 2 additions & 2 deletions pkg/pub_worker/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ packages:
dependency: "direct main"
description:
name: pana
sha256: "3fc3fe8e7a9fd4827fa4d625a423eec95d305b2bc3538a3adf7fd6c49217af97"
sha256: "7112322f009656dbc3a71653bd981c55f3ed9a5625b8b4edec9b07e47564e073"
url: "https://pub.dev"
source: hosted
version: "0.21.45"
version: "0.22.0"
path:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pkg/pub_worker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
appengine: ^0.13.6
json_annotation: ^4.3.0
jsontool: ^1.1.0
pana: ^0.21.45
pana: ^0.22.0
lints: ^3.0.0 # required for pana
meta: ^1.7.0
api_builder:
Expand Down

0 comments on commit 0d675e9

Please sign in to comment.