fix(shorebird_cli): canonicalize build paths (#535)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:shorebird_cli/src/auth_logger_mixin.dart';
|
||||
import 'package:shorebird_cli/src/command.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_build_mixin.dart';
|
||||
@@ -67,9 +68,10 @@ class BuildApkCommand extends ShorebirdCommand
|
||||
|
||||
buildProgress.complete();
|
||||
|
||||
final apkDirPath = p.join('build', 'app', 'outputs', 'apk');
|
||||
final apkPath = flavor != null
|
||||
? './build/app/outputs/apk/$flavor/release/app-$flavor-release.apk'
|
||||
: './build/app/outputs/apk/release/app-release.apk';
|
||||
? p.join(apkDirPath, flavor, 'release', 'app-$flavor-release.apk')
|
||||
: p.join(apkDirPath, 'release', 'app-release.apk');
|
||||
|
||||
logger.info('''
|
||||
📦 Generated an apk at:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:shorebird_cli/src/auth_logger_mixin.dart';
|
||||
import 'package:shorebird_cli/src/command.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_build_mixin.dart';
|
||||
@@ -65,9 +66,10 @@ class BuildAppBundleCommand extends ShorebirdCommand
|
||||
return ExitCode.software.code;
|
||||
}
|
||||
|
||||
final bundleDirPath = p.join('build', 'app', 'outputs', 'bundle');
|
||||
final bundlePath = flavor != null
|
||||
? './build/app/outputs/bundle/${flavor}Release/app-$flavor-release.aab'
|
||||
: './build/app/outputs/bundle/release/app-release.aab';
|
||||
? p.join(bundleDirPath, '${flavor}Release', 'app-$flavor-release.aab')
|
||||
: p.join(bundleDirPath, 'release', 'app-release.aab');
|
||||
|
||||
buildProgress.complete();
|
||||
logger.info('''
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:shorebird_cli/src/auth_logger_mixin.dart';
|
||||
import 'package:shorebird_cli/src/command.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_build_mixin.dart';
|
||||
@@ -80,7 +81,7 @@ Codesigning is disabled. You must manually codesign before deploying to devices.
|
||||
|
||||
buildProgress.complete();
|
||||
|
||||
const xcarchivePath = './build/ios/archive/Runner.xcarchive';
|
||||
final xcarchivePath = p.join('build', 'ios', 'archive', 'Runner.xcarchive');
|
||||
|
||||
logger.info('''
|
||||
📦 Generated an xcode archive at:
|
||||
@@ -93,7 +94,7 @@ ${lightCyan.wrap(xcarchivePath)}''');
|
||||
return ExitCode.success.code;
|
||||
}
|
||||
|
||||
const ipaPath = './build/ios/ipa/Runner.ipa';
|
||||
final ipaPath = p.join('build', 'ios', 'ipa', 'Runner.ipa');
|
||||
|
||||
logger.info('''
|
||||
📦 Generated an ipa at:
|
||||
|
||||
@@ -134,9 +134,10 @@ Did you forget to run "shorebird init"?''',
|
||||
return ExitCode.software.code;
|
||||
}
|
||||
|
||||
final bundleDirPath = p.join('build', 'app', 'outputs', 'bundle');
|
||||
final bundlePath = flavor != null
|
||||
? './build/app/outputs/bundle/${flavor}Release/app-$flavor-release.aab'
|
||||
: './build/app/outputs/bundle/release/app-release.aab';
|
||||
? p.join(bundleDirPath, '${flavor}Release', 'app-$flavor-release.aab')
|
||||
: p.join(bundleDirPath, 'release', 'app-release.aab');
|
||||
|
||||
final String releaseVersion;
|
||||
final detectReleaseVersionProgress = logger.progress(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:args/args.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:shorebird_cli/src/auth/auth.dart';
|
||||
import 'package:shorebird_cli/src/commands/build/build.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_process.dart';
|
||||
@@ -127,7 +128,7 @@ void main() {
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an apk at:
|
||||
${lightCyan.wrap("./build/app/outputs/apk/release/app-release.apk")}''',
|
||||
${lightCyan.wrap(p.join('build', 'app', 'outputs', 'apk', 'release', 'app-release.apk'))}''',
|
||||
),
|
||||
).called(1);
|
||||
});
|
||||
@@ -136,7 +137,7 @@ ${lightCyan.wrap("./build/app/outputs/apk/release/app-release.apk")}''',
|
||||
'exits with code 0 when building apk succeeds '
|
||||
'with flavor and target', () async {
|
||||
const flavor = 'development';
|
||||
const target = './lib/main_development.dart';
|
||||
final target = p.join('lib', 'main_development.dart');
|
||||
when(() => argResults['flavor']).thenReturn(flavor);
|
||||
when(() => argResults['target']).thenReturn(target);
|
||||
when(() => processResult.exitCode).thenReturn(ExitCode.success.code);
|
||||
@@ -165,7 +166,7 @@ ${lightCyan.wrap("./build/app/outputs/apk/release/app-release.apk")}''',
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an apk at:
|
||||
${lightCyan.wrap("./build/app/outputs/apk/$flavor/release/app-$flavor-release.apk")}''',
|
||||
${lightCyan.wrap(p.join('build', 'app', 'outputs', 'apk', flavor, 'release', 'app-$flavor-release.apk'))}''',
|
||||
),
|
||||
).called(1);
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:args/args.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:shorebird_cli/src/auth/auth.dart';
|
||||
import 'package:shorebird_cli/src/commands/build/build.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_process.dart';
|
||||
@@ -128,7 +129,7 @@ void main() {
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an app bundle at:
|
||||
${lightCyan.wrap("./build/app/outputs/bundle/release/app-release.aab")}''',
|
||||
${lightCyan.wrap(p.join('build', 'app', 'outputs', 'bundle', 'release', 'app-release.aab'))}''',
|
||||
),
|
||||
).called(1);
|
||||
});
|
||||
@@ -137,7 +138,7 @@ ${lightCyan.wrap("./build/app/outputs/bundle/release/app-release.aab")}''',
|
||||
'exits with code 0 when building appbundle succeeds '
|
||||
'with flavor and target', () async {
|
||||
const flavor = 'development';
|
||||
const target = './lib/main_development.dart';
|
||||
final target = p.join('lib', 'main_development.dart');
|
||||
when(() => argResults['flavor']).thenReturn(flavor);
|
||||
when(() => argResults['target']).thenReturn(target);
|
||||
when(() => processResult.exitCode).thenReturn(ExitCode.success.code);
|
||||
@@ -166,7 +167,7 @@ ${lightCyan.wrap("./build/app/outputs/bundle/release/app-release.aab")}''',
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an app bundle at:
|
||||
${lightCyan.wrap("./build/app/outputs/bundle/${flavor}Release/app-$flavor-release.aab")}''',
|
||||
${lightCyan.wrap(p.join('build', 'app', 'outputs', 'bundle', '${flavor}Release', 'app-$flavor-release.aab'))}''',
|
||||
),
|
||||
).called(1);
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:args/args.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:shorebird_cli/src/auth/auth.dart';
|
||||
import 'package:shorebird_cli/src/commands/build/build.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_process.dart';
|
||||
@@ -129,12 +130,12 @@ void main() {
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an xcode archive at:
|
||||
${lightCyan.wrap("./build/ios/archive/Runner.xcarchive")}''',
|
||||
${lightCyan.wrap(p.join('build', 'ios', 'archive', 'Runner.xcarchive'))}''',
|
||||
),
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an ipa at:
|
||||
${lightCyan.wrap("./build/ios/ipa/Runner.ipa")}''',
|
||||
${lightCyan.wrap(p.join('build', 'ios', 'ipa', 'Runner.ipa'))}''',
|
||||
),
|
||||
]);
|
||||
});
|
||||
@@ -143,7 +144,7 @@ ${lightCyan.wrap("./build/ios/ipa/Runner.ipa")}''',
|
||||
'exits with code 0 when building ipa succeeds '
|
||||
'with flavor and target', () async {
|
||||
const flavor = 'development';
|
||||
const target = './lib/main_development.dart';
|
||||
final target = p.join('lib', 'main_development.dart');
|
||||
when(() => argResults['flavor']).thenReturn(flavor);
|
||||
when(() => argResults['target']).thenReturn(target);
|
||||
when(() => processResult.exitCode).thenReturn(ExitCode.success.code);
|
||||
@@ -173,12 +174,12 @@ ${lightCyan.wrap("./build/ios/ipa/Runner.ipa")}''',
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an xcode archive at:
|
||||
${lightCyan.wrap("./build/ios/archive/Runner.xcarchive")}''',
|
||||
${lightCyan.wrap(p.join('build', 'ios', 'archive', 'Runner.xcarchive'))}''',
|
||||
),
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an ipa at:
|
||||
${lightCyan.wrap("./build/ios/ipa/Runner.ipa")}''',
|
||||
${lightCyan.wrap(p.join('build', 'ios', 'ipa', 'Runner.ipa'))}''',
|
||||
),
|
||||
]);
|
||||
});
|
||||
@@ -208,7 +209,7 @@ ${lightCyan.wrap("./build/ios/ipa/Runner.ipa")}''',
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an xcode archive at:
|
||||
${lightCyan.wrap("./build/ios/archive/Runner.xcarchive")}''',
|
||||
${lightCyan.wrap(p.join('build', 'ios', 'archive', 'Runner.xcarchive'))}''',
|
||||
),
|
||||
).called(1);
|
||||
|
||||
@@ -216,7 +217,7 @@ ${lightCyan.wrap("./build/ios/archive/Runner.xcarchive")}''',
|
||||
() => logger.info(
|
||||
'''
|
||||
📦 Generated an ipa at:
|
||||
${lightCyan.wrap("./build/ios/ipa/Runner.ipa")}''',
|
||||
${lightCyan.wrap(p.join('build', 'ios', 'ipa', 'Runner.ipa'))}''',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -124,9 +124,10 @@ flutter:
|
||||
File(artifactPath).createSync(recursive: true);
|
||||
}
|
||||
|
||||
final bundleDirPath = p.join('build', 'app', 'outputs', 'bundle');
|
||||
final bundlePath = flavor != null
|
||||
? './build/app/outputs/bundle/${flavor}Release/app-$flavor-release.aab'
|
||||
: './build/app/outputs/bundle/release/app-release.aab';
|
||||
? p.join(bundleDirPath, '${flavor}Release', 'app-$flavor-release.aab')
|
||||
: p.join(bundleDirPath, 'release', 'app-release.aab');
|
||||
File(bundlePath).createSync(recursive: true);
|
||||
}
|
||||
|
||||
@@ -560,7 +561,7 @@ Did you forget to run "shorebird init"?''',
|
||||
'succeeds when release is successful '
|
||||
'with flavors and target', () async {
|
||||
const flavor = 'development';
|
||||
const target = './lib/main_development.dart';
|
||||
final target = p.join('lib', 'main_development.dart');
|
||||
when(() => argResults['flavor']).thenReturn(flavor);
|
||||
when(() => argResults['target']).thenReturn(target);
|
||||
final tempDir = setUpTempDir();
|
||||
|
||||
Reference in New Issue
Block a user