File tree Expand file tree Collapse file tree 5 files changed +35
-3
lines changed
main/java/com/android/tools/build/bundletool
test/java/com/android/tools/build/bundletool/commands Expand file tree Collapse file tree 5 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -46,4 +46,4 @@ https://developer.android.com/studio/command-line/bundletool
4646
4747## Releases
4848
49- Latest release: [ 1.18.0 ] ( https://github.com/google/bundletool/releases )
49+ Latest release: [ 1.18.1 ] ( https://github.com/google/bundletool/releases )
Original file line number Diff line number Diff line change 1- release_version = 1.18.0
1+ release_version = 1.18.1
Original file line number Diff line number Diff line change 4343import com .android .tools .build .bundletool .model .utils .files .BufferedIo ;
4444import com .android .tools .build .bundletool .model .utils .files .FileUtils ;
4545import com .android .tools .build .bundletool .model .version .BundleToolVersion ;
46+ import com .android .tools .build .bundletool .validation .AppBundleValidator ;
4647import com .android .tools .build .bundletool .validation .BundleModulesValidator ;
4748import com .google .auto .value .AutoValue ;
4849import com .google .common .collect .ImmutableList ;
@@ -256,6 +257,9 @@ public void execute() {
256257 AppBundle .buildFromModules (
257258 modulesWithTargeting .build (), bundleConfig , getBundleMetadata ());
258259
260+ // Validate the bundle content before writing it to disk.
261+ AppBundleValidator .create ().validate (appBundle );
262+
259263 Path outputDirectory = getOutputPath ().toAbsolutePath ().getParent ();
260264 if (Files .notExists (outputDirectory )) {
261265 logger .info ("Output directory '" + outputDirectory + "' does not exist, creating it." );
Original file line number Diff line number Diff line change 2626 */
2727public final class BundleToolVersion {
2828
29- private static final String CURRENT_VERSION = "1.18.0 " ;
29+ private static final String CURRENT_VERSION = "1.18.1 " ;
3030
3131
3232 /** Returns the version of BundleTool being run. */
Original file line number Diff line number Diff line change @@ -518,6 +518,34 @@ public void assetsTargeting_generated_deviceTier() throws Exception {
518518 }
519519 }
520520
521+ @ Test
522+ public void assetsTargeting_invalidDeviceGroupName_throws () throws Exception {
523+ XmlNode manifest = androidManifest (PKG_NAME , withHasCode (true ));
524+ Path module =
525+ new ZipBuilder ()
526+ .addFileWithContent (ZipPath .create ("assets/anything.dat" ), "any" .getBytes (UTF_8 ))
527+ .addFileWithContent (
528+ ZipPath .create ("assets/texture#tcf_atc/device#group_@$%!/file.dat" ),
529+ "any2" .getBytes (UTF_8 ))
530+ .addFileWithContent (ZipPath .create ("dex/classes.dex" ), "dex" .getBytes (UTF_8 ))
531+ .addFileWithProtoContent (ZipPath .create ("manifest/AndroidManifest.xml" ), manifest )
532+ .writeTo (tmpDir .resolve ("base.zip" ));
533+
534+ InvalidBundleException exception =
535+ assertThrows (
536+ InvalidBundleException .class ,
537+ () ->
538+ BuildBundleCommand .builder ()
539+ .setOutputPath (bundlePath )
540+ .setModulesPaths (ImmutableList .of (module ))
541+ .build ()
542+ .execute ());
543+
544+ assertThat (exception )
545+ .hasMessageThat ()
546+ .contains ("Device group names should start with a letter" );
547+ }
548+
521549 @ Test
522550 public void assetsTargeting_generated_deviceGroup () throws Exception {
523551 XmlNode manifest = androidManifest (PKG_NAME , withHasCode (true ));
You can’t perform that action at this time.
0 commit comments