@@ -151,7 +151,12 @@ public class RepositoryOptions extends OptionsBase {
151
151
converter = RepositoryOverrideConverter .class ,
152
152
documentationCategory = OptionDocumentationCategory .UNCATEGORIZED ,
153
153
effectTags = {OptionEffectTag .UNKNOWN },
154
- help = "Overrides a repository with a local directory." )
154
+ help =
155
+ "Override a repository with a local path in the form of <repository name>=<path>. If the"
156
+ + " given path is an absolute path, it will be used as it is. If the given path is a"
157
+ + " relative path, it is relative to the current working directory. If the given path"
158
+ + " starts with '%workspace%, it is relative to the workspace root, which is the"
159
+ + " output of `bazel info workspace`" )
155
160
public List <RepositoryOverride > repositoryOverrides ;
156
161
157
162
@ Option (
@@ -161,7 +166,12 @@ public class RepositoryOptions extends OptionsBase {
161
166
converter = ModuleOverrideConverter .class ,
162
167
documentationCategory = OptionDocumentationCategory .BZLMOD ,
163
168
effectTags = {OptionEffectTag .UNKNOWN },
164
- help = "Overrides a module with a local directory." )
169
+ help =
170
+ "Override a module with a local path in the form of <module name>=<path>. If the given"
171
+ + " path is an absolute path, it will be used as it is. If the given path is a"
172
+ + " relative path, it is relative to the current working directory. If the given path"
173
+ + " starts with '%workspace%, it is relative to the workspace root, which is the"
174
+ + " output of `bazel info workspace`" )
165
175
public List <ModuleOverride > moduleOverrides ;
166
176
167
177
@ Option (
@@ -325,17 +335,10 @@ public RepositoryOverride convert(String input) throws OptionsParsingException {
325
335
throw new OptionsParsingException (
326
336
"Repository overrides must be of the form 'repository-name=path'" , input );
327
337
}
328
- OptionsUtils .AbsolutePathFragmentConverter absolutePathFragmentConverter =
329
- new OptionsUtils .AbsolutePathFragmentConverter ();
330
- PathFragment path ;
331
- try {
332
- path = absolutePathFragmentConverter .convert (pieces [1 ]);
333
- } catch (OptionsParsingException e ) {
334
- throw new OptionsParsingException (
335
- "Repository override directory must be an absolute path" , input , e );
336
- }
338
+ OptionsUtils .PathFragmentConverter pathConverter = new OptionsUtils .PathFragmentConverter ();
339
+ String pathString = pathConverter .convert (pieces [1 ]).getPathString ();
337
340
try {
338
- return RepositoryOverride .create (RepositoryName .create (pieces [0 ]), path );
341
+ return RepositoryOverride .create (RepositoryName .create (pieces [0 ]), pathString );
339
342
} catch (LabelSyntaxException e ) {
340
343
throw new OptionsParsingException ("Invalid repository name given to override" , input , e );
341
344
}
@@ -367,15 +370,9 @@ public ModuleOverride convert(String input) throws OptionsParsingException {
367
370
pieces [0 ]));
368
371
}
369
372
370
- OptionsUtils .AbsolutePathFragmentConverter absolutePathFragmentConverter =
371
- new OptionsUtils .AbsolutePathFragmentConverter ();
372
- try {
373
- var path = absolutePathFragmentConverter .convert (pieces [1 ]);
374
- return ModuleOverride .create (pieces [0 ], path .toString ());
375
- } catch (OptionsParsingException e ) {
376
- throw new OptionsParsingException (
377
- "Module override directory must be an absolute path" , input , e );
378
- }
373
+ OptionsUtils .PathFragmentConverter pathConverter = new OptionsUtils .PathFragmentConverter ();
374
+ String pathString = pathConverter .convert (pieces [1 ]).getPathString ();
375
+ return ModuleOverride .create (pieces [0 ], pathString );
379
376
}
380
377
381
378
@ Override
@@ -388,13 +385,13 @@ public String getTypeDescription() {
388
385
@ AutoValue
389
386
public abstract static class RepositoryOverride {
390
387
391
- private static RepositoryOverride create (RepositoryName repositoryName , PathFragment path ) {
388
+ private static RepositoryOverride create (RepositoryName repositoryName , String path ) {
392
389
return new AutoValue_RepositoryOptions_RepositoryOverride (repositoryName , path );
393
390
}
394
391
395
392
public abstract RepositoryName repositoryName ();
396
393
397
- public abstract PathFragment path ();
394
+ public abstract String path ();
398
395
}
399
396
400
397
/** A module override, represented by a name and an absolute path to a module. */
0 commit comments