Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #167 from Parabeac/release-1.2.1
Browse files Browse the repository at this point in the history
Release 1.2.1
  • Loading branch information
ivan-015 committed Nov 19, 2020
2 parents 7394eea + fed29ef commit 1903249
Show file tree
Hide file tree
Showing 47 changed files with 1,278 additions and 230 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Dart CI

on:
push:
branches: [ stable, dev ]
pull_request:
branches: [ stable, dev ]

jobs:

build:

runs-on: ubuntu-latest
services:
sketch_asset_converter:
image: parabeac/sac
ports:
- 4000:4000

steps:
- uses: actions/checkout@v2
- name: Flutter action
uses: subosito/[email protected]

- name: Install dependencies
run: pub get
- name: Run tests
run: pub run test
env:
FIG_API_KEY: ${{ secrets.FIG_API_KEY }}
PB_IS_GITHUB_TEST: true
14 changes: 12 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,23 @@ When looking to contribute there are a few simple steps you can follow to make s
* If it has, reach out to whoever was assigned said issue or, if that issue is not assigned to anyone contact us in the #dev_questions or #parabeac_hackers channels on our [Discord](https://discord.com/invite/qUrghes) to discuss taking the issue.
* If it has not, verify that the work is non-trivial and then create an issue on our Github issues section, make sure to reach out to the Team on [Discord](https://discord.com/invite/qUrghes) if this issue is pressing. You can put the tag proposal on the work you’re trying to do to help us identify and help with prioritization.
3. Create a branch off of the dev branch (if the issue is non-breaking) or the stable branch (if the issue is breaking) within your fork of the repo and implement your changes. Make sure to reach out to someone with the “Team” Role on our [Discord](https://discord.com/invite/qUrghes) to discuss your changes or ideas if you have any questions.
4. Submit this branch to the repo as a Pull Request.
5. Undergo code review. These reviews usually take the form of comments either on the PR on GitHub or within the Parabeac Core [Discord](https://discord.com/invite/qUrghes). More often than not a Parabeac Team Member or Committer will respond or comment to your PR within about 48 hours. If you haven’t heard from anyone by that time feel free to poke anyone on the Parabeac Team on our [Discord](https://discord.com/invite/qUrghes) (But especially our CEO @SiliconIvan).
4. Make sure the tests pass. We have a set of both integration and unit tests created to insure that changes made to the Parabeac Core Repository are stable and consistent with the rest of the project. With this in mind if you're adding new code or changing things you'll likely need to add a new test to accomodate your changes. When your asking yourself "Do I need to write a test for this" the answer will almost always be a yes.
5. Submit this branch to the repo as a Pull Request. For Details on how to run our testing suite please see below.
6. Undergo code review. These reviews usually take the form of comments either on the PR on GitHub or within the Parabeac Core [Discord](https://discord.com/invite/qUrghes). More often than not a Parabeac Team Member or Committer will respond or comment to your PR within about 48 hours. If you haven’t heard from anyone by that time feel free to poke anyone on the Parabeac Team on our [Discord](https://discord.com/invite/qUrghes) (But especially our CEO @SiliconIvan).

Once you have the appropriate sign offs, your final reviewer should merge your code but if they haven’t feel free to merge it in.

While following these steps should you have any issues don’t hesitate to reach out to anyone on Team Parabeac on our [Discord](https://discord.com/invite/qUrghes)


#### Testing
We prioritize keeping the tree clean and keeping releases stable above all else. Pushing out new features is great, but pushing out new features that also don't break existing features is even better.

We have two separate forms of tests within our test suite: Unit Tests and Integration Tests. If you are writing in new functions and expanding on existing feature-sets you'll need to write the appropriate unit tests for your changes to ensure they aren't broken by later changes. If you're adding in new modules or adding entire feature-sets you'll need to not only write the unit tests for these features but also write integration tests between your module and and any modules it interacts with. For any help or further information please check out the #dev_questions channel on our [Discord](https://discord.com/invite/qUrghes).

**_Running the Test Suite:_**
To run the test suite for parabeac core you just need to run ```pub run test``` in the root directory of Parabeac core. However, if you also plan to test for Figma Files as well as sketch files you'll also need to add an environment variable called ```FIG_API_KEY``` to your environment with your API Key. Running the command ```export FIG_API_KEY = <key_here>``` in your terminal or adding that command to your .zshrc/.bashrc files will allow the testing harness to run all tests including those for Figma files as well.

#### Pull Requests

Pull Requests are how you bring the work you’ve done back into the Parabeac-Core codebase. By submitting a Pull Request (or PR) you’re able to merge the changes you've made on your own branch into either dev or stable(Depending on the work done). All PR’s must be reviewed before they can be merged into the codebase in order to ensure that the work being done follows our guidelines and does what it says it will. Code review is usually done within Github itself but in special cases with complex work we do recommend talking with the team directly in our [Discord](https://discord.com/invite/qUrghes). For Additional insight, check out or [Tree Hygiene](https://github.com/Parabeac/Parabeac-Core/wiki/Tree-Hygiene) Page on our Wiki!
Expand Down
4 changes: 2 additions & 2 deletions WINDOWS_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ Parabeac-Core is built in Dart and generates Flutter apps, which make use of Dar

10. Add the following lines to the file:
```bashrc
export DART=/home/roel/snap/flutter/common/flutter/bin
export ANDROID_SDK_ROOT=/home/[your selected ubuntu username]/Android/Sdk
export DART=/home/<your ubuntu username>/snap/flutter/common/flutter/bin
export ANDROID_SDK_ROOT=/home/<your ubuntu username>/Android/Sdk
export JAVA_HOME=/opt/openJDK
export PATH=$PATH:$ANDROID_SDK_ROOT/build-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
Expand Down
8 changes: 4 additions & 4 deletions lib/controllers/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ abstract class Controller {
json.decode(File(configurationPath).readAsStringSync());
}
} catch (e, stackTrace) {
// await MainInfo().sentry.captureException(
// exception: e,
// stackTrace: stackTrace,
// );
await MainInfo().sentry.captureException(
exception: e,
stackTrace: stackTrace,
);
log.error(e.toString());
}

Expand Down
108 changes: 49 additions & 59 deletions lib/controllers/interpret.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,69 +159,38 @@ class Interpret {
///
/// pre-layout generation service for plugin nodes.
///
PBIntermediateNode parentPreLayoutIntermediateNode;
try {
parentPreLayoutIntermediateNode = PBPluginControlService(
parentVisualIntermediateNode,
currentContext: currentContext)
.convertAndModifyPluginNodeTree();
} catch (e, stackTrace) {
// await MainInfo().sentry.captureException(
// exception: e,
// stackTrace: stackTrace,
// );
log.error(e.toString());
parentPreLayoutIntermediateNode =
parentVisualIntermediateNode; //parentVisualIntermediateNode;
}
var stopwatch1 = Stopwatch()..start();
var parentPreLayoutIntermediateNode = await _pluginService(
parentVisualIntermediateNode, currentContext, stopwatch1);

PBIntermediateNode parentLayoutIntermediateNode;
var stopwatch2 = Stopwatch()..start();

/// LayoutGenerationService
try {
parentLayoutIntermediateNode =
PBLayoutGenerationService(currentContext: currentContext)
.injectNodes(parentPreLayoutIntermediateNode);
} catch (e, stackTrace) {
// await MainInfo().sentry.captureException(
// exception: e,
// stackTrace: stackTrace,
// );
log.error(e.toString());
parentLayoutIntermediateNode = parentPreLayoutIntermediateNode;
}
var parentAlignIntermediateNode;
var parentLayoutIntermediateNode = await _layoutGenerationService(
parentPreLayoutIntermediateNode, currentContext, stopwatch2);

var stopwatch3 = Stopwatch()..start();

/// AlignGenerationService
try {
parentAlignIntermediateNode = PBAlignGenerationService(
parentLayoutIntermediateNode,
currentContext: currentContext)
.addAlignmentToLayouts();
} catch (e, stackTrace) {
// await MainInfo().sentry.captureException(
// exception: e,
// stackTrace: stackTrace,
// );
log.error(e.toString());
parentAlignIntermediateNode = parentLayoutIntermediateNode;
}
var parentAlignIntermediateNode = await _alignGenerationService(
parentLayoutIntermediateNode, currentContext, stopwatch3);

return parentAlignIntermediateNode;
}

Future<PBIntermediateNode> _visualGenerationService(
Future<PBIntermediateNode> zz(
var component, var context, var stopwatch) async {
/// VisualGenerationService
PBIntermediateNode node;
try {
node = await PBVisualGenerationService(component, currentContext: context)
.getIntermediateTree();
} catch (e, stackTrace) {
// await MainInfo().sentry.captureException(
// exception: e,
// stackTrace: stackTrace,
// );
await MainInfo().sentry.captureException(
exception: e,
stackTrace: stackTrace,
);
log.error(e.toString());
}
// print(
Expand All @@ -238,10 +207,10 @@ class Interpret {
node = PBPluginControlService(parentnode, currentContext: context)
.convertAndModifyPluginNodeTree();
} catch (e, stackTrace) {
// await MainInfo().sentry.captureException(
// exception: e,
// stackTrace: stackTrace,
// );
await MainInfo().sentry.captureException(
exception: e,
stackTrace: stackTrace,
);
log.error(e.toString());
node = parentnode;
}
Expand All @@ -258,10 +227,10 @@ class Interpret {
node = PBLayoutGenerationService(currentContext: context)
.injectNodes(parentNode);
} catch (e, stackTrace) {
// await MainInfo().sentry.captureException(
// exception: e,
// stackTrace: stackTrace,
// );
await MainInfo().sentry.captureException(
exception: e,
stackTrace: stackTrace,
);
log.error(e.toString());
node = parentNode;
}
Expand All @@ -286,10 +255,10 @@ class Interpret {
node = PBAlignGenerationService(parentnode, currentContext: context)
.addAlignmentToLayouts();
} catch (e, stackTrace) {
// await MainInfo().sentry.captureException(
// exception: e,
// stackTrace: stackTrace,
// );
await MainInfo().sentry.captureException(
exception: e,
stackTrace: stackTrace,
);
log.error(e.toString());
node = parentnode;
}
Expand All @@ -298,4 +267,25 @@ class Interpret {
stopwatch3.stop();
return node;
}

Future<PBIntermediateNode> _visualGenerationService(
var component, var context, var stopwatch) async {
/// VisualGenerationService
PBIntermediateNode node;
try {
node = await PBVisualGenerationService(component, currentContext: context)
.getIntermediateTree();
} catch (e, stackTrace) {
await MainInfo().sentry.captureException(
exception: e,
stackTrace: stackTrace,
);
log.error(e.toString());
}
// print(
// 'Visual Generation Service executed in ${stopwatch.elapsedMilliseconds} milliseconds.');
stopwatch.stop();
node = await _pbSymbolLinkerService.linkSymbols(node);
return node;
}
}
11 changes: 5 additions & 6 deletions lib/eggs/injected_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ class InjectedNavbar extends PBEgg implements PBInjectedIntermediate {
var trailingItem;
PBContext currentContext;

String semanticName = '.*navbar';
@override
String semanticName = '<navbar>';

String UUID;



InjectedNavbar(
Point topLeftCorner, Point bottomRightCorner, this.UUID, String name,
{this.currentContext})
Expand All @@ -34,7 +33,7 @@ class InjectedNavbar extends PBEgg implements PBInjectedIntermediate {
if ((node as PBInheritedIntermediate)
.originalRef
.name
.contains('.*leading')) {
.contains('<leading>')) {
Interpret()
.generateNonRootItem((node as PBInheritedIntermediate).originalRef)
.then((value) => leadingItem = value);
Expand All @@ -43,15 +42,15 @@ class InjectedNavbar extends PBEgg implements PBInjectedIntermediate {
if ((node as PBInheritedIntermediate)
.originalRef
.name
.contains('.*trailing')) {
.contains('<trailing>')) {
Interpret()
.generateNonRootItem((node as PBInheritedIntermediate).originalRef)
.then((value) => trailingItem = value);
}
if ((node as PBInheritedIntermediate)
.originalRef
.name
.contains('.*middle')) {
.contains('<middle>')) {
Interpret()
.generateNonRootItem((node as PBInheritedIntermediate).originalRef)
.then((value) => middleItem = value);
Expand Down
53 changes: 53 additions & 0 deletions lib/eggs/injected_back_arrow.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import 'package:parabeac_core/design_logic/design_node.dart';
import 'package:parabeac_core/generation/generators/pb_generator.dart';
import 'package:parabeac_core/generation/generators/plugins/pb_plugin_node.dart';
import 'package:parabeac_core/interpret_and_optimize/entities/interfaces/pb_injected_intermediate.dart';
import 'package:parabeac_core/interpret_and_optimize/entities/subclasses/pb_intermediate_node.dart';
import 'package:parabeac_core/interpret_and_optimize/helpers/pb_context.dart';
import 'package:parabeac_core/interpret_and_optimize/value_objects/point.dart';

class InjectedBackArrow extends PBEgg implements PBInjectedIntermediate {
@override
PBContext currentContext;

@override
final String UUID;

@override
String semanticName = '<back-arrow>';

InjectedBackArrow(
Point topLeftCorner, Point bottomRightCorner, this.UUID, String name,
{this.currentContext})
: super(topLeftCorner, bottomRightCorner, currentContext, name) {
generator = PBBackArrowGenerator();
}

@override
void addChild(PBIntermediateNode node) {}

@override
void alignChild() {}

@override
void extractInformation(DesignNode incomingNode) {}

@override
PBEgg generatePluginNode(
Point topLeftCorner, Point bottomRightCorner, DesignNode originalRef) {
return InjectedBackArrow(
topLeftCorner, bottomRightCorner, UUID, originalRef.name,
currentContext: currentContext);
}
}

class PBBackArrowGenerator extends PBGenerator {
PBBackArrowGenerator() : super();

@override
String generate(PBIntermediateNode source) {
if (source is InjectedBackArrow) {
return 'BackButton()';
}
}
}
3 changes: 1 addition & 2 deletions lib/eggs/injected_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import 'package:uuid/uuid.dart';
class Tab extends PBEgg implements PBInjectedIntermediate {
PBContext currentContext;


PrototypeNode prototypeNode;

Tab(
Expand Down Expand Up @@ -74,7 +73,7 @@ class Tab extends PBEgg implements PBInjectedIntermediate {
DesignNode _convertWrapper(DesignNode node) {
/// This is for plugins
var str = '${node.name}';
node.name = str.replaceAll(RegExp(r'\.\*'), '');
node.name = str.replaceAll(RegExp(r'\<.*?\>'), '');

///This is for symbol master
if (node is SymbolMaster) {
Expand Down
4 changes: 2 additions & 2 deletions lib/eggs/injected_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'injected_tab.dart';
class InjectedTabBar extends PBEgg implements PBInjectedIntermediate {
final String UUID;
PBContext currentContext;
String semanticName = '.*tabbar';
String semanticName = '<tabbar>';
List<Tab> tabs = [];

InjectedTabBar(
Expand All @@ -33,7 +33,7 @@ class InjectedTabBar extends PBEgg implements PBInjectedIntermediate {
if ((node as PBInheritedIntermediate)
.originalRef
.name
.contains('.*tab')) {
.contains('<tab>')) {
assert(node is! Tab, 'I wrote something wrong here: IvanH');
tabs.add(node);
}
Expand Down
Loading

0 comments on commit 1903249

Please sign in to comment.