Skip to content

Commit

Permalink
Merge pull request #161 from devmil/fix/broken_local_package_refs
Browse files Browse the repository at this point in the history
fix: fixes local package refs
  • Loading branch information
devmil authored Sep 28, 2023
2 parents 147f657 + 2699828 commit 72414ed
Show file tree
Hide file tree
Showing 30 changed files with 637 additions and 561 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Version 0.16.3
- adds more diff result reporting options (cli, json, markdown)
- fixes broken local packages refs

## Version 0.16.2
- fixes relative path handling in package config (leading to unresolvable types)
Expand Down
2 changes: 1 addition & 1 deletion lib/src/analyze/package_api_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ class _InterfaceCollectionResult {
}

@freezed
class _FileToAnalyzeEntry with _$_FileToAnalyzeEntry {
class _FileToAnalyzeEntry with _$FileToAnalyzeEntry {
const factory _FileToAnalyzeEntry({
required String filePath,
@Default([]) List<String> shownNames,
Expand Down
36 changes: 18 additions & 18 deletions lib/src/analyze/package_api_analyzer.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');

/// @nodoc
mixin _$_FileToAnalyzeEntry {
mixin _$FileToAnalyzeEntry {
String get filePath => throw _privateConstructorUsedError;
List<String> get shownNames => throw _privateConstructorUsedError;
List<String> get hiddenNames => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -79,11 +79,11 @@ class __$FileToAnalyzeEntryCopyWithImpl<$Res, $Val extends _FileToAnalyzeEntry>
}

/// @nodoc
abstract class _$$__FileToAnalyzeEntryCopyWith<$Res>
abstract class _$$_FileToAnalyzeEntryImplCopyWith<$Res>
implements _$FileToAnalyzeEntryCopyWith<$Res> {
factory _$$__FileToAnalyzeEntryCopyWith(_$__FileToAnalyzeEntry value,
$Res Function(_$__FileToAnalyzeEntry) then) =
__$$__FileToAnalyzeEntryCopyWithImpl<$Res>;
factory _$$_FileToAnalyzeEntryImplCopyWith(_$_FileToAnalyzeEntryImpl value,
$Res Function(_$_FileToAnalyzeEntryImpl) then) =
__$$_FileToAnalyzeEntryImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
Expand All @@ -94,11 +94,11 @@ abstract class _$$__FileToAnalyzeEntryCopyWith<$Res>
}

/// @nodoc
class __$$__FileToAnalyzeEntryCopyWithImpl<$Res>
extends __$FileToAnalyzeEntryCopyWithImpl<$Res, _$__FileToAnalyzeEntry>
implements _$$__FileToAnalyzeEntryCopyWith<$Res> {
__$$__FileToAnalyzeEntryCopyWithImpl(_$__FileToAnalyzeEntry _value,
$Res Function(_$__FileToAnalyzeEntry) _then)
class __$$_FileToAnalyzeEntryImplCopyWithImpl<$Res>
extends __$FileToAnalyzeEntryCopyWithImpl<$Res, _$_FileToAnalyzeEntryImpl>
implements _$$_FileToAnalyzeEntryImplCopyWith<$Res> {
__$$_FileToAnalyzeEntryImplCopyWithImpl(_$_FileToAnalyzeEntryImpl _value,
$Res Function(_$_FileToAnalyzeEntryImpl) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
Expand All @@ -109,7 +109,7 @@ class __$$__FileToAnalyzeEntryCopyWithImpl<$Res>
Object? hiddenNames = null,
Object? exportedBy = null,
}) {
return _then(_$__FileToAnalyzeEntry(
return _then(_$_FileToAnalyzeEntryImpl(
filePath: null == filePath
? _value.filePath
: filePath // ignore: cast_nullable_to_non_nullable
Expand All @@ -132,8 +132,8 @@ class __$$__FileToAnalyzeEntryCopyWithImpl<$Res>

/// @nodoc
class _$__FileToAnalyzeEntry implements __FileToAnalyzeEntry {
const _$__FileToAnalyzeEntry(
class _$_FileToAnalyzeEntryImpl implements __FileToAnalyzeEntry {
const _$_FileToAnalyzeEntryImpl(
{required this.filePath,
final List<String> shownNames = const [],
final List<String> hiddenNames = const [],
Expand Down Expand Up @@ -179,7 +179,7 @@ class _$__FileToAnalyzeEntry implements __FileToAnalyzeEntry {
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$__FileToAnalyzeEntry &&
other is _$_FileToAnalyzeEntryImpl &&
(identical(other.filePath, filePath) ||
other.filePath == filePath) &&
const DeepCollectionEquality()
Expand All @@ -201,8 +201,8 @@ class _$__FileToAnalyzeEntry implements __FileToAnalyzeEntry {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$__FileToAnalyzeEntryCopyWith<_$__FileToAnalyzeEntry> get copyWith =>
__$$__FileToAnalyzeEntryCopyWithImpl<_$__FileToAnalyzeEntry>(
_$$_FileToAnalyzeEntryImplCopyWith<_$_FileToAnalyzeEntryImpl> get copyWith =>
__$$_FileToAnalyzeEntryImplCopyWithImpl<_$_FileToAnalyzeEntryImpl>(
this, _$identity);
}

Expand All @@ -211,7 +211,7 @@ abstract class __FileToAnalyzeEntry implements _FileToAnalyzeEntry {
{required final String filePath,
final List<String> shownNames,
final List<String> hiddenNames,
required final Set<String> exportedBy}) = _$__FileToAnalyzeEntry;
required final Set<String> exportedBy}) = _$_FileToAnalyzeEntryImpl;

@override
String get filePath;
Expand All @@ -223,6 +223,6 @@ abstract class __FileToAnalyzeEntry implements _FileToAnalyzeEntry {
Set<String> get exportedBy;
@override
@JsonKey(ignore: true)
_$$__FileToAnalyzeEntryCopyWith<_$__FileToAnalyzeEntry> get copyWith =>
_$$_FileToAnalyzeEntryImplCopyWith<_$_FileToAnalyzeEntryImpl> get copyWith =>
throw _privateConstructorUsedError;
}
6 changes: 6 additions & 0 deletions lib/src/cli/commands/command_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ OBSOLETE: Has no effect anymore.
required String sourcePackageConfigPath,
}) async {
final sourcePackageConfigDirPath = p.dirname(sourcePackageConfigPath);
final sourcePackageDirPath =
Directory(sourcePackageConfigDirPath).parent.path;
final targetPackageConfigContent =
jsonDecode(await File(targetPackageConfigPath).readAsString());
// iterate through the package_config.json content and look for relative paths
Expand All @@ -211,6 +213,10 @@ OBSOLETE: Has no effect anymore.
// we make the relative path absolute by using the origin of the source package config as a base
final normalizedPackagePath =
p.normalize(p.join(sourcePackageConfigDirPath, packagePath));
// if the relative path is the package path, then don't make it absolute
if (p.equals(sourcePackageDirPath, normalizedPackagePath)) {
continue;
}
// and write the new absolute path back to the json structure
packageConfig['rootUri'] = p.toUri(normalizedPackagePath).toString();
}
Expand Down
97 changes: 51 additions & 46 deletions lib/src/model/executable_declaration.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ class _$ExecutableParameterDeclarationCopyWithImpl<$Res,
}

/// @nodoc
abstract class _$$_ExecutableParameterDeclarationCopyWith<$Res>
abstract class _$$ExecutableParameterDeclarationImplCopyWith<$Res>
implements $ExecutableParameterDeclarationCopyWith<$Res> {
factory _$$_ExecutableParameterDeclarationCopyWith(
_$_ExecutableParameterDeclaration value,
$Res Function(_$_ExecutableParameterDeclaration) then) =
__$$_ExecutableParameterDeclarationCopyWithImpl<$Res>;
factory _$$ExecutableParameterDeclarationImplCopyWith(
_$ExecutableParameterDeclarationImpl value,
$Res Function(_$ExecutableParameterDeclarationImpl) then) =
__$$ExecutableParameterDeclarationImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
Expand All @@ -145,13 +145,13 @@ abstract class _$$_ExecutableParameterDeclarationCopyWith<$Res>
}

/// @nodoc
class __$$_ExecutableParameterDeclarationCopyWithImpl<$Res>
class __$$ExecutableParameterDeclarationImplCopyWithImpl<$Res>
extends _$ExecutableParameterDeclarationCopyWithImpl<$Res,
_$_ExecutableParameterDeclaration>
implements _$$_ExecutableParameterDeclarationCopyWith<$Res> {
__$$_ExecutableParameterDeclarationCopyWithImpl(
_$_ExecutableParameterDeclaration _value,
$Res Function(_$_ExecutableParameterDeclaration) _then)
_$ExecutableParameterDeclarationImpl>
implements _$$ExecutableParameterDeclarationImplCopyWith<$Res> {
__$$ExecutableParameterDeclarationImplCopyWithImpl(
_$ExecutableParameterDeclarationImpl _value,
$Res Function(_$ExecutableParameterDeclarationImpl) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
Expand All @@ -166,7 +166,7 @@ class __$$_ExecutableParameterDeclarationCopyWithImpl<$Res>
Object? typeFullLibraryName = freezed,
Object? relativePath = null,
}) {
return _then(_$_ExecutableParameterDeclaration(
return _then(_$ExecutableParameterDeclarationImpl(
isRequired: null == isRequired
? _value.isRequired
: isRequired // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -205,9 +205,9 @@ class __$$_ExecutableParameterDeclarationCopyWithImpl<$Res>

/// @nodoc
class _$_ExecutableParameterDeclaration
class _$ExecutableParameterDeclarationImpl
extends _ExecutableParameterDeclaration {
const _$_ExecutableParameterDeclaration(
const _$ExecutableParameterDeclarationImpl(
{required this.isRequired,
required this.isNamed,
required this.name,
Expand Down Expand Up @@ -259,7 +259,7 @@ class _$_ExecutableParameterDeclaration
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_ExecutableParameterDeclaration &&
other is _$ExecutableParameterDeclarationImpl &&
(identical(other.isRequired, isRequired) ||
other.isRequired == isRequired) &&
(identical(other.isNamed, isNamed) || other.isNamed == isNamed) &&
Expand Down Expand Up @@ -291,22 +291,24 @@ class _$_ExecutableParameterDeclaration
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$_ExecutableParameterDeclarationCopyWith<_$_ExecutableParameterDeclaration>
get copyWith => __$$_ExecutableParameterDeclarationCopyWithImpl<
_$_ExecutableParameterDeclaration>(this, _$identity);
_$$ExecutableParameterDeclarationImplCopyWith<
_$ExecutableParameterDeclarationImpl>
get copyWith => __$$ExecutableParameterDeclarationImplCopyWithImpl<
_$ExecutableParameterDeclarationImpl>(this, _$identity);
}

abstract class _ExecutableParameterDeclaration
extends ExecutableParameterDeclaration implements Declaration {
const factory _ExecutableParameterDeclaration(
{required final bool isRequired,
required final bool isNamed,
required final String name,
required final bool isDeprecated,
required final bool isExperimental,
required final String typeName,
required final String? typeFullLibraryName,
required final String relativePath}) = _$_ExecutableParameterDeclaration;
{required final bool isRequired,
required final bool isNamed,
required final String name,
required final bool isDeprecated,
required final bool isExperimental,
required final String typeName,
required final String? typeFullLibraryName,
required final String relativePath}) =
_$ExecutableParameterDeclarationImpl;
const _ExecutableParameterDeclaration._() : super._();

@override
Expand Down Expand Up @@ -343,7 +345,8 @@ abstract class _ExecutableParameterDeclaration
String get relativePath;
@override
@JsonKey(ignore: true)
_$$_ExecutableParameterDeclarationCopyWith<_$_ExecutableParameterDeclaration>
_$$ExecutableParameterDeclarationImplCopyWith<
_$ExecutableParameterDeclarationImpl>
get copyWith => throw _privateConstructorUsedError;
}

Expand Down Expand Up @@ -475,11 +478,12 @@ class _$ExecutableDeclarationCopyWithImpl<$Res,
}

/// @nodoc
abstract class _$$_ExecutableDeclarationCopyWith<$Res>
abstract class _$$ExecutableDeclarationImplCopyWith<$Res>
implements $ExecutableDeclarationCopyWith<$Res> {
factory _$$_ExecutableDeclarationCopyWith(_$_ExecutableDeclaration value,
$Res Function(_$_ExecutableDeclaration) then) =
__$$_ExecutableDeclarationCopyWithImpl<$Res>;
factory _$$ExecutableDeclarationImplCopyWith(
_$ExecutableDeclarationImpl value,
$Res Function(_$ExecutableDeclarationImpl) then) =
__$$ExecutableDeclarationImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
Expand All @@ -496,11 +500,12 @@ abstract class _$$_ExecutableDeclarationCopyWith<$Res>
}

/// @nodoc
class __$$_ExecutableDeclarationCopyWithImpl<$Res>
extends _$ExecutableDeclarationCopyWithImpl<$Res, _$_ExecutableDeclaration>
implements _$$_ExecutableDeclarationCopyWith<$Res> {
__$$_ExecutableDeclarationCopyWithImpl(_$_ExecutableDeclaration _value,
$Res Function(_$_ExecutableDeclaration) _then)
class __$$ExecutableDeclarationImplCopyWithImpl<$Res>
extends _$ExecutableDeclarationCopyWithImpl<$Res,
_$ExecutableDeclarationImpl>
implements _$$ExecutableDeclarationImplCopyWith<$Res> {
__$$ExecutableDeclarationImplCopyWithImpl(_$ExecutableDeclarationImpl _value,
$Res Function(_$ExecutableDeclarationImpl) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
Expand All @@ -517,7 +522,7 @@ class __$$_ExecutableDeclarationCopyWithImpl<$Res>
Object? entryPoints = freezed,
Object? relativePath = null,
}) {
return _then(_$_ExecutableDeclaration(
return _then(_$ExecutableDeclarationImpl(
returnTypeName: null == returnTypeName
? _value.returnTypeName
: returnTypeName // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -564,8 +569,8 @@ class __$$_ExecutableDeclarationCopyWithImpl<$Res>

/// @nodoc
class _$_ExecutableDeclaration extends _ExecutableDeclaration {
const _$_ExecutableDeclaration(
class _$ExecutableDeclarationImpl extends _ExecutableDeclaration {
const _$ExecutableDeclarationImpl(
{required this.returnTypeName,
required this.name,
required this.isDeprecated,
Expand Down Expand Up @@ -654,7 +659,7 @@ class _$_ExecutableDeclaration extends _ExecutableDeclaration {
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_ExecutableDeclaration &&
other is _$ExecutableDeclarationImpl &&
(identical(other.returnTypeName, returnTypeName) ||
other.returnTypeName == returnTypeName) &&
(identical(other.name, name) || other.name == name) &&
Expand Down Expand Up @@ -692,9 +697,9 @@ class _$_ExecutableDeclaration extends _ExecutableDeclaration {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$_ExecutableDeclarationCopyWith<_$_ExecutableDeclaration> get copyWith =>
__$$_ExecutableDeclarationCopyWithImpl<_$_ExecutableDeclaration>(
this, _$identity);
_$$ExecutableDeclarationImplCopyWith<_$ExecutableDeclarationImpl>
get copyWith => __$$ExecutableDeclarationImplCopyWithImpl<
_$ExecutableDeclarationImpl>(this, _$identity);
}

abstract class _ExecutableDeclaration extends ExecutableDeclaration {
Expand All @@ -708,7 +713,7 @@ abstract class _ExecutableDeclaration extends ExecutableDeclaration {
required final ExecutableType type,
required final bool isStatic,
final Set<String>? entryPoints,
required final String relativePath}) = _$_ExecutableDeclaration;
required final String relativePath}) = _$ExecutableDeclarationImpl;
const _ExecutableDeclaration._() : super._();

@override
Expand Down Expand Up @@ -753,6 +758,6 @@ abstract class _ExecutableDeclaration extends ExecutableDeclaration {
String get relativePath;
@override
@JsonKey(ignore: true)
_$$_ExecutableDeclarationCopyWith<_$_ExecutableDeclaration> get copyWith =>
throw _privateConstructorUsedError;
_$$ExecutableDeclarationImplCopyWith<_$ExecutableDeclarationImpl>
get copyWith => throw _privateConstructorUsedError;
}
Loading

0 comments on commit 72414ed

Please sign in to comment.