Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd5166dd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow overriding the compile SDK" into pi-dev

parents ab416a11 9f6dec11
Loading
Loading
Loading
Loading
+36 −25
Original line number Diff line number Diff line
@@ -798,6 +798,7 @@ class LinkCommand {
      return;
    }

    if (!options_.manifest_fixer_options.compile_sdk_version) {
      xml::Attribute* attr = manifest_xml->root->FindAttribute(xml::kSchemaAndroid, "versionCode");
      if (attr != nullptr) {
        Maybe<std::string>& compile_sdk_version = options_.manifest_fixer_options.compile_sdk_version;
@@ -818,8 +819,10 @@ class LinkCommand {
          compile_sdk_version = attr->value;
        }
      }
    }

    attr = manifest_xml->root->FindAttribute(xml::kSchemaAndroid, "versionName");
    if (!options_.manifest_fixer_options.compile_sdk_version_codename) {
      xml::Attribute* attr = manifest_xml->root->FindAttribute(xml::kSchemaAndroid, "versionName");
      if (attr != nullptr) {
        Maybe<std::string>& compile_sdk_version_codename =
            options_.manifest_fixer_options.compile_sdk_version_codename;
@@ -830,6 +833,7 @@ class LinkCommand {
        }
      }
    }
  }

  // Creates a SymbolTable that loads symbols from the various APKs.
  // Pre-condition: context_->GetCompilationPackage() needs to be set.
@@ -2102,6 +2106,13 @@ int Link(const std::vector<StringPiece>& args, IDiagnostics* diagnostics) {
          .OptionalFlag("--version-name",
                        "Version name to inject into the AndroidManifest.xml if none is present.",
                        &options.manifest_fixer_options.version_name_default)
          .OptionalFlag("--compile-sdk-version-code",
                        "Version code (integer) to inject into the AndroidManifest.xml if none is\n"
                        "present.",
                        &options.manifest_fixer_options.compile_sdk_version)
          .OptionalFlag("--compile-sdk-version-name",
                        "Version name to inject into the AndroidManifest.xml if none is present.",
                        &options.manifest_fixer_options.compile_sdk_version_codename)
          .OptionalSwitch("--shared-lib", "Generates a shared Android runtime library.",
                          &shared_lib)
          .OptionalSwitch("--static-lib", "Generate a static Android library.", &static_lib)