-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
989c490
commit 14aec53
Showing
13 changed files
with
135 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# 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,15 @@ | ||
# tekartik_common_build | ||
|
||
Common build helpers: | ||
- version | ||
|
||
## Setup | ||
|
||
```yaml | ||
dependencies: | ||
tekartik_common_build: | ||
git: | ||
url: https://github.com/tekartik/app_build.dart | ||
ref: dart3a | ||
path: packages/common_build | ||
``` |
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,30 @@ | ||
# This file configures the static analysis results for your project (errors, | ||
# warnings, and lints). | ||
# | ||
# This enables the 'recommended' set of lints from `package:lints`. | ||
# This set helps identify many issues that may lead to problems when running | ||
# or consuming Dart code, and enforces writing Dart using a single, idiomatic | ||
# style and format. | ||
# | ||
# If you want a smaller set of lints you can change this to specify | ||
# 'package:lints/core.yaml'. These are just the most critical lints | ||
# (the recommended set includes the core lints). | ||
# The core lints are also what is used by pub.dev for scoring packages. | ||
|
||
include: package:lints/recommended.yaml | ||
|
||
# Uncomment the following section to specify additional rules. | ||
|
||
# linter: | ||
# rules: | ||
# - camel_case_types | ||
|
||
# analyzer: | ||
# exclude: | ||
# - path/to/excluded/files/** | ||
|
||
# For more information about the core and recommended set of lints, see | ||
# https://dart.dev/go/core-lints | ||
|
||
# For additional information about configuring this file, see | ||
# https://dart.dev/guides/language/analysis-options |
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,8 @@ | ||
// ignore: depend_on_referenced_packages | ||
import 'package:pub_semver/pub_semver.dart'; | ||
|
||
/// Package version text | ||
const packageVersionText = '1.0.0'; | ||
|
||
/// Package version | ||
final packageVersion = Version.parse(packageVersionText); |
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,25 @@ | ||
import 'package:dev_build/build_support.dart'; | ||
import 'package:path/path.dart'; | ||
import 'package:process_run/shell.dart'; | ||
import 'package:process_run/stdio.dart'; | ||
|
||
Future<void> generateVersion({String path = '.'}) async { | ||
var pubspecYamlMap = await pathGetPubspecYamlMap(path); | ||
|
||
var version = pubspecYamlGetVersion(pubspecYamlMap); | ||
var versionPackageName = 'pub_semver'; | ||
var dependencies = pubspecYamlGetDependenciesPackageName(pubspecYamlMap); | ||
var file = File(join(path, 'lib', 'src', 'version.dart')); | ||
file.parent.createSync(recursive: true); | ||
await file.writeAsString(''' | ||
${dependencies.contains(versionPackageName) ? '' : '// ignore: depend_on_referenced_packages'} | ||
import 'package:pub_semver/pub_semver.dart'; | ||
/// Package version text | ||
const packageVersionText = '$version'; | ||
/// Package version | ||
final packageVersion = Version.parse(packageVersionText); | ||
'''); | ||
await Shell(workingDirectory: path) | ||
.run('dart format ${shellArgument(file.path)}'); | ||
} |
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 @@ | ||
export 'src/version_io.dart' show generateVersion; |
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,17 @@ | ||
name: tekartik_common_build | ||
description: Common build helper. | ||
version: 1.0.0 | ||
publish_to: none; | ||
|
||
environment: | ||
sdk: ^3.5.0 | ||
|
||
# Add regular dependencies here. | ||
dependencies: | ||
dev_build: '>=1.0.0' | ||
process_run: '>=1.2.0' | ||
path: '>=1.8.0' | ||
|
||
dev_dependencies: | ||
lints: '>=4.0.0' | ||
test: '>=1.24.0' |
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,11 @@ | ||
@TestOn('vm') | ||
library; | ||
|
||
import 'package:tekartik_common_build/src/version_io.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
test('Generate Version', () async { | ||
await generateVersion(); | ||
}); | ||
} |
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
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
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 |
---|---|---|
@@ -1,14 +1,7 @@ | ||
import 'package:dev_build/package.dart'; | ||
import 'package:path/path.dart'; | ||
|
||
var topDir = '..'; | ||
|
||
Future<void> main() async { | ||
for (var dir in [ | ||
'repo_support', | ||
'firebase_build', | ||
]) { | ||
var path = join(topDir, dir); | ||
await packageRunCi(path); | ||
} | ||
await packageRunCi('..', options: PackageRunCiOptions(recursive: true)); | ||
} |