File tree Expand file tree Collapse file tree 4 files changed +45
-1
lines changed 
pkgs/native_assets_builder Expand file tree Collapse file tree 4 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 1+ ## 0.2.1  
2+ 
3+ -  Provide a ` PackageLayout `  constructor for already parsed ` PackageConfig ` 
4+   [ flutter #134427 ] ( https://github.com/flutter/flutter/issues/134427 ) .
5+ 
16## 0.2.0  
27
38-  ** Breaking change**  ` NativeAssetsBuildRunner ` s methods now return an object
Original file line number Diff line number Diff line change @@ -31,6 +31,16 @@ class PackageLayout {
3131  PackageLayout ._(
3232      this .rootPackageRoot, this .packageConfig, this .packageConfigUri);
3333
34+   factory  PackageLayout .fromPackageConfig (
35+     PackageConfig  packageConfig,
36+     Uri  packageConfigUri,
37+   ) {
38+     assert (File .fromUri (packageConfigUri).existsSync ());
39+     packageConfigUri =  packageConfigUri.normalizePath ();
40+     final  rootPackageRoot =  packageConfigUri.resolve ('../' );
41+     return  PackageLayout ._(rootPackageRoot, packageConfig, packageConfigUri);
42+   }
43+ 
3444  static  Future <PackageLayout > fromRootPackageRoot (Uri  rootPackageRoot) async  {
3545    rootPackageRoot =  rootPackageRoot.normalizePath ();
3646    final  packageConfigUri = 
Original file line number Diff line number Diff line change 11name : native_assets_builder 
22description : >- 
33  This package is the backend that invokes top-level `build.dart` scripts. 
4- version : 0.2.0  
4+ version : 0.2.1  
55repository : https://github.com/dart-lang/native/tree/main/pkgs/native_assets_builder 
66
77environment :
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2023, the Dart project authors.  Please see the AUTHORS file 
2+ // for details. All rights reserved. Use of this source code is governed by a 
3+ // BSD-style license that can be found in the LICENSE file. 
4+ 
5+ import  'package:native_assets_builder/native_assets_builder.dart' ;
6+ import  'package:test/test.dart' ;
7+ 
8+ import  '../helpers.dart' ;
9+ import  'helpers.dart' ;
10+ 
11+ void  main () async  {
12+   test ('fromRootPackageRoot' , () async  {
13+     await  inTempDir ((tempUri) async  {
14+       await  copyTestProjects (targetUri:  tempUri);
15+       final  nativeAddUri =  tempUri.resolve ('native_add/' );
16+ 
17+       // First, run `pub get`, we need pub to resolve our dependencies. 
18+       await  runPubGet (workingDirectory:  nativeAddUri, logger:  logger);
19+ 
20+       final  packageLayout = 
21+           await  PackageLayout .fromRootPackageRoot (nativeAddUri);
22+       final  packageLayout2 =  PackageLayout .fromPackageConfig (
23+         packageLayout.packageConfig,
24+         packageLayout.packageConfigUri,
25+       );
26+       expect (packageLayout.rootPackageRoot, packageLayout2.rootPackageRoot);
27+     });
28+   });
29+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments