@@ -570,26 +570,43 @@ def _lookup_uri(version):
570
570
571
571
572
572
def _is_project_repo (src_repo ):
573
- return (os .path .isdir (src_repo ) and
574
- os .path .exists (os .path .join (src_repo , '.git' )) and
575
- os .path .exists (os .path .join (src_repo , 'gradlew' )))
573
+ path = Path (src_repo )
574
+ return (path .is_dir ()
575
+ and (path / ".git" ).exists ()
576
+ and ((path / "gradlew" ).exists () or (path / "mvnw" ).exists ())
577
+ )
576
578
577
579
578
580
def _build_tarball (src_repo ) -> Path :
579
581
""" Build a tarball from src and return the path to it """
580
582
run = partial (subprocess .run , cwd = src_repo , check = True , stdin = subprocess .DEVNULL )
581
583
run (['git' , 'clean' , '-xdff' ])
582
- src_repo = Path (src_repo )
583
- if os . path . exists ( src_repo / 'es' / 'upstream' ):
584
+ path = Path (src_repo )
585
+ if ( path / 'es' / 'upstream' ). exists ( ):
584
586
run (['git' , 'submodule' , 'update' , '--init' , '--' , 'es/upstream' ])
585
- run (['./gradlew' , '--parallel' , '--no-daemon' , 'clean' , 'distTar' ])
586
- distributions = Path (src_repo ) / 'app' / 'build' / 'distributions'
587
+ if (path / "mvnw" ).exists ():
588
+ run ([
589
+ "mvnw" ,
590
+ "clean" ,
591
+ "package" ,
592
+ "-DskipTests=true" ,
593
+ "-Dcheckstyle.skip" ,
594
+ "-Djacoco.skip=true"
595
+ ])
596
+ distributions = path / "app" / "target"
597
+ else :
598
+ run (['./gradlew' , '--parallel' , '--no-daemon' , 'clean' , 'distTar' ])
599
+ distributions = path / 'app' / 'build' / 'distributions'
587
600
return next (distributions .glob ('crate-*.tar.gz' ))
588
601
589
602
590
603
def _extract_tarball (tarball ):
591
604
with tarfile .open (tarball ) as t :
592
- folder_name = t .getnames ()[0 ]
605
+ first_file = t .getnames ()[0 ]
606
+ # First file name might be the folder, or a file inside the folder
607
+ # Normalize to folder
608
+ folder_name = os .path .dirname (first_file )
609
+ folder_name = folder_name == "" and first_file or folder_name
593
610
t .extractall (tarball .parent )
594
611
return str (tarball .parent / folder_name )
595
612
@@ -701,7 +718,7 @@ def create_node(
701
718
):
702
719
init_logging (log )
703
720
settings = {
704
- 'cluster.name' : 'cr8-crate-run' + str (random .randrange (1e9 ))
721
+ 'cluster.name' : 'cr8-crate-run' + str (random .randrange (int ( 1e9 ) ))
705
722
}
706
723
crate_dir = get_crate (version , crate_root )
707
724
if setting :
0 commit comments