 ;; Attribute name for minimal SDK version.
 (def ^:private min-sdk-attribute (keyword :android:minSdkVersion))
 
-;; Attribute name for project version name.
-(def ^:private version-name-attribute (keyword :android:versionName))
-
 ;; ### Local functions
 
 (defn- load-manifest

  "Extracts the target SDK version from the provided manifest file. If
  target SDK is not specified returns minimal SDK."
  [manifest-path]
  (let [[uses-sdk] (xml-> (load-manifest manifest-path) :uses-sdk)
        [target-sdk] (xml-> uses-sdk (attr target-sdk-attribute))]
    (or target-sdk
        (first (xml-> uses-sdk (attr min-sdk-attribute))))))

(defn get-project-version
  "Extracts the project version name from the provided manifest file."
  [manifest-path]
  (first (xml-> (load-manifest manifest-path) (attr version-name-attribute))))

(def ^:private version-bit-sizes [9 9 9 5])

(def ^:private version-maximums
  (mapv (partial bit-shift-left 1) version-bit-sizes))

(def ^:private version-coefficients
  (mapv (fn [offset] (bit-shift-left 1 (- 32 offset)))
        (reductions + version-bit-sizes)))

(defn- assert>
  "Asserts that a>b in version segments"
  [a b]
  (assert (> a b) (str "Version number segment too large to fit in the
  version-code scheme " b ">" a ", maximum version in each segment
  is " (clojure.string/join "." version-maximums)))
  b)

(defn version-code

  (xml-> manifest :application :activity :intent-filter :category
         (attr= :android:name launcher-category)))

;; ### Manifest parsing and data extraction

(defn get-package-name
  "Returns the name of the application's package."
