tup: fully support renaming android package;
@@ -43,7 +43,7 @@ config = {
keystore = '/path/to/keystore',
keystorepass = 'pass:password',
manifest = nil,
- package = nil,
+ package = 'org.lovr.app',
project = nil
}
}
@@ -173,6 +173,7 @@ if target == 'android' then
flags += config.debug and '-funwind-tables' or ''
cflags += '-D_POSIX_C_SOURCE=200809L'
cflags += ('-I%s/sources/android/native_app_glue'):format(config.android.ndk)
+ cflags += '-DLOVR_JAVA_PACKAGE=' .. config.android.package:gsub('%.', '_')
lflags += '-shared -landroid'
end
@@ -487,7 +488,7 @@ if target == 'android' then
end
java = 'bin/Activity.java'
- class = 'org/lovr/app/Activity.class'
+ class = config.android.package:gsub('%.', '/') .. '/Activity.class'
binclass = 'bin/' .. class
jar = 'bin/lovr.jar'
dex = 'bin/apk/classes.dex'
@@ -496,7 +497,7 @@ if target == 'android' then
apk = 'bin/lovr.apk'
manifest = config.android.manifest or 'etc/AndroidManifest.xml'
- package = config.android.package and #config.android.package > 0 and ('--rename-manifest-package ' .. config.android.package) or ''
+ package = '--rename-manifest-package ' .. config.android.package
project = config.android.project and #config.android.project > 0 and ('-A ' .. config.android.project) or ''
version = config.android.version
@@ -506,7 +507,7 @@ if target == 'android' then
tools = config.android.sdk .. '/build-tools/' .. config.android.buildtools
copy(manifest, 'bin/AndroidManifest.xml')
- copy('etc/Activity.java', java)
+ tup.rule('etc/Activity.java', 'tup varsed %f %o', java)
tup.rule(java, '^ JAVAC %b^ javac -classpath $(androidjar) -d bin %f', binclass)
tup.rule(binclass, '^ JAR %b^ jar -cf %o -C bin $(class)', jar)
tup.rule(jar, '^ D8 %b^ $(tools)/d8 --min-api $(version) --output bin/apk %f', dex)
