Skip to content

Commit

Permalink
New release - v1.0.1 (#6)
Browse files Browse the repository at this point in the history
* Refactor build_command.dart

* Print thread exceptions while processing extension

* Refactor remaining processes and handle errors in them

* Don't compile if Java file doesn't exist

* Fix AIX not being produced when there's space in cd

* Copy dev deps if absent

* Don't delete AndroidRuntime.jar if ProGuarded JAR isn't available

* Update scripts/build.dart

* Fix incorrect script path issue

* Update build.dart

* Refactor build_command.dart

* Upgrade the CI

* Add release/optimize field to rush.yml & add Java check

* Fix incorrect package generation

* Add a copy of Apache-2.0 license to the archive

* Format the code

* Update the CI

* Update proguard-rules.pro template

* Delete CHANGELOG.md
  • Loading branch information
shreyashsaitwal authored Mar 23, 2021
1 parent 2671e25 commit a17b344
Show file tree
Hide file tree
Showing 19 changed files with 947 additions and 412 deletions.
167 changes: 167 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-processor:
runs-on: ubuntu-latest
env:
AI_VERSION: 'v186a'

steps:
- uses: actions/checkout@v2

- name: Clone annotation processor repo
run: |
sudo apt update && sudo apt install git
git clone https://github.com/ShreyashSaitwal/rush-annotation-processor processor
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build annotation processor
run: |
cd processor
chmod +x ./gradlew
./gradlew build copyImpl
- name: Upload dev dependencies
uses: actions/upload-artifact@v2
with:
name: dev-deps
path: |
processor/runtime/build/implementation/
processor/runtime/outputs/aar/runtime-release.aar
- name: Upload processor libs
uses: actions/upload-artifact@v2
with:
name: processor
path: |
processor/processor/build/implementation/
processor/processor/build/libs/processor-$AI_VERSION.jar
mac-build:
needs: build-processor
runs-on: macos-latest
env:
RUSH_V: 1.0.1

steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1

- name: Download dev-deps
uses: actions/download-artifact@v2
with:
name: dev-deps
path: temp/

- name: Download processor
uses: actions/download-artifact@v2
with:
name: processor
path: temp/

- name: Install Dart dependencies
run: dart pub get

- name: Run build script
run: dart scripts/build.dart -c -v $RUSH_V

- name: Create archive
run: |
cd build
chmod +x bin/rush
tar -czf ../rush.tar.gz *
- name: Upload archive
uses: actions/upload-artifact@v2
with:
name: macos
path: rush.tar.gz

linux-build:
needs: build-processor
runs-on: ubuntu-latest
env:
RUSH_V: 1.0.1

steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1

- name: Download dev-deps
uses: actions/download-artifact@v2
with:
name: dev-deps
path: temp/

- name: Download processor
uses: actions/download-artifact@v2
with:
name: processor
path: temp/

- name: Install Dart dependencies
run: dart pub get

- name: Run build script
run: dart scripts/build.dart -c -v $RUSH_V

- name: Create archive
run: |
cd build
chmod +x bin/rush
tar -czf ../rush.tar.gz *
- name: Upload archive
uses: actions/upload-artifact@v2
with:
name: linux
path: rush.tar.gz

windows-build:
needs: build-processor
runs-on: windows-latest
env:
RUSH_V: '1.0.1'

steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1

- name: Download dev-deps
uses: actions/download-artifact@v2
with:
name: dev-deps
path: temp/

- name: Download processor
uses: actions/download-artifact@v2
with:
name: processor
path: temp/

- name: Install Dart dependencies
run: dart pub get

- name: Run build script
run: dart scripts/build.dart -c -v=$RUSH_V

- name: Create archive
run: |
cd build
tar.exe -cf ../rush.zip *
- name: Upload archive
uses: actions/upload-artifact@v2
with:
name: windows
path: rush.zip
41 changes: 0 additions & 41 deletions .github/workflows/dart.yml

This file was deleted.

3 changes: 0 additions & 3 deletions CHANGELOG.md

This file was deleted.

7 changes: 4 additions & 3 deletions bin/rush.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:io';
import 'package:args/command_runner.dart';
import 'package:dart_console/dart_console.dart';
import 'package:path/path.dart' as p;
import 'package:process_run/which.dart';
import 'package:rush_cli/commands/build_command/build_command.dart';
import 'package:rush_cli/commands/create_command/create_command.dart';
import 'package:rush_prompt/rush_prompt.dart';
Expand Down Expand Up @@ -34,9 +35,9 @@ void main(List<String> args) {
}

void _printVersion() {
final baseDir =
p.dirname(Platform.script.toFilePath(windows: Platform.isWindows));
final info = loadYaml(File(p.join(baseDir, 'build_info')).readAsStringSync());
final scriptPath = whichSync('rush');
final info =
loadYaml(File(p.join(scriptPath!, 'build_info')).readAsStringSync());

final version = info['name'];
final builton = info['built_on'];
Expand Down
53 changes: 18 additions & 35 deletions lib/commands/build_command/ant_args.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:path/path.dart' as p;
import 'package:process_run/shell.dart';

/// Generate arguments for the Ant exec.
class AntArgs {
Expand All @@ -25,20 +26,13 @@ class AntArgs {
List toList(String task) {
final args = <String>[];
final workspaces = p.join(dataDirPath!, 'workspaces');
final baseDir = p.dirname(p.dirname(Platform.script.path));
final scriptPath = whichSync('rush');
final toolsDir = p.join(scriptPath!.split('bin').first, 'tools');

args.add('-buildfile=${p.joinAll([
...baseDir.split('/'),
'tools',
'apache-ant-1.10.9',
'build.xml'
])}');
args.add('-DantCon=${p.joinAll([
...baseDir.split('/'),
'tools',
'ant-contrib',
'ant-contrib-1.0b3.jar'
])}');
args.add(
'-buildfile=${p.join(toolsDir, 'apache-ant-1.10.9', 'build.xml')}');
args.add(
'-DantCon=${p.join(toolsDir, 'ant-contrib', 'ant-contrib-1.0b3.jar')}');

if (task == 'javac') {
args.add('javac');
Expand All @@ -50,18 +44,10 @@ class AntArgs {
args.add('-Dversion=$version');
args.add('-DdevDeps=${p.join(cd, '.rush', 'dev-deps')}');
args.add('-Ddeps=${p.join(cd, 'deps')}');
args.add('-Dprocessor=${p.joinAll([
...baseDir.split('/'),
'tools',
'processor'
])}');
args.add('-Dprocessor=${p.join(toolsDir, 'processor')}');
} else if (task == 'process') {
args.add('jarExt');
args.add('-Dprocessor=${p.joinAll([
...baseDir.split('/'),
'tools',
'processor'
])}');
args.add('-Dprocessor=${p.join(toolsDir, 'processor')}');
args.add('-Dclasses=${p.join(workspaces, org, 'classes')}');
args.add('-Draw=${p.join(workspaces, org, 'raw')}');
args.add('-DrawCls=${p.join(workspaces, org, 'raw-classes')}');
Expand All @@ -73,31 +59,28 @@ class AntArgs {
final rules = File(p.join(cd, 'src', 'proguard-rules.pro'));
if (rules.existsSync()) {
args.add('-Doptimize=1');
args.add('-DpgPath=${p.joinAll([
...baseDir.split('/'),
'tools',
'proguard'
])}');
args.add('-DpgPath=${p.join(toolsDir, 'proguard')}');
args.add('-DpgRules=${rules.path}');
args.add('-Dout=${p.join(cd, 'out')}');
}
}
if (shouldJetify!) {
args.add('-DjetifierBin=${p.joinAll([
...baseDir.split('/'),
'tools',
'jetifier-standalone',
'bin'
])}');
args.add(
'-DjetifierBin=${p.join(toolsDir, 'jetifier-standalone', 'bin')}');
} else {
args.add('-DjetifierBin=0');
}
} else if (task == 'dex') {
args.add('dexExt');
args.add('-Dextension=$org');
args.add('-Dd8=${p.joinAll([...baseDir.split('/'), 'tools', 'd8.jar'])}');
args.add('-Dd8=${p.join(toolsDir, 'd8.jar')}');
args.add('-Draw=${p.join(workspaces, org, 'raw')}');
args.add('-DrawCls=${p.join(workspaces, org, 'raw-classes')}');
if (shouldJetify!) {
args.add('-DjetifierBin=1');
} else {
args.add('-DjetifierBin=0');
}
} else if (task == 'assemble') {
args.add('assemble');
args.add('-DdevDeps=${p.join(cd, '.rush', 'dev-deps')}');
Expand Down
Loading

0 comments on commit a17b344

Please sign in to comment.