-
Notifications
You must be signed in to change notification settings - Fork 50
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
[infra] script to change deps to path dependencies #817
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Please keep consistent with .pubignore. | ||
|
||
# https://dart.dev/guides/libraries/private-files | ||
# Created by `dart pub` | ||
.dart_tool/ | ||
|
||
# Avoid committing pubspec.lock for library packages; see | ||
# https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
pubspec.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:glob/glob.dart'; | ||
import 'package:glob/list_local_fs.dart'; | ||
import 'package:yaml_edit/yaml_edit.dart'; | ||
import 'package:yaml/yaml.dart'; | ||
|
||
void main(List<String> args) { | ||
final root = Platform.script.resolve('../../'); | ||
final glob = Glob('**pubspec.yaml'); | ||
final files = glob.listSync(root: root.toFilePath()).whereType<File>(); | ||
for (final file in files) { | ||
final yamlEditor = YamlEditor(file.readAsStringSync()); | ||
final yaml = yamlEditor.parseAt([]); | ||
if (yaml is! YamlMap) { | ||
continue; | ||
} | ||
final dependencies = yaml['dependencies']; | ||
if (dependencies is! YamlMap) { | ||
continue; | ||
} | ||
for (final package in dependencies.keys) { | ||
if (!packagesToPin.contains(package)) { | ||
continue; | ||
} | ||
yamlEditor.update( | ||
['dependencies', package], | ||
{ | ||
// Some packages contain full test projects that are copied in unit | ||
// tests. So, use absolute paths. | ||
'path': | ||
root.resolve('pkgs/$package/').toFilePath().replaceAll(r'\', '/'), | ||
}, | ||
); | ||
} | ||
if (yamlEditor.edits.isEmpty) { | ||
continue; | ||
} | ||
yamlEditor.update(['publish_to'], 'none'); | ||
file.writeAsStringSync(yamlEditor.toString()); | ||
} | ||
} | ||
|
||
const packagesToPin = { | ||
'native_assets_builder', | ||
'native_assets_cli', | ||
'native_toolchain_c', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: tools_for_dart_lang_native | ||
description: >- | ||
Some helper scripts for https://github.com/dart-lang/native. | ||
version: 0.1.0 | ||
repository: https://github.com/dart-lang/native/tree/main/pkgs/native_assets_builder | ||
|
||
publish_to: none | ||
|
||
environment: | ||
sdk: '>=3.0.0 <4.0.0' | ||
|
||
dependencies: | ||
glob: ^2.1.2 | ||
yaml_edit: ^2.1.1 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HosseinYousefi Would this be useful for package:jnigen and package:jni as well? So that jnigen is both tested against the published package:jni and against the package:jni in the repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we release both of the versions together, expecting users to use the latests of both, so I don't think it's necessary.