Skip to content

Commit

Permalink
feat(manager/asdf): support channel suffix on asdf-flutter (#22131)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
ronnnnn and viceice committed May 17, 2023
1 parent adacfcf commit 5207da4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
25 changes: 24 additions & 1 deletion lib/modules/manager/asdf/extract.spec.ts
Expand Up @@ -60,7 +60,7 @@ ecspresso 2.1.0
elixir 1.14.1
elm 0.19.1
erlang 25.1.2
flutter 3.7.6
flutter 3.7.6-stable
flux2 0.41.2
gauche 0.9.12
gohugo extended_0.104.3
Expand Down Expand Up @@ -516,6 +516,29 @@ dummy 1.2.3
});
});

it('can handle flutter version channel', () => {
const withChannel = extractPackageFile('flutter 3.10.0-stable');
expect(withChannel).toEqual({
deps: [
{
currentValue: '3.10.0',
datasource: 'flutter-version',
depName: 'flutter',
},
],
});
const withoutChannel = extractPackageFile('flutter 3.10.0');
expect(withoutChannel).toEqual({
deps: [
{
currentValue: '3.10.0',
datasource: 'flutter-version',
depName: 'flutter',
},
],
});
});

it('can handle java jre / jdk', () => {
const jdkRes = extractPackageFile('java adoptopenjdk-16.0.0+36');
expect(jdkRes).toEqual({
Expand Down
7 changes: 5 additions & 2 deletions lib/modules/manager/asdf/upgradeable-tooling.ts
@@ -1,3 +1,4 @@
import { regEx } from '../../../util/regex';
import { DartVersionDatasource } from '../../datasource/dart-version';
import { DockerDatasource } from '../../datasource/docker';
import { FlutterVersionDatasource } from '../../datasource/flutter-version';
Expand Down Expand Up @@ -158,9 +159,11 @@ export const upgradeableTooling: Record<string, ToolingDefinition> = {
},
flutter: {
asdfPluginUrl: 'https://github.com/oae/asdf-flutter',
config: {
config: (version) => ({
datasource: FlutterVersionDatasource.id,
},
// asdf-flutter plugin supports channel on version suffix.
currentValue: version.replace(regEx(/-(stable|beta|dev)$/), ''),
}),
},
flux2: {
asdfPluginUrl: 'https://github.com/tablexi/asdf-flux2.git',
Expand Down

0 comments on commit 5207da4

Please sign in to comment.