Skip to content

Commit

Permalink
Merge pull request #6 from ziqq/feat/github-5/namespace-in-build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
ziqq authored Sep 11, 2024
2 parents d1663f8 + 7ae4563 commit 4199cd7
Show file tree
Hide file tree
Showing 135 changed files with 4,602 additions and 801 deletions.
2 changes: 1 addition & 1 deletion .fvm/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.22.3
3.24.1
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
title: "[Bug]: "
labels: "bug"
assignees: ""
---

Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
title: "[Feature]: "
labels: "new feature"
assignees: ""
---

Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Checkout

on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
Expand Down Expand Up @@ -82,20 +83,6 @@ jobs:
timeout-minutes: 1
run: dart analyze --fatal-infos --fatal-warnings lib/

# - name: 👀 Verify versions
# id: verify-versions
# timeout-minutes: 1
# run: |
# test -f pubspec.yaml && test -f lib/src/model/pubspec.yaml.g.dart
# version_pubspec=$(grep '^version:' pubspec.yaml | awk '{print $2}' | sed 's/[^[:print:]]//g')
# version_dart=$(grep 'representation: r' lib/src/model/pubspec.yaml.g.dart | awk -F"'" '{print $2}' | sed 's/[^[:print:]]//g')
# test -n "$version_pubspec" && test -n "$version_dart"
# echo "Version from pubspec.yaml: '$version_pubspec'"
# echo "Version from pubspec.yaml.g.dart: '$version_dart'"
# echo "$version_pubspec" > /tmp/version_pubspec
# echo "$version_dart" > /tmp/version_dart
# diff /tmp/version_pubspec /tmp/version_dart

- name: 🧪 Run tests
id: run-tests
timeout-minutes: 2
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy to Pub.dev

on:
workflow_dispatch:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"

jobs:
deploy:
name: "Deploy to Pub.dev"
permissions:
id-token: write # Required for authentication using OIDC
runs-on: ubuntu-latest
container:
image: plugfox/flutter:stable
options: --user root
steps:
# Checkout repository
- name: 🚂 Get latest code
uses: actions/checkout@v4

- name: 🗄️ Export pub cache directory
run: |
git config --global --add safe.directory /opt/flutter
export PUB_CACHE=$PWD/.pub_cache/
- name: 🚃 Cache pub modules
id: cache-pub-modules
uses: actions/cache@v3
env:
cache-name: cache-pub-modules
with:
key: ${{ runner.os }}-pub-${{ env.cache-name }}
path: |
$PWD/.pub_cache/
$PWD/.dart_tool/
$PWD/.flutter-plugins
$PWD/.flutter-plugins-dependencies
$PWD/.packages
- name: 👷 Get dependencies
run: |
flutter pub get
timeout-minutes: 5

- name: 🏗️ Publish - dry run
run: flutter pub publish --dry-run
timeout-minutes: 5

- name: 🔥 Publish to pub.dev
run: yes | flutter pub publish -f --skip-validation
timeout-minutes: 5
16 changes: 12 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
"version": "0.2.0",
"configurations": [
{
"name": "[debug] Run app (development)",
"name": "Run Example",
"type": "dart",
"request": "launch",
"cwd": "${workspaceFolder}/example",
"args": [
// "--dart-define-from-file=config/development.json",
// "--dart-define=octopus.logs=true",
// "--dart-define=octopus.measure=false"
],
"env": {}
},
{
"name": "Run Example Gradle 8",
"type": "dart",
"request": "launch",
"cwd": "${workspaceFolder}/example_gradle_8",
"args": [
// "--dart-define-from-file=config/development.json",
],
"env": {}
},
Expand All @@ -27,7 +35,7 @@
"toolArgs": [
"--color",
"--reporter=expanded",
"--file-reporter=json:.coverage/tests.json",
"--file-reporter=json:coverage/tests.json",
"--timeout=30s",
"--concurrency=12"
/* "--name=handles failed connection attempts" */
Expand Down
10 changes: 8 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.foldingImportsByDefault": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
Expand All @@ -36,7 +37,9 @@
"**.pb.dart",
"**.pbenum.dart",
"**.pbjson.dart",
"**/generated/**"
"**/generated/**",
"**.endpoint.dart",
"**_endpoint.dart"
],
"dart.flutterSdkPath": ".fvm/versions/stable",
"search.exclude": {
Expand All @@ -55,11 +58,14 @@
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"pubspec.yaml": ".flutter-plugins, .packages, .dart_tool, .flutter-plugins-dependencies, .metadata, .packages, pubspec.lock, build.yaml, analysis_options.yaml, all_lint_rules.yaml, dart*.yaml, flutter*.yaml, icons_launcher.yaml",
"pubspec.yaml": ".flutter-plugins, .packages, .dart_tool, .flutter-plugins-dependencies, .metadata, .packages, pubspec.lock, build.yaml, analysis_options.yaml, all_lint_rules.yaml, dart*.yaml, flutter*.yaml, icons_launcher.yaml, devtools_options.yaml, l10n.yaml",
".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*",
"readme*": "authors, backers.md, changelog*, citation*, code_of_conduct.md, codeowners, contributing.md, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors.md",
"*.dart": "$(capture).g.dart, $(capture).gr.dart, $(capture).freezed.dart, $(capture).config.dart, $(capture).mocks.dart, $(capture).router.dart, $(capture).locator.dart, $(capture)_skeleton.dart"
},
"files.associations": {
"*.drift": "sql"
},
"highlight.regexes": {
"(\"@\\s*.+\":\\s{0,1}{},)": {
"filterFileRegex": ".*\\.arb",
Expand Down
59 changes: 42 additions & 17 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "2.0.0",
"tasks": [
{
"label": "Dependencies",
"label": "dart:pub:get",
"type": "shell",
"command": [
"flutter pub get"
Expand All @@ -14,10 +14,10 @@
"problemMatcher": []
},
{
"label": "Format",
"label": "dart:format",
"type": "shell",
"command": [
"dart format --fix -l 120"
"dart format --fix -l 80"
],
"group": {
"kind": "none",
Expand All @@ -26,22 +26,37 @@
"problemMatcher": []
},
{
"label": "Codegeneration",
"label": "dart:build_runner:dir",
"type": "shell",
"dependsOn": [
"Dependencies"
"command": [
"dart run build_runner build --build-filter '${fileDirname}/*.dart'"
],
"group": {
"kind": "none",
"isDefault": true
},
"problemMatcher": [],
"dependsOn": [
"dart:pub:get"
]
},{
"label": "example:dart:build_runner:dir",
"type": "shell",
"command": [
"dart run build_runner build --delete-conflicting-outputs"
"dart run build_runner build --build-filter '${fileDirname}/*.dart'",
"&& dart format --fix -l 80 '${fileDirname}'"
],
"group": {
"kind": "none",
"isDefault": true
},
"problemMatcher": []
"problemMatcher": [],
"dependsOn": [
"dart:pub:get"
]
},
{
"label": "Clear build",
"label": "clear:example:build",
"type": "shell",
"command": "make clear-client",
"windows": {
Expand All @@ -51,24 +66,19 @@
"-ExecutionPolicy",
"Bypass",
"-Command",
"Remove-Item -Path '${workspaceFolder}\\build' -Recurse -Force -ErrorAction Ignore"
"Remove-Item -Path '${workspaceFolder}\\example\\build' -Recurse -Force -ErrorAction Ignore"
]
/* "options": {
"shell": {
"executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
}
} */
},
"linux": {
"command": "rm -rf",
"args": [
"${workspaceFolder}/build"
"${workspaceFolder}/example/build"
]
},
"osx": {
"command": "rm -rf",
"args": [
"${workspaceFolder}/build"
"${workspaceFolder}/example/build"
]
},
"problemMatcher": [],
Expand All @@ -80,6 +90,21 @@
"kind": "build",
"isDefault": true
}
},
{
"label": "dart:build_runner:test_dir",
"type": "shell",
"command": [
"dart run build_runner build --build-filter 'test/**'"
],
"group": {
"kind": "none",
"isDefault": true
},
"problemMatcher": [],
"dependsOn": [
"dart:pub:get"
]
}
]
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.8.0
- **ADDED**: `namespace` to android build.gradle


## 1.7.1
- **REMOVED**: `pubspec_generator`
- **ADDED**: `package_info_plus`
Expand Down
81 changes: 69 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,72 @@
include tool/makefile/main.mk
include tool/makefile/pub.mk
include tool/makefile/setup.mk
include tool/makefile/test.mk

# This help dialog
# https://gist.github.com/prwhite/8168133#gistcomment-1313022
.PHONY: help
help:
@echo "Let's make something good"
@make -s version
@echo "Available commands:"
@awk '/^#/ {comment = substr($$0, 3); next} /^[a-zA-Z_0-9-]+:/ {print $$1 " " comment; comment=""}' $(MAKEFILE_LIST)
help: ## Help dialog
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: doctor
doctor: ## Check fvm flutter doctor
@fvm flutter doctor

.PHONY: version
version: ## Check fvm flutter version
@fvm flutter --version


.PHONY: format
format: ## Format code
@echo "╠ RUN FORMAT THE CODE"
@fvm dart format --fix -l 80 . || (echo "👀 Format code error 👀"; exit 1)
@echo "╠ CODE FORMATED SUCCESSFULLY"

.PHONY: fix
fix: format ## Fix code
@fvm dart fix --apply lib

.PHONY: clean-cache
clean-cache: ## Clean the pub cache
@echo "╠ CLEAN PUB CACHE"
@fvm flutter pub cache repair
@echo "╠ PUB CACHE CLEANED SUCCESSFULLY"

.PHONY: get
get: ## Get dependencies
@echo "╠ RUN GET DEPENDENCIES..."
@flutter pub get || (echo "▓▓ Get dependencies error ▓▓"; exit 1)
@echo "╠ DEPENDENCIES GETED SUCCESSFULLY"

.PHONY: analyze
analyze: get format ## Analyze code
@echo "╠ RUN ANALYZE THE CODE..."
@dart analyze --fatal-infos --fatal-warnings
@echo "╠ ANALYZED CODE SUCCESSFULLY"

.PHONY: check
check: analyze ## Check code
@echo "╠ RUN CECK CODE..."
@dart pub publish --dry-run
@dart pub global activate pana
@pana --json --no-warning --line-length 80 > log.pana.json
@echo "╠ CECKED CODE SUCCESSFULLY"

.PHONY: publish
publish: ## Publish package
@echo "╠ RUN PUBLISHING..."
@dart pub publish --server=https://pub.dartlang.org || (echo "▓▓ Publish error ▓▓"; exit 1)
@echo "╠ PUBLISH PACKAGE SUCCESSFULLY"

.PHONY: coverage
coverage: ## Runs get coverage
@lcov --summary coverage/lcov.info

.PHONY: genhtml
genhtml: ## Runs generage coverage html
@genhtml coverage/lcov.info -o coverage/html

.PHONY: test-unit
test-unit: ## Runs unit tests
@echo "╠ RUNNING UNIT TESTS..."
@flutter test --coverage || (echo "Error while running tests"; exit 1)
@genhtml coverage/lcov.info --output=coverage -o coverage/html || (echo "Error while running tests"; exit 2)
@echo "╠ UNIT TESTS SUCCESSFULLY"

Loading

0 comments on commit 4199cd7

Please sign in to comment.