1 # Copyright (C) 2010 The Android Open Source Project
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # A nawk/gawk script used to extract the package name from an application's
16 # manifest (i.e. AndroidManifest.xml).
18 # The name itself is the value of the 'package' attribute in the
25 package_regex1="package=\"([[:alnum:].]+)\""
26 package_regex2="package=\'([[:alnum:].]+)\'"
34 in_manifest == 1 && /package=/ {
35 if (match($0,package_regex1)) {
36 PACKAGE=substr($0,RSTART+9,RLENGTH-10)
38 else if (match($0,package_regex2)) {
39 PACKAGE=substr($0,RSTART+9,RLENGTH-10)
43 in_manifest == 1 && />/ {