Skip to content

Commit 199b6e2

Browse files
authored
release/v0.0.1 dev.5 (#9)
1 parent 25f345d commit 199b6e2

16 files changed

+524
-16
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,15 @@
3131

3232
## 🎯 Improvements
3333
- Updated README
34-
- Updated CHANGELOG (uhm... sorry about that 😅)
34+
- Updated CHANGELOG (uhm... sorry about that 😅)
35+
36+
# 0.0.1-dev.5
37+
## ✨ New Features
38+
- Optional automatic iOS script insertion in Runner.xcscheme - experimental (iOS)
39+
40+
## 🎯 Improvements
41+
- Updated README
42+
43+
## 🛠 Fixed issues
44+
- Fixed incorrect `mason` version in `brick.yaml`
45+
- Specified explicit `mason` version to `>=0.1.0-dev.39` in `pubspec.yaml`

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ way to create configuration.
2727
- 🎯 Dependency check using `pub get`
2828
- 🔧 Fix apply using `dart fix`
2929
- 🤖 Android SDK level check and automatic update
30+
- 🍎 iOS script insertion in Runner.xcscheme (Experimental)
3031

3132
## How to add ➕
3233
This brick is currently **NOT** available on [brickhub.dev](https://brickhub.dev/).

brick.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: freerasp_brick
22
description: A brick for configuration generation and automatic setup for freeRASP.
33

4-
version: 0.0.1-dev.4
4+
version: 0.0.1-dev.5
55

66
environment:
7-
mason: ">=0.1.0-dev.40 <0.1.0"
7+
mason: ">=0.1.0-dev.39 <0.1.0"
88

99
vars:
1010
watcher_mail:

hooks/errors/freerasp_brick_exception.dart

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,25 @@ class FreeRaspBrickException implements Exception {
1515
);
1616
}
1717

18-
factory FreeRaspBrickException.gradleUpdateFailure({StackTrace? stackTrace}) {
18+
factory FreeRaspBrickException.gradleUpdateFailure({
19+
String? message,
20+
StackTrace? stackTrace,
21+
}) {
1922
return FreeRaspBrickException(
2023
code: 'gradle-failure',
21-
message: 'Issue occurred during update of gradle file.',
24+
message: message ?? 'Issue occurred during update of gradle file.',
25+
stackTrace: stackTrace,
26+
);
27+
}
28+
29+
factory FreeRaspBrickException.schemeUpdateFailure({
30+
String? message,
31+
StackTrace? stackTrace,
32+
}) {
33+
return FreeRaspBrickException(
34+
code: 'xcscheme-failure',
35+
message:
36+
message ?? 'Issue occurred during update of Runner.xcscheme file.',
2237
stackTrace: stackTrace,
2338
);
2439
}

hooks/post_gen.dart

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import 'dart:io';
33

44
import 'package:mason/mason.dart';
55

6-
import 'utils/gradle_updater.dart';
6+
import 'utils/utils.dart';
77

88
const String androidBuild = 'build.gradle';
99
const String flutterBuild = 'lib';
1010

1111
Future<void> run(HookContext context) async {
1212
final logger = context.logger;
13-
1413
await _runPubAdd(logger);
1514
await _runPubGet(logger);
1615
await _runDartFix(logger);
1716
await _runGradleCheck(context);
17+
await _runSchemeCheck(context);
1818
}
1919

2020
Future<void> _runPubAdd(Logger logger) async {
@@ -53,13 +53,13 @@ Future<void> _runDartFix(Logger logger) async {
5353
Future<void> _runGradleCheck(HookContext context) async {
5454
final progress = context.logger.progress('Checking build.gradle file');
5555

56-
if (!(context.vars['check_gradle'] as bool)) {
56+
if (!(context.vars['update_gradle'] as bool)) {
5757
progress.complete('Gradle check not required. Skipping...');
5858
return;
5959
}
6060

6161
try {
62-
final hasUpdated = gradleUpdate('android/app/build.gradle');
62+
final hasUpdated = GradleUpdater.update('android/app/build.gradle');
6363
progress.complete(
6464
hasUpdated
6565
? 'build.gradle successfully updated'
@@ -69,3 +69,20 @@ Future<void> _runGradleCheck(HookContext context) async {
6969
progress.fail("Couldn't update build.gradle");
7070
}
7171
}
72+
73+
Future<void> _runSchemeCheck(HookContext context) async {
74+
final progress = context.logger.progress('Checking xcscheme file');
75+
76+
if (!(context.vars['update_scheme'] as bool)) {
77+
progress.complete('Xcscheme check not required. Skipping...');
78+
return;
79+
}
80+
81+
try {
82+
SchemeUpdater.update(
83+
'ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme',
84+
);
85+
} catch (e) {
86+
progress.fail("Couldn't update xcscheme");
87+
}
88+
}

hooks/pre_gen.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ void parseCupertinoData(HookContext context) {
2727
defaultValue: defaultAppPackage,
2828
);
2929

30+
final updateScheme = logger.masonConfirm(
31+
'Do you want to update Runner.xcscheme?',
32+
defaultValue: true,
33+
);
34+
3035
context.vars.addAll({
3136
'bundle_id': bundleId,
3237
'team_id': teamId,
38+
'update_scheme': updateScheme,
3339
});
3440
}
3541

@@ -43,14 +49,14 @@ void parseAndroidData(HookContext context) {
4349

4450
final signingHash = logger.masonPrompt("What's app singing hash?");
4551

46-
final checkGradle = logger.masonConfirm(
52+
final updateGradle = logger.masonConfirm(
4753
'Do you want to check and update API level (minSdkVersion)?',
4854
defaultValue: true,
4955
);
5056

5157
context.vars.addAll({
5258
'package_name': packageName,
5359
'signing_hash': signingHash,
54-
'check_gradle': checkGradle,
60+
'update_gradle': updateGradle,
5561
});
5662
}

hooks/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55

66
dependencies:
77
file: ^6.1.4
8-
mason: ^0.1.0-dev
8+
mason: ^0.1.0-dev.39
99

1010
dev_dependencies:
1111
test: ^1.22.0
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
const missingBuildActionEntries = '''
2+
<?xml version="1.0" encoding="UTF-8"?>
3+
<Scheme
4+
LastUpgradeVersion = "1300"
5+
version = "1.3">
6+
<BuildAction
7+
parallelizeBuildables = "YES"
8+
buildImplicitDependencies = "YES">
9+
</BuildAction>
10+
<TestAction
11+
buildConfiguration = "Debug"
12+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
13+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
14+
shouldUseLaunchSchemeArgsEnv = "YES">
15+
<MacroExpansion>
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
19+
BuildableName = "Runner.app"
20+
BlueprintName = "Runner"
21+
ReferencedContainer = "container:Runner.xcodeproj">
22+
</BuildableReference>
23+
</MacroExpansion>
24+
<Testables>
25+
</Testables>
26+
</TestAction>
27+
<LaunchAction
28+
buildConfiguration = "Debug"
29+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
30+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
31+
launchStyle = "0"
32+
useCustomWorkingDirectory = "NO"
33+
ignoresPersistentStateOnLaunch = "NO"
34+
debugDocumentVersioning = "YES"
35+
debugServiceExtension = "internal"
36+
allowLocationSimulation = "YES">
37+
<BuildableProductRunnable
38+
runnableDebuggingMode = "0">
39+
<BuildableReference
40+
BuildableIdentifier = "primary"
41+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
42+
BuildableName = "Runner.app"
43+
BlueprintName = "Runner"
44+
ReferencedContainer = "container:Runner.xcodeproj">
45+
</BuildableReference>
46+
</BuildableProductRunnable>
47+
</LaunchAction>
48+
<ProfileAction
49+
buildConfiguration = "Profile"
50+
shouldUseLaunchSchemeArgsEnv = "YES"
51+
savedToolIdentifier = ""
52+
useCustomWorkingDirectory = "NO"
53+
debugDocumentVersioning = "YES">
54+
<BuildableProductRunnable
55+
runnableDebuggingMode = "0">
56+
<BuildableReference
57+
BuildableIdentifier = "primary"
58+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
59+
BuildableName = "Runner.app"
60+
BlueprintName = "Runner"
61+
ReferencedContainer = "container:Runner.xcodeproj">
62+
</BuildableReference>
63+
</BuildableProductRunnable>
64+
</ProfileAction>
65+
<AnalyzeAction
66+
buildConfiguration = "Debug">
67+
</AnalyzeAction>
68+
<ArchiveAction
69+
buildConfiguration = "Release"
70+
revealArchiveInOrganizer = "YES">
71+
</ArchiveAction>
72+
</Scheme>
73+
''';
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
const containsPreActions = '''
2+
<?xml version="1.0" encoding="UTF-8"?>
3+
<Scheme
4+
LastUpgradeVersion = "1300"
5+
version = "1.3">
6+
<BuildAction
7+
parallelizeBuildables = "YES"
8+
buildImplicitDependencies = "YES">
9+
<PreActions>
10+
<ExecutionAction
11+
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
12+
<ActionContent
13+
title = "Run Script"
14+
scriptText = "echo &quot;Hello&quot;">
15+
</ActionContent>
16+
</ExecutionAction>
17+
</PreActions>
18+
<BuildActionEntries>
19+
<BuildActionEntry
20+
buildForTesting = "YES"
21+
buildForRunning = "YES"
22+
buildForProfiling = "YES"
23+
buildForArchiving = "YES"
24+
buildForAnalyzing = "YES">
25+
<BuildableReference
26+
BuildableIdentifier = "primary"
27+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
28+
BuildableName = "Runner.app"
29+
BlueprintName = "Runner"
30+
ReferencedContainer = "container:Runner.xcodeproj">
31+
</BuildableReference>
32+
</BuildActionEntry>
33+
</BuildActionEntries>
34+
</BuildAction>
35+
<TestAction
36+
buildConfiguration = "Debug"
37+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
38+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
39+
shouldUseLaunchSchemeArgsEnv = "YES">
40+
<MacroExpansion>
41+
<BuildableReference
42+
BuildableIdentifier = "primary"
43+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
44+
BuildableName = "Runner.app"
45+
BlueprintName = "Runner"
46+
ReferencedContainer = "container:Runner.xcodeproj">
47+
</BuildableReference>
48+
</MacroExpansion>
49+
<Testables>
50+
</Testables>
51+
</TestAction>
52+
<LaunchAction
53+
buildConfiguration = "Debug"
54+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
55+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
56+
launchStyle = "0"
57+
useCustomWorkingDirectory = "NO"
58+
ignoresPersistentStateOnLaunch = "NO"
59+
debugDocumentVersioning = "YES"
60+
debugServiceExtension = "internal"
61+
allowLocationSimulation = "YES">
62+
<BuildableProductRunnable
63+
runnableDebuggingMode = "0">
64+
<BuildableReference
65+
BuildableIdentifier = "primary"
66+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
67+
BuildableName = "Runner.app"
68+
BlueprintName = "Runner"
69+
ReferencedContainer = "container:Runner.xcodeproj">
70+
</BuildableReference>
71+
</BuildableProductRunnable>
72+
</LaunchAction>
73+
<ProfileAction
74+
buildConfiguration = "Profile"
75+
shouldUseLaunchSchemeArgsEnv = "YES"
76+
savedToolIdentifier = ""
77+
useCustomWorkingDirectory = "NO"
78+
debugDocumentVersioning = "YES">
79+
<BuildableProductRunnable
80+
runnableDebuggingMode = "0">
81+
<BuildableReference
82+
BuildableIdentifier = "primary"
83+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
84+
BuildableName = "Runner.app"
85+
BlueprintName = "Runner"
86+
ReferencedContainer = "container:Runner.xcodeproj">
87+
</BuildableReference>
88+
</BuildableProductRunnable>
89+
</ProfileAction>
90+
<AnalyzeAction
91+
buildConfiguration = "Debug">
92+
</AnalyzeAction>
93+
<ArchiveAction
94+
buildConfiguration = "Release"
95+
revealArchiveInOrganizer = "YES">
96+
</ArchiveAction>
97+
</Scheme>
98+
''';

0 commit comments

Comments
 (0)